FASE 4: - Redis cache de stock con fallback graceful - Multi-moneda (MXN/USD) con contabilidad en MXN - Proveedores y ordenes de compra completo - Meilisearch 1.5M+ partes indexadas - Metabase KPIs con dashboard auto-generado FASE 5: - CRM mejorado: activities, tags, loyalty program, analytics - Imagenes de partes: upload, resize, thumbnails WebP - Ordenes de servicio Kanban: received->diagnosis->repair->ready->delivered - Garantias/RMA, alertas de reorden, multi-sucursal - Stubs BNPL (APLAZO) y ERP Sync (Aspel/Contpaqi) FASE 6: - Notificaciones automaticas: push/WhatsApp/email/in-app - Reportes de ahorro vs retail_price - Logistica + tracking: DHL, FedEx, Estafeta, 99min, Uber - API Publica: API keys, rate limiting, catalog search Migraciones: v1.9-v3.0 Tests: 93/93 pasando Backup: nexus_backup_20260427_045859.tar.gz
37 lines
1.3 KiB
SQL
37 lines
1.3 KiB
SQL
-- v2.0_multi_currency.sql
|
|
-- Mejora #8: Soporte Multi-moneda
|
|
--
|
|
-- Adds currency and exchange_rate columns to sales, sale_items,
|
|
-- quotations, quotation_items, and sale_payments.
|
|
--
|
|
-- Business rule: inventory prices are ALWAYS in MXN (base currency).
|
|
-- Sales can be recorded in USD (or other currencies) with conversion
|
|
-- at checkout time. Accounting and CFDI always use MXN.
|
|
|
|
-- sales
|
|
ALTER TABLE sales
|
|
ADD COLUMN IF NOT EXISTS currency VARCHAR(3) DEFAULT 'MXN',
|
|
ADD COLUMN IF NOT EXISTS exchange_rate NUMERIC(12,6) DEFAULT 1.0;
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_sales_currency ON sales(currency);
|
|
|
|
-- sale_items
|
|
ALTER TABLE sale_items
|
|
ADD COLUMN IF NOT EXISTS currency VARCHAR(3) DEFAULT 'MXN',
|
|
ADD COLUMN IF NOT EXISTS exchange_rate NUMERIC(12,6) DEFAULT 1.0;
|
|
|
|
-- quotations
|
|
ALTER TABLE quotations
|
|
ADD COLUMN IF NOT EXISTS currency VARCHAR(3) DEFAULT 'MXN',
|
|
ADD COLUMN IF NOT EXISTS exchange_rate NUMERIC(12,6) DEFAULT 1.0;
|
|
|
|
-- quotation_items
|
|
ALTER TABLE quotation_items
|
|
ADD COLUMN IF NOT EXISTS currency VARCHAR(3) DEFAULT 'MXN',
|
|
ADD COLUMN IF NOT EXISTS exchange_rate NUMERIC(12,6) DEFAULT 1.0;
|
|
|
|
-- sale_payments
|
|
ALTER TABLE sale_payments
|
|
ADD COLUMN IF NOT EXISTS currency VARCHAR(3) DEFAULT 'MXN',
|
|
ADD COLUMN IF NOT EXISTS exchange_rate NUMERIC(12,6) DEFAULT 1.0;
|