Compare commits
No commits in common. "dev" and "master" have entirely different histories.
|
@ -52,7 +52,7 @@
|
||||||
},
|
},
|
||||||
"payMethod": {
|
"payMethod": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "PayMethod",
|
"model": "PayMethodFk",
|
||||||
"foreignKey": "payMethodFk"
|
"foreignKey": "payMethodFk"
|
||||||
},
|
},
|
||||||
"company": {
|
"company": {
|
||||||
|
@ -61,4 +61,4 @@
|
||||||
"foreignKey": "companyFk"
|
"foreignKey": "companyFk"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -54,8 +54,7 @@
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"hasGrant": {
|
"hasGrant": {
|
||||||
"type": "boolean",
|
"type": "boolean"
|
||||||
"default": false
|
|
||||||
},
|
},
|
||||||
"passExpired": {
|
"passExpired": {
|
||||||
"type": "date"
|
"type": "date"
|
||||||
|
@ -169,7 +168,6 @@
|
||||||
"emailVerified",
|
"emailVerified",
|
||||||
"twoFactor"
|
"twoFactor"
|
||||||
]
|
]
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,8 +77,8 @@ INSERT INTO `vn`.`agency` (`name`, `warehouseFk`, `isOwn`, `isAnyVolumeAllowed`)
|
||||||
('Otra agencia ', '1', '0', '0');
|
('Otra agencia ', '1', '0', '0');
|
||||||
|
|
||||||
INSERT INTO `vn`.`expedition` (`agencyModeFk`, `ticketFk`, `isBox`, `counter`, `workerFk`, `externalId`, `packagingFk`, `hostFk`, `itemPackingTypeFk`, `hasNewRoute`) VALUES
|
INSERT INTO `vn`.`expedition` (`agencyModeFk`, `ticketFk`, `isBox`, `counter`, `workerFk`, `externalId`, `packagingFk`, `hostFk`, `itemPackingTypeFk`, `hasNewRoute`) VALUES
|
||||||
('1', '1', 1, '1', '1', '1', '1', 'pc1', 'F', 0),
|
('1', '1', 1, '1', '1', '1', '1', 'pc00', 'F', 0),
|
||||||
('1', '1', 1, '2', '1', '1', '1', 'pc1', 'F', 0);
|
('1', '1', 1, '2', '1', '1', '1', 'pc00', 'F', 0);
|
||||||
|
|
||||||
INSERT INTO vn.client (id,name,defaultAddressFk,street,fi,email,dueDay,isTaxDataChecked,accountingAccount,city,provinceFk,postcode,socialName,contact,credit,countryFk,quality,riskCalculated) VALUES
|
INSERT INTO vn.client (id,name,defaultAddressFk,street,fi,email,dueDay,isTaxDataChecked,accountingAccount,city,provinceFk,postcode,socialName,contact,credit,countryFk,quality,riskCalculated) VALUES
|
||||||
(100,'root',110,'Valle de la muerte','74974747G','root@mydomain.com',0,1,'4300000078','ALGEMESI',1,'46680','rootSocial','rootContact',500.0,1,10,'2025-01-01');
|
(100,'root',110,'Valle de la muerte','74974747G','root@mydomain.com',0,1,'4300000078','ALGEMESI',1,'46680','rootSocial','rootContact',500.0,1,10,'2025-01-01');
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -9,7 +9,7 @@ BEGIN
|
||||||
DECLARE vCalc INT;
|
DECLARE vCalc INT;
|
||||||
DECLARE vWarehouseFk INT;
|
DECLARE vWarehouseFk INT;
|
||||||
|
|
||||||
DECLARE cWarehouses CURSOR FOR
|
DECLARE cWarehouses CURSOR FOR
|
||||||
SELECT id
|
SELECT id
|
||||||
FROM vn.warehouse
|
FROM vn.warehouse
|
||||||
WHERE isInventory;
|
WHERE isInventory;
|
||||||
|
@ -22,13 +22,13 @@ BEGIN
|
||||||
read_loop: LOOP
|
read_loop: LOOP
|
||||||
SET vDone = FALSE;
|
SET vDone = FALSE;
|
||||||
FETCH cWarehouses INTO vWarehouseFk;
|
FETCH cWarehouses INTO vWarehouseFk;
|
||||||
|
|
||||||
IF vDone THEN
|
IF vDone THEN
|
||||||
LEAVE read_loop;
|
LEAVE read_loop;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
CALL cache.visible_refresh(vCalc, FALSE, vWarehouseFk);
|
CALL cache.visible_refresh(vCalc, FALSE, vWarehouseFk);
|
||||||
|
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tVisible
|
CREATE OR REPLACE TEMPORARY TABLE tVisible
|
||||||
SELECT itemFk, SUM(visible) totalVisible
|
SELECT itemFk, SUM(visible) totalVisible
|
||||||
FROM vn.itemShelving ish
|
FROM vn.itemShelving ish
|
||||||
|
@ -37,7 +37,7 @@ BEGIN
|
||||||
JOIN vn.sector sc ON sc.id = p.sectorFk
|
JOIN vn.sector sc ON sc.id = p.sectorFk
|
||||||
WHERE sc.warehouseFk = vWarehouseFk
|
WHERE sc.warehouseFk = vWarehouseFk
|
||||||
GROUP BY itemFk;
|
GROUP BY itemFk;
|
||||||
|
|
||||||
INSERT INTO inventoryDiscrepancyDetail(
|
INSERT INTO inventoryDiscrepancyDetail(
|
||||||
warehouseFk,
|
warehouseFk,
|
||||||
itemFk,
|
itemFk,
|
||||||
|
@ -65,7 +65,7 @@ BEGIN
|
||||||
JOIN vn.ticketState ts ON ts.ticketFk = t.id
|
JOIN vn.ticketState ts ON ts.ticketFk = t.id
|
||||||
JOIN vn.alertLevel al ON al.id = ts.alertLevel
|
JOIN vn.alertLevel al ON al.id = ts.alertLevel
|
||||||
WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE())
|
WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE())
|
||||||
AND NOT s.isPicked
|
AND s.isPicked = FALSE
|
||||||
AND al.code = 'FREE'
|
AND al.code = 'FREE'
|
||||||
AND t.warehouseFk = vWarehouseFk
|
AND t.warehouseFk = vWarehouseFk
|
||||||
GROUP BY s.itemFk
|
GROUP BY s.itemFk
|
||||||
|
@ -73,6 +73,7 @@ BEGIN
|
||||||
) s ON s.itemFk = v.item_id
|
) s ON s.itemFk = v.item_id
|
||||||
WHERE v.calc_id = vCalc
|
WHERE v.calc_id = vCalc
|
||||||
AND NOT v.visible <=> tv.totalVisible;
|
AND NOT v.visible <=> tv.totalVisible;
|
||||||
|
|
||||||
END LOOP;
|
END LOOP;
|
||||||
CLOSE cWarehouses;
|
CLOSE cWarehouses;
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ BEGIN
|
||||||
|
|
||||||
DELETE FROM bs.ventas_contables
|
DELETE FROM bs.ventas_contables
|
||||||
WHERE year = vYear
|
WHERE year = vYear
|
||||||
AND month = vMonth;
|
AND month = vMonth;
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticket_list;
|
DROP TEMPORARY TABLE IF EXISTS tmp.ticket_list;
|
||||||
CREATE TEMPORARY TABLE tmp.ticket_list
|
CREATE TEMPORARY TABLE tmp.ticket_list
|
||||||
|
|
|
@ -3,7 +3,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `cache`.`available_refres
|
||||||
OUT `vCalc` INT,
|
OUT `vCalc` INT,
|
||||||
`vRefresh` INT,
|
`vRefresh` INT,
|
||||||
`vWarehouse` INT,
|
`vWarehouse` INT,
|
||||||
`vAvailabled` DATETIME
|
`vDated` DATE
|
||||||
)
|
)
|
||||||
proc: BEGIN
|
proc: BEGIN
|
||||||
DECLARE vStartDate DATE;
|
DECLARE vStartDate DATE;
|
||||||
|
@ -12,7 +12,6 @@ proc: BEGIN
|
||||||
DECLARE vInventoryDate DATE;
|
DECLARE vInventoryDate DATE;
|
||||||
DECLARE vLifeScope DATE;
|
DECLARE vLifeScope DATE;
|
||||||
DECLARE vWarehouseFkInventory INT;
|
DECLARE vWarehouseFkInventory INT;
|
||||||
DECLARE vDated DATE;
|
|
||||||
|
|
||||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||||
BEGIN
|
BEGIN
|
||||||
|
@ -20,17 +19,13 @@ proc: BEGIN
|
||||||
RESIGNAL;
|
RESIGNAL;
|
||||||
END;
|
END;
|
||||||
|
|
||||||
IF vAvailabled < util.VN_CURDATE() THEN
|
IF vDated < util.VN_CURDATE() THEN
|
||||||
LEAVE proc;
|
LEAVE proc;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
SET vDated = DATE(vAvailabled);
|
|
||||||
|
|
||||||
SET vAvailabled = vDated + INTERVAL HOUR(vAvailabled) HOUR;
|
|
||||||
|
|
||||||
CALL vn.item_getStock(vWarehouse, vDated, NULL);
|
CALL vn.item_getStock(vWarehouse, vDated, NULL);
|
||||||
|
|
||||||
SET vParams = CONCAT_WS('/', vWarehouse, vAvailabled);
|
SET vParams = CONCAT_WS('/', vWarehouse, vDated);
|
||||||
CALL cache_calc_start (vCalc, vRefresh, 'available', vParams);
|
CALL cache_calc_start (vCalc, vRefresh, 'available', vParams);
|
||||||
|
|
||||||
IF !vRefresh THEN
|
IF !vRefresh THEN
|
||||||
|
@ -89,13 +84,14 @@ proc: BEGIN
|
||||||
AND (ir.ended IS NULL OR i.shipped <= ir.ended)
|
AND (ir.ended IS NULL OR i.shipped <= ir.ended)
|
||||||
AND i.warehouseFk = vWarehouse
|
AND i.warehouseFk = vWarehouse
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT i.itemFk, IFNULL(i.availabled, i.landed), i.quantity
|
SELECT i.itemFk, i.landed, i.quantity
|
||||||
FROM vn.itemEntryIn i
|
FROM vn.itemEntryIn i
|
||||||
JOIN itemRange ir ON ir.itemFk = i.itemFk
|
JOIN itemRange ir ON ir.itemFk = i.itemFk
|
||||||
WHERE IFNULL(i.availabled, i.landed) >= vStartDate
|
LEFT JOIN edi.warehouseFloramondo wf ON wf.entryFk = i.entryFk
|
||||||
AND IFNULL(i.availabled, i.landed) <= vAvailabled
|
WHERE i.landed >= vStartDate
|
||||||
AND (ir.ended IS NULL OR IFNULL(i.availabled, i.landed) <= ir.ended)
|
AND (ir.ended IS NULL OR i.landed <= ir.ended)
|
||||||
AND i.warehouseInFk = vWarehouse
|
AND i.warehouseInFk = vWarehouse
|
||||||
|
AND ISNULL(wf.entryFk)
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT i.itemFk, i.shipped, i.quantity
|
SELECT i.itemFk, i.shipped, i.quantity
|
||||||
FROM vn.itemEntryOut i
|
FROM vn.itemEntryOut i
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `sage`.`accountingMovements_add`(
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `sage`.`accountingMovements_add`(
|
||||||
vYear INT,
|
vYear INT,
|
||||||
vCompanyFk INT
|
vCompanyFk INT
|
||||||
)
|
)
|
||||||
BEGIN
|
BEGIN
|
||||||
/**
|
/**
|
||||||
* Traslada la info de contabilidad generada en base a vn.XDiario a la tabla sage.movConta
|
* Traslada la info de contabilidad generada en base a vn.XDiario a la tabla sage.movConta
|
||||||
* para poder ejecutar posteriormente el proceso de importación de datos de SQL Server
|
* para poder ejecutar posteriormente el proceso de importación de datos de SQL Server
|
||||||
* Solo traladará los asientos marcados con el campo vn.XDiario.enlazadoSage = FALSE
|
* Solo traladará los asientos marcados con el campo vn.XDiario.enlazadoSage = FALSE
|
||||||
* @vYear Año contable del que se quiere trasladar la información
|
* @vYear Año contable del que se quiere trasladar la información
|
||||||
|
@ -23,7 +23,6 @@ BEGIN
|
||||||
DECLARE vInvoiceTypeInformativeCode VARCHAR(1);
|
DECLARE vInvoiceTypeInformativeCode VARCHAR(1);
|
||||||
DECLARE vCountryCanariasCode, vCountryCeutaMelillaCode VARCHAR(2);
|
DECLARE vCountryCanariasCode, vCountryCeutaMelillaCode VARCHAR(2);
|
||||||
DECLARE vCompanyCode INT;
|
DECLARE vCompanyCode INT;
|
||||||
DECLARE vHasErrorTax BOOL DEFAULT FALSE;
|
|
||||||
|
|
||||||
SELECT SiglaNacion INTO vCountryCanariasCode
|
SELECT SiglaNacion INTO vCountryCanariasCode
|
||||||
FROM Naciones
|
FROM Naciones
|
||||||
|
@ -45,12 +44,12 @@ BEGIN
|
||||||
FROM taxType
|
FROM taxType
|
||||||
WHERE code = 'import4';
|
WHERE code = 'import4';
|
||||||
|
|
||||||
SELECT shipmentTransactionTypeFk,
|
SELECT shipmentTransactionTypeFk,
|
||||||
definitiveExportTransactionTypeFk,
|
definitiveExportTransactionTypeFk,
|
||||||
pendingServiceTransactionTypeFk,
|
pendingServiceTransactionTypeFk,
|
||||||
company_getCode(vCompanyFk)
|
company_getCode(vCompanyFk)
|
||||||
INTO vTransactionExportTaxFreeFk,
|
INTO vTransactionExportTaxFreeFk,
|
||||||
vTransactionExportFk,
|
vTransactionExportFk,
|
||||||
vDuaTransactionFk,
|
vDuaTransactionFk,
|
||||||
vCompanyCode
|
vCompanyCode
|
||||||
FROM config;
|
FROM config;
|
||||||
|
@ -67,24 +66,6 @@ BEGIN
|
||||||
WHERE enlazadoSage = FALSE
|
WHERE enlazadoSage = FALSE
|
||||||
AND Asiento <> 1 ;
|
AND Asiento <> 1 ;
|
||||||
|
|
||||||
SELECT EXISTS (
|
|
||||||
SELECT TRUE
|
|
||||||
FROM vn.XDiario x
|
|
||||||
JOIN vn.invoiceIn ii ON ii.id = x.CLAVE
|
|
||||||
JOIN vn.invoiceInTax it ON it.invoiceInFk = ii.id
|
|
||||||
LEFT JOIN TiposIva ti ON ti.CodigoIva = it.taxTypeSageFk
|
|
||||||
LEFT JOIN taxType tt ON tt.id = it.taxTypeSageFk
|
|
||||||
WHERE x.FECHA BETWEEN vDatedFrom AND vDatedTo
|
|
||||||
AND NOT x.enlazadoSage
|
|
||||||
AND x.empresa_id = vCompanyFk
|
|
||||||
AND it.taxTypeSageFk
|
|
||||||
AND (ti.CodigoIva IS NULL OR tt.id IS NULL)
|
|
||||||
) INTO vHasErrorTax;
|
|
||||||
|
|
||||||
IF vHasErrorTax tHEN
|
|
||||||
CALL util.throw ('Error in tables for received invoices tax');
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
CALL invoiceOut_manager(vYear, vCompanyFk);
|
CALL invoiceOut_manager(vYear, vCompanyFk);
|
||||||
CALL invoiceIn_manager(vYear, vCompanyFk);
|
CALL invoiceIn_manager(vYear, vCompanyFk);
|
||||||
|
|
||||||
|
@ -325,8 +306,8 @@ BEGIN
|
||||||
mci.FechaFacturaOriginal = x.FECHA_EX,
|
mci.FechaFacturaOriginal = x.FECHA_EX,
|
||||||
mci.SuFacturaNo = x.FACTURAEX,
|
mci.SuFacturaNo = x.FACTURAEX,
|
||||||
mci.FechaOperacion = x.FECHA_OP,
|
mci.FechaOperacion = x.FECHA_OP,
|
||||||
mci.ImporteFactura = mci.ImporteFactura +
|
mci.ImporteFactura = mci.ImporteFactura +
|
||||||
x.BASEEURO +
|
x.BASEEURO +
|
||||||
CAST((x.IVA / 100) * x.BASEEURO AS DECIMAL(10, 2))
|
CAST((x.IVA / 100) * x.BASEEURO AS DECIMAL(10, 2))
|
||||||
WHERE pm.description = 'HP Iva pendiente'
|
WHERE pm.description = 'HP Iva pendiente'
|
||||||
AND mci.enlazadoSage = FALSE
|
AND mci.enlazadoSage = FALSE
|
||||||
|
@ -345,7 +326,7 @@ BEGIN
|
||||||
mci.CodigoIva2 = vTaxImportFk,
|
mci.CodigoIva2 = vTaxImportFk,
|
||||||
mci.IvaDeducible2 = TRUE,
|
mci.IvaDeducible2 = TRUE,
|
||||||
mci.ImporteFactura = mci.ImporteFactura +
|
mci.ImporteFactura = mci.ImporteFactura +
|
||||||
x.BASEEURO +
|
x.BASEEURO +
|
||||||
CAST((x.IVA / 100) * x.BASEEURO AS DECIMAL(10, 2))
|
CAST((x.IVA / 100) * x.BASEEURO AS DECIMAL(10, 2))
|
||||||
WHERE pm.description = 'HP Iva pendiente'
|
WHERE pm.description = 'HP Iva pendiente'
|
||||||
AND mci.enlazadoSage = FALSE
|
AND mci.enlazadoSage = FALSE
|
||||||
|
@ -363,8 +344,8 @@ BEGIN
|
||||||
mci.CodigoTransaccion3 = vDuaTransactionFk ,
|
mci.CodigoTransaccion3 = vDuaTransactionFk ,
|
||||||
mci.CodigoIva3 = vTaxImportSuperReducedFk,
|
mci.CodigoIva3 = vTaxImportSuperReducedFk,
|
||||||
mci.IvaDeducible3 = TRUE,
|
mci.IvaDeducible3 = TRUE,
|
||||||
mci.ImporteFactura = mci.ImporteFactura +
|
mci.ImporteFactura = mci.ImporteFactura +
|
||||||
x.BASEEURO +
|
x.BASEEURO +
|
||||||
CAST((x.IVA / 100) * x.BASEEURO AS DECIMAL(10, 2))
|
CAST((x.IVA / 100) * x.BASEEURO AS DECIMAL(10, 2))
|
||||||
WHERE pm.description = 'HP Iva pendiente'
|
WHERE pm.description = 'HP Iva pendiente'
|
||||||
AND mci.enlazadoSage = FALSE
|
AND mci.enlazadoSage = FALSE
|
||||||
|
@ -398,14 +379,14 @@ BEGIN
|
||||||
OR CodigoTransaccion2 = vTransactionExportFk
|
OR CodigoTransaccion2 = vTransactionExportFk
|
||||||
OR CodigoTransaccion3 = vTransactionExportFk
|
OR CodigoTransaccion3 = vTransactionExportFk
|
||||||
OR CodigoTransaccion4 = vTransactionExportFk)
|
OR CodigoTransaccion4 = vTransactionExportFk)
|
||||||
AND SiglaNacion IN (vCountryCanariasCode COLLATE utf8mb3_unicode_ci,
|
AND SiglaNacion IN (vCountryCanariasCode COLLATE utf8mb3_unicode_ci,
|
||||||
vCountryCeutaMelillaCode COLLATE utf8mb3_unicode_ci);
|
vCountryCeutaMelillaCode COLLATE utf8mb3_unicode_ci);
|
||||||
|
|
||||||
UPDATE movConta mc
|
UPDATE movConta mc
|
||||||
SET CodigoDivisa = 'USD',
|
SET CodigoDivisa = 'USD',
|
||||||
FactorCambio = TRUE,
|
FactorCambio = TRUE,
|
||||||
ImporteCambio = ABS( CAST( IF( ImporteDivisa <> 0 AND ImporteCambio = 0,
|
ImporteCambio = ABS( CAST( IF( ImporteDivisa <> 0 AND ImporteCambio = 0,
|
||||||
ImporteAsiento / ImporteDivisa,
|
ImporteAsiento / ImporteDivisa,
|
||||||
ImporteCambio) AS DECIMAL( 10, 2)))
|
ImporteCambio) AS DECIMAL( 10, 2)))
|
||||||
WHERE enlazadoSage = FALSE
|
WHERE enlazadoSage = FALSE
|
||||||
AND (ImporteCambio <> 0 OR ImporteDivisa <> 0 OR FactorCambio);
|
AND (ImporteCambio <> 0 OR ImporteDivisa <> 0 OR FactorCambio);
|
||||||
|
@ -422,20 +403,20 @@ BEGIN
|
||||||
WITH client AS(
|
WITH client AS(
|
||||||
SELECT DISTINCT c.id
|
SELECT DISTINCT c.id
|
||||||
FROM sage.movConta mc
|
FROM sage.movConta mc
|
||||||
JOIN vn.client c ON c.accountingAccount = mc.CodigoCuenta
|
JOIN vn.client c ON c.accountingAccount = mc.CodigoCuenta
|
||||||
WHERE NOT enlazadoSage
|
WHERE NOT enlazadoSage
|
||||||
),supplier AS(
|
),supplier AS(
|
||||||
SELECT DISTINCT s.id
|
SELECT DISTINCT s.id
|
||||||
FROM sage.movConta mc
|
FROM sage.movConta mc
|
||||||
JOIN vn.supplier s ON s.account = mc.CodigoCuenta
|
JOIN vn.supplier s ON s.account = mc.CodigoCuenta
|
||||||
WHERE NOT enlazadoSage
|
WHERE NOT enlazadoSage
|
||||||
),clientSupplierSync AS(
|
),clientSupplierSync AS(
|
||||||
SELECT idClientSupplier, `type`
|
SELECT idClientSupplier, `type`
|
||||||
FROM sage.clientSupplier cs
|
FROM sage.clientSupplier cs
|
||||||
WHERE isSync
|
WHERE isSync
|
||||||
)
|
)
|
||||||
SELECT idClientSupplier, `type`
|
SELECT idClientSupplier, `type`
|
||||||
FROM sage.clientSupplier cs
|
FROM sage.clientSupplier cs
|
||||||
WHERE NOT isSync
|
WHERE NOT isSync
|
||||||
UNION
|
UNION
|
||||||
SELECT id, 'C'
|
SELECT id, 'C'
|
||||||
|
@ -443,7 +424,7 @@ BEGIN
|
||||||
LEFT JOIN clientSupplierSync cs ON cs.idClientSupplier = c.id
|
LEFT JOIN clientSupplierSync cs ON cs.idClientSupplier = c.id
|
||||||
AND cs.Type ='C'
|
AND cs.Type ='C'
|
||||||
WHERE cs.idClientSupplier IS NULL
|
WHERE cs.idClientSupplier IS NULL
|
||||||
UNION
|
UNION
|
||||||
SELECT id, 'P'
|
SELECT id, 'P'
|
||||||
FROM supplier s
|
FROM supplier s
|
||||||
LEFT JOIN clientSupplierSync cs ON cs.idClientSupplier = s.id
|
LEFT JOIN clientSupplierSync cs ON cs.idClientSupplier = s.id
|
||||||
|
@ -455,7 +436,7 @@ BEGIN
|
||||||
INSERT IGNORE INTO sage.clientSupplier (companyFk, `type`, idClientSupplier, isSync)
|
INSERT IGNORE INTO sage.clientSupplier (companyFk, `type`, idClientSupplier, isSync)
|
||||||
SELECT vCompanyCode, `type`, idClientSupplier, FALSE
|
SELECT vCompanyCode, `type`, idClientSupplier, FALSE
|
||||||
FROM tmp.clientSupplier;
|
FROM tmp.clientSupplier;
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tmp.clientSupplier;
|
DROP TEMPORARY TABLE tmp.clientSupplier;
|
||||||
|
|
||||||
CALL pgc_add(vCompanyFk);
|
CALL pgc_add(vCompanyFk);
|
||||||
|
|
|
@ -1,62 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`getTimeBetweenRoadmapAddresses`(
|
|
||||||
vRoadmapAddressFrom INT,
|
|
||||||
vRoadmapAddressTo INT
|
|
||||||
)
|
|
||||||
RETURNS int(11)
|
|
||||||
DETERMINISTIC
|
|
||||||
BEGIN
|
|
||||||
/**
|
|
||||||
* Retorna el tiempo en segundos que se suele tardar en ir
|
|
||||||
* de un punto de distribución a otro en una ruta troncal.
|
|
||||||
*
|
|
||||||
* @param vRoadmapAddressFrom Punto de distribución de origen
|
|
||||||
* @param vRoadmapAddressTo Punto de distribución de destino
|
|
||||||
* @return Tiempo en segundos
|
|
||||||
*/
|
|
||||||
DECLARE vSeconds INT;
|
|
||||||
|
|
||||||
WITH wRoadmapStop AS (
|
|
||||||
SELECT ROW_NUMBER() OVER(PARTITION BY roadmapFk ORDER BY eta) `sequence`,
|
|
||||||
roadmapFk,
|
|
||||||
roadmapAddressFk,
|
|
||||||
eta
|
|
||||||
FROM vn.roadmapStop
|
|
||||||
WHERE roadmapFk IS NOT NULL
|
|
||||||
AND roadmapAddressFk IS NOT NULL
|
|
||||||
AND eta IS NOT NULL
|
|
||||||
)
|
|
||||||
SELECT AVG(TIME_TO_SEC(TIMEDIFF(rsTo.eta, rsFrom.eta))) INTO vSeconds
|
|
||||||
FROM wRoadmapStop rsFrom
|
|
||||||
JOIN wRoadmapStop rsTo ON rsTo.roadmapFk = rsFrom.roadmapFk
|
|
||||||
WHERE rsFrom.roadmapAddressFk = vRoadmapAddressFrom
|
|
||||||
AND rsTo.roadmapAddressFk = vRoadmapAddressTo
|
|
||||||
AND rsFrom.`sequence` + 1 = rsTo.`sequence`;
|
|
||||||
|
|
||||||
IF NOT IFNULL(vSeconds, 0) THEN
|
|
||||||
WITH wRoadmap AS (
|
|
||||||
SELECT id,
|
|
||||||
roadmapAddressFk,
|
|
||||||
etd
|
|
||||||
FROM vn.roadmap
|
|
||||||
WHERE roadmapAddressFk = vRoadmapAddressFrom
|
|
||||||
AND etd IS NOT NULL
|
|
||||||
), wRoadmapStop AS (
|
|
||||||
SELECT ROW_NUMBER() OVER(PARTITION BY roadmapFk ORDER BY eta) `sequence`,
|
|
||||||
roadmapFk,
|
|
||||||
roadmapAddressFk,
|
|
||||||
eta
|
|
||||||
FROM vn.roadmapStop
|
|
||||||
WHERE roadmapFk IS NOT NULL
|
|
||||||
AND roadmapAddressFk = vRoadmapAddressTo
|
|
||||||
AND eta IS NOT NULL
|
|
||||||
)
|
|
||||||
SELECT AVG(TIME_TO_SEC(TIMEDIFF(rsTo.eta, rFrom.etd))) INTO vSeconds
|
|
||||||
FROM wRoadmap rFrom
|
|
||||||
JOIN wRoadmapStop rsTo ON rsTo.roadmapFk = rFrom.id
|
|
||||||
AND rsTo.`sequence` = 1;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
RETURN vSeconds;
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -19,15 +19,13 @@ BEGIN
|
||||||
* @return tmp.ticketComponentPrice
|
* @return tmp.ticketComponentPrice
|
||||||
*/
|
*/
|
||||||
DECLARE vAvailableCalc INT;
|
DECLARE vAvailableCalc INT;
|
||||||
DECLARE vAvailabled DATETIME;
|
DECLARE vAvailableNoRaidsCalc INT;
|
||||||
DECLARE vDone BOOL;
|
|
||||||
DECLARE vHour INT;
|
|
||||||
DECLARE vShipped DATE;
|
DECLARE vShipped DATE;
|
||||||
DECLARE vWarehouseFk SMALLINT;
|
DECLARE vWarehouseFk SMALLINT;
|
||||||
DECLARE vZoneFk INT;
|
DECLARE vZoneFk INT;
|
||||||
|
DECLARE vDone BOOL;
|
||||||
DECLARE cTravelTree CURSOR FOR
|
DECLARE cTravelTree CURSOR FOR
|
||||||
SELECT zoneFk, warehouseFk, shipped, `hour` FROM tmp.zoneGetShipped;
|
SELECT zoneFk, warehouseFk, shipped FROM tmp.zoneGetShipped;
|
||||||
|
|
||||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
||||||
|
|
||||||
|
@ -68,15 +66,14 @@ BEGIN
|
||||||
OPEN cTravelTree;
|
OPEN cTravelTree;
|
||||||
l: LOOP
|
l: LOOP
|
||||||
SET vDone = FALSE;
|
SET vDone = FALSE;
|
||||||
FETCH cTravelTree INTO vZoneFk, vWarehouseFk, vShipped, vHour;
|
FETCH cTravelTree INTO vZoneFk, vWarehouseFk, vShipped;
|
||||||
|
|
||||||
SET vAvailabled = vShipped + INTERVAL HOUR(vHour) HOUR;
|
|
||||||
|
|
||||||
IF vDone THEN
|
IF vDone THEN
|
||||||
LEAVE l;
|
LEAVE l;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
CALL `cache`.available_refresh(vAvailableCalc, FALSE, vWarehouseFk, vAvailabled);
|
CALL `cache`.available_refresh(vAvailableCalc, FALSE, vWarehouseFk, vShipped);
|
||||||
|
CALL `cache`.availableNoRaids_refresh(vAvailableNoRaidsCalc, FALSE, vWarehouseFk, vShipped);
|
||||||
CALL buy_getUltimate(NULL, vWarehouseFk, vShipped);
|
CALL buy_getUltimate(NULL, vWarehouseFk, vShipped);
|
||||||
|
|
||||||
INSERT INTO tmp.ticketLot (warehouseFk, itemFk, available, buyFk, zoneFk)
|
INSERT INTO tmp.ticketLot (warehouseFk, itemFk, available, buyFk, zoneFk)
|
||||||
|
@ -86,10 +83,31 @@ BEGIN
|
||||||
bu.buyFk,
|
bu.buyFk,
|
||||||
vZoneFk
|
vZoneFk
|
||||||
FROM `cache`.available a
|
FROM `cache`.available a
|
||||||
|
LEFT JOIN cache.availableNoRaids anr ON anr.item_id = a.item_id
|
||||||
|
AND anr.calc_id = vAvailableNoRaidsCalc
|
||||||
JOIN tmp.item i ON i.itemFk = a.item_id
|
JOIN tmp.item i ON i.itemFk = a.item_id
|
||||||
JOIN item it ON it.id = i.itemFk
|
JOIN item it ON it.id = i.itemFk
|
||||||
JOIN `zone` z ON z.id = vZoneFk
|
JOIN `zone` z ON z.id = vZoneFk
|
||||||
LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = a.item_id
|
LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = a.item_id
|
||||||
|
LEFT JOIN edi.supplyResponse sr ON sr.ID = it.supplyResponseFk
|
||||||
|
LEFT JOIN edi.VMPSettings v ON v.VMPID = sr.vmpID
|
||||||
|
LEFT JOIN edi.marketPlace mp ON mp.id = sr.MarketPlaceID
|
||||||
|
LEFT JOIN (SELECT isVNHSupplier, isEarlyBird, TRUE AS itemAllowed
|
||||||
|
FROM addressFilter af
|
||||||
|
JOIN (SELECT ad.provinceFk, p.countryFk, ad.isLogifloraAllowed
|
||||||
|
FROM address ad
|
||||||
|
JOIN province p ON p.id = ad.provinceFk
|
||||||
|
WHERE ad.id = vAddressFk
|
||||||
|
) sub2 ON sub2.provinceFk <=> IFNULL(af.provinceFk, sub2.provinceFk)
|
||||||
|
AND sub2.countryFk <=> IFNULL(af.countryFk, sub2.countryFk)
|
||||||
|
AND sub2.isLogifloraAllowed <=> IFNULL(af.isLogifloraAllowed, sub2.isLogifloraAllowed)
|
||||||
|
WHERE vWarehouseFk = af.warehouseFk
|
||||||
|
AND (vShipped < af.beforeDated
|
||||||
|
OR ISNULL(af.beforeDated)
|
||||||
|
OR vShipped > af.afterDated
|
||||||
|
OR ISNULL(af.afterDated))
|
||||||
|
) sub ON sub.isVNHSupplier = v.isVNHSupplier
|
||||||
|
AND (sub.isEarlyBird = mp.isEarlyBird OR ISNULL(sub.isEarlyBird))
|
||||||
JOIN agencyMode am ON am.id = vAgencyModeFk
|
JOIN agencyMode am ON am.id = vAgencyModeFk
|
||||||
JOIN agency ag ON ag.id = am.agencyFk
|
JOIN agency ag ON ag.id = am.agencyFk
|
||||||
JOIN itemType itt ON itt.id = it.typeFk
|
JOIN itemType itt ON itt.id = it.typeFk
|
||||||
|
@ -106,6 +124,7 @@ BEGIN
|
||||||
AND ait.itemTypeFk = itt.id
|
AND ait.itemTypeFk = itt.id
|
||||||
WHERE a.calc_id = vAvailableCalc
|
WHERE a.calc_id = vAvailableCalc
|
||||||
AND a.available > 0
|
AND a.available > 0
|
||||||
|
AND (sub.itemAllowed OR NOT it.isFloramondo OR anr.available > 0)
|
||||||
AND (ag.isAnyVolumeAllowed OR NOT itt.isUnconventionalSize)
|
AND (ag.isAnyVolumeAllowed OR NOT itt.isUnconventionalSize)
|
||||||
AND (it.`size` IS NULL
|
AND (it.`size` IS NULL
|
||||||
OR IF(itc.isReclining,
|
OR IF(itc.isReclining,
|
||||||
|
|
|
@ -160,11 +160,9 @@ BEGIN
|
||||||
OR (NOT s.isPreparable AND NOT s.isPrintable)
|
OR (NOT s.isPreparable AND NOT s.isPrintable)
|
||||||
OR pb.collectionH IS NOT NULL
|
OR pb.collectionH IS NOT NULL
|
||||||
OR pb.collectionV IS NOT NULL
|
OR pb.collectionV IS NOT NULL
|
||||||
OR pb.collectionA IS NOT NULL
|
|
||||||
OR pb.collectionN IS NOT NULL
|
OR pb.collectionN IS NOT NULL
|
||||||
OR (NOT pb.H AND pb.V + pb.A > 0 AND vItemPackingTypeFk = 'H')
|
OR (NOT pb.H AND pb.V > 0 AND vItemPackingTypeFk = 'H')
|
||||||
OR (NOT pb.V AND vItemPackingTypeFk = 'V')
|
OR (NOT pb.V AND vItemPackingTypeFk = 'V')
|
||||||
OR (NOT pb.A AND vItemPackingTypeFk = 'A')
|
|
||||||
OR (pc.isPreviousPreparationRequired AND pb.previousWithoutParking)
|
OR (pc.isPreviousPreparationRequired AND pb.previousWithoutParking)
|
||||||
OR LENGTH(pb.problem)
|
OR LENGTH(pb.problem)
|
||||||
OR pb.lines > vLinesLimit
|
OR pb.lines > vLinesLimit
|
||||||
|
|
|
@ -1,31 +1,20 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`entry_clone`(
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`entry_clone`(vSelf INT)
|
||||||
vSelf INT,
|
|
||||||
OUT vOutputEntryFk INT
|
|
||||||
)
|
|
||||||
BEGIN
|
BEGIN
|
||||||
/**
|
/**
|
||||||
* clones an entry.
|
* clones an entry.
|
||||||
*
|
*
|
||||||
* @param vSelf The entry id
|
* @param vSelf The entry id
|
||||||
* @param vOutputEntryFk The new entry id
|
|
||||||
*/
|
*/
|
||||||
DECLARE vNewEntryFk INT;
|
DECLARE vNewEntryFk INT;
|
||||||
|
|
||||||
DECLARE vIsRequiredTx BOOL DEFAULT NOT @@in_transaction;
|
START TRANSACTION;
|
||||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
|
||||||
BEGIN
|
|
||||||
CALL util.tx_rollback(vIsRequiredTx);
|
|
||||||
RESIGNAL;
|
|
||||||
END;
|
|
||||||
|
|
||||||
CALL util.tx_start(vIsRequiredTx);
|
|
||||||
|
|
||||||
CALL entry_cloneHeader(vSelf, vNewEntryFk, NULL);
|
CALL entry_cloneHeader(vSelf, vNewEntryFk, NULL);
|
||||||
CALL entry_copyBuys(vSelf, vNewEntryFk);
|
CALL entry_copyBuys(vSelf, vNewEntryFk);
|
||||||
|
|
||||||
CALL util.tx_commit(vIsRequiredTx);
|
COMMIT;
|
||||||
SET vOutputEntryFk = vNewEntryFk;
|
|
||||||
|
|
||||||
|
SELECT vNewEntryFk;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -39,14 +39,14 @@ BEGIN
|
||||||
|
|
||||||
read_loop: LOOP
|
read_loop: LOOP
|
||||||
SET vDone = FALSE;
|
SET vDone = FALSE;
|
||||||
|
|
||||||
FETCH cur INTO vBuyFk, vIshStickers, vBuyStickers;
|
FETCH cur INTO vBuyFk, vIshStickers, vBuyStickers;
|
||||||
|
|
||||||
IF vDone THEN
|
IF vDone THEN
|
||||||
LEAVE read_loop;
|
LEAVE read_loop;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
IF vIshStickers = vBuyStickers THEN
|
IF vIshStickers = vBuyStickers THEN
|
||||||
UPDATE buy
|
UPDATE buy
|
||||||
SET entryFk = vToEntryFk
|
SET entryFk = vToEntryFk
|
||||||
WHERE id = vBuyFk;
|
WHERE id = vBuyFk;
|
||||||
|
|
|
@ -1,158 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`entry_transfer`(
|
|
||||||
vOriginalEntry INT,
|
|
||||||
OUT vNewEntryFk INT
|
|
||||||
)
|
|
||||||
BEGIN
|
|
||||||
/**
|
|
||||||
* Adelanta a mañana la mercancia de una entrada a partir de lo que hay ubicado en el almacén
|
|
||||||
*
|
|
||||||
* @param vOriginalEntry entrada que se quiera adelantar
|
|
||||||
* @param vNewEntry nueva entrada creada
|
|
||||||
*/
|
|
||||||
DECLARE vTravelFk INT;
|
|
||||||
DECLARE vWarehouseFk INT;
|
|
||||||
DECLARE vWarehouseInFk INT;
|
|
||||||
DECLARE vWarehouseOutFk INT;
|
|
||||||
DECLARE vRef INT;
|
|
||||||
DECLARE vIsReceived INT;
|
|
||||||
DECLARE vAgencyModeFk INT;
|
|
||||||
DECLARE vTomorrow DATETIME DEFAULT util.tomorrow();
|
|
||||||
DECLARE vCurDate DATE DEFAULT util.VN_CURDATE();
|
|
||||||
|
|
||||||
DECLARE vIsRequiredTx BOOL DEFAULT NOT @@in_transaction;
|
|
||||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
|
||||||
BEGIN
|
|
||||||
CALL util.tx_rollback(vIsRequiredTx);
|
|
||||||
RESIGNAL;
|
|
||||||
END;
|
|
||||||
|
|
||||||
-- Clonar la entrada
|
|
||||||
CALL entry_clone(vOriginalEntry, vNewEntryFk);
|
|
||||||
|
|
||||||
CALL util.tx_start(vIsRequiredTx);
|
|
||||||
|
|
||||||
/* Hay que crear un nuevo travel, con salida hoy y llegada mañana y
|
|
||||||
asignar la entrada nueva al nuevo travel.*/
|
|
||||||
SELECT t.warehouseInFk, t.warehouseOutFk, t.`ref`, t.isReceived, t.agencyModeFk
|
|
||||||
INTO vWarehouseInFk, vWarehouseOutFk, vRef, vIsReceived, vAgencyModeFk
|
|
||||||
FROM travel t
|
|
||||||
JOIN entry e ON e.travelFk = t.id
|
|
||||||
WHERE e.id = vOriginalEntry;
|
|
||||||
|
|
||||||
SELECT id INTO vTravelFk
|
|
||||||
FROM travel t
|
|
||||||
WHERE shipped = vCurDate
|
|
||||||
AND landed = vTomorrow
|
|
||||||
AND warehouseInFk = vWarehouseInFk
|
|
||||||
AND warehouseOutFk = vWarehouseOutFk
|
|
||||||
AND `ref` = vRef
|
|
||||||
AND isReceived =vIsReceived
|
|
||||||
AND agencyModeFk = vAgencyModeFk;
|
|
||||||
|
|
||||||
IF vTravelFk IS NULL THEN
|
|
||||||
INSERT INTO travel(
|
|
||||||
shipped,
|
|
||||||
landed,
|
|
||||||
warehouseInFk,
|
|
||||||
warehouseOutFk,
|
|
||||||
`ref`,
|
|
||||||
isReceived,
|
|
||||||
agencyModeFk)
|
|
||||||
SELECT vCurDate,
|
|
||||||
vTomorrow,
|
|
||||||
t.warehouseInFk,
|
|
||||||
t.warehouseOutFk,
|
|
||||||
t.`ref`,
|
|
||||||
t.isReceived,
|
|
||||||
t.agencyModeFk
|
|
||||||
FROM travel t
|
|
||||||
JOIN entry e ON e.travelFk = t.id
|
|
||||||
WHERE e.id = vOriginalEntry;
|
|
||||||
|
|
||||||
SET vTravelFk = LAST_INSERT_ID();
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
UPDATE entry
|
|
||||||
SET travelFk = vTravelFk,
|
|
||||||
evaNotes = vOriginalEntry
|
|
||||||
WHERE id = vNewEntryFk;
|
|
||||||
|
|
||||||
-- Poner a 0 las cantidades
|
|
||||||
UPDATE buy b
|
|
||||||
SET b.quantity = 0, b.stickers = 0
|
|
||||||
WHERE b.entryFk = vNewEntryFk;
|
|
||||||
|
|
||||||
-- Eliminar duplicados
|
|
||||||
DELETE b
|
|
||||||
FROM buy b
|
|
||||||
LEFT JOIN (SELECT b.id, b.itemFk
|
|
||||||
FROM buy b
|
|
||||||
WHERE b.entryFk = vNewEntryFk
|
|
||||||
GROUP BY b.itemFk) tBuy ON tBuy.id = b.id
|
|
||||||
WHERE b.entryFk = vNewEntryFk
|
|
||||||
AND tBuy.id IS NULL;
|
|
||||||
|
|
||||||
SELECT t.warehouseInFk INTO vWarehouseFk
|
|
||||||
FROM travel t
|
|
||||||
JOIN entry e ON e.travelFk = t.id
|
|
||||||
WHERE e.id = vOriginalEntry;
|
|
||||||
|
|
||||||
/* Actualizar nueva entrada con lo que no está ubicado HOY,
|
|
||||||
descontando lo vendido HOY de esas ubicaciones*/
|
|
||||||
CREATE OR REPLACE TEMPORARY TABLE buys
|
|
||||||
WITH tBuy AS (
|
|
||||||
SELECT b.itemFk, SUM(b.quantity) totalQuantity
|
|
||||||
FROM vn.buy b
|
|
||||||
WHERE b.entryFk = vOriginalEntry
|
|
||||||
GROUP BY b.itemFk
|
|
||||||
),
|
|
||||||
itemShelvings AS (
|
|
||||||
SELECT ish.itemFk, SUM(ish.visible) visible
|
|
||||||
FROM vn.itemShelving ish
|
|
||||||
JOIN vn.shelving sh ON sh.id = ish.shelvingFk
|
|
||||||
JOIN vn.parking p ON p.id = sh.parkingFk
|
|
||||||
JOIN vn.sector s ON s.id = p.sectorFk
|
|
||||||
JOIN vn.buy b ON b.id = ish.buyFk
|
|
||||||
JOIN vn.entry e ON e.id = b.entryFk
|
|
||||||
JOIN tBuy t ON t.itemFk = ish.itemFk
|
|
||||||
WHERE s.warehouseFk = vWarehouseFk
|
|
||||||
AND sh.parked >= vCurDate
|
|
||||||
GROUP BY ish.itemFk
|
|
||||||
),
|
|
||||||
sales AS (
|
|
||||||
SELECT s.itemFk, SUM(s.quantity) sold
|
|
||||||
FROM vn.ticket t
|
|
||||||
JOIN vn.sale s ON s.ticketFk = t.id
|
|
||||||
JOIN vn.itemShelvingSale iss ON iss.saleFk = s.id
|
|
||||||
JOIN vn.itemShelving is2 ON is2.id = iss.itemShelvingFk
|
|
||||||
JOIN vn.shelving s2 ON s2.id = is2.shelvingFk
|
|
||||||
JOIN tBuy t ON t.itemFk = s.itemFk
|
|
||||||
WHERE t.shipped BETWEEN vCurDate AND util.dayend(vCurDate)
|
|
||||||
AND s2.parked >= vCurDate
|
|
||||||
GROUP BY s.itemFk
|
|
||||||
)
|
|
||||||
SELECT tmp.itemFk,
|
|
||||||
IFNULL(iss.visible, 0) visible,
|
|
||||||
tmp.totalQuantity,
|
|
||||||
IFNULL(s.sold, 0) sold
|
|
||||||
FROM tBuy tmp
|
|
||||||
LEFT JOIN itemShelvings iss ON tmp.itemFk = iss.itemFk
|
|
||||||
LEFT JOIN sales s ON s.itemFk = tmp.itemFk
|
|
||||||
WHERE visible < tmp.totalQuantity
|
|
||||||
OR iss.itemFk IS NULL;
|
|
||||||
|
|
||||||
UPDATE buy b
|
|
||||||
JOIN buys tmp ON tmp.itemFk = b.itemFk
|
|
||||||
SET b.quantity = tmp.totalQuantity - tmp.visible - tmp.sold
|
|
||||||
WHERE b.entryFk = vNewEntryFk;
|
|
||||||
|
|
||||||
-- Limpia la nueva entrada
|
|
||||||
DELETE FROM buy WHERE entryFk = vNewEntryFk AND quantity = 0;
|
|
||||||
|
|
||||||
CALL util.tx_commit(vIsRequiredTx);
|
|
||||||
|
|
||||||
CALL cache.visible_refresh(@c,TRUE,vWarehouseFk);
|
|
||||||
CALL cache.available_refresh(@c, TRUE, vWarehouseFk, vCurDate);
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -0,0 +1,207 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemShelvingRadar`(
|
||||||
|
vSectorFk INT
|
||||||
|
)
|
||||||
|
BEGIN
|
||||||
|
/**
|
||||||
|
* Calcula la información detallada respecto un sector.
|
||||||
|
*
|
||||||
|
* @param vSectorFk Id de sector
|
||||||
|
*/
|
||||||
|
DECLARE vCalcVisibleFk INT;
|
||||||
|
DECLARE vCalcAvailableFk INT;
|
||||||
|
DECLARE hasFatherSector BOOLEAN;
|
||||||
|
DECLARE vBuyerFk INT DEFAULT 0;
|
||||||
|
DECLARE vWarehouseFk INT DEFAULT 0;
|
||||||
|
DECLARE vSonSectorFk INT;
|
||||||
|
DECLARE vWorkerFk INT;
|
||||||
|
|
||||||
|
SELECT s.workerFk INTO vWorkerFk
|
||||||
|
FROM sector s
|
||||||
|
WHERE s.id = vSectorFk;
|
||||||
|
|
||||||
|
SELECT COUNT(*) INTO hasFatherSector
|
||||||
|
FROM sector
|
||||||
|
WHERE sonFk = vSectorFk;
|
||||||
|
|
||||||
|
SELECT warehouseFk, sonFk INTO vWarehouseFk, vSonSectorFk
|
||||||
|
FROM sector
|
||||||
|
WHERE id = vSectorFk;
|
||||||
|
|
||||||
|
CALL cache.visible_refresh(vCalcVisibleFk, TRUE, vWarehouseFk);
|
||||||
|
CALL cache.available_refresh(vCalcAvailableFk, FALSE, vWarehouseFk, util.VN_CURDATE());
|
||||||
|
|
||||||
|
IF hasFatherSector THEN
|
||||||
|
CREATE OR REPLACE TEMPORARY TABLE tItemShelvingRadar
|
||||||
|
(PRIMARY KEY (itemFk))
|
||||||
|
ENGINE = MEMORY
|
||||||
|
SELECT *
|
||||||
|
FROM (
|
||||||
|
SELECT iss.itemFk,
|
||||||
|
i.longName,
|
||||||
|
i.size,
|
||||||
|
i.subName producer,
|
||||||
|
IFNULL(a.available, 0) available,
|
||||||
|
SUM(IF(s.sonFk = vSectorFk, IFNULL(iss.visible, 0), 0)) upstairs,
|
||||||
|
SUM(IF(iss.sectorFk = vSectorFk, IFNULL(iss.visible, 0), 0)) downstairs,
|
||||||
|
IF(it.isPackaging, NULL, IFNULL(v.visible, 0)) visible,
|
||||||
|
vSectorFk sectorFk,
|
||||||
|
ish.isChecked,
|
||||||
|
sub.isAllChecked
|
||||||
|
FROM itemShelvingStock iss
|
||||||
|
JOIN itemShelving ish ON ish.id = iss.itemShelvingFk
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT itemFk,
|
||||||
|
IF(
|
||||||
|
COUNT(*) = SUM(IF(isChecked >= 0, 1, 0)),
|
||||||
|
TRUE,
|
||||||
|
FALSE
|
||||||
|
) isAllChecked
|
||||||
|
FROM itemShelving is2
|
||||||
|
GROUP BY itemFk
|
||||||
|
) sub ON sub.itemFk = ish.itemFk
|
||||||
|
JOIN sector s ON s.id = iss.sectorFk
|
||||||
|
JOIN item i ON i.id = iss.itemFk
|
||||||
|
JOIN itemType it ON it.id = i.typeFk
|
||||||
|
LEFT JOIN cache.available a ON a.item_id = iss.itemFk
|
||||||
|
AND a.calc_id = vCalcAvailableFk
|
||||||
|
LEFT JOIN cache.visible v ON v.item_id = iss.itemFk
|
||||||
|
AND v.calc_id = vCalcVisibleFk
|
||||||
|
WHERE vSectorFk IN (iss.sectorFk, s.sonFk)
|
||||||
|
GROUP BY iss.itemFk
|
||||||
|
UNION ALL
|
||||||
|
SELECT v.item_id,
|
||||||
|
i.longName,
|
||||||
|
i.size,
|
||||||
|
i.subName,
|
||||||
|
IFNULL(a.available, 0),
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
IF(it.isPackaging, NULL, v.visible),
|
||||||
|
vSectorFk,
|
||||||
|
NULL,
|
||||||
|
NULL
|
||||||
|
FROM cache.visible v
|
||||||
|
JOIN item i ON i.id = v.item_id
|
||||||
|
JOIN itemType it ON it.id = i.typeFk
|
||||||
|
LEFT JOIN itemShelvingStock iss ON iss.itemFk = v.item_id
|
||||||
|
AND iss.warehouseFk = vWarehouseFk
|
||||||
|
LEFT JOIN cache.available a ON a.item_id = v.item_id
|
||||||
|
AND a.calc_id = vCalcAvailableFk
|
||||||
|
WHERE v.calc_id = vCalcVisibleFk
|
||||||
|
AND iss.itemFk IS NULL
|
||||||
|
AND it.isInventory
|
||||||
|
) sub
|
||||||
|
GROUP BY itemFk;
|
||||||
|
|
||||||
|
SELECT ishr.*,
|
||||||
|
CAST(visible - upstairs - downstairs AS DECIMAL(10, 0)) nicho,
|
||||||
|
CAST(downstairs - IFNULL(notPickedYed, 0) AS DECIMAL(10, 0)) pendiente
|
||||||
|
FROM tItemShelvingRadar ishr
|
||||||
|
JOIN item i ON i.id = ishr.itemFk
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT s.itemFk, SUM(s.quantity) notPickedYed
|
||||||
|
FROM ticket t
|
||||||
|
JOIN ticketStateToday tst ON tst.ticketFk = t.id
|
||||||
|
JOIN alertLevel al ON al.id = tst.alertLevel
|
||||||
|
JOIN sale s ON s.ticketFk = t.id
|
||||||
|
WHERE t.warehouseFk = vWarehouseFk
|
||||||
|
AND al.code = 'FREE'
|
||||||
|
GROUP BY s.itemFk
|
||||||
|
) sub ON sub.itemFk = ishr.itemFk
|
||||||
|
ORDER BY i.typeFk, i.longName;
|
||||||
|
ELSE
|
||||||
|
CREATE OR REPLACE TEMPORARY TABLE tItemShelvingRadar
|
||||||
|
(PRIMARY KEY (itemFk))
|
||||||
|
ENGINE = MEMORY
|
||||||
|
SELECT iss.itemFk,
|
||||||
|
0 `hour`,
|
||||||
|
0 `minute`,
|
||||||
|
'--' itemPlacementCode,
|
||||||
|
i.longName,
|
||||||
|
i.size,
|
||||||
|
i.subName producer,
|
||||||
|
i.upToDown,
|
||||||
|
IFNULL(a.available, 0) available,
|
||||||
|
IFNULL(v.visible - iss.visible, 0) dayEndVisible,
|
||||||
|
IFNULL(v.visible - iss.visible, 0) firstNegative,
|
||||||
|
IFNULL(v.visible - iss.visible, 0) itemPlacementVisible,
|
||||||
|
IFNULL(i.minimum * b.packing, 0) itemPlacementSize,
|
||||||
|
ips.onTheWay,
|
||||||
|
iss.visible itemShelvingStock,
|
||||||
|
IFNULL(v.visible, 0) visible,
|
||||||
|
b.isPickedOff,
|
||||||
|
iss.sectorFk
|
||||||
|
FROM itemShelvingStock iss
|
||||||
|
JOIN item i ON i.id = iss.itemFk
|
||||||
|
LEFT JOIN cache.last_buy lb ON lb.item_id = iss.itemFk
|
||||||
|
AND lb.warehouse_id = vWarehouseFk
|
||||||
|
LEFT JOIN buy b ON b.id = lb.buy_id
|
||||||
|
LEFT JOIN cache.available a ON a.item_id = iss.itemFk
|
||||||
|
AND a.calc_id = vCalcAvailableFk
|
||||||
|
LEFT JOIN cache.visible v ON v.item_id = iss.itemFk
|
||||||
|
AND v.calc_id = vCalcVisibleFk
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT itemFk, SUM(saldo) onTheWay
|
||||||
|
FROM itemPlacementSupplyList
|
||||||
|
WHERE saldo > 0
|
||||||
|
GROUP BY itemFk
|
||||||
|
) ips ON ips.itemFk = i.id
|
||||||
|
WHERE iss.sectorFk = vSectorFk
|
||||||
|
OR iss.sectorFk IS NULL;
|
||||||
|
|
||||||
|
CREATE OR REPLACE TEMPORARY TABLE tmp.itemOutTime
|
||||||
|
SELECT *, SUM(amount) quantity
|
||||||
|
FROM (
|
||||||
|
SELECT io.itemFk,
|
||||||
|
io.quantity amount,
|
||||||
|
IF(HOUR(t.shipped), HOUR(t.shipped), HOUR(z.`hour`)) `hours`,
|
||||||
|
IF(MINUTE(t.shipped), MINUTE(t.shipped), MINUTE(z.`hour`)) `minutes`
|
||||||
|
FROM itemTicketOut `io`
|
||||||
|
JOIN tItemShelvingRadar isr ON isr.itemFk = io.itemFk
|
||||||
|
JOIN ticket t ON t.id= io.ticketFk
|
||||||
|
JOIN ticketState ts ON ts.ticketFk = io.ticketFk
|
||||||
|
JOIN `state` s ON s.id = ts.stateFk
|
||||||
|
LEFT JOIN `zone` z ON z.id = t.zoneFk
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT DISTINCT saleFk
|
||||||
|
FROM saleTracking st
|
||||||
|
WHERE st.created > util.VN_CURDATE()
|
||||||
|
AND st.isChecked
|
||||||
|
) stPrevious ON stPrevious.saleFk = io.saleFk
|
||||||
|
WHERE t.warehouseFk = vWarehouseFk
|
||||||
|
AND NOT s.isPicked
|
||||||
|
AND NOT io.reserved
|
||||||
|
AND stPrevious.saleFk IS NULL
|
||||||
|
AND io.shipped >= util.VN_CURDATE()
|
||||||
|
AND io.shipped < util.VN_CURDATE() + INTERVAL 1 DAY
|
||||||
|
) sub
|
||||||
|
GROUP BY itemFk, `hours`, `minutes`;
|
||||||
|
|
||||||
|
INSERT INTO tItemShelvingRadar (itemFk)
|
||||||
|
SELECT itemFk FROM tmp.itemOutTime
|
||||||
|
ON DUPLICATE KEY UPDATE dayEndVisible = dayEndVisible + quantity,
|
||||||
|
firstNegative = IF(firstNegative < 0, firstNegative, firstNegative + quantity),
|
||||||
|
`hour` = IFNULL(IF(firstNegative > 0 , `hour`, `hours`), 0),
|
||||||
|
`minute` = IFNULL(IF(firstNegative > 0, `minute`, `minutes`), 0);
|
||||||
|
|
||||||
|
UPDATE tItemShelvingRadar isr
|
||||||
|
JOIN (
|
||||||
|
SELECT s.itemFk, SUM(s.quantity) amount
|
||||||
|
FROM sale s
|
||||||
|
JOIN ticket t ON t.id = s.ticketFk
|
||||||
|
JOIN ticketState ts ON ts.ticketFk = t.id
|
||||||
|
WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE())
|
||||||
|
AND ts.code = 'COOLER_PREPARATION'
|
||||||
|
GROUP BY s.itemFk
|
||||||
|
) sub ON sub.itemFk = isr.itemFk
|
||||||
|
SET isr.dayEndVisible = dayEndVisible + sub.amount,
|
||||||
|
firstNegative = firstNegative + sub.amount;
|
||||||
|
|
||||||
|
SELECT * FROM tItemShelvingRadar;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
DROP TEMPORARY TABLE tItemShelvingRadar;
|
||||||
|
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -30,7 +30,7 @@ BEGIN
|
||||||
WITH entriesIn AS (
|
WITH entriesIn AS (
|
||||||
SELECT 'entry' originType,
|
SELECT 'entry' originType,
|
||||||
e.id originId,
|
e.id originId,
|
||||||
IFNULL(tr.availabled, tr.landed) shipped,
|
tr.landed shipped,
|
||||||
b.quantity `in`,
|
b.quantity `in`,
|
||||||
NULL `out`,
|
NULL `out`,
|
||||||
st.alertLevel ,
|
st.alertLevel ,
|
||||||
|
@ -54,7 +54,7 @@ BEGIN
|
||||||
OR (util.VN_CURDATE() AND tr.isReceived),
|
OR (util.VN_CURDATE() AND tr.isReceived),
|
||||||
'DELIVERED',
|
'DELIVERED',
|
||||||
'FREE')
|
'FREE')
|
||||||
WHERE IFNULL(tr.availabled, tr.landed) >= vDateInventory
|
WHERE tr.landed >= vDateInventory
|
||||||
AND tr.warehouseInFk = vWarehouseFk
|
AND tr.warehouseInFk = vWarehouseFk
|
||||||
AND (s.id <> vSupplierInventoryFk OR vDated IS NULL)
|
AND (s.id <> vSupplierInventoryFk OR vDated IS NULL)
|
||||||
AND b.itemFk = vItemFk
|
AND b.itemFk = vItemFk
|
||||||
|
@ -99,7 +99,7 @@ BEGIN
|
||||||
),
|
),
|
||||||
sales AS (
|
sales AS (
|
||||||
WITH itemSales AS (
|
WITH itemSales AS (
|
||||||
SELECT DATE(t.shipped) + INTERVAL HOUR(z.`hour`) HOUR shipped,
|
SELECT DATE(t.shipped) shipped,
|
||||||
s.quantity,
|
s.quantity,
|
||||||
st2.alertLevel,
|
st2.alertLevel,
|
||||||
st2.name,
|
st2.name,
|
||||||
|
@ -114,7 +114,6 @@ BEGIN
|
||||||
cb.claimFk
|
cb.claimFk
|
||||||
FROM vn.sale s
|
FROM vn.sale s
|
||||||
JOIN vn.ticket t ON t.id = s.ticketFk
|
JOIN vn.ticket t ON t.id = s.ticketFk
|
||||||
JOIN vn.`zone` z ON z.id = t.zoneFk
|
|
||||||
LEFT JOIN vn.ticketState ts ON ts.ticketFk = t.id
|
LEFT JOIN vn.ticketState ts ON ts.ticketFk = t.id
|
||||||
LEFT JOIN vn.state st ON st.code = ts.code
|
LEFT JOIN vn.state st ON st.code = ts.code
|
||||||
JOIN vn.client c ON c.id = t.clientFk
|
JOIN vn.client c ON c.id = t.clientFk
|
||||||
|
@ -190,15 +189,14 @@ BEGIN
|
||||||
SELECT * FROM sales
|
SELECT * FROM sales
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT * FROM orders
|
SELECT * FROM orders
|
||||||
ORDER BY DATE(shipped),
|
ORDER BY shipped,
|
||||||
(inventorySupplierFk = entityId) DESC,
|
(inventorySupplierFk = entityId) DESC,
|
||||||
alertLevel DESC,
|
alertLevel DESC,
|
||||||
isTicket,
|
isTicket,
|
||||||
`order` DESC,
|
`order` DESC,
|
||||||
isPicked DESC,
|
isPicked DESC,
|
||||||
`in` DESC,
|
`in` DESC,
|
||||||
`out` DESC,
|
`out` DESC;
|
||||||
shipped;
|
|
||||||
|
|
||||||
IF vDated IS NULL THEN
|
IF vDated IS NULL THEN
|
||||||
SET @a := 0;
|
SET @a := 0;
|
||||||
|
@ -207,7 +205,7 @@ BEGIN
|
||||||
|
|
||||||
SELECT t.originType,
|
SELECT t.originType,
|
||||||
t.originId,
|
t.originId,
|
||||||
@shipped:= t.shipped,
|
DATE(@shipped:= t.shipped) shipped,
|
||||||
t.alertLevel,
|
t.alertLevel,
|
||||||
t.stateName,
|
t.stateName,
|
||||||
t.reference,
|
t.reference,
|
||||||
|
|
|
@ -1,20 +1,9 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`item_getLack`(
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`item_getLack`(IN vForce BOOLEAN, IN vDays INT)
|
||||||
vSelf INT,
|
|
||||||
vForce BOOLEAN,
|
|
||||||
vDays INT,
|
|
||||||
vLongname VARCHAR(255),
|
|
||||||
vProducerName VARCHAR(255),
|
|
||||||
vColor VARCHAR(255),
|
|
||||||
vSize INT,
|
|
||||||
vOrigen INT,
|
|
||||||
vLack INT,
|
|
||||||
vWarehouseFk INT
|
|
||||||
)
|
|
||||||
BEGIN
|
BEGIN
|
||||||
/**
|
/**
|
||||||
* Calcula una tabla con el máximo negativo visible para cada producto y almacen
|
* Calcula una tabla con el máximo negativo visible para cada producto y almacen
|
||||||
*
|
*
|
||||||
* @param vForce Fuerza el recalculo del stock
|
* @param vForce Fuerza el recalculo del stock
|
||||||
* @param vDays Numero de dias a considerar
|
* @param vDays Numero de dias a considerar
|
||||||
**/
|
**/
|
||||||
|
@ -24,33 +13,33 @@ BEGIN
|
||||||
CALL item_getMinETD();
|
CALL item_getMinETD();
|
||||||
CALL item_zoneClosure();
|
CALL item_zoneClosure();
|
||||||
|
|
||||||
SELECT i.id itemFk,
|
SELECT i.id itemFk,
|
||||||
i.longName,
|
i.longName,
|
||||||
w.id warehouseFk,
|
w.id warehouseFk,
|
||||||
p.`name` producer,
|
p.`name` producer,
|
||||||
i.`size`,
|
i.`size`,
|
||||||
i.category,
|
i.category,
|
||||||
w.name warehouse,
|
w.name warehouse,
|
||||||
SUM(IFNULL(sub.amount,0)) lack,
|
SUM(IFNULL(sub.amount,0)) lack,
|
||||||
i.inkFk,
|
i.inkFk,
|
||||||
IFNULL(im.timed, util.midnight()) timed,
|
IFNULL(im.timed, util.midnight()) timed,
|
||||||
IFNULL(izc.timed, util.midnight()) minTimed,
|
IFNULL(izc.timed, util.midnight()) minTimed,
|
||||||
o.name originFk
|
o.name originFk
|
||||||
FROM (SELECT item_id,
|
FROM (SELECT item_id,
|
||||||
warehouse_id,
|
warehouse_id,
|
||||||
amount
|
amount
|
||||||
FROM cache.stock
|
FROM cache.stock
|
||||||
WHERE amount > 0
|
WHERE amount > 0
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT itemFk,
|
SELECT itemFk,
|
||||||
warehouseFk,
|
warehouseFk,
|
||||||
amount
|
amount
|
||||||
FROM tmp.itemMinacum
|
FROM tmp.itemMinacum
|
||||||
) sub
|
) sub
|
||||||
JOIN warehouse w ON w.id = sub.warehouse_id
|
JOIN warehouse w ON w.id = sub.warehouse_id
|
||||||
JOIN item i ON i.id = sub.item_id
|
JOIN item i ON i.id = sub.item_id
|
||||||
LEFT JOIN producer p ON p.id = i.producerFk
|
LEFT JOIN producer p ON p.id = i.producerFk
|
||||||
JOIN itemType it ON it.id = i.typeFk
|
JOIN itemType it ON it.id = i.typeFk
|
||||||
JOIN itemCategory ic ON ic.id = it.categoryFk
|
JOIN itemCategory ic ON ic.id = it.categoryFk
|
||||||
LEFT JOIN tmp.itemMinETD im ON im.itemFk = i.id
|
LEFT JOIN tmp.itemMinETD im ON im.itemFk = i.id
|
||||||
LEFT JOIN tmp.itemZoneClosure izc ON izc.itemFk = i.id
|
LEFT JOIN tmp.itemZoneClosure izc ON izc.itemFk = i.id
|
||||||
|
@ -58,14 +47,6 @@ BEGIN
|
||||||
WHERE w.isForTicket
|
WHERE w.isForTicket
|
||||||
AND ic.display
|
AND ic.display
|
||||||
AND it.code != 'GEN'
|
AND it.code != 'GEN'
|
||||||
AND (vSelf IS NULL OR i.id = vSelf)
|
|
||||||
AND (vLongname IS NULL OR i.name = vLongname)
|
|
||||||
AND (vProducerName IS NULL OR p.`name` LIKE CONCAT('%', vProducerName, '%'))
|
|
||||||
AND (vColor IS NULL OR vColor = i.inkFk)
|
|
||||||
AND (vSize IS NULL OR vSize = i.`size`)
|
|
||||||
AND (vOrigen IS NULL OR vOrigen = w.id)
|
|
||||||
AND (vLack IS NULL OR vLack = sub.amount)
|
|
||||||
AND (vWarehouseFk IS NULL OR vWarehouseFk = w.id)
|
|
||||||
GROUP BY i.id, w.id
|
GROUP BY i.id, w.id
|
||||||
HAVING lack < 0;
|
HAVING lack < 0;
|
||||||
|
|
||||||
|
|
|
@ -82,26 +82,21 @@ BEGIN
|
||||||
AND it.priority = vPriority
|
AND it.priority = vPriority
|
||||||
LEFT JOIN vn.tag t ON t.id = it.tagFk
|
LEFT JOIN vn.tag t ON t.id = it.tagFk
|
||||||
LEFT JOIN vn.buy b ON b.id = bu.buyFk
|
LEFT JOIN vn.buy b ON b.id = bu.buyFk
|
||||||
LEFT JOIN vn.itemShelvingStock iss ON iss.itemFk = i.id
|
|
||||||
AND iss.warehouseFk = vWarehouseFk
|
|
||||||
LEFT JOIN vn.ink ink ON ink.id = i.tag5
|
|
||||||
JOIN itemTags its
|
JOIN itemTags its
|
||||||
WHERE a.available > 0
|
WHERE a.available > 0
|
||||||
AND (i.typeFk = its.typeFk OR NOT vShowType)
|
AND (i.typeFk = its.typeFk OR NOT vShowType)
|
||||||
AND i.id <> vSelf
|
AND i.id <> vSelf
|
||||||
ORDER BY (a.available > 0) DESC,
|
ORDER BY `counter` DESC,
|
||||||
`counter` DESC,
|
(t.name = its.name) DESC,
|
||||||
(t.name = its.name) DESC,
|
(it.value = its.value) DESC,
|
||||||
(it.value = its.value) DESC,
|
(i.tag5 = its.tag5) DESC,
|
||||||
(i.tag5 = its.tag5) DESC,
|
match5 DESC,
|
||||||
(ink.`showOrder`) DESC,
|
(i.tag6 = its.tag6) DESC,
|
||||||
match5 DESC,
|
match6 DESC,
|
||||||
(i.tag6 = its.tag6) DESC,
|
(i.tag7 = its.tag7) DESC,
|
||||||
match6 DESC,
|
match7 DESC,
|
||||||
(i.tag7 = its.tag7) DESC,
|
(i.tag8 = its.tag8) DESC,
|
||||||
match7 DESC,
|
match8 DESC
|
||||||
(i.tag8 = its.tag8) DESC,
|
|
||||||
match8 DESC
|
|
||||||
LIMIT 100;
|
LIMIT 100;
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tmp.buyUltimate;
|
DROP TEMPORARY TABLE tmp.buyUltimate;
|
||||||
|
|
|
@ -15,6 +15,8 @@ BEGIN
|
||||||
*
|
*
|
||||||
* @return tmp.itemList(itemFk, stock, visible, available)
|
* @return tmp.itemList(itemFk, stock, visible, available)
|
||||||
*/
|
*/
|
||||||
|
DECLARE vIsLogifloraDay BOOL DEFAULT vn.isLogifloraDay(vDated, vWarehouseFk);
|
||||||
|
|
||||||
SET vDated = TIMESTAMP(vDated, '00:00:00');
|
SET vDated = TIMESTAMP(vDated, '00:00:00');
|
||||||
|
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tmp.itemList
|
CREATE OR REPLACE TEMPORARY TABLE tmp.itemList
|
||||||
|
@ -34,11 +36,14 @@ BEGIN
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT iei.itemFk, iei.quantity
|
SELECT iei.itemFk, iei.quantity
|
||||||
FROM itemEntryIn iei
|
FROM itemEntryIn iei
|
||||||
|
LEFT JOIN edi.warehouseFloramondo wf ON wf.entryFk = iei.entryFk
|
||||||
JOIN item i ON i.id = iei.itemFk
|
JOIN item i ON i.id = iei.itemFk
|
||||||
WHERE IFNULL(iei.availabled, iei.landed) >= util.VN_CURDATE()
|
WHERE iei.landed >= util.VN_CURDATE()
|
||||||
AND IFNULL(iei.availabled, iei.landed) < vDated
|
AND iei.landed < vDated
|
||||||
AND iei.warehouseInFk = vWarehouseFk
|
AND iei.warehouseInFk = vWarehouseFk
|
||||||
AND (vItemFk IS NULL OR iei.itemFk = vItemFk)
|
AND (vItemFk IS NULL OR iei.itemFk = vItemFk)
|
||||||
|
AND (wf.entryFk IS NULL OR vIsLogifloraDay)
|
||||||
|
AND NOT (iei.landed > util.VN_CURDATE() AND i.isFloramondo)
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT ieo.itemFk, ieo.quantity
|
SELECT ieo.itemFk, ieo.quantity
|
||||||
FROM itemEntryOut ieo
|
FROM itemEntryOut ieo
|
||||||
|
@ -47,6 +52,7 @@ BEGIN
|
||||||
AND ieo.shipped < vDated
|
AND ieo.shipped < vDated
|
||||||
AND ieo.warehouseOutFk = vWarehouseFk
|
AND ieo.warehouseOutFk = vWarehouseFk
|
||||||
AND (vItemFk IS NULL OR ieo.itemFk = vItemFk)
|
AND (vItemFk IS NULL OR ieo.itemFk = vItemFk)
|
||||||
|
AND NOT (ieo.shipped > util.VN_CURDATE() AND i.isFloramondo)
|
||||||
) sub
|
) sub
|
||||||
GROUP BY itemFk
|
GROUP BY itemFk
|
||||||
HAVING stock;
|
HAVING stock;
|
||||||
|
|
|
@ -1,18 +1,16 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`prepareTicketList`(
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`prepareTicketList`(vStartingDate DATETIME, vEndingDate DATETIME)
|
||||||
vStartingDate DATETIME,
|
|
||||||
vEndingDate DATETIME
|
|
||||||
)
|
|
||||||
BEGIN
|
BEGIN
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.productionTicket;
|
DROP TEMPORARY TABLE IF EXISTS tmp.productionTicket;
|
||||||
CREATE TEMPORARY TABLE tmp.productionTicket
|
CREATE TEMPORARY TABLE tmp.productionTicket
|
||||||
(PRIMARY KEY (ticketFk))
|
(PRIMARY KEY (ticketFk))
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
SELECT t.id ticketFk
|
SELECT t.id ticketFk, t.clientFk
|
||||||
FROM ticket t
|
FROM ticket t
|
||||||
JOIN alertLevel al ON al.code = 'DELIVERED'
|
JOIN alertLevel al ON al.code = 'DELIVERED'
|
||||||
LEFT JOIN ticketState ts ON ts.ticketFk = t.id
|
LEFT JOIN ticketState ts ON ts.ticketFk = t.id
|
||||||
JOIN client c ON c.id = t.clientFk
|
JOIN client c ON c.id = t.clientFk
|
||||||
|
|
||||||
WHERE c.typeFk IN ('normal','handMaking','internalUse')
|
WHERE c.typeFk IN ('normal','handMaking','internalUse')
|
||||||
AND (
|
AND (
|
||||||
t.shipped BETWEEN util.VN_CURDATE() AND vEndingDate
|
t.shipped BETWEEN util.VN_CURDATE() AND vEndingDate
|
||||||
|
|
|
@ -24,31 +24,24 @@ proc: BEGIN
|
||||||
CALL prepareTicketList(util.yesterday(), vEndingDate);
|
CALL prepareTicketList(util.yesterday(), vEndingDate);
|
||||||
|
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
|
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
|
||||||
|
SELECT * FROM tmp.productionTicket;
|
||||||
|
|
||||||
|
CALL prepareClientList();
|
||||||
|
|
||||||
|
CREATE OR REPLACE TEMPORARY TABLE tmp.sale_getProblems
|
||||||
(INDEX (ticketFk))
|
(INDEX (ticketFk))
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
SELECT ticketFk
|
SELECT tt.ticketFk, tt.clientFk, t.warehouseFk, t.shipped
|
||||||
FROM tmp.productionTicket;
|
FROM tmp.productionTicket tt
|
||||||
|
JOIN ticket t ON t.id = tt.ticketFk;
|
||||||
|
|
||||||
CALL ticket_getProblems(vIsTodayRelative);
|
CALL ticket_getProblems(vIsTodayRelative);
|
||||||
|
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tmp.productionBuffer
|
CREATE OR REPLACE TEMPORARY TABLE tmp.productionBuffer
|
||||||
(PRIMARY KEY(ticketFk), previaParking VARCHAR(255))
|
(PRIMARY KEY(ticketFk), previaParking VARCHAR(255))
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
WITH saleProblemsDescription AS(
|
|
||||||
SELECT s.ticketFk,
|
|
||||||
LEFT(CONCAT('F: ', GROUP_CONCAT(CONCAT(i.id, ' ', i.longName) SEPARATOR ', ')), 250) itemShortage,
|
|
||||||
LEFT(CONCAT('R: ', GROUP_CONCAT(CONCAT(i2.id, ' ', i2.longName) SEPARATOR ', ')), 250) itemDelay,
|
|
||||||
LEFT(CONCAT('I: ', GROUP_CONCAT(CONCAT(i3.id, ' ', i3.longName) SEPARATOR ', ')), 250) itemLost
|
|
||||||
FROM tmp.saleProblems sp
|
|
||||||
JOIN vn.sale s ON s.id = sp.saleFk
|
|
||||||
LEFT JOIN vn.item i ON i.id = s.itemFk AND sp.hasItemShortage
|
|
||||||
LEFT JOIN vn.item i2 ON i2.id = s.itemFk AND sp.hasItemDelay
|
|
||||||
LEFT JOIN vn.item i3 ON i3.id = s.itemFk AND sp.hasItemLost
|
|
||||||
WHERE hasItemShortage OR hasItemDelay OR hasItemLost
|
|
||||||
GROUP BY s.ticketFk
|
|
||||||
)
|
|
||||||
SELECT tt.ticketFk,
|
SELECT tt.ticketFk,
|
||||||
t.clientFk,
|
tt.clientFk,
|
||||||
t.warehouseFk,
|
t.warehouseFk,
|
||||||
t.nickname,
|
t.nickname,
|
||||||
t.packages,
|
t.packages,
|
||||||
|
@ -66,17 +59,7 @@ proc: BEGIN
|
||||||
0 `lines`,
|
0 `lines`,
|
||||||
CAST( 0 AS DECIMAL(5,2)) m3,
|
CAST( 0 AS DECIMAL(5,2)) m3,
|
||||||
CAST( 0 AS DECIMAL(5,2)) preparationRate,
|
CAST( 0 AS DECIMAL(5,2)) preparationRate,
|
||||||
TRIM(CAST(CONCAT( IFNULL(sp.itemShortage, ''),
|
"" problem,
|
||||||
IFNULL(sp.itemDelay, ''),
|
|
||||||
IFNULL(sp.itemLost, ''),
|
|
||||||
IF(tpr.isFreezed, ' CONGELADO',''),
|
|
||||||
IF(tpr.hasHighRisk, ' RIESGO',''),
|
|
||||||
IF(tpr.hasTicketRequest, ' COD 100',''),
|
|
||||||
IF(tpr.isTaxDataChecked, '',' FICHA INCOMPLETA'),
|
|
||||||
IF(tpr.hasComponentLack, ' COMPONENTES', ''),
|
|
||||||
IF(HOUR(util.VN_NOW()) < IF(HOUR(t.shipped), HOUR(t.shipped), COALESCE(HOUR(zc.hour),HOUR(z.hour)))
|
|
||||||
AND tpr.isTooLittle, ' PEQUEÑO', '')
|
|
||||||
) AS char(255))) problem,
|
|
||||||
IFNULL(tls.state,2) state,
|
IFNULL(tls.state,2) state,
|
||||||
w.code workerCode,
|
w.code workerCode,
|
||||||
DATE(t.shipped) shipped,
|
DATE(t.shipped) shipped,
|
||||||
|
@ -91,37 +74,34 @@ proc: BEGIN
|
||||||
pk.code parking,
|
pk.code parking,
|
||||||
0 H,
|
0 H,
|
||||||
0 V,
|
0 V,
|
||||||
0 A,
|
|
||||||
0 N,
|
0 N,
|
||||||
st.isOk,
|
st.isOk,
|
||||||
ag.isOwn,
|
ag.isOwn,
|
||||||
rm.bufferFk
|
rm.bufferFk
|
||||||
FROM tmp.productionTicket tt
|
FROM tmp.productionTicket tt
|
||||||
JOIN vn.ticket t ON tt.ticketFk = t.id
|
JOIN ticket t ON tt.ticketFk = t.id
|
||||||
JOIN vn.alertLevel al ON al.code = 'FREE'
|
JOIN alertLevel al ON al.code = 'FREE'
|
||||||
LEFT JOIN vn.ticketStateToday tst ON tst.ticketFk = t.id
|
LEFT JOIN ticketStateToday tst ON tst.ticketFk = t.id
|
||||||
LEFT JOIN vn.`state` st ON st.id = tst.state
|
LEFT JOIN `state` st ON st.id = tst.state
|
||||||
LEFT JOIN vn.client c ON c.id = t.clientFk
|
LEFT JOIN client c ON c.id = t.clientFk
|
||||||
LEFT JOIN vn.worker wk ON wk.id = c.salesPersonFk
|
LEFT JOIN worker wk ON wk.id = c.salesPersonFk
|
||||||
JOIN vn.address a ON a.id = t.addressFk
|
JOIN address a ON a.id = t.addressFk
|
||||||
LEFT JOIN vn.province p ON p.id = a.provinceFk
|
LEFT JOIN province p ON p.id = a.provinceFk
|
||||||
JOIN vn.agencyMode am ON am.id = t.agencyModeFk
|
JOIN agencyMode am ON am.id = t.agencyModeFk
|
||||||
JOIN vn.deliveryMethod dm ON dm.id = am.deliveryMethodFk
|
JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk
|
||||||
JOIN vn.agency ag ON ag.id = am.agencyFk
|
JOIN agency ag ON ag.id = am.agencyFk
|
||||||
LEFT JOIN vn.ticketState tls ON tls.ticketFk = tt.ticketFk
|
LEFT JOIN ticketState tls ON tls.ticketFk = tt.ticketFk
|
||||||
LEFT JOIN vn.ticketLastUpdated tlu ON tlu.ticketFk = tt.ticketFk
|
LEFT JOIN ticketLastUpdated tlu ON tlu.ticketFk = tt.ticketFk
|
||||||
LEFT JOIN vn.worker w ON w.id = tls.userFk
|
LEFT JOIN worker w ON w.id = tls.userFk
|
||||||
LEFT JOIN vn.routesMonitor rm ON rm.routeFk = t.routeFk
|
LEFT JOIN routesMonitor rm ON rm.routeFk = t.routeFk
|
||||||
LEFT JOIN vn.`zone` z ON z.id = t.zoneFk
|
LEFT JOIN `zone` z ON z.id = t.zoneFk
|
||||||
LEFT JOIN vn.zoneClosure zc ON zc.zoneFk = t.zoneFk
|
LEFT JOIN zoneClosure zc ON zc.zoneFk = t.zoneFk
|
||||||
AND DATE(t.shipped) = zc.dated
|
AND DATE(t.shipped) = zc.dated
|
||||||
LEFT JOIN vn.ticketParking tp ON tp.ticketFk = t.id
|
LEFT JOIN ticketParking tp ON tp.ticketFk = t.id
|
||||||
LEFT JOIN vn.parking pk ON pk.id = tp.parkingFk
|
LEFT JOIN parking pk ON pk.id = tp.parkingFk
|
||||||
LEFT JOIN tmp.ticketProblems tpr ON tpr.ticketFk = tt.ticketFk
|
|
||||||
LEFT JOIN saleProblemsDescription sp ON sp.ticketFk = tt.ticketFk
|
|
||||||
WHERE t.warehouseFk = vWarehouseFk
|
WHERE t.warehouseFk = vWarehouseFk
|
||||||
AND dm.code IN ('AGENCY', 'DELIVERY', 'PICKUP');
|
AND dm.code IN ('AGENCY', 'DELIVERY', 'PICKUP');
|
||||||
|
|
||||||
UPDATE tmp.productionBuffer pb
|
UPDATE tmp.productionBuffer pb
|
||||||
JOIN (
|
JOIN (
|
||||||
SELECT pb.ticketFk, GROUP_CONCAT(p.code) previaParking
|
SELECT pb.ticketFk, GROUP_CONCAT(p.code) previaParking
|
||||||
|
@ -139,9 +119,21 @@ proc: BEGIN
|
||||||
CHANGE COLUMN `problem` `problem` VARCHAR(255),
|
CHANGE COLUMN `problem` `problem` VARCHAR(255),
|
||||||
ADD COLUMN `collectionH` INT,
|
ADD COLUMN `collectionH` INT,
|
||||||
ADD COLUMN `collectionV` INT,
|
ADD COLUMN `collectionV` INT,
|
||||||
ADD COLUMN `collectionA` INT,
|
|
||||||
ADD COLUMN `collectionN` INT;
|
ADD COLUMN `collectionN` INT;
|
||||||
|
|
||||||
|
UPDATE tmp.productionBuffer pb
|
||||||
|
JOIN tmp.ticket_problems tp ON tp.ticketFk = pb.ticketFk
|
||||||
|
SET pb.problem = TRIM(CAST(CONCAT( IFNULL(tp.itemShortage, ''),
|
||||||
|
IFNULL(tp.itemDelay, ''),
|
||||||
|
IFNULL(tp.itemLost, ''),
|
||||||
|
IF(tp.isFreezed, ' CONGELADO',''),
|
||||||
|
IF(tp.hasHighRisk, ' RIESGO',''),
|
||||||
|
IF(tp.hasTicketRequest, ' COD 100',''),
|
||||||
|
IF(tp.isTaxDataChecked, '',' FICHA INCOMPLETA'),
|
||||||
|
IF(tp.hasComponentLack, ' COMPONENTES', ''),
|
||||||
|
IF(HOUR(util.VN_NOW()) < pb.HH AND tp.isTooLittle, ' PEQUEÑO', '')
|
||||||
|
) AS char(255)));
|
||||||
|
|
||||||
-- Clientes Nuevos o Recuperados
|
-- Clientes Nuevos o Recuperados
|
||||||
UPDATE tmp.productionBuffer pb
|
UPDATE tmp.productionBuffer pb
|
||||||
LEFT JOIN bs.clientNewBorn cnb ON cnb.clientFk = pb.clientFk
|
LEFT JOIN bs.clientNewBorn cnb ON cnb.clientFk = pb.clientFk
|
||||||
|
@ -180,14 +172,12 @@ proc: BEGIN
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
SELECT ticketFk,
|
SELECT ticketFk,
|
||||||
SUM(sub.H) H,
|
SUM(sub.H) H,
|
||||||
SUM(sub.V) V,
|
SUM(sub.V) V,
|
||||||
SUM(sub.A) A,
|
|
||||||
SUM(sub.N) N
|
SUM(sub.N) N
|
||||||
FROM (
|
FROM (
|
||||||
SELECT t.ticketFk,
|
SELECT t.ticketFk,
|
||||||
SUM(i.itemPackingTypeFk = 'H') H,
|
SUM(i.itemPackingTypeFk = 'H') H,
|
||||||
SUM(i.itemPackingTypeFk = 'V') V,
|
SUM(i.itemPackingTypeFk = 'V') V,
|
||||||
SUM(i.itemPackingTypeFk = 'A') A,
|
|
||||||
SUM(i.itemPackingTypeFk IS NULL) N
|
SUM(i.itemPackingTypeFk IS NULL) N
|
||||||
FROM tmp.productionTicket t
|
FROM tmp.productionTicket t
|
||||||
JOIN sale s ON s.ticketFk = t.ticketFk
|
JOIN sale s ON s.ticketFk = t.ticketFk
|
||||||
|
@ -200,7 +190,6 @@ proc: BEGIN
|
||||||
JOIN tItemPackingType ti ON ti.ticketFk = pb.ticketFk
|
JOIN tItemPackingType ti ON ti.ticketFk = pb.ticketFk
|
||||||
SET pb.H = ti.H,
|
SET pb.H = ti.H,
|
||||||
pb.V = ti.V,
|
pb.V = ti.V,
|
||||||
pb.A = ti.A,
|
|
||||||
pb.N = ti.N;
|
pb.N = ti.N;
|
||||||
|
|
||||||
-- Colecciones segun tipo de encajado
|
-- Colecciones segun tipo de encajado
|
||||||
|
@ -208,7 +197,6 @@ proc: BEGIN
|
||||||
JOIN ticketCollection tc ON pb.ticketFk = tc.ticketFk
|
JOIN ticketCollection tc ON pb.ticketFk = tc.ticketFk
|
||||||
SET pb.collectionH = IF(pb.H, tc.collectionFk, NULL),
|
SET pb.collectionH = IF(pb.H, tc.collectionFk, NULL),
|
||||||
pb.collectionV = IF(pb.V, tc.collectionFk, NULL),
|
pb.collectionV = IF(pb.V, tc.collectionFk, NULL),
|
||||||
pb.collectionA = IF(pb.A, tc.collectionFk, NULL),
|
|
||||||
pb.collectionN = IF(pb.N, tc.collectionFk, NULL);
|
pb.collectionN = IF(pb.N, tc.collectionFk, NULL);
|
||||||
|
|
||||||
-- Previa pendiente
|
-- Previa pendiente
|
||||||
|
@ -278,20 +266,19 @@ proc: BEGIN
|
||||||
UPDATE tmp.productionBuffer pb
|
UPDATE tmp.productionBuffer pb
|
||||||
JOIN sale s ON s.ticketFk = pb.ticketFk
|
JOIN sale s ON s.ticketFk = pb.ticketFk
|
||||||
JOIN item i ON i.id = s.itemFk
|
JOIN item i ON i.id = s.itemFk
|
||||||
JOIN cache.last_buy lb ON lb.warehouse_id = vWarehouseFk
|
JOIN cache.last_buy lb ON lb.warehouse_id = vWarehouseFk
|
||||||
AND lb.item_id = s.itemFk
|
AND lb.item_id = s.itemFk
|
||||||
JOIN buy b ON b.id = lb.buy_id
|
JOIN buy b ON b.id = lb.buy_id
|
||||||
JOIN packaging p ON p.id = b.packagingFk
|
JOIN packaging p ON p.id = b.packagingFk
|
||||||
SET pb.hasPlantTray = TRUE
|
SET pb.hasPlantTray = TRUE
|
||||||
WHERE p.isPlantTray
|
WHERE p.isPlantTray
|
||||||
AND s.quantity >= b.packing
|
AND s.quantity >= b.packing
|
||||||
AND pb.isOwn;
|
AND pb.isOwn;
|
||||||
|
|
||||||
DROP TEMPORARY TABLE
|
DROP TEMPORARY TABLE
|
||||||
tmp.productionTicket,
|
tmp.productionTicket,
|
||||||
tmp.ticket,
|
tmp.ticket,
|
||||||
tmp.ticketProblems,
|
tmp.ticket_problems,
|
||||||
tmp.saleProblems,
|
|
||||||
tmp.ticketWithPrevia,
|
tmp.ticketWithPrevia,
|
||||||
tItemShelvingStock,
|
tItemShelvingStock,
|
||||||
tItemPackingType;
|
tItemPackingType;
|
||||||
|
|
|
@ -1,72 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`roadmap_cloneDay`(
|
|
||||||
vDateToCopy DATE,
|
|
||||||
vDateToPaste DATE
|
|
||||||
)
|
|
||||||
BEGIN
|
|
||||||
/**
|
|
||||||
* Clona roadmaps de un día a otro, incluyendo las paradas y sin algunos
|
|
||||||
* campos de la tabla principal, como matrículas, conductores...
|
|
||||||
*
|
|
||||||
* @param vDateToCopy Fecha para copiar
|
|
||||||
* @param vDateToPaste Fecha para pegar
|
|
||||||
*/
|
|
||||||
DECLARE vDaysDiff INT;
|
|
||||||
DECLARE vRoadmapFk INT;
|
|
||||||
DECLARE vNewRoadmapFk INT;
|
|
||||||
DECLARE vDone BOOL DEFAULT FALSE;
|
|
||||||
DECLARE vRoadmaps CURSOR FOR
|
|
||||||
SELECT id
|
|
||||||
FROM roadmap
|
|
||||||
WHERE etd BETWEEN vDateToCopy AND util.dayEnd(vDateToCopy);
|
|
||||||
|
|
||||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
|
||||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
|
||||||
BEGIN
|
|
||||||
ROLLBACK;
|
|
||||||
RESIGNAL;
|
|
||||||
END;
|
|
||||||
|
|
||||||
SET vDaysDiff = DATEDIFF(vDateToPaste, vDateToCopy);
|
|
||||||
|
|
||||||
IF vDaysDiff IS NULL THEN
|
|
||||||
CALL util.throw("No valid dates");
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
START TRANSACTION;
|
|
||||||
|
|
||||||
OPEN vRoadmaps;
|
|
||||||
l: LOOP
|
|
||||||
SET vDone = FALSE;
|
|
||||||
FETCH vRoadmaps INTO vRoadmapFk;
|
|
||||||
|
|
||||||
IF vDone THEN
|
|
||||||
LEAVE l;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
INSERT INTO roadmap (`name`, roadmapAddressFk, etd, eta, observations, price)
|
|
||||||
SELECT `name`,
|
|
||||||
roadmapAddressFk,
|
|
||||||
etd + INTERVAL vDaysDiff DAY,
|
|
||||||
eta + INTERVAL vDaysDiff DAY,
|
|
||||||
observations,
|
|
||||||
price
|
|
||||||
FROM roadmap
|
|
||||||
WHERE id = vRoadmapFk;
|
|
||||||
|
|
||||||
SET vNewRoadmapFk = LAST_INSERT_ID();
|
|
||||||
|
|
||||||
INSERT INTO roadmapStop (roadmapFk, roadmapAddressFk, eta, `description`, bufferFk)
|
|
||||||
SELECT vNewRoadmapFk,
|
|
||||||
roadmapAddressFk,
|
|
||||||
eta + INTERVAL vDaysDiff DAY,
|
|
||||||
`description`,
|
|
||||||
bufferFk
|
|
||||||
FROM roadmapStop
|
|
||||||
WHERE roadmapFk = vRoadmapFk;
|
|
||||||
END LOOP;
|
|
||||||
CLOSE vRoadmaps;
|
|
||||||
|
|
||||||
COMMIT;
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -1,42 +1,86 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`sale_getProblems`(
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`sale_getProblems`(
|
||||||
vIsTodayRelative TINYINT(1)
|
vIsTodayRelative tinyint(1)
|
||||||
)
|
)
|
||||||
BEGIN
|
BEGIN
|
||||||
/**
|
/**
|
||||||
* Calcula los problemas para un conjunto de sale
|
* Calcula los problemas de cada venta para un conjunto de tickets.
|
||||||
*
|
*
|
||||||
* @param vIsTodayRelative Indica si se calcula el disponible como si todo saliera hoy
|
* @param vIsTodayRelative Indica si se calcula el disponible como si todo saliera hoy
|
||||||
* @table tmp.sale(saleFk) Identificadores de los sale a calcular
|
* @table tmp.sale_getProblems(ticketFk, clientFk, warehouseFk, shipped) Tickets a calcular
|
||||||
* @return tmp.saleProblems
|
* @return tmp.sale_problems
|
||||||
*/
|
*/
|
||||||
DECLARE vWarehouseFk INT;
|
DECLARE vWarehouseFk INT;
|
||||||
DECLARE vDate DATE;
|
DECLARE vDate DATE;
|
||||||
DECLARE vAvailableCache INT;
|
DECLARE vAvailableCache INT;
|
||||||
DECLARE vVisibleCache INT;
|
DECLARE vVisibleCache INT;
|
||||||
DECLARE vDone BOOL;
|
DECLARE vDone BOOL;
|
||||||
DECLARE vCursor CURSOR FOR
|
DECLARE vCursor CURSOR FOR
|
||||||
SELECT t.warehouseFk, IF(vIsTodayRelative, util.VN_CURDATE(), DATE(t.shipped)) dated
|
SELECT DISTINCT warehouseFk, IF(vIsTodayRelative, util.VN_CURDATE(), DATE(shipped))
|
||||||
FROM tmp.sale ts
|
FROM tmp.sale_getProblems
|
||||||
JOIN sale s ON s.id = ts.saleFk
|
WHERE shipped BETWEEN util.VN_CURDATE()
|
||||||
JOIN ticket t ON t.id = s.ticketFk
|
AND util.dayEnd(util.VN_CURDATE() + INTERVAL IF(vIsTodayRelative, 9.9, 1.9) DAY);
|
||||||
WHERE t.shipped BETWEEN util.VN_CURDATE()
|
|
||||||
AND util.dayEnd(util.VN_CURDATE() + INTERVAL IF(vIsTodayRelative, 9.9, 1.9) DAY)
|
|
||||||
GROUP BY warehouseFk, dated;
|
|
||||||
|
|
||||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
||||||
|
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tmp.saleProblems(
|
CREATE OR REPLACE TEMPORARY TABLE tmp.sale_problems (
|
||||||
|
ticketFk INT(11),
|
||||||
saleFk INT(11),
|
saleFk INT(11),
|
||||||
hasItemShortage BOOL DEFAULT FALSE,
|
isFreezed INTEGER(1) DEFAULT 0,
|
||||||
hasItemLost BOOL DEFAULT FALSE,
|
risk DECIMAL(10,1) DEFAULT 0,
|
||||||
hasComponentLack BOOL DEFAULT FALSE,
|
hasRisk TINYINT(1) DEFAULT 0,
|
||||||
hasItemDelay BOOL DEFAULT FALSE,
|
hasHighRisk TINYINT(1) DEFAULT 0,
|
||||||
hasRounding BOOL DEFAULT FALSE,
|
hasTicketRequest INTEGER(1) DEFAULT 0,
|
||||||
PRIMARY KEY (saleFk)
|
itemShortage VARCHAR(255),
|
||||||
) ENGINE = MEMORY;
|
isTaxDataChecked INTEGER(1) DEFAULT 1,
|
||||||
|
itemDelay VARCHAR(255),
|
||||||
|
itemLost VARCHAR(255),
|
||||||
|
hasComponentLack INTEGER(1),
|
||||||
|
hasRounding VARCHAR(255),
|
||||||
|
isTooLittle BOOL DEFAULT FALSE,
|
||||||
|
isVip BOOL DEFAULT FALSE,
|
||||||
|
PRIMARY KEY (ticketFk, saleFk)
|
||||||
|
); -- No memory
|
||||||
|
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tItemShelving
|
INSERT INTO tmp.sale_problems(ticketFk,
|
||||||
|
saleFk,
|
||||||
|
isFreezed,
|
||||||
|
risk,
|
||||||
|
hasRisk,
|
||||||
|
hasHighRisk,
|
||||||
|
hasTicketRequest,
|
||||||
|
isTaxDataChecked,
|
||||||
|
hasComponentLack,
|
||||||
|
isTooLittle)
|
||||||
|
SELECT sgp.ticketFk,
|
||||||
|
s.id,
|
||||||
|
IF(FIND_IN_SET('isFreezed', t.problem), TRUE, FALSE) isFreezed,
|
||||||
|
t.risk,
|
||||||
|
IF(FIND_IN_SET('hasRisk', t.problem), TRUE, FALSE) hasRisk,
|
||||||
|
IF(FIND_IN_SET('hasHighRisk', t.problem), TRUE, FALSE) hasHighRisk,
|
||||||
|
IF(FIND_IN_SET('hasTicketRequest', t.problem), TRUE, FALSE) hasTicketRequest,
|
||||||
|
IF(FIND_IN_SET('isTaxDataChecked', t.problem), FALSE, TRUE) isTaxDataChecked,
|
||||||
|
IF(FIND_IN_SET('hasComponentLack', s.problem), TRUE, FALSE) hasComponentLack,
|
||||||
|
IF(FIND_IN_SET('isTooLittle', t.problem)
|
||||||
|
AND util.VN_NOW() < (util.VN_CURDATE() + INTERVAL HOUR(zc.`hour`) HOUR) + INTERVAL MINUTE(zc.`hour`) MINUTE,
|
||||||
|
TRUE, FALSE) isTooLittle
|
||||||
|
FROM tmp.sale_getProblems sgp
|
||||||
|
JOIN ticket t ON t.id = sgp.ticketFk
|
||||||
|
LEFT JOIN sale s ON s.ticketFk = t.id
|
||||||
|
LEFT JOIN item i ON i.id = s.itemFk
|
||||||
|
LEFT JOIN zoneClosure zc ON zc.zoneFk = t.zoneFk
|
||||||
|
AND zc.dated = util.VN_CURDATE()
|
||||||
|
WHERE s.problem <> '' OR t.problem <> '' OR t.risk
|
||||||
|
GROUP BY t.id, s.id;
|
||||||
|
|
||||||
|
INSERT INTO tmp.sale_problems(ticketFk, isVip)
|
||||||
|
SELECT sgp.ticketFk, TRUE
|
||||||
|
FROM tmp.sale_getProblems sgp
|
||||||
|
JOIN client c ON c.id = sgp.clientFk
|
||||||
|
WHERE c.businessTypeFk = 'VIP'
|
||||||
|
ON DUPLICATE KEY UPDATE isVIP = TRUE;
|
||||||
|
|
||||||
|
CREATE OR REPLACE TEMPORARY TABLE tItemShelvingStock_byWarehouse
|
||||||
(INDEX (itemFk, warehouseFk))
|
(INDEX (itemFk, warehouseFk))
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
SELECT ish.itemFk itemFk,
|
SELECT ish.itemFk itemFk,
|
||||||
|
@ -48,14 +92,6 @@ BEGIN
|
||||||
JOIN sector s ON s.id = p.sectorFk
|
JOIN sector s ON s.id = p.sectorFk
|
||||||
GROUP BY ish.itemFk, s.warehouseFk;
|
GROUP BY ish.itemFk, s.warehouseFk;
|
||||||
|
|
||||||
-- Componentes: Algún componente obligatorio no se ha calcualdo
|
|
||||||
INSERT INTO tmp.saleProblems(saleFk, hasComponentLack)
|
|
||||||
SELECT s.id, TRUE
|
|
||||||
FROM tmp.sale ts
|
|
||||||
JOIN sale s ON s.id = ts.saleFk
|
|
||||||
WHERE FIND_IN_SET('hasComponentLack', s.problem)
|
|
||||||
GROUP BY s.id;
|
|
||||||
|
|
||||||
-- Disponible, faltas, inventario y retrasos
|
-- Disponible, faltas, inventario y retrasos
|
||||||
OPEN vCursor;
|
OPEN vCursor;
|
||||||
l: LOOP
|
l: LOOP
|
||||||
|
@ -68,112 +104,130 @@ BEGIN
|
||||||
|
|
||||||
-- Disponible: no va a haber suficiente producto para preparar todos los pedidos
|
-- Disponible: no va a haber suficiente producto para preparar todos los pedidos
|
||||||
CALL cache.available_refresh(vAvailableCache, FALSE, vWarehouseFk, vDate);
|
CALL cache.available_refresh(vAvailableCache, FALSE, vWarehouseFk, vDate);
|
||||||
|
|
||||||
-- Faltas: visible, disponible y ubicado son menores que la cantidad vendida
|
-- Faltas: visible, disponible y ubicado son menores que la cantidad vendida
|
||||||
CALL cache.visible_refresh(vVisibleCache, FALSE, vWarehouseFk);
|
CALL cache.visible_refresh(vVisibleCache, FALSE, vWarehouseFk);
|
||||||
|
|
||||||
INSERT INTO tmp.saleProblems(saleFk, hasItemShortage)
|
INSERT INTO tmp.sale_problems(ticketFk, itemShortage, saleFk)
|
||||||
SELECT s.id, TRUE
|
SELECT ticketFk, problem, saleFk
|
||||||
FROM tmp.sale ts
|
FROM (
|
||||||
JOIN sale s ON s.id = ts.saleFk
|
SELECT sgp.ticketFk,
|
||||||
JOIN ticket t ON t.id = s.ticketFk
|
LEFT(CONCAT('F: ', GROUP_CONCAT(i.id, ' ', i.longName, ' ')), 250) problem,
|
||||||
JOIN item i ON i.id = s.itemFk
|
s.id saleFk
|
||||||
JOIN itemType it ON it.id = i.typeFk
|
FROM tmp.sale_getProblems sgp
|
||||||
JOIN itemCategory ic ON ic.id = it.categoryFk
|
JOIN ticket t ON t.id = sgp.ticketFk
|
||||||
LEFT JOIN cache.visible v ON v.item_id = i.id
|
JOIN sale s ON s.ticketFk = t.id
|
||||||
AND v.calc_id = vVisibleCache
|
JOIN item i ON i.id = s.itemFk
|
||||||
LEFT JOIN cache.available av ON av.item_id = i.id
|
JOIN itemType it ON it.id = i.typeFk
|
||||||
AND av.calc_id = vAvailableCache
|
JOIN itemCategory ic ON ic.id = it.categoryFk
|
||||||
LEFT JOIN tItemShelving tis ON tis.itemFk = i.id
|
LEFT JOIN cache.visible v ON v.item_id = i.id
|
||||||
AND tis.warehouseFk = t.warehouseFk
|
AND v.calc_id = vVisibleCache
|
||||||
WHERE (s.quantity > v.visible OR (s.quantity > 0 AND v.visible IS NULL))
|
LEFT JOIN cache.available av ON av.item_id = i.id
|
||||||
AND (av.available < 0 OR av.available IS NULL)
|
AND av.calc_id = vAvailableCache
|
||||||
AND (s.quantity > tis.visible OR tis.visible IS NULL)
|
LEFT JOIN tItemShelvingStock_byWarehouse issw ON issw.itemFk = i.id
|
||||||
AND NOT s.isPicked
|
AND issw.warehouseFk = t.warehouseFk
|
||||||
AND NOT s.reserved
|
WHERE IFNULL(v.visible, 0) < s.quantity
|
||||||
AND ic.merchandise
|
AND IFNULL(av.available, 0) < 0
|
||||||
AND IF(vIsTodayRelative, TRUE, DATE(t.shipped) = vDate)
|
AND IFNULL(issw.visible, 0) < s.quantity
|
||||||
AND NOT i.generic
|
AND NOT s.isPicked
|
||||||
AND util.VN_CURDATE() = vDate
|
AND NOT s.reserved
|
||||||
AND t.warehouseFk = vWarehouseFk
|
AND ic.merchandise
|
||||||
GROUP BY s.id
|
AND IF(vIsTodayRelative, TRUE, DATE(t.shipped) = vDate)
|
||||||
ON DUPLICATE KEY UPDATE hasItemShortage = TRUE;
|
AND NOT i.generic
|
||||||
|
AND util.VN_CURDATE() = vDate
|
||||||
|
AND t.warehouseFk = vWarehouseFk
|
||||||
|
GROUP BY sgp.ticketFk) sub
|
||||||
|
ON DUPLICATE KEY UPDATE itemShortage = sub.problem, saleFk = sub.saleFk;
|
||||||
|
|
||||||
-- Inventario: Visible suficiente, pero ubicado menor a la cantidad vendida
|
-- Inventario: Visible suficiente, pero ubicado menor a la cantidad vendida
|
||||||
INSERT INTO tmp.saleProblems(saleFk, hasItemLost)
|
INSERT INTO tmp.sale_problems(ticketFk, itemLost, saleFk)
|
||||||
SELECT s.id, TRUE
|
SELECT ticketFk, problem, saleFk
|
||||||
FROM tmp.sale ts
|
FROM (
|
||||||
JOIN sale s ON s.id = ts.saleFk
|
SELECT sgp.ticketFk,
|
||||||
JOIN ticket t ON t.id = s.ticketFk
|
LEFT(GROUP_CONCAT('I: ', i.id, ' ', i.longName, ' '), 250) problem,
|
||||||
JOIN item i ON i.id = s.itemFk
|
s.id saleFk
|
||||||
JOIN itemType it ON it.id = i.typeFk
|
FROM tmp.sale_getProblems sgp
|
||||||
JOIN itemCategory ic ON ic.id = it.categoryFk
|
JOIN ticket t ON t.id = sgp.ticketFk
|
||||||
LEFT JOIN cache.visible v ON v.item_id = s.itemFk
|
JOIN sale s ON s.ticketFk = t.id
|
||||||
AND v.calc_id = vVisibleCache
|
JOIN item i ON i.id = s.itemFk
|
||||||
LEFT JOIN tItemShelving tis ON tis.itemFk = i.id
|
JOIN itemType it ON it.id = i.typeFk
|
||||||
AND tis.warehouseFk = t.warehouseFk
|
JOIN itemCategory ic ON ic.id = it.categoryFk
|
||||||
WHERE (v.visible >= s.quantity OR v.visible IS NULL)
|
LEFT JOIN cache.visible v ON v.item_id = s.itemFk
|
||||||
AND (s.quantity > tis.visible AND tis.visible IS NOT NULL)
|
AND v.calc_id = vVisibleCache
|
||||||
AND s.quantity > 0
|
LEFT JOIN tItemShelvingStock_byWarehouse issw ON issw.itemFk = i.id
|
||||||
AND NOT s.isPicked
|
AND issw.warehouseFk = t.warehouseFk
|
||||||
AND NOT s.reserved
|
WHERE IFNULL(v.visible, 0) >= s.quantity
|
||||||
AND ic.merchandise
|
AND IFNULL(issw.visible, 0) < s.quantity
|
||||||
AND IF(vIsTodayRelative, TRUE, DATE(t.shipped) = vDate)
|
AND s.quantity > 0
|
||||||
AND NOT i.generic
|
AND NOT s.isPicked
|
||||||
AND util.VN_CURDATE() = vDate
|
AND NOT s.reserved
|
||||||
AND t.warehouseFk = vWarehouseFk
|
AND ic.merchandise
|
||||||
GROUP BY s.id
|
AND IF(vIsTodayRelative, TRUE, DATE(t.shipped) = vDate)
|
||||||
ON DUPLICATE KEY UPDATE hasItemLost = TRUE;
|
AND NOT i.generic
|
||||||
|
AND util.VN_CURDATE() = vDate
|
||||||
|
AND t.warehouseFk = vWarehouseFk
|
||||||
|
GROUP BY sgp.ticketFk
|
||||||
|
) sub
|
||||||
|
ON DUPLICATE KEY UPDATE itemLost = sub.problem, saleFk = sub.saleFk;
|
||||||
|
|
||||||
-- Retraso: Disponible suficiente, pero no visible ni ubicado
|
-- Retraso: Disponible suficiente, pero no visible ni ubicado
|
||||||
INSERT INTO tmp.saleProblems(saleFk, hasItemDelay)
|
INSERT INTO tmp.sale_problems(ticketFk, itemDelay, saleFk)
|
||||||
SELECT s.id, TRUE
|
SELECT ticketFk, problem, saleFk
|
||||||
FROM tmp.sale ts
|
FROM (
|
||||||
JOIN sale s ON s.id = ts.saleFk
|
SELECT sgp.ticketFk,
|
||||||
JOIN ticket t ON t.id = s.ticketFk
|
LEFT(GROUP_CONCAT('R: ', i.id, ' ', i.longName, ' '), 250) problem,
|
||||||
JOIN item i ON i.id = s.itemFk
|
s.id saleFk
|
||||||
JOIN itemType it ON it.id = i.typeFk
|
FROM tmp.sale_getProblems sgp
|
||||||
JOIN itemCategory ic ON ic.id = it.categoryFk
|
JOIN ticket t ON t.id = sgp.ticketFk
|
||||||
LEFT JOIN cache.visible v ON v.item_id = s.itemFk
|
JOIN sale s ON s.ticketFk = t.id
|
||||||
AND v.calc_id = vVisibleCache
|
JOIN item i ON i.id = s.itemFk
|
||||||
LEFT JOIN cache.available av ON av.item_id = i.id
|
JOIN itemType it ON it.id = i.typeFk
|
||||||
AND av.calc_id = vAvailableCache
|
JOIN itemCategory ic ON ic.id = it.categoryFk
|
||||||
LEFT JOIN tItemShelving tis ON tis.itemFk = i.id
|
LEFT JOIN cache.visible v ON v.item_id = s.itemFk
|
||||||
AND tis.warehouseFk = t.warehouseFk
|
AND v.calc_id = vVisibleCache
|
||||||
WHERE (s.quantity > v.visible AND v.visible IS NULL)
|
LEFT JOIN cache.available av ON av.item_id = i.id
|
||||||
AND (av.available >= 0 OR av.available IS NULL)
|
AND av.calc_id = vAvailableCache
|
||||||
AND (s.quantity > tis.visible AND tis.visible IS NOT NULL)
|
LEFT JOIN tItemShelvingStock_byWarehouse issw ON issw.itemFk = i.id
|
||||||
AND s.quantity > 0
|
AND issw.warehouseFk = t.warehouseFk
|
||||||
AND NOT s.isPicked
|
WHERE IFNULL(v.visible, 0) < s.quantity
|
||||||
AND NOT s.reserved
|
AND IFNULL(av.available, 0) >= 0
|
||||||
AND ic.merchandise
|
AND IFNULL(issw.visible, 0) < s.quantity
|
||||||
AND IF(vIsTodayRelative, TRUE, DATE(t.shipped) = vDate)
|
AND s.quantity > 0
|
||||||
AND NOT i.generic
|
AND NOT s.isPicked
|
||||||
AND util.VN_CURDATE() = vDate
|
AND NOT s.reserved
|
||||||
AND t.warehouseFk = vWarehouseFk
|
AND ic.merchandise
|
||||||
GROUP BY s.id
|
AND IF(vIsTodayRelative, TRUE, DATE(t.shipped) = vDate)
|
||||||
ON DUPLICATE KEY UPDATE hasItemDelay = TRUE;
|
AND NOT i.generic
|
||||||
|
AND util.VN_CURDATE() = vDate
|
||||||
|
AND t.warehouseFk = vWarehouseFk
|
||||||
|
GROUP BY sgp.ticketFk
|
||||||
|
) sub
|
||||||
|
ON DUPLICATE KEY UPDATE itemDelay = sub.problem, saleFk = sub.saleFk;
|
||||||
|
|
||||||
-- Redondeo: cantidad incorrecta con respecto al grouping
|
-- Redondeo: cantidad incorrecta con respecto al grouping
|
||||||
CALL buy_getUltimate(NULL, vWarehouseFk, vDate);
|
CALL buy_getUltimate(NULL, vWarehouseFk, vDate);
|
||||||
|
INSERT INTO tmp.sale_problems(ticketFk, hasRounding, saleFk)
|
||||||
INSERT INTO tmp.saleProblems(saleFk, hasRounding)
|
SELECT ticketFk, problem, saleFk
|
||||||
SELECT s.id, TRUE
|
FROM (
|
||||||
FROM tmp.sale ts
|
SELECT sgp.ticketFk,
|
||||||
JOIN sale s ON s.id = ts.saleFk
|
s.id saleFk,
|
||||||
JOIN ticket t ON t.id = s.ticketFk
|
LEFT(GROUP_CONCAT('RE: ',i.id, ' ', IFNULL(i.longName,'') SEPARATOR ', '), 250) problem
|
||||||
AND t.warehouseFk = vWarehouseFk
|
FROM tmp.sale_getProblems sgp
|
||||||
JOIN item i ON i.id = s.itemFk
|
JOIN ticket t ON t.id = sgp.ticketFk
|
||||||
JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk
|
AND t.warehouseFk = vWarehouseFk
|
||||||
JOIN buy b ON b.id = bu.buyFk
|
JOIN sale s ON s.ticketFk = sgp.ticketFk
|
||||||
WHERE MOD(s.quantity, b.`grouping`)
|
JOIN item i ON i.id = s.itemFk
|
||||||
GROUP BY s.id
|
JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk
|
||||||
ON DUPLICATE KEY UPDATE hasRounding = TRUE;
|
JOIN buy b ON b.id = bu.buyFk
|
||||||
|
WHERE MOD(s.quantity, b.`grouping`)
|
||||||
|
GROUP BY sgp.ticketFk
|
||||||
|
)sub
|
||||||
|
ON DUPLICATE KEY UPDATE hasRounding = sub.problem, saleFk = sub.saleFk;
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tmp.buyUltimate;
|
DROP TEMPORARY TABLE tmp.buyUltimate;
|
||||||
END LOOP;
|
END LOOP;
|
||||||
CLOSE vCursor;
|
CLOSE vCursor;
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tItemShelving;
|
DROP TEMPORARY TABLE tItemShelvingStock_byWarehouse;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -1,25 +1,25 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`sale_getProblemsByTicket`(
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`sale_getProblemsByTicket`(IN vTicketFk INT, IN vIsTodayRelative TINYINT(1))
|
||||||
IN vTicketFk INT,
|
|
||||||
IN vIsTodayRelative TINYINT(1)
|
|
||||||
)
|
|
||||||
BEGIN
|
BEGIN
|
||||||
/**
|
/**
|
||||||
* Calcula los problemas de cada venta para un tickets.
|
* Calcula los problemas de cada venta
|
||||||
|
* para un conjunto de tickets.
|
||||||
*
|
*
|
||||||
* @return Problems result
|
* @return Problems result
|
||||||
*/
|
*/
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tmp.sale
|
CREATE OR REPLACE TEMPORARY TABLE tmp.sale_getProblems
|
||||||
(INDEX (saleFk))
|
(INDEX (ticketFk))
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
SELECT id saleFk FROM sale WHERE ticketFk = vTicketFk;
|
SELECT t.id ticketFk, t.clientFk, t.warehouseFk, t.shipped
|
||||||
|
FROM ticket t
|
||||||
|
WHERE t.id = vTicketFk;
|
||||||
|
|
||||||
CALL sale_getProblems(vIsTodayRelative);
|
CALL sale_getProblems(vIsTodayRelative);
|
||||||
|
|
||||||
SELECT * FROM tmp.saleProblems;
|
SELECT * FROM tmp.sale_problems;
|
||||||
|
|
||||||
DROP TEMPORARY TABLE
|
DROP TEMPORARY TABLE
|
||||||
tmp.saleProblems,
|
tmp.sale_getProblems,
|
||||||
tmp.sale;
|
tmp.sale_problems;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -25,11 +25,9 @@ BEGIN
|
||||||
DECLARE vNewSaleFk INT;
|
DECLARE vNewSaleFk INT;
|
||||||
DECLARE vFinalPrice DECIMAL(10,2);
|
DECLARE vFinalPrice DECIMAL(10,2);
|
||||||
|
|
||||||
|
|
||||||
DECLARE vIsRequiredTx BOOL DEFAULT NOT @@in_transaction;
|
|
||||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||||
BEGIN
|
BEGIN
|
||||||
CALL util.tx_rollback(vIsRequiredTx);
|
ROLLBACK;
|
||||||
RESIGNAL;
|
RESIGNAL;
|
||||||
END;
|
END;
|
||||||
|
|
||||||
|
@ -64,7 +62,7 @@ BEGIN
|
||||||
WHERE tmp.itemFk = vNewItemFk AND tmp.WarehouseFk = vWarehouseFk;
|
WHERE tmp.itemFk = vNewItemFk AND tmp.WarehouseFk = vWarehouseFk;
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tmp.buyUltimate;
|
DROP TEMPORARY TABLE tmp.buyUltimate;
|
||||||
|
|
||||||
IF vGroupingMode = 'packing' AND vPacking > 0 THEN
|
IF vGroupingMode = 'packing' AND vPacking > 0 THEN
|
||||||
SET vRoundQuantity = vPacking;
|
SET vRoundQuantity = vPacking;
|
||||||
END IF;
|
END IF;
|
||||||
|
@ -131,6 +129,6 @@ BEGIN
|
||||||
VALUES(vItemFk, vNewItemFk, 1)
|
VALUES(vItemFk, vNewItemFk, 1)
|
||||||
ON DUPLICATE KEY UPDATE counter = counter + 1;
|
ON DUPLICATE KEY UPDATE counter = counter + 1;
|
||||||
|
|
||||||
CALL util.tx_commit(vIsRequiredTx);
|
COMMIT;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -41,7 +41,6 @@ BEGIN
|
||||||
) currencyBalance
|
) currencyBalance
|
||||||
FROM (
|
FROM (
|
||||||
SELECT NULL bankFk,
|
SELECT NULL bankFk,
|
||||||
NULL bank,
|
|
||||||
ii.companyFk,
|
ii.companyFk,
|
||||||
ii.serial,
|
ii.serial,
|
||||||
ii.id,
|
ii.id,
|
||||||
|
@ -75,7 +74,6 @@ BEGIN
|
||||||
GROUP BY iid.id, ii.id
|
GROUP BY iid.id, ii.id
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT p.bankFk,
|
SELECT p.bankFk,
|
||||||
a.bank,
|
|
||||||
p.companyFk,
|
p.companyFk,
|
||||||
NULL,
|
NULL,
|
||||||
p.id,
|
p.id,
|
||||||
|
@ -111,7 +109,6 @@ BEGIN
|
||||||
AND (vIsConciliated = p.isConciliated OR NOT vIsConciliated)
|
AND (vIsConciliated = p.isConciliated OR NOT vIsConciliated)
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT NULL,
|
SELECT NULL,
|
||||||
NULL bankFk,
|
|
||||||
companyFk,
|
companyFk,
|
||||||
NULL,
|
NULL,
|
||||||
se.id,
|
se.id,
|
||||||
|
@ -139,7 +136,6 @@ BEGIN
|
||||||
AND (vIsConciliated = se.isConciliated OR NOT vIsConciliated)
|
AND (vIsConciliated = se.isConciliated OR NOT vIsConciliated)
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT NULL bankFk,
|
SELECT NULL bankFk,
|
||||||
NULL,
|
|
||||||
e.companyFk,
|
e.companyFk,
|
||||||
'E' serial,
|
'E' serial,
|
||||||
e.invoiceNumber id,
|
e.invoiceNumber id,
|
||||||
|
@ -158,7 +154,7 @@ BEGIN
|
||||||
JOIN travel tr ON tr.id = e.travelFk
|
JOIN travel tr ON tr.id = e.travelFk
|
||||||
JOIN currency c ON c.id = e.currencyFk
|
JOIN currency c ON c.id = e.currencyFk
|
||||||
WHERE e.supplierFk = vSupplierFk
|
WHERE e.supplierFk = vSupplierFk
|
||||||
AND tr.landed >= util.VN_CURDATE()
|
AND tr.landed >= CURDATE()
|
||||||
AND e.invoiceInFk IS NULL
|
AND e.invoiceInFk IS NULL
|
||||||
AND vHasEntries
|
AND vHasEntries
|
||||||
ORDER BY (dated IS NULL AND NOT isBooked),
|
ORDER BY (dated IS NULL AND NOT isBooked),
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_DelayTruck`(vWarehouserFk INT, vHour INT, vMinute INT)
|
||||||
|
BEGIN
|
||||||
|
DECLARE done INT DEFAULT FALSE;
|
||||||
|
DECLARE vTicketFk INT;
|
||||||
|
DECLARE cur1 CURSOR FOR SELECT ticketFk FROM tTicket;
|
||||||
|
|
||||||
|
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
|
||||||
|
|
||||||
|
CALL vn.productionControl(vWarehouserFk,0) ;
|
||||||
|
|
||||||
|
DROP TEMPORARY TABLE IF EXISTS tTicket;
|
||||||
|
CREATE TEMPORARY TABLE tTicket
|
||||||
|
SELECT ticketFk
|
||||||
|
FROM tmp.productionBuffer
|
||||||
|
JOIN alertLevel al ON al.code = 'FREE'
|
||||||
|
WHERE shipped = util.VN_CURDATE()
|
||||||
|
AND problem LIKE '%I:%'
|
||||||
|
AND (HH <= vHour OR HH = vHour AND mm < vMinute)
|
||||||
|
AND alertLevel = al.id;
|
||||||
|
|
||||||
|
OPEN cur1;
|
||||||
|
|
||||||
|
read_loop: LOOP
|
||||||
|
FETCH cur1 INTO vTicketFk;
|
||||||
|
IF done THEN
|
||||||
|
LEAVE read_loop;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
CALL vn.ticket_DelayTruckSplit(vTicketFk);
|
||||||
|
END LOOP;
|
||||||
|
|
||||||
|
CLOSE cur1;
|
||||||
|
DROP TEMPORARY TABLE tTicket, tmp.productionBuffer;
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -0,0 +1,59 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_DelayTruckSplit`(
|
||||||
|
vTicketFk INT
|
||||||
|
)
|
||||||
|
BEGIN
|
||||||
|
/**
|
||||||
|
* Splita las lineas de ticket que no estan ubicadas
|
||||||
|
*
|
||||||
|
* @param vTicketFk Id ticket
|
||||||
|
*/
|
||||||
|
DECLARE vNewTicketFk INT;
|
||||||
|
DECLARE vTotalLines INT;
|
||||||
|
DECLARE vLinesToSplit INT;
|
||||||
|
|
||||||
|
DROP TEMPORARY TABLE IF EXISTS tmp.SalesToSplit;
|
||||||
|
|
||||||
|
SELECT COUNT(*) INTO vTotalLines
|
||||||
|
FROM sale
|
||||||
|
WHERE ticketFk = vTicketFk;
|
||||||
|
|
||||||
|
CREATE TEMPORARY TABLE tmp.SalesToSplit
|
||||||
|
SELECT s.id saleFk
|
||||||
|
FROM ticket t
|
||||||
|
JOIN sale s ON t.id = s.ticketFk
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT ish.itemFk itemFk,
|
||||||
|
SUM(ish.visible) visible,
|
||||||
|
s.warehouseFk warehouseFk
|
||||||
|
FROM itemShelving ish
|
||||||
|
JOIN shelving sh ON sh.id = ish.shelvingFk
|
||||||
|
JOIN parking p ON p.id = sh.parkingFk
|
||||||
|
JOIN sector s ON s.id = p.sectorFk
|
||||||
|
GROUP BY ish.itemFk,
|
||||||
|
s.warehouseFk
|
||||||
|
) issw ON issw.itemFk = s.itemFk
|
||||||
|
AND issw.warehouseFk = t.warehouseFk
|
||||||
|
WHERE s.quantity > IFNULL(issw.visible, 0)
|
||||||
|
AND s.quantity > 0
|
||||||
|
AND NOT s.isPicked
|
||||||
|
AND NOT s.reserved
|
||||||
|
AND t.id = vTicketFk;
|
||||||
|
|
||||||
|
SELECT COUNT(*) INTO vLinesToSplit
|
||||||
|
FROM tmp.SalesToSplit;
|
||||||
|
|
||||||
|
IF vLinesToSplit = vTotalLines AND vLinesToSplit > 0 THEN
|
||||||
|
SET vNewTicketFk = vTicketFk;
|
||||||
|
ELSE
|
||||||
|
CALL ticket_Clone(vTicketFk, vNewTicketFk);
|
||||||
|
UPDATE sale s
|
||||||
|
JOIN tmp.SalesToSplit sts ON sts.saleFk = s.id
|
||||||
|
SET s.ticketFk = vNewTicketFk;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
CALL ticket_setState(vNewTicketFk, 'FIXING');
|
||||||
|
|
||||||
|
DROP TEMPORARY TABLE tmp.SalesToSplit;
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -3,7 +3,7 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_canMerge`(vDat
|
||||||
BEGIN
|
BEGIN
|
||||||
/**
|
/**
|
||||||
* Devuelve un listado de tickets susceptibles de fusionarse con otros tickets en el futuro
|
* Devuelve un listado de tickets susceptibles de fusionarse con otros tickets en el futuro
|
||||||
*
|
*
|
||||||
* @param vDated Fecha en cuestión
|
* @param vDated Fecha en cuestión
|
||||||
* @param vScopeDays Dias en el futuro a sondear
|
* @param vScopeDays Dias en el futuro a sondear
|
||||||
* @param vLitersMax Volumen máximo de los tickets a catapultar
|
* @param vLitersMax Volumen máximo de los tickets a catapultar
|
||||||
|
|
|
@ -19,7 +19,6 @@ BEGIN
|
||||||
sub2.iptd futureIpt,
|
sub2.iptd futureIpt,
|
||||||
sub2.state futureState,
|
sub2.state futureState,
|
||||||
t.clientFk,
|
t.clientFk,
|
||||||
cl.salespersonFk,
|
|
||||||
t.warehouseFk,
|
t.warehouseFk,
|
||||||
ts.alertLevel,
|
ts.alertLevel,
|
||||||
sub2.alertLevel futureAlertLevel,
|
sub2.alertLevel futureAlertLevel,
|
||||||
|
@ -30,21 +29,15 @@ BEGIN
|
||||||
st.code stateCode,
|
st.code stateCode,
|
||||||
sub2.code futureStateCode,
|
sub2.code futureStateCode,
|
||||||
st.classColor,
|
st.classColor,
|
||||||
sub2.classColor futureClassColor,
|
sub2.classColor futureClassColor
|
||||||
am.id agencyFk,
|
|
||||||
am.name agency,
|
|
||||||
sub2.agencyModeFk futureAgencyFk,
|
|
||||||
sub2.agencyMode futureAgency
|
|
||||||
FROM vn.saleVolume sv
|
FROM vn.saleVolume sv
|
||||||
JOIN vn.sale s ON s.id = sv.saleFk
|
JOIN vn.sale s ON s.id = sv.saleFk
|
||||||
JOIN vn.item i ON i.id = s.itemFk
|
JOIN vn.item i ON i.id = s.itemFk
|
||||||
JOIN vn.ticket t ON t.id = sv.ticketFk
|
JOIN vn.ticket t ON t.id = sv.ticketFk
|
||||||
JOIN vn.agencyMode am ON am.id = t.agencyModeFk
|
|
||||||
JOIN vn.address a ON a.id = t.addressFk
|
JOIN vn.address a ON a.id = t.addressFk
|
||||||
JOIN vn.province p ON p.id = a.provinceFk
|
JOIN vn.province p ON p.id = a.provinceFk
|
||||||
JOIN vn.country c ON c.id = p.countryFk
|
JOIN vn.country c ON c.id = p.countryFk
|
||||||
JOIN vn.ticketState ts ON ts.ticketFk = t.id
|
JOIN vn.ticketState ts ON ts.ticketFk = t.id
|
||||||
JOIN vn.client cl ON cl.id = t.clientFk
|
|
||||||
JOIN vn.state st ON st.id = ts.stateFk
|
JOIN vn.state st ON st.id = ts.stateFk
|
||||||
JOIN vn.alertLevel al ON al.id = ts.alertLevel
|
JOIN vn.alertLevel al ON al.id = ts.alertLevel
|
||||||
LEFT JOIN vn.ticketParking tp ON tp.ticketFk = t.id
|
LEFT JOIN vn.ticketParking tp ON tp.ticketFk = t.id
|
||||||
|
@ -59,19 +52,16 @@ BEGIN
|
||||||
st.name state,
|
st.name state,
|
||||||
st.code,
|
st.code,
|
||||||
st.classColor,
|
st.classColor,
|
||||||
am.id agencyModeFk,
|
|
||||||
am.name agencyMode,
|
|
||||||
GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) iptd
|
GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) iptd
|
||||||
FROM vn.ticket t
|
FROM vn.ticket t
|
||||||
JOIN vn.agencyMode am ON am.id = t.agencyModeFk
|
JOIN vn.ticketState ts ON ts.ticketFk = t.id
|
||||||
JOIN vn.ticketState ts ON ts.ticketFk = t.id
|
JOIN vn.state st ON st.id = ts.stateFk
|
||||||
JOIN vn.state st ON st.id = ts.stateFk
|
JOIN vn.sale s ON s.ticketFk = t.id
|
||||||
JOIN vn.sale s ON s.ticketFk = t.id
|
JOIN vn.item i ON i.id = s.itemFk
|
||||||
JOIN vn.item i ON i.id = s.itemFk
|
WHERE t.shipped BETWEEN vFutureDated
|
||||||
WHERE t.shipped BETWEEN vFutureDated
|
AND util.dayend(vFutureDated)
|
||||||
AND util.dayend(vFutureDated)
|
AND t.warehouseFk = vWarehouseFk
|
||||||
AND t.warehouseFk = vWarehouseFk
|
GROUP BY t.id
|
||||||
GROUP BY t.id
|
|
||||||
) sub
|
) sub
|
||||||
GROUP BY sub.addressFk
|
GROUP BY sub.addressFk
|
||||||
) sub2 ON sub2.addressFk = t.addressFk AND t.id != sub2.id
|
) sub2 ON sub2.addressFk = t.addressFk AND t.id != sub2.id
|
||||||
|
|
|
@ -1,109 +1,53 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_getProblems`(
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_getProblems`(
|
||||||
vIsTodayRelative TINYINT(1)
|
vIsTodayRelative tinyint(1)
|
||||||
)
|
)
|
||||||
BEGIN
|
BEGIN
|
||||||
/**
|
/**
|
||||||
* Calcula los problemas para un conjunto de tickets.
|
* Calcula los problemas para un conjunto de tickets.
|
||||||
|
* Agrupados por ticket
|
||||||
*
|
*
|
||||||
* @param vIsTodayRelative Indica si se calcula el disponible como si todo saliera hoy
|
* @table tmp.sale_getProblems(ticketFk, clientFk, warehouseFk, shipped) Identificadores de los tickets a calcular
|
||||||
* @table tmp.ticket(ticketFk) Identificadores de los tickets a calcular
|
* @return tmp.ticket_problems
|
||||||
* @return tmp.ticketProblems, tmp.saleProblems
|
|
||||||
*/
|
*/
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tmp.sale (
|
|
||||||
saleFk INT(11),
|
|
||||||
PRIMARY KEY (saleFk)
|
|
||||||
) ENGINE = MEMORY
|
|
||||||
SELECT DISTINCT s.id saleFk
|
|
||||||
FROM tmp.ticket tt
|
|
||||||
JOIN ticket t ON t.id = tt.ticketFk
|
|
||||||
JOIN sale s ON s.ticketFk = t.id
|
|
||||||
GROUP BY s.id;
|
|
||||||
|
|
||||||
CALL sale_getProblems(vIsTodayRelative);
|
CALL sale_getProblems(vIsTodayRelative);
|
||||||
|
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tmp.ticketProblems (
|
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket_problems
|
||||||
ticketFk INT(11),
|
(PRIMARY KEY (ticketFk))
|
||||||
isFreezed BOOL DEFAULT FALSE,
|
ENGINE = MEMORY
|
||||||
risk DECIMAL(10,1) DEFAULT 0,
|
SELECT ticketFk,
|
||||||
hasRisk BOOL DEFAULT FALSE,
|
MAX(isFreezed) isFreezed,
|
||||||
hasHighRisk BOOL DEFAULT FALSE,
|
MAX(risk) risk,
|
||||||
hasTicketRequest BOOL DEFAULT FALSE,
|
MAX(hasRisk) hasRisk,
|
||||||
isTaxDataChecked BOOL DEFAULT FALSE,
|
MAX(hasHighRisk) hasHighRisk,
|
||||||
isTooLittle BOOL DEFAULT FALSE,
|
MAX(hasTicketRequest) hasTicketRequest,
|
||||||
isVip BOOL DEFAULT FALSE,
|
MAX(itemShortage) itemShortage,
|
||||||
hasItemShortage BOOL DEFAULT FALSE,
|
MIN(isTaxDataChecked) isTaxDataChecked,
|
||||||
hasItemDelay BOOL DEFAULT FALSE,
|
MAX(hasComponentLack) hasComponentLack,
|
||||||
hasItemLost BOOL DEFAULT FALSE,
|
MAX(isTooLittle) isTooLittle,
|
||||||
hasComponentLack BOOL DEFAULT FALSE,
|
MAX(itemDelay) itemDelay,
|
||||||
hasRounding BOOL DEFAULT FALSE,
|
MAX(hasRounding) hasRounding,
|
||||||
PRIMARY KEY (ticketFk)
|
MAX(itemLost) itemLost,
|
||||||
) ENGINE = MEMORY
|
MAX(isVip) isVip,
|
||||||
WITH hasItemShortage AS(
|
|
||||||
SELECT s.ticketFk
|
|
||||||
FROM tmp.saleProblems sp
|
|
||||||
JOIN vn.sale s ON s.id = sp.saleFk
|
|
||||||
WHERE sp.hasItemShortage
|
|
||||||
GROUP BY s.ticketFk
|
|
||||||
),hasItemLost AS(
|
|
||||||
SELECT s.ticketFk
|
|
||||||
FROM tmp.saleProblems sp
|
|
||||||
JOIN vn.sale s ON s.id = sp.saleFk
|
|
||||||
WHERE sp.hasItemLost
|
|
||||||
GROUP BY s.ticketFk
|
|
||||||
),hasRounding AS(
|
|
||||||
SELECT s.ticketFk
|
|
||||||
FROM tmp.saleProblems sp
|
|
||||||
JOIN vn.sale s ON s.id = sp.saleFk
|
|
||||||
WHERE sp.hasRounding
|
|
||||||
GROUP BY s.ticketFk
|
|
||||||
), hasItemDelay AS(
|
|
||||||
SELECT s.ticketFk
|
|
||||||
FROM tmp.saleProblems sp
|
|
||||||
JOIN vn.sale s ON s.id = sp.saleFk
|
|
||||||
WHERE sp.hasItemDelay
|
|
||||||
GROUP BY s.ticketFk
|
|
||||||
), hasComponentLack AS(
|
|
||||||
SELECT s.ticketFk
|
|
||||||
FROM tmp.saleProblems sp
|
|
||||||
JOIN vn.sale s ON s.id = sp.saleFk
|
|
||||||
WHERE sp.hasComponentLack
|
|
||||||
GROUP BY s.ticketFk
|
|
||||||
)SELECT tt.ticketFk,
|
|
||||||
FIND_IN_SET('isFreezed', t.problem) > 0 isFreezed,
|
|
||||||
t.risk,
|
|
||||||
FIND_IN_SET('hasRisk', t.problem) > 0 hasRisk,
|
|
||||||
FIND_IN_SET('hasHighRisk', t.problem) > 0 hasHighRisk,
|
|
||||||
FIND_IN_SET('hasTicketRequest', t.problem) > 0 hasTicketRequest,
|
|
||||||
FIND_IN_SET('isTaxDataChecked', t.problem) > 0 isTaxDataChecked,
|
|
||||||
FIND_IN_SET('isTooLittle', t.problem) > 0
|
|
||||||
AND util.VN_NOW() < (util.VN_CURDATE() +
|
|
||||||
INTERVAL HOUR(zc.`hour`) HOUR) +
|
|
||||||
INTERVAL MINUTE(zc.`hour`) MINUTE isTooLittle,
|
|
||||||
c.businessTypeFk = 'VIP' isVip,
|
|
||||||
NOT (his.ticketFk IS NULL) hasItemShortage,
|
|
||||||
NOT (hid.ticketFk IS NULL) hasItemDelay,
|
|
||||||
NOT (hil.ticketFk IS NULL) hasItemLost,
|
|
||||||
NOT (hcl.ticketFk IS NULL) hasComponentLack,
|
|
||||||
NOT (hr.ticketFk IS NULL) hasRounding,
|
|
||||||
0 totalProblems
|
0 totalProblems
|
||||||
FROM tmp.ticket tt
|
FROM tmp.sale_problems
|
||||||
JOIN vn.ticket t ON t.id = tt.ticketFk
|
GROUP BY ticketFk;
|
||||||
JOIN vn.client c ON c.id = t.clientFk
|
|
||||||
LEFT JOIN hasItemShortage his ON his.ticketFk = t.id
|
|
||||||
LEFT JOIN hasItemLost hil ON hil.ticketFk = t.id
|
|
||||||
LEFT JOIN hasRounding hr ON hr.ticketFk = t.id
|
|
||||||
LEFT JOIN hasItemDelay hid ON hid.ticketFk = t.id
|
|
||||||
LEFT JOIN hasComponentLack hcl ON hcl.ticketFk = t.id
|
|
||||||
LEFT JOIN vn.zoneClosure zc ON zc.zoneFk = t.zoneFk
|
|
||||||
AND zc.dated = util.VN_CURDATE()
|
|
||||||
GROUP BY t.id;
|
|
||||||
|
|
||||||
UPDATE tmp.ticketProblems
|
UPDATE tmp.ticket_problems
|
||||||
SET totalProblems = isFreezed + hasHighRisk + hasTicketRequest +
|
SET totalProblems = (
|
||||||
isTaxDataChecked + hasComponentLack + hasItemDelay +
|
(isFreezed) +
|
||||||
isTooLittle + hasItemLost + hasRounding + hasItemShortage + isVip;
|
(hasHighRisk) +
|
||||||
|
(hasTicketRequest) +
|
||||||
|
(!isTaxDataChecked) +
|
||||||
|
(hasComponentLack) +
|
||||||
|
(itemDelay IS NOT NULL) +
|
||||||
|
(isTooLittle) +
|
||||||
|
(itemLost IS NOT NULL) +
|
||||||
|
(hasRounding IS NOT NULL) +
|
||||||
|
(itemShortage IS NOT NULL) +
|
||||||
|
(isVip)
|
||||||
|
);
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tmp.sale;
|
DROP TEMPORARY TABLE tmp.sale_problems;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -1,21 +1,14 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`vehicle_checkNumberPlate`(
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`vehicle_checkNumberPlate`(vNumberPlate VARCHAR(10), vCountryCodeFk VARCHAR(2))
|
||||||
vNumberPlate VARCHAR(10),
|
|
||||||
vCountryCodeFk VARCHAR(2)
|
|
||||||
)
|
|
||||||
BEGIN
|
BEGIN
|
||||||
/**
|
/**
|
||||||
* Comprueba si la matricula pasada tiene el formato
|
* Comprueba si la matricula pasada tiene el formato correcto dependiendo del pais del vehiculo
|
||||||
* correcto dependiendo del pais del vehiculo.
|
|
||||||
*
|
|
||||||
* @param vNumberPlate Número de matricula
|
|
||||||
* @param vCountryCodeFk Código de pais
|
|
||||||
*/
|
*/
|
||||||
DECLARE vRegex VARCHAR(45);
|
DECLARE vRegex VARCHAR(45);
|
||||||
|
|
||||||
SELECT regex INTO vRegex
|
SELECT vp.regex INTO vRegex
|
||||||
FROM vehiclePlateRegex
|
FROM vehiclePlateRegex vp
|
||||||
WHERE countryCodeFk = vCountryCodeFk;
|
WHERE vp.countryCodeFk = vCountryCodeFk;
|
||||||
|
|
||||||
IF NOT vNumberPlate REGEXP BINARY (vRegex)THEN
|
IF NOT vNumberPlate REGEXP BINARY (vRegex)THEN
|
||||||
CALL util.throw(CONCAT('Error: la matricula ', vNumberPlate, ' no es valida para ',vCountryCodeFk));
|
CALL util.throw(CONCAT('Error: la matricula ', vNumberPlate, ' no es valida para ',vCountryCodeFk));
|
||||||
|
|
|
@ -3,16 +3,8 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`roadmapStop_beforeInser
|
||||||
BEFORE INSERT ON `roadmapStop`
|
BEFORE INSERT ON `roadmapStop`
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
BEGIN
|
BEGIN
|
||||||
SET NEW.editorFk = account.myUser_getId();
|
|
||||||
|
|
||||||
IF NEW.description IS NOT NULL THEN
|
SET NEW.description = UCASE(NEW.description);
|
||||||
SET NEW.description = UCASE(NEW.description);
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
IF NEW.roadmapFk IS NOT NULL THEN
|
|
||||||
IF NEW.eta < (SELECT etd FROM roadmap WHERE id = NEW.roadmapFk) THEN
|
|
||||||
CALL util.throw('Departure time can not be after arrival time');
|
|
||||||
END IF;
|
|
||||||
END IF;
|
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -3,17 +3,8 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`roadmapStop_beforeUpdat
|
||||||
BEFORE UPDATE ON `roadmapStop`
|
BEFORE UPDATE ON `roadmapStop`
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
BEGIN
|
BEGIN
|
||||||
SET NEW.editorFk = account.myUser_getId();
|
|
||||||
|
|
||||||
IF NOT (NEW.description <=> OLD.description) THEN
|
SET NEW.description = UCASE(NEW.description);
|
||||||
SET NEW.description = UCASE(NEW.description);
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
IF NOT (NEW.roadmapFk <=> OLD.roadmapFk) OR NOT (NEW.eta <=> OLD.eta) THEN
|
|
||||||
|
|
||||||
IF NEW.eta < (SELECT etd FROM roadmap WHERE id = NEW.roadmapFk) THEN
|
|
||||||
CALL util.throw('Departure time can not be after arrival time');
|
|
||||||
END IF;
|
|
||||||
END IF;
|
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -3,31 +3,10 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`roadmap_beforeInsert`
|
||||||
BEFORE INSERT ON `roadmap`
|
BEFORE INSERT ON `roadmap`
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
BEGIN
|
BEGIN
|
||||||
SET NEW.editorFk = account.myUser_getId();
|
|
||||||
|
|
||||||
IF NEW.name IS NOT NULL THEN
|
|
||||||
SET NEW.name = UCASE(NEW.name);
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
IF NEW.trailerPlate IS NOT NULL OR NEW.tugPlate IS NOT NULL THEN
|
|
||||||
SET NEW.m3 = (SELECT SUM(m3) FROM vehicle WHERE numberPlate IN (NEW.trailerPlate, NEW.tugPlate));
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
IF NEW.driver1Fk IS NOT NULL THEN
|
IF NEW.driver1Fk IS NOT NULL THEN
|
||||||
SET NEW.driverName = (SELECT CONCAT(w.firstName, ' ', w.lastName)
|
SET NEW.driverName = (SELECT firstName FROM worker WHERE id = NEW.driver1Fk);
|
||||||
FROM worker w
|
ELSE
|
||||||
WHERE w.id = NEW.driver1Fk);
|
SET NEW.driverName = NULL;
|
||||||
|
|
||||||
SET NEW.phone = (SELECT COALESCE(w.phone, c.mobile, c.phone, c.mobile)
|
|
||||||
FROM worker w
|
|
||||||
LEFT JOIN client c ON c.id = w.id
|
|
||||||
WHERE w.id = NEW.driver1Fk);
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
IF NEW.driverChangeFk IS NOT NULL THEN
|
|
||||||
SET NEW.driverChangeName = (SELECT CONCAT(w.firstName, ' ', w.lastName)
|
|
||||||
FROM worker w
|
|
||||||
WHERE w.id = NEW.driverChangeFk);
|
|
||||||
END IF;
|
END IF;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
|
@ -3,51 +3,10 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`roadmap_beforeUpdate`
|
||||||
BEFORE UPDATE ON `roadmap`
|
BEFORE UPDATE ON `roadmap`
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
BEGIN
|
BEGIN
|
||||||
DECLARE vSeconds INT;
|
IF NEW.driver1Fk IS NOT NULL THEN
|
||||||
|
SET NEW.driverName = (SELECT firstName FROM worker WHERE id = NEW.driver1Fk);
|
||||||
SET NEW.editorFk = account.myUser_getId();
|
ELSE
|
||||||
|
SET NEW.driverName = NULL;
|
||||||
IF NOT (NEW.name <=> OLD.name) THEN
|
|
||||||
SET NEW.name = UCASE(NEW.name);
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
IF NOT (NEW.trailerPlate <=> OLD.trailerPlate) OR NOT (NEW.tugPlate <=> OLD.tugPlate) THEN
|
|
||||||
SET NEW.m3 = (SELECT SUM(m3) FROM vehicle WHERE numberPlate IN (NEW.trailerPlate, NEW.tugPlate));
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
IF NOT (NEW.driverName <=> OLD.driverName) THEN
|
|
||||||
SET NEW.driver1Fk = NULL;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
IF NOT (NEW.driver1Fk <=> OLD.driver1Fk) AND NEW.driver1Fk IS NOT NULL THEN
|
|
||||||
SET NEW.driverName = (SELECT CONCAT(w.firstName, ' ', w.lastName)
|
|
||||||
FROM worker w
|
|
||||||
WHERE w.id = NEW.driver1Fk);
|
|
||||||
|
|
||||||
SET NEW.phone = (SELECT COALESCE(w.phone, c.mobile, c.phone, c.mobile)
|
|
||||||
FROM worker w
|
|
||||||
LEFT JOIN client c ON c.id = w.id
|
|
||||||
WHERE w.id = NEW.driver1Fk);
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
IF NOT (NEW.driverChangeName <=> OLD.driverChangeName) THEN
|
|
||||||
SET NEW.driverChangeFk = NULL;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
IF NOT (NEW.driverChangeFk <=> OLD.driverChangeFk) AND NEW.driverChangeFk IS NOT NULL THEN
|
|
||||||
SET NEW.driverChangeName = (SELECT CONCAT(w.firstName, ' ', w.lastName)
|
|
||||||
FROM worker w
|
|
||||||
WHERE w.id = NEW.driverChangeFk);
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
IF NOT (NEW.etd <=> OLD.etd) THEN
|
|
||||||
SET vSeconds = TIME_TO_SEC(TIMEDIFF(NEW.etd, OLD.etd));
|
|
||||||
|
|
||||||
IF vSeconds <> 0 THEN
|
|
||||||
UPDATE roadmapStop
|
|
||||||
SET eta = eta + INTERVAL vSeconds SECOND
|
|
||||||
WHERE roadmapFk = NEW.id;
|
|
||||||
END IF;
|
|
||||||
END IF;
|
END IF;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
|
@ -16,9 +16,5 @@ BEGIN
|
||||||
IF NEW.awbFk IS NOT NULL THEN
|
IF NEW.awbFk IS NOT NULL THEN
|
||||||
CALL travel_throwAwb(NEW.id);
|
CALL travel_throwAwb(NEW.id);
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
IF NEW.availabled < NEW.landed THEN
|
|
||||||
CALL util.throw('The travel availabled cannot be earlier than landed');
|
|
||||||
END IF;
|
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -40,9 +40,5 @@ BEGIN
|
||||||
IF (NOT(NEW.awbFk <=> OLD.awbFk)) AND NEW.awbFk IS NOT NULL THEN
|
IF (NOT(NEW.awbFk <=> OLD.awbFk)) AND NEW.awbFk IS NOT NULL THEN
|
||||||
CALL travel_throwAwb(NEW.id);
|
CALL travel_throwAwb(NEW.id);
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
IF NEW.availabled < NEW.landed THEN
|
|
||||||
CALL util.throw('The travel availabled cannot be earlier than landed');
|
|
||||||
END IF;
|
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
CREATE OR REPLACE DEFINER=`vn`@`localhost`
|
|
||||||
SQL SECURITY DEFINER
|
|
||||||
VIEW `vn`.`agencyModeIncoming` AS
|
|
||||||
SELECT
|
|
||||||
am.id,
|
|
||||||
am.name
|
|
||||||
FROM `vn`.`agencyMode` AS am
|
|
||||||
JOIN `vn`.`agencyIncoming` AS ai
|
|
||||||
ON am.id = ai.agencyModeFk;
|
|
|
@ -7,8 +7,7 @@ AS SELECT `t`.`warehouseInFk` AS `warehouseInFk`,
|
||||||
`b`.`quantity` AS `quantity`,
|
`b`.`quantity` AS `quantity`,
|
||||||
`t`.`isReceived` AS `isReceived`,
|
`t`.`isReceived` AS `isReceived`,
|
||||||
`t`.`isRaid` AS `isVirtualStock`,
|
`t`.`isRaid` AS `isVirtualStock`,
|
||||||
`e`.`id` AS `entryFk`,
|
`e`.`id` AS `entryFk`
|
||||||
`t`.`availabled`
|
|
||||||
FROM (
|
FROM (
|
||||||
(
|
(
|
||||||
`vn`.`buy` `b`
|
`vn`.`buy` `b`
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
CREATE OR REPLACE DEFINER=`vn`@`localhost`
|
|
||||||
SQL SECURITY DEFINER
|
|
||||||
VIEW `vn`.`roadmapEta`
|
|
||||||
AS SELECT `roadmapFk` AS id,
|
|
||||||
MAX(`eta`) AS `eta`
|
|
||||||
FROM `vn`.`roadmapStop`
|
|
||||||
WHERE `roadmapFk` IS NOT NULL
|
|
||||||
GROUP BY `roadmapFk`;
|
|
|
@ -18,6 +18,5 @@ AS SELECT `p`.`id` AS `Id_Cubo`,
|
||||||
`p`.`base` AS `Base`,
|
`p`.`base` AS `Base`,
|
||||||
`p`.`isBox` AS `box`,
|
`p`.`isBox` AS `box`,
|
||||||
`p`.`returnCost` AS `costeRetorno`,
|
`p`.`returnCost` AS `costeRetorno`,
|
||||||
`p`.`isActive` AS `isActive`,
|
`p`.`isActive` AS `isActive`
|
||||||
`p`.`flippingCost` AS `flippingCost`
|
|
||||||
FROM `vn`.`packaging` `p`
|
FROM `vn`.`packaging` `p`
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||||
|
SQL SECURITY DEFINER
|
||||||
|
VIEW `vn2008`.`Split_lines`
|
||||||
|
AS SELECT `sl`.`id` AS `Id_Split_lines`,
|
||||||
|
`sl`.`splitFk` AS `Id_Split`,
|
||||||
|
`sl`.`itemFk` AS `Id_Article`,
|
||||||
|
`sl`.`buyFk` AS `Id_Compra`
|
||||||
|
FROM `vn`.`splitLine` `sl`
|
|
@ -29,6 +29,5 @@ AS SELECT `a`.`id` AS `id`,
|
||||||
`a`.`invoiceInPaletizedFk` AS `invoiceInPaletizedFk`,
|
`a`.`invoiceInPaletizedFk` AS `invoiceInPaletizedFk`,
|
||||||
`a`.`observation` AS `observation`,
|
`a`.`observation` AS `observation`,
|
||||||
`a`.`hasFreightPrepaid` AS `hasFreightPrepaid`,
|
`a`.`hasFreightPrepaid` AS `hasFreightPrepaid`,
|
||||||
`a`.`propertyNumber` AS `propertyNumber`,
|
`a`.`propertyNumber` AS `propertyNumber`
|
||||||
`a`.`costPerKg` AS `costPerKg`
|
|
||||||
FROM `vn`.`awb` `a`
|
FROM `vn`.`awb` `a`
|
||||||
|
|
|
@ -16,6 +16,7 @@ AS SELECT `t`.`id` AS `id`,
|
||||||
`t`.`kg` AS `kg`,
|
`t`.`kg` AS `kg`,
|
||||||
`t`.`cargoSupplierFk` AS `cargoSupplierFk`,
|
`t`.`cargoSupplierFk` AS `cargoSupplierFk`,
|
||||||
`t`.`totalEntries` AS `totalEntries`,
|
`t`.`totalEntries` AS `totalEntries`,
|
||||||
|
`t`.`appointment` AS `appointment`,
|
||||||
`t`.`awbFk` AS `awbFk`,
|
`t`.`awbFk` AS `awbFk`,
|
||||||
`t`.`isRaid` AS `isRaid`,
|
`t`.`isRaid` AS `isRaid`,
|
||||||
`t`.`daysInForward` AS `daysInForward`
|
`t`.`daysInForward` AS `daysInForward`
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
INSERT IGNORE INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
|
|
||||||
VALUES
|
|
||||||
('Ticket','itemLack','READ','ALLOW','ROLE','employee'),
|
|
||||||
('Ticket','itemLackDetail','READ','ALLOW','ROLE','employee'),
|
|
||||||
('Ticket','split','WRITE','ALLOW','ROLE','employee'),
|
|
||||||
('Sale','replaceItem','WRITE','ALLOW','ROLE','employee');
|
|
|
@ -1,27 +0,0 @@
|
||||||
ALTER TABLE vn.business
|
|
||||||
ADD CONSTRAINT `business_companyCodeFk` FOREIGN KEY (`companyCodeFk`) REFERENCES `company` (`code`) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
||||||
|
|
||||||
-- Auto-generated SQL script. Actual values for binary/complex data types may differ - what you see is the default string representation of values.
|
|
||||||
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
|
|
||||||
VALUES ('BusinessReasonEnd','find','*','ALLOW','ROLE','hr');
|
|
||||||
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
|
|
||||||
VALUES ('CalendarType','find','*','ALLOW','ROLE','hr');
|
|
||||||
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
|
|
||||||
VALUES ('OccupationCode','find','*','ALLOW','ROLE','hr');
|
|
||||||
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
|
|
||||||
VALUES ('BusinessReasonEnd','find','*','ALLOW','ROLE','hr');
|
|
||||||
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
|
|
||||||
VALUES ('WorkerBusinessProfessionalCategory','find','*','ALLOW','ROLE','hr');
|
|
||||||
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
|
|
||||||
VALUES ('WorkerBusinessAgreement','find','*','ALLOW','ROLE','hr');
|
|
||||||
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
|
|
||||||
VALUES ('WorkerBusinessType','find','*','ALLOW','ROLE','hr');
|
|
||||||
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
|
|
||||||
VALUES ('PayrollCategory','find','*','ALLOW','ROLE','hr');
|
|
||||||
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
|
|
||||||
VALUES ('Worker','__get__business','*','ALLOW','ROLE','hr');
|
|
||||||
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
|
|
||||||
VALUES ('Worker','__create__business','*','ALLOW','ROLE','hr');
|
|
||||||
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
|
|
||||||
VALUES ('Business','crud','*','ALLOW','ROLE','hr');
|
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
ALTER TABLE vn.ticketConfig ADD lackAlertPrice int(11) DEFAULT 30 NOT NULL COMMENT 'Value to alert when item proposal exceed price';
|
|
||||||
ALTER TABLE vn.ticketConfig ADD lackScopeDays int(11) DEFAULT 2 NOT NULL COMMENT 'Number of days to look back for ticket with negatives';
|
|
|
@ -1,14 +0,0 @@
|
||||||
UPDATE vn.state
|
|
||||||
SET alertLevel = 1 -- ON_PREVIOUS
|
|
||||||
WHERE id IN (
|
|
||||||
36, -- Previa Revisando
|
|
||||||
37, -- Previa Revisado
|
|
||||||
26, -- Prep Previa
|
|
||||||
28, -- Previa OK
|
|
||||||
29, -- Previa Impreso
|
|
||||||
31, -- Polizon Impreso
|
|
||||||
32, -- Polizon OK
|
|
||||||
20, -- Asignado
|
|
||||||
23, -- URGENTE
|
|
||||||
33 -- Auto_Impreso
|
|
||||||
);
|
|
|
@ -1,3 +0,0 @@
|
||||||
-- Place your SQL code here
|
|
||||||
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
|
|
||||||
VALUES ('Ticket','getTicketProblems','READ','ALLOW','ROLE','employee');
|
|
|
@ -1,2 +0,0 @@
|
||||||
-- Place your SQL code here
|
|
||||||
ALTER TABLE vn.claimConfig ADD IF NOT EXISTS daysToClaim int(11) NOT NULL DEFAULT 7 COMMENT 'Dias para reclamar';
|
|
|
@ -1,10 +0,0 @@
|
||||||
UPDATE vn.town t
|
|
||||||
LEFT JOIN vn.zoneGeo zg ON zg.id = t.geoFk
|
|
||||||
SET t.geoFk = NULL
|
|
||||||
WHERE zg.id IS NULL;
|
|
||||||
|
|
||||||
ALTER TABLE vn.town
|
|
||||||
ADD CONSTRAINT town_zoneGeo_FK FOREIGN KEY (geoFk)
|
|
||||||
REFERENCES vn.zoneGeo(id)
|
|
||||||
ON DELETE RESTRICT
|
|
||||||
ON UPDATE CASCADE;
|
|
|
@ -1,10 +0,0 @@
|
||||||
UPDATE vn.postCode pc
|
|
||||||
LEFT JOIN vn.zoneGeo zg ON zg.id = pc.geoFk
|
|
||||||
SET pc.geoFk = NULL
|
|
||||||
WHERE zg.id IS NULL;
|
|
||||||
|
|
||||||
ALTER TABLE vn.postCode
|
|
||||||
ADD CONSTRAINT postCode_zoneGeo_FK FOREIGN KEY (geoFk)
|
|
||||||
REFERENCES vn.zoneGeo(id)
|
|
||||||
ON DELETE RESTRICT
|
|
||||||
ON UPDATE CASCADE;
|
|
|
@ -1,10 +0,0 @@
|
||||||
UPDATE vn.province p
|
|
||||||
LEFT JOIN vn.zoneGeo zg ON zg.id = p.geoFk
|
|
||||||
SET p.geoFk = NULL
|
|
||||||
WHERE zg.id IS NULL;
|
|
||||||
|
|
||||||
ALTER TABLE vn.province
|
|
||||||
ADD CONSTRAINT province_zoneGeo_FK FOREIGN KEY (geoFk)
|
|
||||||
REFERENCES vn.zoneGeo(id)
|
|
||||||
ON DELETE RESTRICT
|
|
||||||
ON UPDATE CASCADE;
|
|
|
@ -1,23 +0,0 @@
|
||||||
CREATE TABLE vn.parkingCoordinates (
|
|
||||||
parkingFk int(11) NOT NULL,
|
|
||||||
x varchar(5) NOT NULL,
|
|
||||||
y varchar(5) NOT NULL,
|
|
||||||
z varchar(5) NOT NULL,
|
|
||||||
CONSTRAINT parkingCoordinates_pk PRIMARY KEY (parkingFk),
|
|
||||||
CONSTRAINT parkingCoordinates_parking_FK FOREIGN KEY (parkingFk) REFERENCES vn.parking(id) ON DELETE CASCADE ON UPDATE CASCADE
|
|
||||||
)
|
|
||||||
ENGINE=InnoDB
|
|
||||||
DEFAULT CHARSET=utf8mb3
|
|
||||||
COLLATE=utf8mb3_unicode_ci;
|
|
||||||
|
|
||||||
INSERT INTO vn.parkingCoordinates (parkingFk, x, y, z)
|
|
||||||
SELECT id, `column`, `row`, `floor`
|
|
||||||
FROM vn.parking
|
|
||||||
WHERE `column` IS NOT NULL
|
|
||||||
OR `row` IS NOT NULL
|
|
||||||
OR `floor` IS NOT NULL;
|
|
||||||
|
|
||||||
ALTER TABLE vn.parking
|
|
||||||
DROP COLUMN `column`,
|
|
||||||
DROP COLUMN `row`,
|
|
||||||
DROP COLUMN `floor`;
|
|
|
@ -1,19 +0,0 @@
|
||||||
INSERT INTO account.`role` (name,description,hasLogin)
|
|
||||||
VALUES ('deliveryFreelancer','Repartidor autónomo',1);
|
|
||||||
|
|
||||||
INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId)
|
|
||||||
VALUES
|
|
||||||
('Route', 'getTickets', 'READ', 'ALLOW', 'ROLE', 'deliveryFreelancer'),
|
|
||||||
('AgencyTerm', 'filter', 'READ', 'ALLOW', 'ROLE', 'deliveryFreelancer'),
|
|
||||||
('Route', 'summary', 'READ', 'ALLOW', 'ROLE', 'deliveryFreelancer'),
|
|
||||||
('Route', 'getRouteByAgency', 'WRITE', 'ALLOW', 'ROLE', 'deliveryFreelancer'),
|
|
||||||
('Route','filter','READ','ALLOW','ROLE','deliveryFreelancer'),
|
|
||||||
('UserConfig','getUserConfig','*','ALLOW','ROLE','deliveryFreelancer'),
|
|
||||||
('Route', 'getTickets', 'READ', 'ALLOW', 'ROLE', 'deliveryFreelancer'),
|
|
||||||
('Route','guessPriority','WRITE','ALLOW','ROLE','deliveryFreelancer'),
|
|
||||||
('Route','getDeliveryPoint','READ','ALLOW','ROLE','deliveryFreelancer'),
|
|
||||||
('Route', 'findById', 'READ', 'ALLOW', 'ROLE', 'deliveryFreelancer'),
|
|
||||||
('Route','sendSms','WRITE','ALLOW','ROLE','deliveryFreelancer'),
|
|
||||||
('Ticket','updateAttributes','WRITE','ALLOW','ROLE','deliveryFreelancer'),
|
|
||||||
('Client','findById','READ','ALLOW','ROLE','deliveryFreelancer');
|
|
||||||
;
|
|
|
@ -1,41 +0,0 @@
|
||||||
USE vn;
|
|
||||||
|
|
||||||
INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId)
|
|
||||||
VALUES ('Vehicle', 'filter', 'READ', 'ALLOW', 'ROLE', 'administrative'),
|
|
||||||
('Vehicle', 'filter', 'READ', 'ALLOW', 'ROLE', 'deliveryAssistant'),
|
|
||||||
('Vehicle', 'find', 'READ', 'ALLOW', 'ROLE', 'administrative'),
|
|
||||||
('Vehicle', 'find', 'READ', 'ALLOW', 'ROLE', 'deliveryAssistant'),
|
|
||||||
('Vehicle', 'findById', 'READ', 'ALLOW', 'ROLE', 'administrative'),
|
|
||||||
('Vehicle', 'findById', 'READ', 'ALLOW', 'ROLE', 'deliveryAssistant'),
|
|
||||||
('Vehicle', '__get__active', 'READ', 'ALLOW', 'ROLE', 'employee'),
|
|
||||||
('Vehicle', 'updateAttributes', 'WRITE', 'ALLOW', 'ROLE', 'administrative'),
|
|
||||||
('Vehicle', 'updateAttributes', 'WRITE', 'ALLOW', 'ROLE', 'deliveryAssistant'),
|
|
||||||
('Vehicle', 'deleteById', 'WRITE', 'ALLOW', 'ROLE', 'administrative'),
|
|
||||||
('Vehicle', 'deleteById', 'WRITE', 'ALLOW', 'ROLE', 'deliveryAssistant'),
|
|
||||||
('Vehicle', 'create', 'WRITE', 'ALLOW', 'ROLE', 'administrative'),
|
|
||||||
('Vehicle', 'create', 'WRITE', 'ALLOW', 'ROLE', 'deliveryAssistant'),
|
|
||||||
('BankPolicy', 'find', 'READ', 'ALLOW', 'ROLE', 'administrative'),
|
|
||||||
('BankPolicy', 'find', 'READ', 'ALLOW', 'ROLE', 'deliveryAssistant'),
|
|
||||||
('VehicleState', 'find', 'READ', 'ALLOW', 'ROLE', 'administrative'),
|
|
||||||
('VehicleState', 'find', 'READ', 'ALLOW', 'ROLE', 'deliveryAssistant'),
|
|
||||||
('Ppe', 'find', 'READ', 'ALLOW', 'ROLE', 'administrative' ),
|
|
||||||
('Ppe', 'find', 'READ', 'ALLOW', 'ROLE', 'deliveryAssistant' ),
|
|
||||||
('VehicleType', 'find', 'READ', 'ALLOW', 'ROLE', 'employee'),
|
|
||||||
('DeliveryPoint', 'find', 'READ', 'ALLOW', 'ROLE', 'deliveryAssistant'),
|
|
||||||
('DeliveryPoint', 'find', 'READ', 'ALLOW', 'ROLE', 'administrative');
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS vehicleType (
|
|
||||||
id INT(11) PRIMARY KEY AUTO_INCREMENT,
|
|
||||||
name VARCHAR(45) NOT NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
INSERT IGNORE INTO vehicleType (id, name)
|
|
||||||
VALUES (1,'vehículo empresa'),
|
|
||||||
(2, 'furgoneta'),
|
|
||||||
(3, 'cabeza tractora'),
|
|
||||||
(4, 'remolque');
|
|
||||||
|
|
||||||
ALTER TABLE vehicle ADD COLUMN importCooler decimal(10,2) DEFAULT NULL;
|
|
||||||
ALTER TABLE vehicle ADD COLUMN vehicleTypeFk INT(11) DEFAULT 1;
|
|
||||||
ALTER TABLE vehicle ADD CONSTRAINT fk_vehicle_vehicleType FOREIGN KEY (vehicleTypeFk) REFERENCES vehicleType(id);
|
|
||||||
|
|
|
@ -1,90 +0,0 @@
|
||||||
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
|
|
||||||
VALUES ('Entry','getBuyList','READ','ALLOW','ROLE','buyer'),
|
|
||||||
('Entry','getBuyUltimate','READ','ALLOW','ROLE','buyer'),
|
|
||||||
('Entry','search','READ','ALLOW','ROLE','buyer'),
|
|
||||||
('Entry','create','WRITE','ALLOW','ROLE','buyer'),
|
|
||||||
('Entry','cloneEntry','WRITE','ALLOW','ROLE','buyer'),
|
|
||||||
('Entry','deleteEntry','WRITE','ALLOW','ROLE','buyer'),
|
|
||||||
('Entry','recalcEntryPrices','WRITE','ALLOW','ROLE','buyer'),
|
|
||||||
('EntryType','find','READ','ALLOW','ROLE','buyer'),
|
|
||||||
('EntryConfig','findOne','READ','ALLOW','ROLE','buyer');
|
|
||||||
|
|
||||||
ALTER TABLE vn.ink ADD IF NOT EXISTS hexJson TEXT NOT NULL;
|
|
||||||
|
|
||||||
UPDATE vn.ink
|
|
||||||
SET hexJson = CONCAT('{"value": ["',hex,'"]}');
|
|
||||||
|
|
||||||
UPDATE vn.ink
|
|
||||||
SET hexJson = CASE `name`
|
|
||||||
WHEN 'Blanco/Naranja' THEN '{"value": ["FFFFFF", "FFA500"]}'
|
|
||||||
WHEN 'Sin especificar' THEN '{"value": ["808080"]}'
|
|
||||||
WHEN '2 Colores' THEN '{"value": ["000000", "FFFFFF"]}'
|
|
||||||
WHEN 'Amarillo/Marrón' THEN '{"value": ["FFFF00", "8B4513"]}'
|
|
||||||
WHEN 'Amarillo/Naranja' THEN '{"value": ["FFFF00", "FFA500"]}'
|
|
||||||
WHEN 'Rosa/Blanco/Amarillo' THEN '{"value": ["FFC0CB", "FFFFFF", "FFFF00"]}'
|
|
||||||
WHEN 'Rosa/Amarillo' THEN '{"value": ["FFC0CB", "FFFF00"]}'
|
|
||||||
WHEN 'Antracita' THEN '{"value": ["2F2F2F"]}'
|
|
||||||
WHEN 'Azul/Amarillo' THEN '{"value": ["0000FF", "FFFF00"]}'
|
|
||||||
WHEN 'Azul Claro' THEN '{"value": ["ADD8E6"]}'
|
|
||||||
WHEN 'Azul/Marron' THEN '{"value": ["0000FF", "8B4513"]}'
|
|
||||||
WHEN 'Azul/Verde' THEN '{"value": ["0000FF", "008000"]}'
|
|
||||||
WHEN 'Blanco/Amarillo' THEN '{"value": ["FFFFFF", "FFFF00"]}'
|
|
||||||
WHEN 'Blaugrana' THEN '{"value": ["A50044", "004D98"]}'
|
|
||||||
WHEN 'Blanco/Negro' THEN '{"value": ["FFFFFF", "000000"]}'
|
|
||||||
WHEN 'Blanco/Verde' THEN '{"value": ["FFFFFF", "008000"]}'
|
|
||||||
WHEN 'Blanco/Azul' THEN '{"value": ["FFFFFF", "0000FF"]}'
|
|
||||||
WHEN 'Blanco/Rosa' THEN '{"value": ["FFFFFF", "FFC0CB"]}'
|
|
||||||
WHEN 'Cognac/Verde' THEN '{"value": ["9A463D", "008000"]}'
|
|
||||||
WHEN 'Champagne/Verde' THEN '{"value": ["F7E7CE", "008000"]}'
|
|
||||||
WHEN 'Camuflaje' THEN '{"value": ["6B8E23", "556B2F", "8B4513"]}'
|
|
||||||
WHEN 'Crema/Rosa' THEN '{"value": ["FFFDD0", "FFC0CB"]}'
|
|
||||||
WHEN 'Fucsia/Amarillo' THEN '{"value": ["FF00FF", "FFFF00"]}'
|
|
||||||
WHEN 'Fucsia/Blanco' THEN '{"value": ["FF00FF", "FFFFFF"]}'
|
|
||||||
WHEN 'Fucsia/Crema' THEN '{"value": ["FF00FF", "FFFDD0"]}'
|
|
||||||
WHEN 'Fucsia/Rosa' THEN '{"value": ["FF00FF", "FFC0CB"]}'
|
|
||||||
WHEN 'Fucsia/Verde' THEN '{"value": ["FF00FF", "008000"]}'
|
|
||||||
WHEN 'Granate/Blanco' THEN '{"value": ["800000", "FFFFFF"]}'
|
|
||||||
WHEN 'Gris Lila' THEN '{"value": ["808080", "C8A2C8"]}'
|
|
||||||
WHEN 'Lavanda/Amarillo' THEN '{"value": ["E6E6FA", "FFFF00"]}'
|
|
||||||
WHEN 'Lavanda/Gris' THEN '{"value": ["E6E6FA", "808080"]}'
|
|
||||||
WHEN 'Lividum' THEN '{"value": ["702963"]}'
|
|
||||||
WHEN 'Morado/Amarillo' THEN '{"value": ["800080", "FFFF00"]}'
|
|
||||||
WHEN 'Marrón/Blanco' THEN '{"value": ["8B4513", "FFFFFF"]}'
|
|
||||||
WHEN 'Marron/Gris' THEN '{"value": ["8B4513", "808080"]}'
|
|
||||||
WHEN 'Marron/Negro' THEN '{"value": ["8B4513", "000000"]}'
|
|
||||||
WHEN 'Marrón/Verde' THEN '{"value": ["8B4513", "008000"]}'
|
|
||||||
WHEN 'Matizado' THEN '{"value": ["D3D3D3", "808080", "FFFFFF"]}'
|
|
||||||
WHEN 'Mixto' THEN '{"value": ["FF0000", "0000FF", "008000", "FFFF00"]}'
|
|
||||||
WHEN 'Marrón Oscuro' THEN '{"value": ["654321"]}'
|
|
||||||
WHEN 'Naranja/Marron' THEN '{"value": ["FFA500", "8B4513"]}'
|
|
||||||
WHEN 'Naranja/Rosa' THEN '{"value": ["FFA500", "FFC0CB"]}'
|
|
||||||
WHEN 'Ocre/Burgundi' THEN '{"value": ["CC7722", "800020"]}'
|
|
||||||
WHEN 'Oro/Plata' THEN '{"value": ["FFD700", "C0C0C0"]}'
|
|
||||||
WHEN 'Oro/Negro' THEN '{"value": ["FFD700", "000000"]}'
|
|
||||||
WHEN 'Oro/Verde' THEN '{"value": ["FFD700", "008000"]}'
|
|
||||||
WHEN 'Purpura/Blanco' THEN '{"value": ["800080", "FFFFFF"]}'
|
|
||||||
WHEN 'Purpura/Rosa' THEN '{"value": ["800080", "FFC0CB"]}'
|
|
||||||
WHEN 'Pastel' THEN '{"value": ["FFB6C1", "87CEFA", "98FB98"]}'
|
|
||||||
WHEN 'Plata' THEN '{"value": ["C0C0C0"]}'
|
|
||||||
WHEN 'Plata/Verde' THEN '{"value": ["C0C0C0", "008000"]}'
|
|
||||||
WHEN 'Rojo/Amarillo' THEN '{"value": ["FF0000", "FFFF00"]}'
|
|
||||||
WHEN 'Rojo/Blanco' THEN '{"value": ["FF0000", "FFFFFF"]}'
|
|
||||||
WHEN 'Rojo/Naranja' THEN '{"value": ["FF0000", "FFA500"]}'
|
|
||||||
WHEN 'Rojo/Oro' THEN '{"value": ["FF0000", "FFD700"]}'
|
|
||||||
WHEN 'Rojo/Verde' THEN '{"value": ["FF0000", "008000"]}'
|
|
||||||
WHEN 'Rosa/Lila' THEN '{"value": ["FFC0CB", "C8A2C8"]}'
|
|
||||||
WHEN 'Rosa/Naranja' THEN '{"value": ["FFC0CB", "FFA500"]}'
|
|
||||||
WHEN 'Rojo/Rosa' THEN '{"value": ["FF0000", "FFC0CB"]}'
|
|
||||||
WHEN 'Rosa empolvado' THEN '{"value": ["E6B8AF"]}'
|
|
||||||
WHEN 'Rosa/Verde' THEN '{"value": ["FFC0CB", "008000"]}'
|
|
||||||
WHEN 'Topo/Blanco' THEN '{"value": ["8B8589", "FFFFFF"]}'
|
|
||||||
WHEN 'Topo' THEN '{"value": ["8B8589"]}'
|
|
||||||
WHEN 'Transparente' THEN '{"value": ["00000000"]}'
|
|
||||||
WHEN 'Verde/Amarillo' THEN '{"value": ["008000", "FFFF00"]}'
|
|
||||||
WHEN 'Verde/Negro' THEN '{"value": ["008000", "000000"]}'
|
|
||||||
WHEN 'Variado' THEN '{"value": ["FF0000", "0000FF", "008000", "FFFF00", "FFA500"]}'
|
|
||||||
WHEN 'Verde Claro/Morado' THEN '{"value": ["90EE90", "800080"]}'
|
|
||||||
WHEN 'Verde/Lila' THEN '{"value": ["008000", "C8A2C8"]}'
|
|
||||||
WHEN 'Vaquero Neon' THEN '{"value": ["1560BD", "FFFF00"]}'
|
|
||||||
ELSE hexJson
|
|
||||||
END;
|
|
|
@ -1,6 +0,0 @@
|
||||||
INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId)
|
|
||||||
VALUES
|
|
||||||
('WorkerDms', 'hasHighPrivs', 'READ', 'ALLOW', 'ROLE', 'hr'),
|
|
||||||
('Business', 'updateAttributes', 'WRITE', 'ALLOW', 'ROLE', 'hr'),
|
|
||||||
('Worker', '__get__business', 'READ', 'ALLOW', 'ROLE', 'hr')
|
|
||||||
;
|
|
|
@ -1,13 +0,0 @@
|
||||||
use `vn`;
|
|
||||||
DELETE ai from
|
|
||||||
`vn`.`agencyIncoming` ai
|
|
||||||
LEFT JOIN `vn`.`agencyMode` am ON
|
|
||||||
am.id = ai.agencyModeFk
|
|
||||||
WHERE am.id IS null;
|
|
||||||
|
|
||||||
ALTER TABLE `vn`.`agencyIncoming`
|
|
||||||
ADD CONSTRAINT `fk_agencyIncoming_agencyMode`
|
|
||||||
FOREIGN KEY (`agencyModeFk`)
|
|
||||||
REFERENCES `agencyMode`(`id`)
|
|
||||||
ON DELETE CASCADE
|
|
||||||
ON UPDATE CASCADE;
|
|
|
@ -1,7 +0,0 @@
|
||||||
ALTER TABLE `vn`.`travelThermograph`
|
|
||||||
ADD COLUMN `agencyModeFk` INT(11) NULL AFTER `editorFk`,
|
|
||||||
ADD CONSTRAINT `travelThermograph_agencyIncoming_fk`
|
|
||||||
FOREIGN KEY (`agencyModeFk`)
|
|
||||||
REFERENCES `agencyIncoming`(`agencyModeFk`)
|
|
||||||
ON DELETE RESTRICT
|
|
||||||
ON UPDATE CASCADE;
|
|
|
@ -1,4 +0,0 @@
|
||||||
ALTER TABLE vn.roadmap
|
|
||||||
DROP FOREIGN KEY roadmap_worker_FK_2,
|
|
||||||
DROP FOREIGN KEY roadmap_worker_FK,
|
|
||||||
DROP FOREIGN KEY roadmap_ibfk_2;
|
|
|
@ -1,20 +0,0 @@
|
||||||
ALTER TABLE vn.roadmap
|
|
||||||
COMMENT='Rutas troncales (trailers)',
|
|
||||||
MODIFY COLUMN m3 int(10) unsigned DEFAULT NULL NULL COMMENT 'Capacidad máxima del remolque',
|
|
||||||
MODIFY COLUMN trailerPlate varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL NULL,
|
|
||||||
MODIFY COLUMN etd datetime NOT NULL COMMENT 'Tiempo estimado de salida',
|
|
||||||
MODIFY COLUMN `name` varchar(45) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NULL,
|
|
||||||
MODIFY COLUMN driver1Fk int(10) unsigned DEFAULT NULL NULL AFTER driverName,
|
|
||||||
MODIFY COLUMN driver2Fk int(10) unsigned DEFAULT NULL NULL AFTER driver1Fk,
|
|
||||||
ADD eta datetime DEFAULT NULL NULL COMMENT 'Tiempo estimado de llegada' AFTER etd,
|
|
||||||
ADD roadmapAddressFk int(11) DEFAULT NULL NULL AFTER `name`,
|
|
||||||
ADD dollyPlate varchar(10) DEFAULT NULL AFTER trailerPlate,
|
|
||||||
ADD tugPlate varchar(10) DEFAULT NULL AFTER dollyPlate,
|
|
||||||
ADD driverChangeName varchar(45) DEFAULT NULL AFTER driver2Fk,
|
|
||||||
ADD driverChangeFk int(10) unsigned DEFAULT NULL NULL AFTER driverChangeName;
|
|
||||||
|
|
||||||
-- Separamos los CHANGE por que si no arriba no se aplican
|
|
||||||
ALTER TABLE vn.roadmap
|
|
||||||
CHANGE userFk editorFk int(10) unsigned DEFAULT NULL NULL AFTER m3;
|
|
||||||
|
|
||||||
CREATE INDEX roadmap_etd_IDX USING BTREE ON vn.roadmap (etd);
|
|
|
@ -1,15 +0,0 @@
|
||||||
UPDATE vn.roadmap
|
|
||||||
SET roadmapAddressFk = (SELECT MIN(addressFk) FROM vn.roadmapAddress),
|
|
||||||
eta = etd + INTERVAL 1 DAY;
|
|
||||||
|
|
||||||
ALTER TABLE vn.roadmap
|
|
||||||
ADD CONSTRAINT roadmap_roadmapAddress_FK FOREIGN KEY (roadmapAddressFk)
|
|
||||||
REFERENCES vn.roadmapAddress(addressFk) ON DELETE RESTRICT ON UPDATE CASCADE,
|
|
||||||
ADD CONSTRAINT roadmap_driver_FK FOREIGN KEY (driver1Fk)
|
|
||||||
REFERENCES vn.worker(id) ON DELETE RESTRICT ON UPDATE CASCADE,
|
|
||||||
ADD CONSTRAINT roadmap_driver_FK2 FOREIGN KEY (driver2Fk)
|
|
||||||
REFERENCES vn.worker(id) ON DELETE RESTRICT ON UPDATE CASCADE,
|
|
||||||
ADD CONSTRAINT roadmap_driverChange_FK FOREIGN KEY (driverChangeFk)
|
|
||||||
REFERENCES vn.worker(id) ON DELETE RESTRICT ON UPDATE CASCADE,
|
|
||||||
ADD CONSTRAINT roadmap_user_Fk FOREIGN KEY (editorFk)
|
|
||||||
REFERENCES account.user(id) ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
|
@ -1,7 +0,0 @@
|
||||||
ALTER TABLE vn.roadmapStop
|
|
||||||
CHANGE userFk editorFk int(10) unsigned DEFAULT NULL NULL,
|
|
||||||
CHANGE addressFk roadmapAddressFk int(11) DEFAULT NULL NULL,
|
|
||||||
DROP FOREIGN KEY expeditionTruck_FK_2;
|
|
||||||
|
|
||||||
ALTER TABLE vn.roadmapStop ADD CONSTRAINT roadmapStop_roadmap_FK
|
|
||||||
FOREIGN KEY (roadmapFk) REFERENCES vn.roadmap(id) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
|
@ -1,4 +0,0 @@
|
||||||
ALTER TABLE vn.route
|
|
||||||
ADD roadmapStopFk int(11) NULL,
|
|
||||||
ADD CONSTRAINT route_roadmapStop_FK FOREIGN KEY (roadmapStopFk) REFERENCES vn.roadmapStop(id) ON DELETE RESTRICT ON UPDATE CASCADE,
|
|
||||||
CHANGE editorFk editorFk int(10) unsigned DEFAULT NULL NULL AFTER roadmapStopFk;
|
|
|
@ -1,2 +0,0 @@
|
||||||
ALTER TABLE vn.roadmapAddress
|
|
||||||
COMMENT='Direcciones de los troncales o también llamados puntos de distribución';
|
|
|
@ -1,11 +0,0 @@
|
||||||
GRANT SELECT ON TABLE vn.roadmap TO 'delivery';
|
|
||||||
GRANT SELECT ON TABLE vn.roadmapStop TO 'delivery';
|
|
||||||
GRANT SELECT ON TABLE vn.roadmapAddress TO 'delivery';
|
|
||||||
|
|
||||||
GRANT DELETE, UPDATE, INSERT ON TABLE vn.roadmap TO 'deliveryBoss';
|
|
||||||
GRANT DELETE, UPDATE, INSERT ON TABLE vn.roadmapStop TO 'deliveryBoss';
|
|
||||||
GRANT DELETE, UPDATE, INSERT ON TABLE vn.roadmapAddress TO 'deliveryBoss';
|
|
||||||
|
|
||||||
-- Comentado debido a que da error porque ejecuta primero el script de la versión
|
|
||||||
-- GRANT EXECUTE ON PROCEDURE vn.roadmap_cloneDay TO 'deliveryBoss';
|
|
||||||
-- GRANT EXECUTE ON FUNCTION vn.getTimeBetweenRoadmapAddresses TO 'deliveryBoss';
|
|
|
@ -1,2 +0,0 @@
|
||||||
ALTER TABLE vn.route DROP FOREIGN KEY fk_route_1;
|
|
||||||
ALTER TABLE vn.route DROP COLUMN zoneFk;
|
|
|
@ -1,2 +0,0 @@
|
||||||
ALTER TABLE vn.vehicle
|
|
||||||
ADD typeFk enum('car','van','truck','trailer','tug', 'tugDolly','dolly') DEFAULT 'van' NOT NULL;
|
|
|
@ -1 +0,0 @@
|
||||||
CREATE INDEX route_dated_IDX USING BTREE ON vn.route (dated);
|
|
|
@ -1,2 +0,0 @@
|
||||||
ALTER TABLE `vn`.`tag`
|
|
||||||
ADD COLUMN IF NOT EXISTS `validationRegex` varchar(50) DEFAULT NULL;
|
|
|
@ -1,5 +0,0 @@
|
||||||
RENAME TABLE vn.sorter TO vn.sorter__;
|
|
||||||
ALTER TABLE vn.sorter__ COMMENT='@deprecated 2025-01-22';
|
|
||||||
|
|
||||||
RENAME TABLE vn.splitLine TO vn.splitLine__;
|
|
||||||
ALTER TABLE vn.splitLine__ COMMENT='@deprecated 2025-01-22';
|
|
|
@ -1,3 +0,0 @@
|
||||||
-- Place your SQL code here
|
|
||||||
ALTER TABLE vn.travel ADD IF NOT EXISTS availabled DATETIME NULL
|
|
||||||
COMMENT 'Indicates the moment in time when the goods become available for picking';
|
|
|
@ -1,2 +0,0 @@
|
||||||
INSERT IGNORE INTO salix.ACL (model, property, accessType, permission, principalType, principalId)
|
|
||||||
VALUES('Entry', 'transfer', 'WRITE', 'ALLOW', 'ROLE', 'coolerBoss');
|
|
|
@ -1,2 +0,0 @@
|
||||||
ALTER TABLE vn.packaging
|
|
||||||
ADD COLUMN flippingCost decimal(10, 2) NOT NULL DEFAULT 0.00
|
|
|
@ -1 +0,0 @@
|
||||||
ALTER TABLE vn.travel CHANGE appointment appointment__ datetime DEFAULT NULL COMMENT '@deprecated 2025-01-28';
|
|
|
@ -1,2 +0,0 @@
|
||||||
ALTER TABLE `vn`.`awb`
|
|
||||||
ADD COLUMN `costPerKg` DECIMAL(10, 2) UNSIGNED DEFAULT NULL COMMENT 'Tarifa que indica a cuanto cuesta el kilo en ese vuelo';
|
|
|
@ -1,5 +0,0 @@
|
||||||
|
|
||||||
|
|
||||||
INSERT IGNORE INTO util.notification
|
|
||||||
SET name = 'misallocation-warehouse',
|
|
||||||
description = 'Misallocation in warehouse';
|
|
|
@ -1,3 +0,0 @@
|
||||||
ALTER TABLE vn.roadmap
|
|
||||||
MODIFY COLUMN dollyPlate varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT NULL NULL COMMENT
|
|
||||||
'Vehículo sin motor diseñado para conectarse a una unidad tractora, un camión o un vehículo tractor con fuerte potencia de tracción';
|
|
|
@ -1,3 +0,0 @@
|
||||||
ALTER TABLE vn.volumeConfig ADD COLUMN id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST;
|
|
||||||
|
|
||||||
GRANT UPDATE (palletM3) ON vn.volumeConfig TO deliveryBoss;
|
|
|
@ -1,3 +0,0 @@
|
||||||
ALTER TABLE vn.vehicle
|
|
||||||
MODIFY COLUMN typeFk enum('car','van','truck','trailer','tug','dolly','trailerLink')
|
|
||||||
CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT 'van' NOT NULL;
|
|
|
@ -1 +0,0 @@
|
||||||
ALTER TABLE vn.roadmap DROP COLUMN eta;
|
|
|
@ -1,8 +0,0 @@
|
||||||
UPDATE vn.expedition e
|
|
||||||
JOIN (
|
|
||||||
SELECT id
|
|
||||||
FROM vn.expedition
|
|
||||||
WHERE hostFk COLLATE utf8mb3_unicode_ci NOT IN
|
|
||||||
(SELECT code COLLATE utf8mb3_unicode_ci FROM vn.host WHERE code IS NOT NULL)
|
|
||||||
) s ON e.id = s.id
|
|
||||||
SET e.hostFk = 'pc336';
|
|
|
@ -1,9 +0,0 @@
|
||||||
ALTER TABLE vn.expedition
|
|
||||||
MODIFY COLUMN hostFk VARCHAR(30) COLLATE utf8mb3_general_ci;
|
|
||||||
|
|
||||||
ALTER TABLE vn.expedition
|
|
||||||
ADD CONSTRAINT fk_expedition_host_code
|
|
||||||
FOREIGN KEY (hostFk)
|
|
||||||
REFERENCES host(code)
|
|
||||||
ON UPDATE CASCADE
|
|
||||||
ON DELETE CASCADE;
|
|
|
@ -0,0 +1,65 @@
|
||||||
|
import selectors from '../../helpers/selectors.js';
|
||||||
|
import getBrowser from '../../helpers/puppeteer';
|
||||||
|
|
||||||
|
describe('Client defaulter path', () => {
|
||||||
|
let browser;
|
||||||
|
let page;
|
||||||
|
|
||||||
|
beforeAll(async() => {
|
||||||
|
browser = await getBrowser();
|
||||||
|
page = browser.page;
|
||||||
|
await page.loginAndModule('insurance', 'client');
|
||||||
|
await page.accessToSection('client.defaulter');
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async() => {
|
||||||
|
await browser.close();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should count the amount of clients in the turns section', async() => {
|
||||||
|
const result = await page.countElement(selectors.clientDefaulter.anyClient);
|
||||||
|
|
||||||
|
expect(result).toEqual(6);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should check contain expected client', async() => {
|
||||||
|
const clientName =
|
||||||
|
await page.waitToGetProperty(selectors.clientDefaulter.firstClientName, 'innerText');
|
||||||
|
const salesPersonName =
|
||||||
|
await page.waitToGetProperty(selectors.clientDefaulter.firstSalesPersonName, 'innerText');
|
||||||
|
|
||||||
|
expect(clientName).toEqual('Ororo Munroe');
|
||||||
|
expect(salesPersonName).toEqual('salesperson');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should first observation not changed', async() => {
|
||||||
|
const expectedObservation = 'Madness, as you know, is like gravity, all it takes is a little push';
|
||||||
|
const result = await page.waitToGetProperty(selectors.clientDefaulter.firstObservation, 'value');
|
||||||
|
|
||||||
|
expect(result).toContain(expectedObservation);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not add empty observation', async() => {
|
||||||
|
await page.waitToClick(selectors.clientDefaulter.allDefaulterCheckbox);
|
||||||
|
|
||||||
|
await page.waitToClick(selectors.clientDefaulter.addObservationButton);
|
||||||
|
await page.write(selectors.clientDefaulter.observation, '');
|
||||||
|
await page.waitToClick(selectors.clientDefaulter.saveButton);
|
||||||
|
const message = await page.waitForSnackbar();
|
||||||
|
|
||||||
|
expect(message.text).toContain(`The message can't be empty`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should checked all defaulters', async() => {
|
||||||
|
await page.loginAndModule('insurance', 'client');
|
||||||
|
await page.accessToSection('client.defaulter');
|
||||||
|
|
||||||
|
await page.waitToClick(selectors.clientDefaulter.allDefaulterCheckbox);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should add observation for all clients', async() => {
|
||||||
|
await page.waitToClick(selectors.clientDefaulter.addObservationButton);
|
||||||
|
await page.write(selectors.clientDefaulter.observation, 'My new observation');
|
||||||
|
await page.waitToClick(selectors.clientDefaulter.saveButton);
|
||||||
|
});
|
||||||
|
});
|
|
@ -58,10 +58,10 @@
|
||||||
"Swift / BIC can't be empty": "Swift / BIC can't be empty",
|
"Swift / BIC can't be empty": "Swift / BIC can't be empty",
|
||||||
"Deleted sales from ticket": "I have deleted the following lines from the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{deletions}}}",
|
"Deleted sales from ticket": "I have deleted the following lines from the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{deletions}}}",
|
||||||
"Added sale to ticket": "I have added the following line to the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{addition}}}",
|
"Added sale to ticket": "I have added the following line to the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{addition}}}",
|
||||||
"Changed sale discount": "I have changed the following lines discounts from the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}} {{ticketWeekly}}",
|
"Changed sale discount": "I have changed the following lines discounts from the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
|
||||||
"Created claim": "I have created the claim [{{claimId}}]({{{claimUrl}}}) for the following lines from the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
|
"Created claim": "I have created the claim [{{claimId}}]({{{claimUrl}}}) for the following lines from the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
|
||||||
"Changed sale price": "I have changed the price of [{{itemId}} {{concept}}]({{{itemUrl}}}) ({{quantity}}) from {{oldPrice}}€ ➔ *{{newPrice}}€* of the ticket [{{ticketId}}]({{{ticketUrl}}}) {{ticketWeekly}}",
|
"Changed sale price": "I have changed the price of [{{itemId}} {{concept}}]({{{itemUrl}}}) ({{quantity}}) from {{oldPrice}}€ ➔ *{{newPrice}}€* of the ticket [{{ticketId}}]({{{ticketUrl}}})",
|
||||||
"Changed sale quantity": "I have changed {{changes}} of the ticket [{{ticketId}}]({{{ticketUrl}}}) {{ticketWeekly}}",
|
"Changed sale quantity": "I have changed {{changes}} of the ticket [{{ticketId}}]({{{ticketUrl}}})",
|
||||||
"Changes in sales": "the quantity of [{{itemId}} {{concept}}]({{{itemUrl}}}) from {{oldQuantity}} ➔ *{{newQuantity}}*",
|
"Changes in sales": "the quantity of [{{itemId}} {{concept}}]({{{itemUrl}}}) from {{oldQuantity}} ➔ *{{newQuantity}}*",
|
||||||
"Changed sale reserved state": "I have changed the following lines reserved state from the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
|
"Changed sale reserved state": "I have changed the following lines reserved state from the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
|
||||||
"Bought units from buy request": "Bought {{quantity}} units of [{{itemId}} {{concept}}]({{{urlItem}}}) for the ticket id [{{ticketId}}]({{{url}}})",
|
"Bought units from buy request": "Bought {{quantity}} units of [{{itemId}} {{concept}}]({{{urlItem}}}) for the ticket id [{{ticketId}}]({{{url}}})",
|
||||||
|
@ -234,7 +234,6 @@
|
||||||
"It has been invoiced but the PDF of refund not be generated": "It has been invoiced but the PDF of refund not be generated",
|
"It has been invoiced but the PDF of refund not be generated": "It has been invoiced but the PDF of refund not be generated",
|
||||||
"Cannot add holidays on this day": "Cannot add holidays on this day",
|
"Cannot add holidays on this day": "Cannot add holidays on this day",
|
||||||
"Cannot send mail": "Cannot send mail",
|
"Cannot send mail": "Cannot send mail",
|
||||||
"This worker already exists": "This worker already exists",
|
|
||||||
"CONSTRAINT `chkParkingCodeFormat` failed for `vn`.`parking`": "CONSTRAINT `chkParkingCodeFormat` failed for `vn`.`parking`",
|
"CONSTRAINT `chkParkingCodeFormat` failed for `vn`.`parking`": "CONSTRAINT `chkParkingCodeFormat` failed for `vn`.`parking`",
|
||||||
"This postcode already exists": "This postcode already exists",
|
"This postcode already exists": "This postcode already exists",
|
||||||
"Original invoice not found": "Original invoice not found",
|
"Original invoice not found": "Original invoice not found",
|
||||||
|
@ -254,8 +253,5 @@
|
||||||
"Sales already moved": "Sales already moved",
|
"Sales already moved": "Sales already moved",
|
||||||
"Holidays to past days not available": "Holidays to past days not available",
|
"Holidays to past days not available": "Holidays to past days not available",
|
||||||
"Incorrect delivery order alert on route": "Incorrect delivery order alert on route: {{ route }} zone: {{ zone }}",
|
"Incorrect delivery order alert on route": "Incorrect delivery order alert on route: {{ route }} zone: {{ zone }}",
|
||||||
"Ticket has been delivered out of order": "The ticket {{ticket}} of route {{{fullUrl}}} has been delivered out of order.",
|
"Ticket has been delivered out of order": "The ticket {{ticket}} of route {{{fullUrl}}} has been delivered out of order."
|
||||||
"clonedFromTicketWeekly": ", that is a cloned sale from ticket {{ ticketWeekly }}",
|
}
|
||||||
"negativeReplaced": "Replaced item [#{{oldItemId}}]({{{oldItemUrl}}}) {{oldItem}} with [#{{newItemId}}]({{{newItemUrl}}}) {{newItem}} from ticket [{{ticketId}}]({{{ticketUrl}}})",
|
|
||||||
"The tag and priority can't be repeated": "The tag and priority can't be repeated"
|
|
||||||
}
|
|
|
@ -1,402 +1,400 @@
|
||||||
{
|
{
|
||||||
"Phone format is invalid": "El formato del teléfono no es correcto",
|
"Phone format is invalid": "El formato del teléfono no es correcto",
|
||||||
"You are not allowed to change the credit": "No tienes privilegios para modificar el crédito",
|
"You are not allowed to change the credit": "No tienes privilegios para modificar el crédito",
|
||||||
"Unable to mark the equivalence surcharge": "No se puede marcar el recargo de equivalencia",
|
"Unable to mark the equivalence surcharge": "No se puede marcar el recargo de equivalencia",
|
||||||
"The default consignee can not be unchecked": "No se puede desmarcar el consignatario predeterminado",
|
"The default consignee can not be unchecked": "No se puede desmarcar el consignatario predeterminado",
|
||||||
"Unable to default a disabled consignee": "No se puede poner predeterminado un consignatario desactivado",
|
"Unable to default a disabled consignee": "No se puede poner predeterminado un consignatario desactivado",
|
||||||
"Can't be blank": "No puede estar en blanco",
|
"Can't be blank": "No puede estar en blanco",
|
||||||
"Invalid TIN": "NIF/CIF inválido",
|
"Invalid TIN": "NIF/CIF inválido",
|
||||||
"TIN must be unique": "El NIF/CIF debe ser único",
|
"TIN must be unique": "El NIF/CIF debe ser único",
|
||||||
"A client with that Web User name already exists": "Ya existe un cliente con ese Usuario Web",
|
"A client with that Web User name already exists": "Ya existe un cliente con ese Usuario Web",
|
||||||
"Is invalid": "Es inválido",
|
"Is invalid": "Es inválido",
|
||||||
"Quantity cannot be zero": "La cantidad no puede ser cero",
|
"Quantity cannot be zero": "La cantidad no puede ser cero",
|
||||||
"Enter an integer different to zero": "Introduce un entero distinto de cero",
|
"Enter an integer different to zero": "Introduce un entero distinto de cero",
|
||||||
"Package cannot be blank": "El embalaje no puede estar en blanco",
|
"Package cannot be blank": "El embalaje no puede estar en blanco",
|
||||||
"The company name must be unique": "La razón social debe ser única",
|
"The company name must be unique": "La razón social debe ser única",
|
||||||
"Invalid email": "Correo electrónico inválido",
|
"Invalid email": "Correo electrónico inválido",
|
||||||
"The IBAN does not have the correct format": "El IBAN no tiene el formato correcto",
|
"The IBAN does not have the correct format": "El IBAN no tiene el formato correcto",
|
||||||
"That payment method requires an IBAN": "El método de pago seleccionado requiere un IBAN",
|
"That payment method requires an IBAN": "El método de pago seleccionado requiere un IBAN",
|
||||||
"That payment method requires a BIC": "El método de pago seleccionado requiere un BIC",
|
"That payment method requires a BIC": "El método de pago seleccionado requiere un BIC",
|
||||||
"State cannot be blank": "El estado no puede estar en blanco",
|
"State cannot be blank": "El estado no puede estar en blanco",
|
||||||
"Worker cannot be blank": "El trabajador no puede estar en blanco",
|
"Worker cannot be blank": "El trabajador no puede estar en blanco",
|
||||||
"Cannot change the payment method if no salesperson": "No se puede cambiar la forma de pago si no hay comercial asignado",
|
"Cannot change the payment method if no salesperson": "No se puede cambiar la forma de pago si no hay comercial asignado",
|
||||||
"can't be blank": "El campo no puede estar vacío",
|
"can't be blank": "El campo no puede estar vacío",
|
||||||
"Observation type must be unique": "El tipo de observación no puede repetirse",
|
"Observation type must be unique": "El tipo de observación no puede repetirse",
|
||||||
"The credit must be an integer greater than or equal to zero": "The credit must be an integer greater than or equal to zero",
|
"The credit must be an integer greater than or equal to zero": "The credit must be an integer greater than or equal to zero",
|
||||||
"The grade must be similar to the last one": "El grade debe ser similar al último",
|
"The grade must be similar to the last one": "El grade debe ser similar al último",
|
||||||
"Only manager can change the credit": "Solo el gerente puede cambiar el credito de este cliente",
|
"Only manager can change the credit": "Solo el gerente puede cambiar el credito de este cliente",
|
||||||
"Name cannot be blank": "El nombre no puede estar en blanco",
|
"Name cannot be blank": "El nombre no puede estar en blanco",
|
||||||
"Phone cannot be blank": "El teléfono no puede estar en blanco",
|
"Phone cannot be blank": "El teléfono no puede estar en blanco",
|
||||||
"Period cannot be blank": "El periodo no puede estar en blanco",
|
"Period cannot be blank": "El periodo no puede estar en blanco",
|
||||||
"Choose a company": "Selecciona una empresa",
|
"Choose a company": "Selecciona una empresa",
|
||||||
"Se debe rellenar el campo de texto": "Se debe rellenar el campo de texto",
|
"Se debe rellenar el campo de texto": "Se debe rellenar el campo de texto",
|
||||||
"Description should have maximum of 45 characters": "La descripción debe tener maximo 45 caracteres",
|
"Description should have maximum of 45 characters": "La descripción debe tener maximo 45 caracteres",
|
||||||
"Cannot be blank": "El campo no puede estar en blanco",
|
"Cannot be blank": "El campo no puede estar en blanco",
|
||||||
"The grade must be an integer greater than or equal to zero": "El grade debe ser un entero mayor o igual a cero",
|
"The grade must be an integer greater than or equal to zero": "El grade debe ser un entero mayor o igual a cero",
|
||||||
"Sample type cannot be blank": "El tipo de plantilla no puede quedar en blanco",
|
"Sample type cannot be blank": "El tipo de plantilla no puede quedar en blanco",
|
||||||
"Description cannot be blank": "Se debe rellenar el campo de texto",
|
"Description cannot be blank": "Se debe rellenar el campo de texto",
|
||||||
"The price of the item changed": "El precio del artículo cambió",
|
"The price of the item changed": "El precio del artículo cambió",
|
||||||
"The value should not be greater than 100%": "El valor no debe de ser mayor de 100%",
|
"The value should not be greater than 100%": "El valor no debe de ser mayor de 100%",
|
||||||
"The value should be a number": "El valor debe ser un numero",
|
"The value should be a number": "El valor debe ser un numero",
|
||||||
"This order is not editable": "Esta orden no se puede modificar",
|
"This order is not editable": "Esta orden no se puede modificar",
|
||||||
"You can't create an order for a frozen client": "No puedes crear una orden para un cliente congelado",
|
"You can't create an order for a frozen client": "No puedes crear una orden para un cliente congelado",
|
||||||
"You can't create an order for a client that has a debt": "No puedes crear una orden para un cliente con deuda",
|
"You can't create an order for a client that has a debt": "No puedes crear una orden para un cliente con deuda",
|
||||||
"is not a valid date": "No es una fecha valida",
|
"is not a valid date": "No es una fecha valida",
|
||||||
"Barcode must be unique": "El código de barras debe ser único",
|
"Barcode must be unique": "El código de barras debe ser único",
|
||||||
"The warehouse can't be repeated": "El almacén no puede repetirse",
|
"The warehouse can't be repeated": "El almacén no puede repetirse",
|
||||||
"The tag or priority can't be repeated for an item": "El tag o prioridad no puede repetirse para un item",
|
"The tag or priority can't be repeated for an item": "El tag o prioridad no puede repetirse para un item",
|
||||||
"The observation type can't be repeated": "El tipo de observación no puede repetirse",
|
"The observation type can't be repeated": "El tipo de observación no puede repetirse",
|
||||||
"A claim with that sale already exists": "Ya existe una reclamación para esta línea",
|
"A claim with that sale already exists": "Ya existe una reclamación para esta línea",
|
||||||
"You don't have enough privileges to change that field": "No tienes permisos para cambiar ese campo",
|
"You don't have enough privileges to change that field": "No tienes permisos para cambiar ese campo",
|
||||||
"Warehouse cannot be blank": "El almacén no puede quedar en blanco",
|
"Warehouse cannot be blank": "El almacén no puede quedar en blanco",
|
||||||
"Agency cannot be blank": "La agencia no puede quedar en blanco",
|
"Agency cannot be blank": "La agencia no puede quedar en blanco",
|
||||||
"Not enough privileges to edit a client with verified data": "No tienes permisos para hacer cambios en un cliente con datos comprobados",
|
"Not enough privileges to edit a client with verified data": "No tienes permisos para hacer cambios en un cliente con datos comprobados",
|
||||||
"This address doesn't exist": "Este consignatario no existe",
|
"This address doesn't exist": "Este consignatario no existe",
|
||||||
"You must delete the claim id %d first": "Antes debes borrar la reclamación %d",
|
"You must delete the claim id %d first": "Antes debes borrar la reclamación %d",
|
||||||
"You don't have enough privileges": "No tienes suficientes permisos",
|
"You don't have enough privileges": "No tienes suficientes permisos",
|
||||||
"Cannot check Equalization Tax in this NIF/CIF": "No se puede marcar RE en este NIF/CIF",
|
"Cannot check Equalization Tax in this NIF/CIF": "No se puede marcar RE en este NIF/CIF",
|
||||||
"You can't make changes on the basic data of an confirmed order or with rows": "No puedes cambiar los datos básicos de una orden con artículos",
|
"You can't make changes on the basic data of an confirmed order or with rows": "No puedes cambiar los datos básicos de una orden con artículos",
|
||||||
"INVALID_USER_NAME": "El nombre de usuario solo debe contener letras minúsculas o, a partir del segundo carácter, números o subguiones, no está permitido el uso de la letra ñ",
|
"INVALID_USER_NAME": "El nombre de usuario solo debe contener letras minúsculas o, a partir del segundo carácter, números o subguiones, no está permitido el uso de la letra ñ",
|
||||||
"You can't create a ticket for a frozen client": "No puedes crear un ticket para un cliente congelado",
|
"You can't create a ticket for a frozen client": "No puedes crear un ticket para un cliente congelado",
|
||||||
"You can't create a ticket for an inactive client": "No puedes crear un ticket para un cliente inactivo",
|
"You can't create a ticket for an inactive client": "No puedes crear un ticket para un cliente inactivo",
|
||||||
"Tag value cannot be blank": "El valor del tag no puede quedar en blanco",
|
"Tag value cannot be blank": "El valor del tag no puede quedar en blanco",
|
||||||
"ORDER_EMPTY": "Cesta vacía",
|
"ORDER_EMPTY": "Cesta vacía",
|
||||||
"You don't have enough privileges to do that": "No tienes permisos para cambiar esto",
|
"You don't have enough privileges to do that": "No tienes permisos para cambiar esto",
|
||||||
"NO SE PUEDE DESACTIVAR EL CONSIGNAT": "NO SE PUEDE DESACTIVAR EL CONSIGNAT",
|
"NO SE PUEDE DESACTIVAR EL CONSIGNAT": "NO SE PUEDE DESACTIVAR EL CONSIGNAT",
|
||||||
"Error. El NIF/CIF está repetido": "Error. El NIF/CIF está repetido",
|
"Error. El NIF/CIF está repetido": "Error. El NIF/CIF está repetido",
|
||||||
"Street cannot be empty": "Dirección no puede estar en blanco",
|
"Street cannot be empty": "Dirección no puede estar en blanco",
|
||||||
"City cannot be empty": "Ciudad no puede estar en blanco",
|
"City cannot be empty": "Ciudad no puede estar en blanco",
|
||||||
"Code cannot be blank": "Código no puede estar en blanco",
|
"Code cannot be blank": "Código no puede estar en blanco",
|
||||||
"You cannot remove this department": "No puedes eliminar este departamento",
|
"You cannot remove this department": "No puedes eliminar este departamento",
|
||||||
"The extension must be unique": "La extensión debe ser unica",
|
"The extension must be unique": "La extensión debe ser unica",
|
||||||
"The secret can't be blank": "La contraseña no puede estar en blanco",
|
"The secret can't be blank": "La contraseña no puede estar en blanco",
|
||||||
"We weren't able to send this SMS": "No hemos podido enviar el SMS",
|
"We weren't able to send this SMS": "No hemos podido enviar el SMS",
|
||||||
"This client can't be invoiced": "Este cliente no puede ser facturado",
|
"This client can't be invoiced": "Este cliente no puede ser facturado",
|
||||||
"You must provide the correction information to generate a corrective invoice": "Debes informar la información de corrección para generar una factura rectificativa",
|
"You must provide the correction information to generate a corrective invoice": "Debes informar la información de corrección para generar una factura rectificativa",
|
||||||
"This ticket can't be invoiced": "Este ticket no puede ser facturado",
|
"This ticket can't be invoiced": "Este ticket no puede ser facturado",
|
||||||
"You cannot add or modify services to an invoiced ticket": "No puedes añadir o modificar servicios a un ticket facturado",
|
"You cannot add or modify services to an invoiced ticket": "No puedes añadir o modificar servicios a un ticket facturado",
|
||||||
"This ticket can not be modified": "Este ticket no puede ser modificado",
|
"This ticket can not be modified": "Este ticket no puede ser modificado",
|
||||||
"The introduced hour already exists": "Esta hora ya ha sido introducida",
|
"The introduced hour already exists": "Esta hora ya ha sido introducida",
|
||||||
"INFINITE_LOOP": "Existe una dependencia entre dos Jefes",
|
"INFINITE_LOOP": "Existe una dependencia entre dos Jefes",
|
||||||
"The sales of the receiver ticket can't be modified": "Las lineas del ticket al que envias no pueden ser modificadas",
|
"The sales of the receiver ticket can't be modified": "Las lineas del ticket al que envias no pueden ser modificadas",
|
||||||
"NO_AGENCY_AVAILABLE": "No hay una zona de reparto disponible con estos parámetros",
|
"NO_AGENCY_AVAILABLE": "No hay una zona de reparto disponible con estos parámetros",
|
||||||
"ERROR_PAST_SHIPMENT": "No puedes seleccionar una fecha de envío en pasado",
|
"ERROR_PAST_SHIPMENT": "No puedes seleccionar una fecha de envío en pasado",
|
||||||
"The current ticket can't be modified": "El ticket actual no puede ser modificado",
|
"The current ticket can't be modified": "El ticket actual no puede ser modificado",
|
||||||
"The current claim can't be modified": "La reclamación actual no puede ser modificada",
|
"The current claim can't be modified": "La reclamación actual no puede ser modificada",
|
||||||
"The sales of this ticket can't be modified": "Las lineas de este ticket no pueden ser modificadas",
|
"The sales of this ticket can't be modified": "Las lineas de este ticket no pueden ser modificadas",
|
||||||
"The sales do not exists": "La(s) línea(s) seleccionada(s) no existe(n)",
|
"The sales do not exists": "La(s) línea(s) seleccionada(s) no existe(n)",
|
||||||
"Please select at least one sale": "Por favor selecciona al menos una linea",
|
"Please select at least one sale": "Por favor selecciona al menos una linea",
|
||||||
"All sales must belong to the same ticket": "Todas las lineas deben pertenecer al mismo ticket",
|
"All sales must belong to the same ticket": "Todas las lineas deben pertenecer al mismo ticket",
|
||||||
"NO_ZONE_FOR_THIS_PARAMETERS": "Para este día no hay ninguna zona configurada",
|
"NO_ZONE_FOR_THIS_PARAMETERS": "Para este día no hay ninguna zona configurada",
|
||||||
"This item doesn't exists": "El artículo no existe",
|
"This item doesn't exists": "El artículo no existe",
|
||||||
"NOT_ZONE_WITH_THIS_PARAMETERS": "Para este día no hay ninguna zona configurada",
|
"NOT_ZONE_WITH_THIS_PARAMETERS": "Para este día no hay ninguna zona configurada",
|
||||||
"Extension format is invalid": "El formato de la extensión es inválido",
|
"Extension format is invalid": "El formato de la extensión es inválido",
|
||||||
"Invalid parameters to create a new ticket": "Parámetros inválidos para crear un nuevo ticket",
|
"Invalid parameters to create a new ticket": "Parámetros inválidos para crear un nuevo ticket",
|
||||||
"This item is not available": "Este artículo no está disponible",
|
"This item is not available": "Este artículo no está disponible",
|
||||||
"This postcode already exists": "Este código postal ya existe",
|
"This postcode already exists": "Este código postal ya existe",
|
||||||
"Concept cannot be blank": "El concepto no puede quedar en blanco",
|
"Concept cannot be blank": "El concepto no puede quedar en blanco",
|
||||||
"File doesn't exists": "El archivo no existe",
|
"File doesn't exists": "El archivo no existe",
|
||||||
"You don't have privileges to change the zone": "No tienes permisos para cambiar la zona o para esos parámetros hay más de una opción de envío, hable con las agencias",
|
"You don't have privileges to change the zone": "No tienes permisos para cambiar la zona o para esos parámetros hay más de una opción de envío, hable con las agencias",
|
||||||
"This ticket is already on weekly tickets": "Este ticket ya está en tickets programados",
|
"This ticket is already on weekly tickets": "Este ticket ya está en tickets programados",
|
||||||
"Ticket id cannot be blank": "El id de ticket no puede quedar en blanco",
|
"Ticket id cannot be blank": "El id de ticket no puede quedar en blanco",
|
||||||
"Weekday cannot be blank": "El día de la semana no puede quedar en blanco",
|
"Weekday cannot be blank": "El día de la semana no puede quedar en blanco",
|
||||||
"You can't delete a confirmed order": "No puedes borrar un pedido confirmado",
|
"You can't delete a confirmed order": "No puedes borrar un pedido confirmado",
|
||||||
"The social name has an invalid format": "El nombre fiscal tiene un formato incorrecto",
|
"The social name has an invalid format": "El nombre fiscal tiene un formato incorrecto",
|
||||||
"Invalid quantity": "Cantidad invalida",
|
"Invalid quantity": "Cantidad invalida",
|
||||||
"This postal code is not valid": "Este código postal no es válido",
|
"This postal code is not valid": "Este código postal no es válido",
|
||||||
"is invalid": "es inválido",
|
"is invalid": "es inválido",
|
||||||
"The postcode doesn't exist. Please enter a correct one": "El código postal no existe. Por favor, introduce uno correcto",
|
"The postcode doesn't exist. Please enter a correct one": "El código postal no existe. Por favor, introduce uno correcto",
|
||||||
"The department name can't be repeated": "El nombre del departamento no puede repetirse",
|
"The department name can't be repeated": "El nombre del departamento no puede repetirse",
|
||||||
"This phone already exists": "Este teléfono ya existe",
|
"This phone already exists": "Este teléfono ya existe",
|
||||||
"You cannot move a parent to its own sons": "No puedes mover un elemento padre a uno de sus hijos",
|
"You cannot move a parent to its own sons": "No puedes mover un elemento padre a uno de sus hijos",
|
||||||
"You can't create a claim for a removed ticket": "No puedes crear una reclamación para un ticket eliminado",
|
"You can't create a claim for a removed ticket": "No puedes crear una reclamación para un ticket eliminado",
|
||||||
"You cannot delete a ticket that part of it is being prepared": "No puedes eliminar un ticket en el que una parte que está siendo preparada",
|
"You cannot delete a ticket that part of it is being prepared": "No puedes eliminar un ticket en el que una parte que está siendo preparada",
|
||||||
"You must delete all the buy requests first": "Debes eliminar todas las peticiones de compra primero",
|
"You must delete all the buy requests first": "Debes eliminar todas las peticiones de compra primero",
|
||||||
"You should specify a date": "Debes especificar una fecha",
|
"You should specify a date": "Debes especificar una fecha",
|
||||||
"You should specify at least a start or end date": "Debes especificar al menos una fecha de inicio o de fin",
|
"You should specify at least a start or end date": "Debes especificar al menos una fecha de inicio o de fin",
|
||||||
"Start date should be lower than end date": "La fecha de inicio debe ser menor que la fecha de fin",
|
"Start date should be lower than end date": "La fecha de inicio debe ser menor que la fecha de fin",
|
||||||
"You should mark at least one week day": "Debes marcar al menos un día de la semana",
|
"You should mark at least one week day": "Debes marcar al menos un día de la semana",
|
||||||
"Swift / BIC can't be empty": "Swift / BIC no puede estar vacío",
|
"Swift / BIC can't be empty": "Swift / BIC no puede estar vacío",
|
||||||
"Customs agent is required for a non UEE member": "El agente de aduanas es requerido para los clientes extracomunitarios",
|
"Customs agent is required for a non UEE member": "El agente de aduanas es requerido para los clientes extracomunitarios",
|
||||||
"Incoterms is required for a non UEE member": "El incoterms es requerido para los clientes extracomunitarios",
|
"Incoterms is required for a non UEE member": "El incoterms es requerido para los clientes extracomunitarios",
|
||||||
"Deleted sales from ticket": "He eliminado las siguientes lineas del ticket [{{ticketId}}]({{{ticketUrl}}}): {{{deletions}}}",
|
"Deleted sales from ticket": "He eliminado las siguientes lineas del ticket [{{ticketId}}]({{{ticketUrl}}}): {{{deletions}}}",
|
||||||
"Added sale to ticket": "He añadido la siguiente linea al ticket [{{ticketId}}]({{{ticketUrl}}}): {{{addition}}}",
|
"Added sale to ticket": "He añadido la siguiente linea al ticket [{{ticketId}}]({{{ticketUrl}}}): {{{addition}}}",
|
||||||
"Changed sale discount": "He cambiado el descuento de las siguientes lineas al ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}} {{ticketWeekly}}",
|
"Changed sale discount": "He cambiado el descuento de las siguientes lineas al ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
|
||||||
"Created claim": "He creado la reclamación [{{claimId}}]({{{claimUrl}}}) de las siguientes lineas del ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
|
"Created claim": "He creado la reclamación [{{claimId}}]({{{claimUrl}}}) de las siguientes lineas del ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
|
||||||
"Changed sale price": "He cambiado el precio de [{{itemId}} {{concept}}]({{{itemUrl}}}) ({{quantity}}) de {{oldPrice}}€ ➔ *{{newPrice}}€* del ticket [{{ticketId}}]({{{ticketUrl}}}) {{ticketWeekly}} ",
|
"Changed sale price": "He cambiado el precio de [{{itemId}} {{concept}}]({{{itemUrl}}}) ({{quantity}}) de {{oldPrice}}€ ➔ *{{newPrice}}€* del ticket [{{ticketId}}]({{{ticketUrl}}})",
|
||||||
"Changed sale quantity": "He cambiado {{changes}} del ticket [{{ticketId}}]({{{ticketUrl}}}) {{ticketWeekly}}",
|
"Changed sale quantity": "He cambiado {{changes}} del ticket [{{ticketId}}]({{{ticketUrl}}})",
|
||||||
"Changes in sales": "la cantidad de [{{itemId}} {{concept}}]({{{itemUrl}}}) de {{oldQuantity}} ➔ *{{newQuantity}}*",
|
"Changes in sales": "la cantidad de [{{itemId}} {{concept}}]({{{itemUrl}}}) de {{oldQuantity}} ➔ *{{newQuantity}}*",
|
||||||
"State": "Estado",
|
"State": "Estado",
|
||||||
"regular": "normal",
|
"regular": "normal",
|
||||||
"reserved": "reservado",
|
"reserved": "reservado",
|
||||||
"Changed sale reserved state": "He cambiado el estado reservado de las siguientes lineas al ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
|
"Changed sale reserved state": "He cambiado el estado reservado de las siguientes lineas al ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
|
||||||
"Bought units from buy request": "Se ha comprado {{quantity}} unidades de [{{itemId}} {{concept}}]({{{urlItem}}}) para el ticket id [{{ticketId}}]({{{url}}})",
|
"Bought units from buy request": "Se ha comprado {{quantity}} unidades de [{{itemId}} {{concept}}]({{{urlItem}}}) para el ticket id [{{ticketId}}]({{{url}}})",
|
||||||
"Deny buy request": "Se ha rechazado la petición de compra para el ticket id [{{ticketId}}]({{{url}}}). Motivo: {{observation}}",
|
"Deny buy request": "Se ha rechazado la petición de compra para el ticket id [{{ticketId}}]({{{url}}}). Motivo: {{observation}}",
|
||||||
"MESSAGE_INSURANCE_CHANGE": "He cambiado el crédito asegurado del cliente [{{clientName}} ({{clientId}})]({{{url}}}) a *{{credit}} €*",
|
"MESSAGE_INSURANCE_CHANGE": "He cambiado el crédito asegurado del cliente [{{clientName}} ({{clientId}})]({{{url}}}) a *{{credit}} €*",
|
||||||
"Changed client paymethod": "He cambiado la forma de pago del cliente [{{clientName}} ({{clientId}})]({{{url}}})",
|
"Changed client paymethod": "He cambiado la forma de pago del cliente [{{clientName}} ({{clientId}})]({{{url}}})",
|
||||||
"Sent units from ticket": "Envio *{{quantity}}* unidades de [{{concept}} ({{itemId}})]({{{itemUrl}}}) a *\"{{nickname}}\"* provenientes del ticket id [{{ticketId}}]({{{ticketUrl}}})",
|
"Sent units from ticket": "Envio *{{quantity}}* unidades de [{{concept}} ({{itemId}})]({{{itemUrl}}}) a *\"{{nickname}}\"* provenientes del ticket id [{{ticketId}}]({{{ticketUrl}}})",
|
||||||
"Change quantity": "{{concept}} cambia de {{oldQuantity}} a {{newQuantity}}",
|
"Change quantity": "{{concept}} cambia de {{oldQuantity}} a {{newQuantity}}",
|
||||||
"Claim will be picked": "Se recogerá el género de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}*, con el tipo de recogida *{{claimPickup}}*",
|
"Claim will be picked": "Se recogerá el género de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}*, con el tipo de recogida *{{claimPickup}}*",
|
||||||
"Claim state has changed to": "Se ha cambiado el estado de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}* a *{{newState}}*",
|
"Claim state has changed to": "Se ha cambiado el estado de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}* a *{{newState}}*",
|
||||||
"Client checked as validated despite of duplication": "Cliente comprobado a pesar de que existe el cliente id {{clientId}}",
|
"Client checked as validated despite of duplication": "Cliente comprobado a pesar de que existe el cliente id {{clientId}}",
|
||||||
"ORDER_ROW_UNAVAILABLE": "No hay disponibilidad de este producto",
|
"ORDER_ROW_UNAVAILABLE": "No hay disponibilidad de este producto",
|
||||||
"Distance must be lesser than 4000": "La distancia debe ser inferior a 4000",
|
"Distance must be lesser than 4000": "La distancia debe ser inferior a 4000",
|
||||||
"This ticket is deleted": "Este ticket está eliminado",
|
"This ticket is deleted": "Este ticket está eliminado",
|
||||||
"Unable to clone this travel": "No ha sido posible clonar este travel",
|
"Unable to clone this travel": "No ha sido posible clonar este travel",
|
||||||
"This thermograph id already exists": "La id del termógrafo ya existe",
|
"This thermograph id already exists": "La id del termógrafo ya existe",
|
||||||
"Choose a date range or days forward": "Selecciona un rango de fechas o días en adelante",
|
"Choose a date range or days forward": "Selecciona un rango de fechas o días en adelante",
|
||||||
"ORDER_ALREADY_CONFIRMED": "ORDEN YA CONFIRMADA",
|
"ORDER_ALREADY_CONFIRMED": "ORDEN YA CONFIRMADA",
|
||||||
"Invalid password": "Invalid password",
|
"Invalid password": "Invalid password",
|
||||||
"Password does not meet requirements": "La contraseña no cumple los requisitos",
|
"Password does not meet requirements": "La contraseña no cumple los requisitos",
|
||||||
"Role already assigned": "Rol ya asignado",
|
"Role already assigned": "Rol ya asignado",
|
||||||
"Invalid role name": "Nombre de rol no válido",
|
"Invalid role name": "Nombre de rol no válido",
|
||||||
"Role name must be written in camelCase": "El nombre del rol debe escribirse en camelCase",
|
"Role name must be written in camelCase": "El nombre del rol debe escribirse en camelCase",
|
||||||
"Email already exists": "El correo ya existe",
|
"Email already exists": "El correo ya existe",
|
||||||
"User already exists": "El/La usuario/a ya existe",
|
"User already exists": "El/La usuario/a ya existe",
|
||||||
"Absence change notification on the labour calendar": "Notificación de cambio de ausencia en el calendario laboral",
|
"Absence change notification on the labour calendar": "Notificación de cambio de ausencia en el calendario laboral",
|
||||||
"Record of hours week": "Registro de horas semana {{week}} año {{year}} ",
|
"Record of hours week": "Registro de horas semana {{week}} año {{year}} ",
|
||||||
"Created absence": "El empleado <strong>{{author}}</strong> ha añadido una ausencia de tipo '{{absenceType}}' a <a href='{{{workerUrl}}}'><strong>{{employee}}</strong></a> para el día {{dated}}.",
|
"Created absence": "El empleado <strong>{{author}}</strong> ha añadido una ausencia de tipo '{{absenceType}}' a <a href='{{{workerUrl}}}'><strong>{{employee}}</strong></a> para el día {{dated}}.",
|
||||||
"Deleted absence": "El empleado <strong>{{author}}</strong> ha eliminado una ausencia de tipo '{{absenceType}}' a <a href='{{{workerUrl}}}'><strong>{{employee}}</strong></a> del día {{dated}}.",
|
"Deleted absence": "El empleado <strong>{{author}}</strong> ha eliminado una ausencia de tipo '{{absenceType}}' a <a href='{{{workerUrl}}}'><strong>{{employee}}</strong></a> del día {{dated}}.",
|
||||||
"I have deleted the ticket id": "He eliminado el ticket id [{{id}}]({{{url}}})",
|
"I have deleted the ticket id": "He eliminado el ticket id [{{id}}]({{{url}}})",
|
||||||
"I have restored the ticket id": "He restaurado el ticket id [{{id}}]({{{url}}})",
|
"I have restored the ticket id": "He restaurado el ticket id [{{id}}]({{{url}}})",
|
||||||
"You can only restore a ticket within the first hour after deletion": "Únicamente puedes restaurar el ticket dentro de la primera hora después de su eliminación",
|
"You can only restore a ticket within the first hour after deletion": "Únicamente puedes restaurar el ticket dentro de la primera hora después de su eliminación",
|
||||||
"Changed this data from the ticket": "He cambiado estos datos del ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
|
"Changed this data from the ticket": "He cambiado estos datos del ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
|
||||||
"agencyModeFk": "Agencia",
|
"agencyModeFk": "Agencia",
|
||||||
"clientFk": "Cliente",
|
"clientFk": "Cliente",
|
||||||
"zoneFk": "Zona",
|
"zoneFk": "Zona",
|
||||||
"warehouseFk": "Almacén",
|
"warehouseFk": "Almacén",
|
||||||
"shipped": "F. envío",
|
"shipped": "F. envío",
|
||||||
"landed": "F. entrega",
|
"landed": "F. entrega",
|
||||||
"addressFk": "Consignatario",
|
"addressFk": "Consignatario",
|
||||||
"companyFk": "Empresa",
|
"companyFk": "Empresa",
|
||||||
"agency": "Agencia",
|
"agency": "Agencia",
|
||||||
"delivery": "Reparto",
|
"delivery": "Reparto",
|
||||||
"The social name cannot be empty": "La razón social no puede quedar en blanco",
|
"The social name cannot be empty": "La razón social no puede quedar en blanco",
|
||||||
"The nif cannot be empty": "El NIF no puede quedar en blanco",
|
"The nif cannot be empty": "El NIF no puede quedar en blanco",
|
||||||
"You need to fill sage information before you check verified data": "Debes rellenar la información de sage antes de marcar datos comprobados",
|
"You need to fill sage information before you check verified data": "Debes rellenar la información de sage antes de marcar datos comprobados",
|
||||||
"ASSIGN_ZONE_FIRST": "Asigna una zona primero",
|
"ASSIGN_ZONE_FIRST": "Asigna una zona primero",
|
||||||
"Amount cannot be zero": "El importe no puede ser cero",
|
"Amount cannot be zero": "El importe no puede ser cero",
|
||||||
"Company has to be official": "Empresa inválida",
|
"Company has to be official": "Empresa inválida",
|
||||||
"You can not select this payment method without a registered bankery account": "No se puede utilizar este método de pago si no has registrado una cuenta bancaria",
|
"You can not select this payment method without a registered bankery account": "No se puede utilizar este método de pago si no has registrado una cuenta bancaria",
|
||||||
"Action not allowed on the test environment": "Esta acción no está permitida en el entorno de pruebas",
|
"Action not allowed on the test environment": "Esta acción no está permitida en el entorno de pruebas",
|
||||||
"The selected ticket is not suitable for this route": "El ticket seleccionado no es apto para esta ruta",
|
"The selected ticket is not suitable for this route": "El ticket seleccionado no es apto para esta ruta",
|
||||||
"New ticket request has been created with price": "Se ha creado una nueva petición de compra '{{description}}' para el día *{{shipped}}*, con una cantidad de *{{quantity}}* y un precio de *{{price}} €*",
|
"New ticket request has been created with price": "Se ha creado una nueva petición de compra '{{description}}' para el día *{{shipped}}*, con una cantidad de *{{quantity}}* y un precio de *{{price}} €*",
|
||||||
"New ticket request has been created": "Se ha creado una nueva petición de compra '{{description}}' para el día *{{shipped}}*, con una cantidad de *{{quantity}}*",
|
"New ticket request has been created": "Se ha creado una nueva petición de compra '{{description}}' para el día *{{shipped}}*, con una cantidad de *{{quantity}}*",
|
||||||
"Swift / BIC cannot be empty": "Swift / BIC no puede estar vacío",
|
"Swift / BIC cannot be empty": "Swift / BIC no puede estar vacío",
|
||||||
"This BIC already exist.": "Este BIC ya existe.",
|
"This BIC already exist.": "Este BIC ya existe.",
|
||||||
"That item doesn't exists": "Ese artículo no existe",
|
"That item doesn't exists": "Ese artículo no existe",
|
||||||
"There's a new urgent ticket:": "Hay un nuevo ticket urgente:",
|
"There's a new urgent ticket:": "Hay un nuevo ticket urgente:",
|
||||||
"Invalid account": "Cuenta inválida",
|
"Invalid account": "Cuenta inválida",
|
||||||
"Compensation account is empty": "La cuenta para compensar está vacia",
|
"Compensation account is empty": "La cuenta para compensar está vacia",
|
||||||
"This genus already exist": "Este genus ya existe",
|
"This genus already exist": "Este genus ya existe",
|
||||||
"This specie already exist": "Esta especie ya existe",
|
"This specie already exist": "Esta especie ya existe",
|
||||||
"Client assignment has changed": "He cambiado el comercial ~*\"<{{previousWorkerName}}>\"*~ por *\"<{{currentWorkerName}}>\"* del cliente [{{clientName}} ({{clientId}})]({{{url}}})",
|
"Client assignment has changed": "He cambiado el comercial ~*\"<{{previousWorkerName}}>\"*~ por *\"<{{currentWorkerName}}>\"* del cliente [{{clientName}} ({{clientId}})]({{{url}}})",
|
||||||
"None": "Ninguno",
|
"None": "Ninguno",
|
||||||
"The contract was not active during the selected date": "El contrato no estaba activo durante la fecha seleccionada",
|
"The contract was not active during the selected date": "El contrato no estaba activo durante la fecha seleccionada",
|
||||||
"Cannot add more than one '1/2 day vacation'": "No puedes añadir más de un 'Vacaciones 1/2 dia'",
|
"Cannot add more than one '1/2 day vacation'": "No puedes añadir más de un 'Vacaciones 1/2 dia'",
|
||||||
"This document already exists on this ticket": "Este documento ya existe en el ticket",
|
"This document already exists on this ticket": "Este documento ya existe en el ticket",
|
||||||
"Some of the selected tickets are not billable": "Algunos de los tickets seleccionados no son facturables",
|
"Some of the selected tickets are not billable": "Algunos de los tickets seleccionados no son facturables",
|
||||||
"You can't invoice tickets from multiple clients": "No puedes facturar tickets de multiples clientes",
|
"You can't invoice tickets from multiple clients": "No puedes facturar tickets de multiples clientes",
|
||||||
"nickname": "nickname",
|
"nickname": "nickname",
|
||||||
"INACTIVE_PROVIDER": "Proveedor inactivo",
|
"INACTIVE_PROVIDER": "Proveedor inactivo",
|
||||||
"This client is not invoiceable": "Este cliente no es facturable",
|
"This client is not invoiceable": "Este cliente no es facturable",
|
||||||
"serial non editable": "Esta serie no permite asignar la referencia",
|
"serial non editable": "Esta serie no permite asignar la referencia",
|
||||||
"Max shipped required": "La fecha límite es requerida",
|
"Max shipped required": "La fecha límite es requerida",
|
||||||
"Can't invoice to future": "No se puede facturar a futuro",
|
"Can't invoice to future": "No se puede facturar a futuro",
|
||||||
"Can't invoice to past": "No se puede facturar a pasado",
|
"Can't invoice to past": "No se puede facturar a pasado",
|
||||||
"This ticket is already invoiced": "Este ticket ya está facturado",
|
"This ticket is already invoiced": "Este ticket ya está facturado",
|
||||||
"A ticket with an amount of zero can't be invoiced": "No se puede facturar un ticket con importe cero",
|
"A ticket with an amount of zero can't be invoiced": "No se puede facturar un ticket con importe cero",
|
||||||
"A ticket with a negative base can't be invoiced": "No se puede facturar un ticket con una base negativa",
|
"A ticket with a negative base can't be invoiced": "No se puede facturar un ticket con una base negativa",
|
||||||
"Global invoicing failed": "[Facturación global] No se han podido facturar algunos clientes",
|
"Global invoicing failed": "[Facturación global] No se han podido facturar algunos clientes",
|
||||||
"Wasn't able to invoice the following clients": "No se han podido facturar los siguientes clientes",
|
"Wasn't able to invoice the following clients": "No se han podido facturar los siguientes clientes",
|
||||||
"Can't verify data unless the client has a business type": "No se puede verificar datos de un cliente que no tiene tipo de negocio",
|
"Can't verify data unless the client has a business type": "No se puede verificar datos de un cliente que no tiene tipo de negocio",
|
||||||
"You don't have enough privileges to set this credit amount": "No tienes suficientes privilegios para establecer esta cantidad de crédito",
|
"You don't have enough privileges to set this credit amount": "No tienes suficientes privilegios para establecer esta cantidad de crédito",
|
||||||
"You can't change the credit set to zero from a financialBoss": "No puedes cambiar el cŕedito establecido a cero por un jefe de finanzas",
|
"You can't change the credit set to zero from a financialBoss": "No puedes cambiar el cŕedito establecido a cero por un jefe de finanzas",
|
||||||
"Amounts do not match": "Las cantidades no coinciden",
|
"Amounts do not match": "Las cantidades no coinciden",
|
||||||
"The PDF document does not exist": "El documento PDF no existe. Prueba a regenerarlo desde la opción 'Regenerar PDF factura'",
|
"The PDF document does not exist": "El documento PDF no existe. Prueba a regenerarlo desde la opción 'Regenerar PDF factura'",
|
||||||
"The type of business must be filled in basic data": "El tipo de negocio debe estar rellenado en datos básicos",
|
"The type of business must be filled in basic data": "El tipo de negocio debe estar rellenado en datos básicos",
|
||||||
"You can't create a claim from a ticket delivered more than seven days ago": "No puedes crear una reclamación de un ticket entregado hace más de siete días",
|
"You can't create a claim from a ticket delivered more than seven days ago": "No puedes crear una reclamación de un ticket entregado hace más de siete días",
|
||||||
"The worker has hours recorded that day": "El trabajador tiene horas fichadas ese día",
|
"The worker has hours recorded that day": "El trabajador tiene horas fichadas ese día",
|
||||||
"The worker has a marked absence that day": "El trabajador tiene marcada una ausencia ese día",
|
"The worker has a marked absence that day": "El trabajador tiene marcada una ausencia ese día",
|
||||||
"You can not modify is pay method checked": "No se puede modificar el campo método de pago validado",
|
"You can not modify is pay method checked": "No se puede modificar el campo método de pago validado",
|
||||||
"The account size must be exactly 10 characters": "El tamaño de la cuenta debe ser exactamente de 10 caracteres",
|
"The account size must be exactly 10 characters": "El tamaño de la cuenta debe ser exactamente de 10 caracteres",
|
||||||
"Can't transfer claimed sales": "No puedes transferir lineas reclamadas",
|
"Can't transfer claimed sales": "No puedes transferir lineas reclamadas",
|
||||||
"You don't have privileges to create refund": "No tienes permisos para crear un abono",
|
"You don't have privileges to create refund": "No tienes permisos para crear un abono",
|
||||||
"The item is required": "El artículo es requerido",
|
"The item is required": "El artículo es requerido",
|
||||||
"The agency is already assigned to another autonomous": "La agencia ya está asignada a otro autónomo",
|
"The agency is already assigned to another autonomous": "La agencia ya está asignada a otro autónomo",
|
||||||
"date in the future": "Fecha en el futuro",
|
"date in the future": "Fecha en el futuro",
|
||||||
"reference duplicated": "Referencia duplicada",
|
"reference duplicated": "Referencia duplicada",
|
||||||
"This ticket is already a refund": "Este ticket ya es un abono",
|
"This ticket is already a refund": "Este ticket ya es un abono",
|
||||||
"isWithoutNegatives": "Sin negativos",
|
"isWithoutNegatives": "Sin negativos",
|
||||||
"routeFk": "routeFk",
|
"routeFk": "routeFk",
|
||||||
"Can't change the password of another worker": "No se puede cambiar la contraseña de otro trabajador",
|
"Can't change the password of another worker": "No se puede cambiar la contraseña de otro trabajador",
|
||||||
"No hay un contrato en vigor": "No hay un contrato en vigor",
|
"No hay un contrato en vigor": "No hay un contrato en vigor",
|
||||||
"No se permite fichar a futuro": "No se permite fichar a futuro",
|
"No se permite fichar a futuro": "No se permite fichar a futuro",
|
||||||
"No está permitido trabajar": "No está permitido trabajar",
|
"No está permitido trabajar": "No está permitido trabajar",
|
||||||
"Fichadas impares": "Fichadas impares",
|
"Fichadas impares": "Fichadas impares",
|
||||||
"Descanso diario 12h.": "Descanso diario 12h.",
|
"Descanso diario 12h.": "Descanso diario 12h.",
|
||||||
"Descanso semanal 36h. / 72h.": "Descanso semanal 36h. / 72h.",
|
"Descanso semanal 36h. / 72h.": "Descanso semanal 36h. / 72h.",
|
||||||
"Dirección incorrecta": "Dirección incorrecta",
|
"Dirección incorrecta": "Dirección incorrecta",
|
||||||
"Modifiable user details only by an administrator": "Detalles de usuario modificables solo por un administrador",
|
"Modifiable user details only by an administrator": "Detalles de usuario modificables solo por un administrador",
|
||||||
"Modifiable password only via recovery or by an administrator": "Contraseña modificable solo a través de la recuperación o por un administrador",
|
"Modifiable password only via recovery or by an administrator": "Contraseña modificable solo a través de la recuperación o por un administrador",
|
||||||
"Not enough privileges to edit a client": "No tienes suficientes privilegios para editar un cliente",
|
"Not enough privileges to edit a client": "No tienes suficientes privilegios para editar un cliente",
|
||||||
"This route does not exists": "Esta ruta no existe",
|
"This route does not exists": "Esta ruta no existe",
|
||||||
"Claim pickup order sent": "Reclamación Orden de recogida enviada [{{claimId}}]({{{claimUrl}}}) al cliente *{{clientName}}*",
|
"Claim pickup order sent": "Reclamación Orden de recogida enviada [{{claimId}}]({{{claimUrl}}}) al cliente *{{clientName}}*",
|
||||||
"You don't have grant privilege": "No tienes privilegios para dar privilegios",
|
"You don't have grant privilege": "No tienes privilegios para dar privilegios",
|
||||||
"You don't own the role and you can't assign it to another user": "No eres el propietario del rol y no puedes asignarlo a otro usuario",
|
"You don't own the role and you can't assign it to another user": "No eres el propietario del rol y no puedes asignarlo a otro usuario",
|
||||||
"Ticket merged": "Ticket [{{originId}}]({{{originFullPath}}}) ({{{originDated}}}) fusionado con [{{destinationId}}]({{{destinationFullPath}}}) ({{{destinationDated}}})",
|
"Ticket merged": "Ticket [{{originId}}]({{{originFullPath}}}) ({{{originDated}}}) fusionado con [{{destinationId}}]({{{destinationFullPath}}}) ({{{destinationDated}}})",
|
||||||
"Already has this status": "Ya tiene este estado",
|
"Already has this status": "Ya tiene este estado",
|
||||||
"There aren't records for this week": "No existen registros para esta semana",
|
"There aren't records for this week": "No existen registros para esta semana",
|
||||||
"Empty data source": "Origen de datos vacio",
|
"Empty data source": "Origen de datos vacio",
|
||||||
"App locked": "Aplicación bloqueada por el usuario {{userId}}",
|
"App locked": "Aplicación bloqueada por el usuario {{userId}}",
|
||||||
"Email verify": "Correo de verificación",
|
"Email verify": "Correo de verificación",
|
||||||
"Landing cannot be lesser than shipment": "Landing cannot be lesser than shipment",
|
"Landing cannot be lesser than shipment": "Landing cannot be lesser than shipment",
|
||||||
"Receipt's bank was not found": "No se encontró el banco del recibo",
|
"Receipt's bank was not found": "No se encontró el banco del recibo",
|
||||||
"This receipt was not compensated": "Este recibo no ha sido compensado",
|
"This receipt was not compensated": "Este recibo no ha sido compensado",
|
||||||
"Client's email was not found": "No se encontró el email del cliente",
|
"Client's email was not found": "No se encontró el email del cliente",
|
||||||
"Negative basis": "Base negativa",
|
"Negative basis": "Base negativa",
|
||||||
"This worker code already exists": "Este codigo de trabajador ya existe",
|
"This worker code already exists": "Este codigo de trabajador ya existe",
|
||||||
"This personal mail already exists": "Este correo personal ya existe",
|
"This personal mail already exists": "Este correo personal ya existe",
|
||||||
"This worker already exists": "Este trabajador ya existe",
|
"This worker already exists": "Este trabajador ya existe",
|
||||||
"App name does not exist": "El nombre de aplicación no es válido",
|
"App name does not exist": "El nombre de aplicación no es válido",
|
||||||
"Try again": "Vuelve a intentarlo",
|
"Try again": "Vuelve a intentarlo",
|
||||||
"Aplicación bloqueada por el usuario 9": "Aplicación bloqueada por el usuario 9",
|
"Aplicación bloqueada por el usuario 9": "Aplicación bloqueada por el usuario 9",
|
||||||
"Failed to upload delivery note": "Error al subir albarán {{id}}",
|
"Failed to upload delivery note": "Error al subir albarán {{id}}",
|
||||||
"The DOCUWARE PDF document does not exists": "El documento PDF Docuware no existe",
|
"The DOCUWARE PDF document does not exists": "El documento PDF Docuware no existe",
|
||||||
"It is not possible to modify tracked sales": "No es posible modificar líneas de pedido que se hayan empezado a preparar",
|
"It is not possible to modify tracked sales": "No es posible modificar líneas de pedido que se hayan empezado a preparar",
|
||||||
"It is not possible to modify sales that their articles are from Floramondo": "No es posible modificar líneas de pedido cuyos artículos sean de Floramondo",
|
"It is not possible to modify sales that their articles are from Floramondo": "No es posible modificar líneas de pedido cuyos artículos sean de Floramondo",
|
||||||
"It is not possible to modify cloned sales": "No es posible modificar líneas de pedido clonadas",
|
"It is not possible to modify cloned sales": "No es posible modificar líneas de pedido clonadas",
|
||||||
"A supplier with the same name already exists. Change the country.": "Un proveedor con el mismo nombre ya existe. Cambie el país.",
|
"A supplier with the same name already exists. Change the country.": "Un proveedor con el mismo nombre ya existe. Cambie el país.",
|
||||||
"There is no assigned email for this client": "No hay correo asignado para este cliente",
|
"There is no assigned email for this client": "No hay correo asignado para este cliente",
|
||||||
"Exists an invoice with a future date": "Existe una factura con fecha posterior",
|
"Exists an invoice with a future date": "Existe una factura con fecha posterior",
|
||||||
"Invoice date can't be less than max date": "La fecha de factura no puede ser inferior a la fecha límite",
|
"Invoice date can't be less than max date": "La fecha de factura no puede ser inferior a la fecha límite",
|
||||||
"Warehouse inventory not set": "El almacén inventario no está establecido",
|
"Warehouse inventory not set": "El almacén inventario no está establecido",
|
||||||
"This locker has already been assigned": "Esta taquilla ya ha sido asignada",
|
"This locker has already been assigned": "Esta taquilla ya ha sido asignada",
|
||||||
"Tickets with associated refunds": "No se pueden borrar tickets con abonos asociados. Este ticket está asociado al abono Nº %s",
|
"Tickets with associated refunds": "No se pueden borrar tickets con abonos asociados. Este ticket está asociado al abono Nº %s",
|
||||||
"Not exist this branch": "La rama no existe",
|
"Not exist this branch": "La rama no existe",
|
||||||
"This ticket cannot be signed because it has not been boxed": "Este ticket no puede firmarse porque no ha sido encajado",
|
"This ticket cannot be signed because it has not been boxed": "Este ticket no puede firmarse porque no ha sido encajado",
|
||||||
"Collection does not exist": "La colección no existe",
|
"Collection does not exist": "La colección no existe",
|
||||||
"Cannot obtain exclusive lock": "No se puede obtener un bloqueo exclusivo",
|
"Cannot obtain exclusive lock": "No se puede obtener un bloqueo exclusivo",
|
||||||
"Insert a date range": "Inserte un rango de fechas",
|
"Insert a date range": "Inserte un rango de fechas",
|
||||||
"Added observation": "{{user}} añadió esta observacion: {{text}} {{defaulterId}} ({{{defaulterUrl}}})",
|
"Added observation": "{{user}} añadió esta observacion: {{text}} {{defaulterId}} ({{{defaulterUrl}}})",
|
||||||
"Comment added to client": "Observación añadida al cliente {{clientFk}}",
|
"Comment added to client": "Observación añadida al cliente {{clientFk}}",
|
||||||
"Invalid auth code": "Código de verificación incorrecto",
|
"Invalid auth code": "Código de verificación incorrecto",
|
||||||
"Invalid or expired verification code": "Código de verificación incorrecto o expirado",
|
"Invalid or expired verification code": "Código de verificación incorrecto o expirado",
|
||||||
"Cannot create a new claimBeginning from a different ticket": "No se puede crear una línea de reclamación de un ticket diferente al origen",
|
"Cannot create a new claimBeginning from a different ticket": "No se puede crear una línea de reclamación de un ticket diferente al origen",
|
||||||
"company": "Compañía",
|
"company": "Compañía",
|
||||||
"country": "País",
|
"country": "País",
|
||||||
"clientId": "Id cliente",
|
"clientId": "Id cliente",
|
||||||
"clientSocialName": "Cliente",
|
"clientSocialName": "Cliente",
|
||||||
"amount": "Importe",
|
"amount": "Importe",
|
||||||
"taxableBase": "Base",
|
"taxableBase": "Base",
|
||||||
"ticketFk": "Id ticket",
|
"ticketFk": "Id ticket",
|
||||||
"isActive": "Activo",
|
"isActive": "Activo",
|
||||||
"hasToInvoice": "Facturar",
|
"hasToInvoice": "Facturar",
|
||||||
"isTaxDataChecked": "Datos comprobados",
|
"isTaxDataChecked": "Datos comprobados",
|
||||||
"comercialId": "Id comercial",
|
"comercialId": "Id comercial",
|
||||||
"comercialName": "Comercial",
|
"comercialName": "Comercial",
|
||||||
"Pass expired": "La contraseña ha caducado, cambiela desde Salix",
|
"Pass expired": "La contraseña ha caducado, cambiela desde Salix",
|
||||||
"Invalid NIF for VIES": "Invalid NIF for VIES",
|
"Invalid NIF for VIES": "Invalid NIF for VIES",
|
||||||
"Ticket does not exist": "Este ticket no existe",
|
"Ticket does not exist": "Este ticket no existe",
|
||||||
"Ticket is already signed": "Este ticket ya ha sido firmado",
|
"Ticket is already signed": "Este ticket ya ha sido firmado",
|
||||||
"Authentication failed": "Autenticación fallida",
|
"Authentication failed": "Autenticación fallida",
|
||||||
"You can't use the same password": "No puedes usar la misma contraseña",
|
"You can't use the same password": "No puedes usar la misma contraseña",
|
||||||
"You can only add negative amounts in refund tickets": "Solo se puede añadir cantidades negativas en tickets abono",
|
"You can only add negative amounts in refund tickets": "Solo se puede añadir cantidades negativas en tickets abono",
|
||||||
"Fecha fuera de rango": "Fecha fuera de rango",
|
"Fecha fuera de rango": "Fecha fuera de rango",
|
||||||
"Error while generating PDF": "Error al generar PDF",
|
"Error while generating PDF": "Error al generar PDF",
|
||||||
"Error when sending mail to client": "Error al enviar el correo al cliente",
|
"Error when sending mail to client": "Error al enviar el correo al cliente",
|
||||||
"Mail not sent": "Se ha producido un fallo al enviar la factura al cliente [{{clientId}}]({{{clientUrl}}}), por favor revisa la dirección de correo electrónico",
|
"Mail not sent": "Se ha producido un fallo al enviar la factura al cliente [{{clientId}}]({{{clientUrl}}}), por favor revisa la dirección de correo electrónico",
|
||||||
"The renew period has not been exceeded": "El periodo de renovación no ha sido superado",
|
"The renew period has not been exceeded": "El periodo de renovación no ha sido superado",
|
||||||
"Valid priorities": "Prioridades válidas: %d",
|
"Valid priorities": "Prioridades válidas: %d",
|
||||||
"hasAnyNegativeBase": "Base negativa para los tickets: {{ticketsIds}}",
|
"hasAnyNegativeBase": "Base negativa para los tickets: {{ticketsIds}}",
|
||||||
"hasAnyPositiveBase": "Base positivas para los tickets: {{ticketsIds}}",
|
"hasAnyPositiveBase": "Base positivas para los tickets: {{ticketsIds}}",
|
||||||
"You cannot assign an alias that you are not assigned to": "No puede asignar un alias que no tenga asignado",
|
"You cannot assign an alias that you are not assigned to": "No puede asignar un alias que no tenga asignado",
|
||||||
"This ticket cannot be left empty.": "Este ticket no se puede dejar vacío. %s",
|
"This ticket cannot be left empty.": "Este ticket no se puede dejar vacío. %s",
|
||||||
"The company has not informed the supplier account for bank transfers": "La empresa no tiene informado la cuenta de proveedor para transferencias bancarias",
|
"The company has not informed the supplier account for bank transfers": "La empresa no tiene informado la cuenta de proveedor para transferencias bancarias",
|
||||||
"You cannot assign/remove an alias that you are not assigned to": "No puede asignar/eliminar un alias que no tenga asignado",
|
"You cannot assign/remove an alias that you are not assigned to": "No puede asignar/eliminar un alias que no tenga asignado",
|
||||||
"This invoice has a linked vehicle.": "Esta factura tiene un vehiculo vinculado",
|
"This invoice has a linked vehicle.": "Esta factura tiene un vehiculo vinculado",
|
||||||
"You don't have enough privileges.": "No tienes suficientes permisos.",
|
"You don't have enough privileges.": "No tienes suficientes permisos.",
|
||||||
"This ticket is locked": "Este ticket está bloqueado.",
|
"This ticket is locked": "Este ticket está bloqueado.",
|
||||||
"This ticket is not editable.": "Este ticket no es editable.",
|
"This ticket is not editable.": "Este ticket no es editable.",
|
||||||
"The ticket doesn't exist.": "No existe el ticket.",
|
"The ticket doesn't exist.": "No existe el ticket.",
|
||||||
"Social name should be uppercase": "La razón social debe ir en mayúscula",
|
"Social name should be uppercase": "La razón social debe ir en mayúscula",
|
||||||
"Street should be uppercase": "La dirección fiscal debe ir en mayúscula",
|
"Street should be uppercase": "La dirección fiscal debe ir en mayúscula",
|
||||||
"Ticket without Route": "Ticket sin ruta",
|
"Ticket without Route": "Ticket sin ruta",
|
||||||
"Select a different client": "Seleccione un cliente distinto",
|
"Select a different client": "Seleccione un cliente distinto",
|
||||||
"Fill all the fields": "Rellene todos los campos",
|
"Fill all the fields": "Rellene todos los campos",
|
||||||
"The response is not a PDF": "La respuesta no es un PDF",
|
"The response is not a PDF": "La respuesta no es un PDF",
|
||||||
"Booking completed": "Reserva completada",
|
"Booking completed": "Reserva completada",
|
||||||
"The ticket is in preparation": "El ticket [{{ticketId}}]({{{ticketUrl}}}) del comercial {{salesPersonId}} está en preparación",
|
"The ticket is in preparation": "El ticket [{{ticketId}}]({{{ticketUrl}}}) del comercial {{salesPersonId}} está en preparación",
|
||||||
"The notification subscription of this worker cant be modified": "La subscripción a la notificación de este trabajador no puede ser modificada",
|
"The notification subscription of this worker cant be modified": "La subscripción a la notificación de este trabajador no puede ser modificada",
|
||||||
"User disabled": "Usuario desactivado",
|
"User disabled": "Usuario desactivado",
|
||||||
"The amount cannot be less than the minimum": "La cantidad no puede ser menor que la cantidad mínima",
|
"The amount cannot be less than the minimum": "La cantidad no puede ser menor que la cantidad mínima",
|
||||||
"quantityLessThanMin": "La cantidad no puede ser menor que la cantidad mínima",
|
"quantityLessThanMin": "La cantidad no puede ser menor que la cantidad mínima",
|
||||||
"Cannot past travels with entries": "No se pueden pasar envíos con entradas",
|
"Cannot past travels with entries": "No se pueden pasar envíos con entradas",
|
||||||
"It was not able to remove the next expeditions:": "No se pudo eliminar las siguientes expediciones: {{expeditions}}",
|
"It was not able to remove the next expeditions:": "No se pudo eliminar las siguientes expediciones: {{expeditions}}",
|
||||||
"This claim has been updated": "La reclamación con Id: {{claimId}}, ha sido actualizada",
|
"This claim has been updated": "La reclamación con Id: {{claimId}}, ha sido actualizada",
|
||||||
"This user does not have an assigned tablet": "Este usuario no tiene tablet asignada",
|
"This user does not have an assigned tablet": "Este usuario no tiene tablet asignada",
|
||||||
"Field are invalid": "El campo '{{tag}}' no es válido",
|
"Field are invalid": "El campo '{{tag}}' no es válido",
|
||||||
"Incorrect pin": "Pin incorrecto.",
|
"Incorrect pin": "Pin incorrecto.",
|
||||||
"You already have the mailAlias": "Ya tienes este alias de correo",
|
"You already have the mailAlias": "Ya tienes este alias de correo",
|
||||||
"The alias cant be modified": "Este alias de correo no puede ser modificado",
|
"The alias cant be modified": "Este alias de correo no puede ser modificado",
|
||||||
"No tickets to invoice": "No hay tickets para facturar que cumplan los requisitos de facturación",
|
"No tickets to invoice": "No hay tickets para facturar que cumplan los requisitos de facturación",
|
||||||
"this warehouse has not dms": "El Almacén no acepta documentos",
|
"this warehouse has not dms": "El Almacén no acepta documentos",
|
||||||
"This ticket already has a cmr saved": "Este ticket ya tiene un cmr guardado",
|
"This ticket already has a cmr saved": "Este ticket ya tiene un cmr guardado",
|
||||||
"Name should be uppercase": "El nombre debe ir en mayúscula",
|
"Name should be uppercase": "El nombre debe ir en mayúscula",
|
||||||
"Bank entity must be specified": "La entidad bancaria es obligatoria",
|
"Bank entity must be specified": "La entidad bancaria es obligatoria",
|
||||||
"An email is necessary": "Es necesario un email",
|
"An email is necessary": "Es necesario un email",
|
||||||
"You cannot update these fields": "No puedes actualizar estos campos",
|
"You cannot update these fields": "No puedes actualizar estos campos",
|
||||||
"CountryFK cannot be empty": "El país no puede estar vacío",
|
"CountryFK cannot be empty": "El país no puede estar vacío",
|
||||||
"Cmr file does not exist": "El archivo del cmr no existe",
|
"Cmr file does not exist": "El archivo del cmr no existe",
|
||||||
"You are not allowed to modify the alias": "No estás autorizado a modificar el alias",
|
"You are not allowed to modify the alias": "No estás autorizado a modificar el alias",
|
||||||
"The address of the customer must have information about Incoterms and Customs Agent": "El consignatario del cliente debe tener informado Incoterms y Agente de aduanas",
|
"The address of the customer must have information about Incoterms and Customs Agent": "El consignatario del cliente debe tener informado Incoterms y Agente de aduanas",
|
||||||
"No invoice series found for these parameters": "No se encontró una serie para estos parámetros",
|
"No invoice series found for these parameters": "No se encontró una serie para estos parámetros",
|
||||||
"The line could not be marked": "La linea no puede ser marcada",
|
"The line could not be marked": "La linea no puede ser marcada",
|
||||||
"Through this procedure, it is not possible to modify the password of users with verified email": "Mediante este procedimiento, no es posible modificar la contraseña de usuarios con correo verificado",
|
"Through this procedure, it is not possible to modify the password of users with verified email": "Mediante este procedimiento, no es posible modificar la contraseña de usuarios con correo verificado",
|
||||||
"They're not your subordinate": "No es tu subordinado/a.",
|
"They're not your subordinate": "No es tu subordinado/a.",
|
||||||
"No results found": "No se han encontrado resultados",
|
"No results found": "No se han encontrado resultados",
|
||||||
"InvoiceIn is already booked": "La factura recibida está contabilizada",
|
"InvoiceIn is already booked": "La factura recibida está contabilizada",
|
||||||
"This workCenter is already assigned to this agency": "Este centro de trabajo ya está asignado a esta agencia",
|
"This workCenter is already assigned to this agency": "Este centro de trabajo ya está asignado a esta agencia",
|
||||||
"Select ticket or client": "Elija un ticket o un client",
|
"Select ticket or client": "Elija un ticket o un client",
|
||||||
"It was not able to create the invoice": "No se pudo crear la factura",
|
"It was not able to create the invoice": "No se pudo crear la factura",
|
||||||
"Incoterms and Customs agent are required for a non UEE member": "Se requieren Incoterms y agente de aduanas para un no miembro de la UEE",
|
"Incoterms and Customs agent are required for a non UEE member": "Se requieren Incoterms y agente de aduanas para un no miembro de la UEE",
|
||||||
"You can not use the same password": "No puedes usar la misma contraseña",
|
"You can not use the same password": "No puedes usar la misma contraseña",
|
||||||
"This PDA is already assigned to another user": "Este PDA ya está asignado a otro usuario",
|
"This PDA is already assigned to another user": "Este PDA ya está asignado a otro usuario",
|
||||||
"You can only have one PDA": "Solo puedes tener un PDA",
|
"You can only have one PDA": "Solo puedes tener un PDA",
|
||||||
"The invoices have been created but the PDFs could not be generated": "Se ha facturado pero no se ha podido generar el PDF",
|
"The invoices have been created but the PDFs could not be generated": "Se ha facturado pero no se ha podido generar el PDF",
|
||||||
"It has been invoiced but the PDF of refund not be generated": "Se ha facturado pero no se ha podido generar el PDF del abono",
|
"It has been invoiced but the PDF of refund not be generated": "Se ha facturado pero no se ha podido generar el PDF del abono",
|
||||||
"Payment method is required": "El método de pago es obligatorio",
|
"Payment method is required": "El método de pago es obligatorio",
|
||||||
"Cannot send mail": "Não é possível enviar o email",
|
"Cannot send mail": "Não é possível enviar o email",
|
||||||
"CONSTRAINT `supplierAccountTooShort` failed for `vn`.`supplier`": "La cuenta debe tener exactamente 10 dígitos",
|
"CONSTRAINT `supplierAccountTooShort` failed for `vn`.`supplier`": "La cuenta debe tener exactamente 10 dígitos",
|
||||||
"The sale not exists in the item shelving": "La venta no existe en la estantería del artículo",
|
"The sale not exists in the item shelving": "La venta no existe en la estantería del artículo",
|
||||||
"The entry not have stickers": "La entrada no tiene etiquetas",
|
"The entry not have stickers": "La entrada no tiene etiquetas",
|
||||||
"Too many records": "Demasiados registros",
|
"Too many records": "Demasiados registros",
|
||||||
"Original invoice not found": "Factura original no encontrada",
|
"Original invoice not found": "Factura original no encontrada",
|
||||||
"The entry has no lines or does not exist": "La entrada no tiene lineas o no existe",
|
"The entry has no lines or does not exist": "La entrada no tiene lineas o no existe",
|
||||||
"Weight already set": "El peso ya está establecido",
|
"Weight already set": "El peso ya está establecido",
|
||||||
"This ticket is not allocated to your department": "Este ticket no está asignado a tu departamento",
|
"This ticket is not allocated to your department": "Este ticket no está asignado a tu departamento",
|
||||||
"There is already a tray with the same height": "Ya existe una bandeja con la misma altura",
|
"There is already a tray with the same height": "Ya existe una bandeja con la misma altura",
|
||||||
"The height must be greater than 50cm": "La altura debe ser superior a 50cm",
|
"The height must be greater than 50cm": "La altura debe ser superior a 50cm",
|
||||||
"The maximum height of the wagon is 200cm": "La altura máxima es 200cm",
|
"The maximum height of the wagon is 200cm": "La altura máxima es 200cm",
|
||||||
"The entry does not have stickers": "La entrada no tiene etiquetas",
|
"The entry does not have stickers": "La entrada no tiene etiquetas",
|
||||||
"This buyer has already made a reservation for this date": "Este comprador ya ha hecho una reserva para esta fecha",
|
"This buyer has already made a reservation for this date": "Este comprador ya ha hecho una reserva para esta fecha",
|
||||||
"No valid travel thermograph found": "No se encontró un termógrafo válido",
|
"No valid travel thermograph found": "No se encontró un termógrafo válido",
|
||||||
"The quantity claimed cannot be greater than the quantity of the line": "La cantidad reclamada no puede ser mayor que la cantidad de la línea",
|
"The quantity claimed cannot be greater than the quantity of the line": "La cantidad reclamada no puede ser mayor que la cantidad de la línea",
|
||||||
"type cannot be blank": "Se debe rellenar el tipo",
|
"type cannot be blank": "Se debe rellenar el tipo",
|
||||||
"There are tickets for this area, delete them first": "Hay tickets para esta sección, borralos primero",
|
"There are tickets for this area, delete them first": "Hay tickets para esta sección, borralos primero",
|
||||||
"There is no company associated with that warehouse": "No hay ninguna empresa asociada a ese almacén",
|
"There is no company associated with that warehouse": "No hay ninguna empresa asociada a ese almacén",
|
||||||
"You do not have permission to modify the booked field": "No tienes permisos para modificar el campo contabilizada",
|
"You do not have permission to modify the booked field": "No tienes permisos para modificar el campo contabilizada",
|
||||||
"ticketLostExpedition": "El ticket [{{ticketId}}]({{{ticketUrl}}}) tiene la siguiente expedición perdida:{{ expeditionId }}",
|
"ticketLostExpedition": "El ticket [{{ticketId}}]({{{ticketUrl}}}) tiene la siguiente expedición perdida:{{ expeditionId }}",
|
||||||
"The web user's email already exists": "El correo del usuario web ya existe",
|
"The web user's email already exists": "El correo del usuario web ya existe",
|
||||||
"Sales already moved": "Ya han sido transferidas",
|
"Sales already moved": "Ya han sido transferidas",
|
||||||
"The raid information is not correct": "La información de la redada no es correcta",
|
"The raid information is not correct": "La información de la redada no es correcta",
|
||||||
"An item type with the same code already exists": "Un tipo con el mismo código ya existe",
|
"An item type with the same code already exists": "Un tipo con el mismo código ya existe",
|
||||||
"Holidays to past days not available": "Las vacaciones a días pasados no están disponibles",
|
"Holidays to past days not available": "Las vacaciones a días pasados no están disponibles",
|
||||||
"All tickets have a route order": "Todos los tickets tienen orden de ruta",
|
"All tickets have a route order": "Todos los tickets tienen orden de ruta",
|
||||||
"There are tickets to be invoiced": "La zona tiene tickets por facturar",
|
"There are tickets to be invoiced": "La zona tiene tickets por facturar",
|
||||||
"Incorrect delivery order alert on route": "Alerta de orden de entrega incorrecta en ruta: {{ route }} zona: {{ zone }}",
|
"Incorrect delivery order alert on route": "Alerta de orden de entrega incorrecta en ruta: {{ route }} zona: {{ zone }}",
|
||||||
"Ticket has been delivered out of order": "El ticket {{ticket}} {{{fullUrl}}} no ha sido entregado en su orden.",
|
"Ticket has been delivered out of order": "El ticket {{ticket}} de la ruta {{{fullUrl}}} no ha sigo entregado en su orden.",
|
||||||
"Price cannot be blank": "El precio no puede estar en blanco",
|
"Price cannot be blank": "El precio no puede estar en blanco"
|
||||||
"clonedFromTicketWeekly": ", que es una linea clonada del ticket {{ticketWeekly}}",
|
}
|
||||||
"negativeReplaced": "Sustituido el articulo [#{{oldItemId}}]({{{oldItemUrl}}}) {{oldItem}} por [#{{newItemId}}]({{{newItemUrl}}}) {{newItem}} del ticket [{{ticketId}}]({{{ticketUrl}}})"
|
|
||||||
}
|
|
|
@ -368,6 +368,5 @@
|
||||||
"ticketLostExpedition": "Le ticket [{{ticketId}}]({{{ticketUrl}}}) a l'expédition perdue suivante : {{expeditionId}}",
|
"ticketLostExpedition": "Le ticket [{{ticketId}}]({{{ticketUrl}}}) a l'expédition perdue suivante : {{expeditionId}}",
|
||||||
"The web user's email already exists": "L'email de l'internaute existe déjà",
|
"The web user's email already exists": "L'email de l'internaute existe déjà",
|
||||||
"Incorrect delivery order alert on route": "Alerte de bon de livraison incorrect sur l'itinéraire: {{ route }} zone : {{ zone }}",
|
"Incorrect delivery order alert on route": "Alerte de bon de livraison incorrect sur l'itinéraire: {{ route }} zone : {{ zone }}",
|
||||||
"Ticket has been delivered out of order": "Le ticket {{ticket}} de la route {{{fullUrl}}} a été livré hors service.",
|
"Ticket has been delivered out of order": "Le ticket {{ticket}} de la route {{{fullUrl}}} a été livré hors service."
|
||||||
"negativeReplaced": "Remplacé l'article [#{{oldItemId}}]({{{oldItemUrl}}}) {{oldItem}} par [#{{newItemId}}]({{{newItemUrl}}}) {{newItem}} du ticket [{{ticketId}}]({{{ticketUrl}}})"
|
}
|
||||||
}
|
|
|
@ -367,6 +367,5 @@
|
||||||
"ticketLostExpedition": "O ticket [{{ticketId}}]({{{ticketUrl}}}) tem a seguinte expedição perdida: {{expeditionId}}",
|
"ticketLostExpedition": "O ticket [{{ticketId}}]({{{ticketUrl}}}) tem a seguinte expedição perdida: {{expeditionId}}",
|
||||||
"The web user's email already exists": "O e-mail do utilizador da web já existe.",
|
"The web user's email already exists": "O e-mail do utilizador da web já existe.",
|
||||||
"Incorrect delivery order alert on route": "Alerta de ordem de entrega incorreta na rota: {{ route }} zona: {{ zone }}",
|
"Incorrect delivery order alert on route": "Alerta de ordem de entrega incorreta na rota: {{ route }} zona: {{ zone }}",
|
||||||
"Ticket has been delivered out of order": "O ticket {{ticket}} da rota {{{fullUrl}}} foi entregue fora de ordem.",
|
"Ticket has been delivered out of order": "O ticket {{ticket}} da rota {{{fullUrl}}} foi entregue fora de ordem."
|
||||||
"negativeReplaced": "Substituído o artigo [#{{oldItemId}}]({{{oldItemUrl}}}) {{oldItem}} por [#{{newItemId}}]({{{newItemUrl}}}) {{newItem}} do ticket [{{ticketId}}]({{{ticketUrl}}})"
|
}
|
||||||
}
|
|
|
@ -4,7 +4,7 @@ const LoopBackContext = require('loopback-context');
|
||||||
describe('ClaimBeginning model()', () => {
|
describe('ClaimBeginning model()', () => {
|
||||||
const claimFk = 1;
|
const claimFk = 1;
|
||||||
const activeCtx = {
|
const activeCtx = {
|
||||||
accessToken: {userId: 72},
|
accessToken: {userId: 18},
|
||||||
headers: {origin: 'localhost:5000'},
|
headers: {origin: 'localhost:5000'},
|
||||||
__: () => {}
|
__: () => {}
|
||||||
};
|
};
|
||||||
|
|
|
@ -109,7 +109,6 @@ module.exports = Self => {
|
||||||
const args = ctx.args;
|
const args = ctx.args;
|
||||||
const myOptions = {};
|
const myOptions = {};
|
||||||
let to;
|
let to;
|
||||||
let myTeamIds = [];
|
|
||||||
|
|
||||||
if (typeof options == 'object')
|
if (typeof options == 'object')
|
||||||
Object.assign(myOptions, options);
|
Object.assign(myOptions, options);
|
||||||
|
@ -134,8 +133,21 @@ module.exports = Self => {
|
||||||
claimIdsByClaimResponsibleFk = claims.map(claim => claim.claimFk);
|
claimIdsByClaimResponsibleFk = claims.map(claim => claim.claimFk);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.myTeam != null)
|
// Apply filter by team
|
||||||
myTeamIds = await models.Worker.myTeam(userId);
|
const teamMembersId = [];
|
||||||
|
if (args.myTeam != null) {
|
||||||
|
const worker = await models.Worker.findById(userId, {
|
||||||
|
include: {
|
||||||
|
relation: 'collegues'
|
||||||
|
}
|
||||||
|
}, myOptions);
|
||||||
|
const collegues = worker.collegues() || [];
|
||||||
|
for (let collegue of collegues)
|
||||||
|
teamMembersId.push(collegue.collegueFk);
|
||||||
|
|
||||||
|
if (teamMembersId.length == 0)
|
||||||
|
teamMembersId.push(userId);
|
||||||
|
}
|
||||||
|
|
||||||
const where = buildFilter(ctx.args, (param, value) => {
|
const where = buildFilter(ctx.args, (param, value) => {
|
||||||
switch (param) {
|
switch (param) {
|
||||||
|
@ -172,9 +184,9 @@ module.exports = Self => {
|
||||||
return {'t.zoneFk': value};
|
return {'t.zoneFk': value};
|
||||||
case 'myTeam':
|
case 'myTeam':
|
||||||
if (value)
|
if (value)
|
||||||
return {'cl.workerFk': {inq: myTeamIds}};
|
return {'cl.workerFk': {inq: teamMembersId}};
|
||||||
else
|
else
|
||||||
return {'cl.workerFk': {nin: myTeamIds}};
|
return {'cl.workerFk': {nin: teamMembersId}};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -3,18 +3,22 @@ const LoopBackContext = require('loopback-context');
|
||||||
|
|
||||||
describe('Claim createFromSales()', () => {
|
describe('Claim createFromSales()', () => {
|
||||||
const ticketId = 23;
|
const ticketId = 23;
|
||||||
const newSale = [{id: 31, instance: 0, quantity: 10}];
|
const newSale = [{
|
||||||
let activeCtx;
|
id: 31,
|
||||||
let ctx;
|
instance: 0,
|
||||||
|
quantity: 10
|
||||||
|
}];
|
||||||
|
const activeCtx = {
|
||||||
|
accessToken: {userId: 1},
|
||||||
|
headers: {origin: 'localhost:5000'},
|
||||||
|
__: () => {}
|
||||||
|
};
|
||||||
|
|
||||||
|
const ctx = {
|
||||||
|
req: activeCtx
|
||||||
|
};
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
activeCtx = {
|
|
||||||
accessToken: {userId: 72},
|
|
||||||
headers: {origin: 'localhost:5000'},
|
|
||||||
__: () => {}
|
|
||||||
};
|
|
||||||
ctx = {req: activeCtx};
|
|
||||||
|
|
||||||
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||||
active: activeCtx
|
active: activeCtx
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
|
|
||||||
const UserError = require('vn-loopback/util/user-error');
|
const UserError = require('vn-loopback/util/user-error');
|
||||||
const LoopBackContext = require('loopback-context');
|
const LoopBackContext = require('loopback-context');
|
||||||
const moment = require('moment');
|
|
||||||
|
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
require('../methods/claim-beginning/importToNewRefundTicket')(Self);
|
require('../methods/claim-beginning/importToNewRefundTicket')(Self);
|
||||||
|
@ -14,51 +13,10 @@ module.exports = Self => {
|
||||||
const options = ctx.options;
|
const options = ctx.options;
|
||||||
const models = Self.app.models;
|
const models = Self.app.models;
|
||||||
const saleFk = ctx?.currentInstance?.saleFk || ctx?.instance?.saleFk;
|
const saleFk = ctx?.currentInstance?.saleFk || ctx?.instance?.saleFk;
|
||||||
const claimFk = ctx?.instance?.claimFk || ctx?.currentInstance?.claimFk;
|
|
||||||
const myOptions = {};
|
|
||||||
const accessToken = ctx?.options?.accessToken || LoopBackContext.getCurrentContext().active.accessToken;
|
|
||||||
const ctxToken = {req: {accessToken}};
|
|
||||||
|
|
||||||
if (typeof options == 'object')
|
|
||||||
Object.assign(myOptions, options);
|
|
||||||
|
|
||||||
const sale = await models.Sale.findById(saleFk, {fields: ['ticketFk', 'quantity']}, options);
|
const sale = await models.Sale.findById(saleFk, {fields: ['ticketFk', 'quantity']}, options);
|
||||||
|
|
||||||
const canCreateClaimAfterDeadline = models.ACL.checkAccessAcl(
|
|
||||||
ctxToken,
|
|
||||||
'Claim',
|
|
||||||
'createAfterDeadline',
|
|
||||||
myOptions
|
|
||||||
);
|
|
||||||
|
|
||||||
const canUpdateClaim = models.ACL.checkAccessAcl(
|
|
||||||
ctxToken,
|
|
||||||
'Claim',
|
|
||||||
'updateClaim',
|
|
||||||
myOptions
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!canUpdateClaim && !canCreateClaimAfterDeadline)
|
|
||||||
throw new UserError(`You don't have permission to modify this claim`);
|
|
||||||
|
|
||||||
if (canUpdateClaim) {
|
|
||||||
const query = `
|
|
||||||
SELECT daysToClaim
|
|
||||||
FROM vn.claimConfig`;
|
|
||||||
const res = await Self.rawSql(query);
|
|
||||||
const daysToClaim = res[0]?.daysToClaim;
|
|
||||||
|
|
||||||
const claim = await models.Claim.findById(claimFk, {fields: ['created']}, options);
|
|
||||||
const claimDate = moment.utc(claim.created);
|
|
||||||
const currentDate = moment.utc();
|
|
||||||
const daysSinceSale = currentDate.diff(claimDate, 'days');
|
|
||||||
|
|
||||||
if (daysSinceSale > daysToClaim && !canCreateClaimAfterDeadline)
|
|
||||||
throw new UserError(`You can't modify this claim because the deadline has already passed`);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ctx.isNewInstance) {
|
if (ctx.isNewInstance) {
|
||||||
const claim = await models.Claim.findById(claimFk, {fields: ['ticketFk']}, options);
|
const claim = await models.Claim.findById(ctx.instance.claimFk, {fields: ['ticketFk']}, options);
|
||||||
if (sale.ticketFk != claim.ticketFk)
|
if (sale.ticketFk != claim.ticketFk)
|
||||||
throw new UserError(`Cannot create a new claimBeginning from a different ticket`);
|
throw new UserError(`Cannot create a new claimBeginning from a different ticket`);
|
||||||
}
|
}
|
||||||
|
@ -83,7 +41,7 @@ module.exports = Self => {
|
||||||
if (ctx.options && ctx.options.transaction)
|
if (ctx.options && ctx.options.transaction)
|
||||||
myOptions.transaction = ctx.options.transaction;
|
myOptions.transaction = ctx.options.transaction;
|
||||||
|
|
||||||
const claimBeginning = ctx.instance ?? await Self.findById(ctx?.where?.id);
|
const claimBeginning = ctx.instance ?? await Self.findById(ctx.where.id);
|
||||||
|
|
||||||
const filter = {
|
const filter = {
|
||||||
where: {id: claimBeginning.claimFk},
|
where: {id: claimBeginning.claimFk},
|
||||||
|
|
|
@ -158,12 +158,10 @@ module.exports = Self => {
|
||||||
a.provinceFk AS provinceAddressFk,
|
a.provinceFk AS provinceAddressFk,
|
||||||
p.name AS province,
|
p.name AS province,
|
||||||
u.id AS salesPersonFk,
|
u.id AS salesPersonFk,
|
||||||
u.name AS salesPerson,
|
u.name AS salesPerson
|
||||||
co.name AS country
|
|
||||||
FROM client c
|
FROM client c
|
||||||
LEFT JOIN account.user u ON u.id = c.salesPersonFk
|
LEFT JOIN account.user u ON u.id = c.salesPersonFk
|
||||||
LEFT JOIN province p ON p.id = c.provinceFk
|
LEFT JOIN province p ON p.id = c.provinceFk
|
||||||
LEFT JOIN country co ON co.id = c.countryFk
|
|
||||||
JOIN address a ON a.clientFk = c.id
|
JOIN address a ON a.clientFk = c.id
|
||||||
`
|
`
|
||||||
);
|
);
|
||||||
|
|
|
@ -157,52 +157,4 @@ describe('Address updateAddress', () => {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should update ticket observations when updateObservations is true', async() => {
|
|
||||||
const tx = await models.Client.beginTransaction({});
|
|
||||||
const client = 1103;
|
|
||||||
const address = 123;
|
|
||||||
const ticket = 31;
|
|
||||||
const observationType = 3;
|
|
||||||
|
|
||||||
const salesAssistantId = 21;
|
|
||||||
const addressObservation = 'nuevo texto';
|
|
||||||
const ticketObservation = 'texto a modificar';
|
|
||||||
|
|
||||||
try {
|
|
||||||
const options = {transaction: tx};
|
|
||||||
ctx.req.accessToken.userId = salesAssistantId;
|
|
||||||
ctx.args = {
|
|
||||||
updateObservations: true,
|
|
||||||
incotermsFk: incotermsId,
|
|
||||||
provinceFk: provinceId,
|
|
||||||
customsAgentFk: customAgentOneId
|
|
||||||
};
|
|
||||||
|
|
||||||
await models.AddressObservation.create({
|
|
||||||
addressFk: address,
|
|
||||||
observationTypeFk: observationType,
|
|
||||||
description: addressObservation
|
|
||||||
}, options);
|
|
||||||
|
|
||||||
await models.TicketObservation.create({
|
|
||||||
ticketFk: ticket,
|
|
||||||
observationTypeFk: observationType,
|
|
||||||
description: ticketObservation
|
|
||||||
}, options);
|
|
||||||
|
|
||||||
await models.Client.updateAddress(ctx, client, address, options);
|
|
||||||
|
|
||||||
const updatedObservation = await models.TicketObservation.findOne({
|
|
||||||
where: {ticketFk: ticket, observationTypeFk: observationType}
|
|
||||||
}, options);
|
|
||||||
|
|
||||||
expect(updatedObservation.description).toEqual(addressObservation);
|
|
||||||
|
|
||||||
await tx.rollback();
|
|
||||||
} catch (e) {
|
|
||||||
await tx.rollback();
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -80,10 +80,6 @@ module.exports = function(Self) {
|
||||||
{
|
{
|
||||||
arg: 'latitude',
|
arg: 'latitude',
|
||||||
type: 'any',
|
type: 'any',
|
||||||
},
|
|
||||||
{
|
|
||||||
arg: 'updateObservations',
|
|
||||||
type: 'boolean'
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
returns: {
|
returns: {
|
||||||
|
@ -139,17 +135,6 @@ module.exports = function(Self) {
|
||||||
delete args.ctx; // Remove unwanted properties
|
delete args.ctx; // Remove unwanted properties
|
||||||
|
|
||||||
const updatedAddress = await address.updateAttributes(ctx.args, myOptions);
|
const updatedAddress = await address.updateAttributes(ctx.args, myOptions);
|
||||||
if (args.updateObservations) {
|
|
||||||
const ticket = await Self.rawSql(`
|
|
||||||
UPDATE ticketObservation to2
|
|
||||||
JOIN ticket t ON t.id = to2.ticketFk
|
|
||||||
JOIN address a ON a.id = t.addressFk
|
|
||||||
JOIN addressObservation ao ON ao.addressFk = a.id
|
|
||||||
SET to2.description = ao.description
|
|
||||||
WHERE ao.observationTypeFk = to2.observationTypeFk
|
|
||||||
AND a.id = ?
|
|
||||||
AND t.shipped >= util.VN_CURDATE()`, [addressId], myOptions);
|
|
||||||
}
|
|
||||||
|
|
||||||
return updatedAddress;
|
return updatedAddress;
|
||||||
};
|
};
|
||||||
|
|
|
@ -21,7 +21,7 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
returns: {
|
returns: {
|
||||||
type: 'object',
|
type: ['object'],
|
||||||
root: true
|
root: true
|
||||||
},
|
},
|
||||||
http: {
|
http: {
|
||||||
|
@ -41,28 +41,23 @@ module.exports = Self => {
|
||||||
switch (param) {
|
switch (param) {
|
||||||
case 'search':
|
case 'search':
|
||||||
return {or: [
|
return {or: [
|
||||||
{'c.id': value},
|
{'d.clientFk': value},
|
||||||
{'c.name': {like: `%${value}%`}}
|
{'d.clientName': {like: `%${value}%`}}
|
||||||
]};
|
]};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const date = Date.vnNew();
|
filter = mergeFilters(ctx.args.filter, {where});
|
||||||
date.setHours(0, 0, 0, 0);
|
|
||||||
|
|
||||||
filter = mergeFilters({where: {'d.created': date, 'd.amount': {gt: 0}}}, ctx.args.filter);
|
|
||||||
filter = mergeFilters(filter, {where});
|
|
||||||
|
|
||||||
const stmts = [];
|
const stmts = [];
|
||||||
|
|
||||||
let stmt = new ParameterizedSQL(
|
const date = Date.vnNew();
|
||||||
`CREATE OR REPLACE TEMPORARY TABLE tmp.defaulters
|
date.setHours(0, 0, 0, 0);
|
||||||
WITH clientObservations AS
|
const stmt = new ParameterizedSQL(
|
||||||
(SELECT clientFk,text, created, workerFk
|
`SELECT *
|
||||||
FROM vn.clientObservation
|
FROM (
|
||||||
GROUP BY clientFk
|
SELECT
|
||||||
ORDER BY created DESC
|
DISTINCT c.id clientFk,
|
||||||
)SELECT c.id clientFk,
|
|
||||||
c.name clientName,
|
c.name clientName,
|
||||||
c.salesPersonFk,
|
c.salesPersonFk,
|
||||||
c.businessTypeFk = 'worker' isWorker,
|
c.businessTypeFk = 'worker' isWorker,
|
||||||
|
@ -85,43 +80,36 @@ module.exports = Self => {
|
||||||
JOIN client c ON c.id = d.clientFk
|
JOIN client c ON c.id = d.clientFk
|
||||||
JOIN country cn ON cn.id = c.countryFk
|
JOIN country cn ON cn.id = c.countryFk
|
||||||
JOIN payMethod pm ON pm.id = c.payMethodFk
|
JOIN payMethod pm ON pm.id = c.payMethodFk
|
||||||
LEFT JOIN clientObservations co ON co.clientFk = c.id
|
LEFT JOIN clientObservation co ON co.clientFk = c.id
|
||||||
LEFT JOIN account.user u ON u.id = c.salesPersonFk
|
LEFT JOIN account.user u ON u.id = c.salesPersonFk
|
||||||
LEFT JOIN account.user uw ON uw.id = co.workerFk
|
LEFT JOIN account.user uw ON uw.id = co.workerFk
|
||||||
LEFT JOIN (
|
LEFT JOIN (
|
||||||
SELECT r1.started, r1.clientFk, r1.finished
|
SELECT r1.started, r1.clientFk, r1.finished
|
||||||
FROM recovery r1
|
FROM recovery r1
|
||||||
JOIN (
|
JOIN (
|
||||||
SELECT MAX(started) maxStarted, clientFk
|
SELECT MAX(started) AS maxStarted, clientFk
|
||||||
FROM recovery
|
FROM recovery
|
||||||
GROUP BY clientFk
|
GROUP BY clientFk
|
||||||
) r2 ON r1.clientFk = r2.clientFk
|
) r2 ON r1.clientFk = r2.clientFk
|
||||||
AND r1.started = r2.maxStarted
|
AND r1.started = r2.maxStarted
|
||||||
WHERE r1.finished
|
|
||||||
GROUP BY r1.clientFk
|
|
||||||
) r ON r.clientFk = c.id
|
) r ON r.clientFk = c.id
|
||||||
LEFT JOIN workerDepartment wd ON wd.workerFk = u.id
|
LEFT JOIN workerDepartment wd ON wd.workerFk = u.id
|
||||||
LEFT JOIN department dp ON dp.id = wd.departmentFk`);
|
LEFT JOIN department dp ON dp.id = wd.departmentFk
|
||||||
|
WHERE
|
||||||
|
d.created = ?
|
||||||
|
AND d.amount > 0
|
||||||
|
ORDER BY co.created DESC) d`
|
||||||
|
, [date]);
|
||||||
|
|
||||||
stmt.merge(conn.makeWhere(filter.where));
|
stmt.merge(conn.makeWhere(filter.where));
|
||||||
stmts.push(stmt);
|
stmt.merge(`GROUP BY d.clientFk`);
|
||||||
|
|
||||||
stmt = new ParameterizedSQL(`
|
|
||||||
SELECT SUM(amount) amount
|
|
||||||
FROM tmp.defaulters
|
|
||||||
`);
|
|
||||||
stmts.push(stmt);
|
|
||||||
|
|
||||||
stmt = new ParameterizedSQL(`
|
|
||||||
SELECT *
|
|
||||||
FROM tmp.defaulters
|
|
||||||
`);
|
|
||||||
stmt.merge(conn.makeOrderBy(filter.order));
|
stmt.merge(conn.makeOrderBy(filter.order));
|
||||||
|
stmt.merge(conn.makeLimit(filter));
|
||||||
|
|
||||||
const itemsIndex = stmts.push(stmt) - 1;
|
const itemsIndex = stmts.push(stmt) - 1;
|
||||||
const sql = ParameterizedSQL.join(stmts, ';');
|
const sql = ParameterizedSQL.join(stmts, ';');
|
||||||
const result = await conn.executeStmt(sql, myOptions);
|
const result = await conn.executeStmt(sql, myOptions);
|
||||||
|
|
||||||
return {defaulters: result[itemsIndex], amount: result[itemsIndex - 1][0].amount};
|
return itemsIndex === 0 ? result : result[itemsIndex];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -11,10 +11,10 @@ describe('defaulter filter()', () => {
|
||||||
const ctx = {req: {accessToken: {userId: authUserId}}, args: {filter: filter}};
|
const ctx = {req: {accessToken: {userId: authUserId}}, args: {filter: filter}};
|
||||||
|
|
||||||
const result = await models.Defaulter.filter(ctx, null, options);
|
const result = await models.Defaulter.filter(ctx, null, options);
|
||||||
const firstRow = result.defaulters[0];
|
const firstRow = result[0];
|
||||||
|
|
||||||
expect(firstRow.clientFk).toEqual(1101);
|
expect(firstRow.clientFk).toEqual(1101);
|
||||||
expect(result.defaulters.length).toEqual(5);
|
expect(result.length).toEqual(5);
|
||||||
|
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -31,7 +31,7 @@ describe('defaulter filter()', () => {
|
||||||
const ctx = {req: {accessToken: {userId: authUserId}}, args: {search: 1101}};
|
const ctx = {req: {accessToken: {userId: authUserId}}, args: {search: 1101}};
|
||||||
|
|
||||||
const result = await models.Defaulter.filter(ctx, null, options);
|
const result = await models.Defaulter.filter(ctx, null, options);
|
||||||
const firstRow = result.defaulters[0];
|
const firstRow = result[0];
|
||||||
|
|
||||||
expect(firstRow.clientFk).toEqual(1101);
|
expect(firstRow.clientFk).toEqual(1101);
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ describe('defaulter filter()', () => {
|
||||||
const ctx = {req: {accessToken: {userId: authUserId}}, args: {search: 'Petter Parker'}};
|
const ctx = {req: {accessToken: {userId: authUserId}}, args: {search: 'Petter Parker'}};
|
||||||
|
|
||||||
const result = await models.Defaulter.filter(ctx, null, options);
|
const result = await models.Defaulter.filter(ctx, null, options);
|
||||||
const firstRow = result.defaulters[0];
|
const firstRow = result[0];
|
||||||
|
|
||||||
expect(firstRow.clientName).toEqual('Petter Parker');
|
expect(firstRow.clientName).toEqual('Petter Parker');
|
||||||
|
|
||||||
|
@ -60,23 +60,4 @@ describe('defaulter filter()', () => {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return the defaulter the sum of every defaulters', async() => {
|
|
||||||
const tx = await models.Defaulter.beginTransaction({});
|
|
||||||
|
|
||||||
try {
|
|
||||||
const options = {transaction: tx};
|
|
||||||
const ctx = {req: {accessToken: {userId: authUserId}}, args: {search: 1101}};
|
|
||||||
const {defaulters, amount} = await models.Defaulter.filter(ctx, null, options);
|
|
||||||
|
|
||||||
const total = defaulters.reduce((total, row) => total + row.amount, 0);
|
|
||||||
|
|
||||||
expect(total).toEqual(amount);
|
|
||||||
|
|
||||||
await tx.rollback();
|
|
||||||
} catch (e) {
|
|
||||||
await tx.rollback();
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -139,23 +139,5 @@
|
||||||
},
|
},
|
||||||
"Xdiario": {
|
"Xdiario": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
|
||||||
"BusinessReasonEnd": {
|
|
||||||
"dataSource": "vn"
|
|
||||||
},
|
|
||||||
"OccupationCode": {
|
|
||||||
"dataSource": "vn"
|
|
||||||
},
|
|
||||||
"WorkerBusinessProfessionalCategory": {
|
|
||||||
"dataSource": "vn"
|
|
||||||
},
|
|
||||||
"CalendarType": {
|
|
||||||
"dataSource": "vn"
|
|
||||||
},
|
|
||||||
"WorkerBusinessType": {
|
|
||||||
"dataSource": "vn"
|
|
||||||
},
|
|
||||||
"PayrollCategory": {
|
|
||||||
"dataSource": "vn"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue