Merge branch 'dev' into 8077-sumDefaulter
gitea/salix/pipeline/pr-dev This commit looks good
Details
gitea/salix/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
commit
9765d2b633
|
@ -1723,7 +1723,6 @@ INSERT INTO `ACL` VALUES (378,'OsTicket','osTicketReportEmail','WRITE','ALLOW','
|
||||||
INSERT INTO `ACL` VALUES (379,'Item','buyerWasteEmail','WRITE','ALLOW','ROLE','system',NULL);
|
INSERT INTO `ACL` VALUES (379,'Item','buyerWasteEmail','WRITE','ALLOW','ROLE','system',NULL);
|
||||||
INSERT INTO `ACL` VALUES (380,'Claim','claimPickupPdf','READ','ALLOW','ROLE','employee',NULL);
|
INSERT INTO `ACL` VALUES (380,'Claim','claimPickupPdf','READ','ALLOW','ROLE','employee',NULL);
|
||||||
INSERT INTO `ACL` VALUES (381,'Claim','claimPickupEmail','WRITE','ALLOW','ROLE','claimManager',NULL);
|
INSERT INTO `ACL` VALUES (381,'Claim','claimPickupEmail','WRITE','ALLOW','ROLE','claimManager',NULL);
|
||||||
INSERT INTO `ACL` VALUES (382,'Item','labelPdf','READ','ALLOW','ROLE','employee',NULL);
|
|
||||||
INSERT INTO `ACL` VALUES (383,'Sector','*','READ','ALLOW','ROLE','employee',NULL);
|
INSERT INTO `ACL` VALUES (383,'Sector','*','READ','ALLOW','ROLE','employee',NULL);
|
||||||
INSERT INTO `ACL` VALUES (384,'Sector','*','WRITE','ALLOW','ROLE','employee',NULL);
|
INSERT INTO `ACL` VALUES (384,'Sector','*','WRITE','ALLOW','ROLE','employee',NULL);
|
||||||
INSERT INTO `ACL` VALUES (385,'Route','driverRoutePdf','READ','ALLOW','ROLE','employee',NULL);
|
INSERT INTO `ACL` VALUES (385,'Route','driverRoutePdf','READ','ALLOW','ROLE','employee',NULL);
|
||||||
|
|
|
@ -1505,32 +1505,32 @@ INSERT INTO `vn`.`awb` (id, code, package, weight, created, amount, transitoryFk
|
||||||
(9, '99610289193', 302, 2972, util.VN_CURDATE(), 3871, 442, 1),
|
(9, '99610289193', 302, 2972, util.VN_CURDATE(), 3871, 442, 1),
|
||||||
(10, '07546500856', 185, 2364, util.VN_CURDATE(), 5321, 442, 1);
|
(10, '07546500856', 185, 2364, util.VN_CURDATE(), 5321, 442, 1);
|
||||||
|
|
||||||
INSERT INTO `vn`.`travel`(`id`,`shipped`, `landed`, `warehouseInFk`, `warehouseOutFk`, `agencyModeFk`, `m3`, `kg`,`ref`, `totalEntries`, `cargoSupplierFk`, `awbFK`)
|
INSERT INTO `vn`.`travel`(`id`,`shipped`, `landed`, `warehouseInFk`, `warehouseOutFk`, `agencyModeFk`, `m3`, `kg`,`ref`, `totalEntries`, `cargoSupplierFk`, `awbFK`, `daysInForward`)
|
||||||
VALUES (1, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), 1, 2, 1, 100.00, 1000, 'first travel', 1, 1, 1),
|
VALUES (1, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), 1, 2, 1, 100.00, 1000, 'first travel', 1, 1, 1, NULL),
|
||||||
(2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 2, 1, 150.00, 2000, 'second travel', 2, 2, 2),
|
(2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 2, 1, 150.00, 2000, 'second travel', 2, 2, 2, NULL),
|
||||||
(3, util.VN_CURDATE(), util.VN_CURDATE(), 1, 2, 1, 0.00, 0.00, 'third travel', 1, 1, 3),
|
(3, util.VN_CURDATE(), util.VN_CURDATE(), 1, 2, 1, 0.00, 0.00, 'third travel', 1, 1, 3, NULL),
|
||||||
(4, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 3, 1, 50.00, 500, 'fourth travel', 0, 2, 4),
|
(4, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 3, 1, 50.00, 500, 'fourth travel', 0, 2, 4, NULL),
|
||||||
(5, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 3, 1, 50.00, 500, 'fifth travel', 1, 1, 5),
|
(5, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 3, 1, 50.00, 500, 'fifth travel', 1, 1, 5, NULL),
|
||||||
(6, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 4, 4, 1, 50.00, 500, 'sixth travel', 1, 2, 6),
|
(6, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 4, 4, 1, 50.00, 500, 'sixth travel', 1, 2, 6, NULL),
|
||||||
(7, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 4, 1, 50.00, 500, 'seventh travel', 2, 1, 7),
|
(7, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 4, 1, 50.00, 500, 'seventh travel', 2, 1, 7, 2),
|
||||||
(8, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 1, 1, 50.00, 500, 'eight travel', 1, 2, 10),
|
(8, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 1, 1, 50.00, 500, 'eight travel', 1, 2, 10, NULL),
|
||||||
(10, DATE_ADD(util.VN_CURDATE(), INTERVAL +5 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL +5 DAY), 5, 1, 1, 50.00, 500, 'nineth travel', 1, 2, 10),
|
(10, DATE_ADD(util.VN_CURDATE(), INTERVAL +5 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL +5 DAY), 5, 1, 1, 50.00, 500, 'nineth travel', 1, 2, 10, 2),
|
||||||
(11, util.VN_CURDATE() - INTERVAL 1 DAY , util.VN_CURDATE(), 6, 3, 0, 50.00, 500, 'eleventh travel', 1, 2, 4),
|
(11, util.VN_CURDATE() - INTERVAL 1 DAY , util.VN_CURDATE(), 6, 3, 0, 50.00, 500, 'eleventh travel', 1, 2, 4, NULL),
|
||||||
(12, util.VN_CURDATE() , util.VN_CURDATE() + INTERVAL 1 DAY, 6, 3, 0, 50.00, 500, 'eleventh travel', 1, 2, 4);
|
(12, util.VN_CURDATE() , util.VN_CURDATE() + INTERVAL 1 DAY, 6, 3, 0, 50.00, 500, 'eleventh travel', 1, 2, 4, NULL);
|
||||||
|
|
||||||
INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed`, `companyFk`, `invoiceNumber`, `reference`, `isExcludedFromAvailable`, `isRaid`, `evaNotes`)
|
INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed`, `companyFk`, `invoiceNumber`, `reference`, `isExcludedFromAvailable`, `evaNotes`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 1, 442, 'IN2001', 'Movement 1', 0, 0, ''),
|
(1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 1, 442, 'IN2001', 'Movement 1', 0, ''),
|
||||||
(2, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 442, 'IN2002', 'Movement 2', 0, 0, 'observation two'),
|
(2, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 442, 'IN2002', 'Movement 2', 0, 'observation two'),
|
||||||
(3, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 0, 442, 'IN2003', 'Movement 3', 0, 0, 'observation three'),
|
(3, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 3, 0, 442, 'IN2003', 'Movement 3', 0, 'observation three'),
|
||||||
(4, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 69, 'IN2004', 'Movement 4', 0, 0, 'observation four'),
|
(4, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2, 0, 69, 'IN2004', 'Movement 4', 0, 'observation four'),
|
||||||
(5, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 0, 442, 'IN2005', 'Movement 5', 0, 0, 'observation five'),
|
(5, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 5, 0, 442, 'IN2005', 'Movement 5', 0, 'observation five'),
|
||||||
(6, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 6, 0, 442, 'IN2006', 'Movement 6', 0, 0, 'observation six'),
|
(6, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 6, 0, 442, 'IN2006', 'Movement 6', 0, 'observation six'),
|
||||||
(7, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2007', 'Movement 7', 0, 0, 'observation seven'),
|
(7, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2007', 'Movement 7', 0, 'observation seven'),
|
||||||
(8, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2008', 'Movement 8', 1, 1, ''),
|
(8, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'IN2008', 'Movement 8', 1,''),
|
||||||
(9, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY), 10, 0, 442, 'IN2009', 'Movement 9', 1, 1, ''),
|
(9, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY), 10, 0, 442, 'IN2009', 'Movement 9', 1, ''),
|
||||||
(10, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY), 10, 0, 442, 'IN2009', 'Movement 10', 1, 1, ''),
|
(10, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY), 10, 0, 442, 'IN2009', 'Movement 10', 1, ''),
|
||||||
(99, 69, '2000-12-01 00:00:00.000', 11, 0, 442, 'IN2009', 'Movement 99', 0, 0, '');
|
(99, 69, '2000-12-01 00:00:00.000', 11, 0, 442, 'IN2009', 'Movement 99', 0, '');
|
||||||
|
|
||||||
INSERT INTO `vn`.`entryConfig` (`defaultEntry`, `inventorySupplierFk`, `defaultSupplierFk`)
|
INSERT INTO `vn`.`entryConfig` (`defaultEntry`, `inventorySupplierFk`, `defaultSupplierFk`)
|
||||||
VALUES (2, 4, 1);
|
VALUES (2, 4, 1);
|
||||||
|
|
|
@ -53,7 +53,7 @@ proc: BEGIN
|
||||||
WHERE t.landed BETWEEN vInventoryDate AND vStartDate
|
WHERE t.landed BETWEEN vInventoryDate AND vStartDate
|
||||||
AND t.warehouseInFk = vWarehouse
|
AND t.warehouseInFk = vWarehouse
|
||||||
AND s.name != 'INVENTARIO'
|
AND s.name != 'INVENTARIO'
|
||||||
AND NOT e.isRaid
|
AND NOT t.daysInForward
|
||||||
GROUP BY b.itemFk
|
GROUP BY b.itemFk
|
||||||
) c
|
) c
|
||||||
JOIN vn.item i ON i.id = c.itemFk
|
JOIN vn.item i ON i.id = c.itemFk
|
||||||
|
|
|
@ -14,7 +14,7 @@ BEGIN
|
||||||
b.stickers = NEW.NumberOfUnits
|
b.stickers = NEW.NumberOfUnits
|
||||||
WHERE i.supplyResponseFk = NEW.ID
|
WHERE i.supplyResponseFk = NEW.ID
|
||||||
AND am.name = 'LOGIFLORA'
|
AND am.name = 'LOGIFLORA'
|
||||||
AND e.isRaid
|
AND tr.daysInForward
|
||||||
AND tr.landed >= util.VN_CURDATE();
|
AND tr.landed >= util.VN_CURDATE();
|
||||||
|
|
||||||
END$$
|
END$$
|
||||||
|
|
|
@ -59,7 +59,7 @@ BEGIN
|
||||||
JOIN vn.travel t ON t.id = e.travelFk
|
JOIN vn.travel t ON t.id = e.travelFk
|
||||||
WHERE t.landed BETWEEN vDateInv AND vDate
|
WHERE t.landed BETWEEN vDateInv AND vDate
|
||||||
AND t.warehouseInFk = vWarehouse
|
AND t.warehouseInFk = vWarehouse
|
||||||
AND NOT e.isRaid
|
AND NOT t.daysInForward
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT b.itemFk, -b.quantity
|
SELECT b.itemFk, -b.quantity
|
||||||
FROM vn.buy b
|
FROM vn.buy b
|
||||||
|
@ -67,7 +67,7 @@ BEGIN
|
||||||
JOIN vn.travel t ON t.id = e.travelFk
|
JOIN vn.travel t ON t.id = e.travelFk
|
||||||
WHERE t.shipped BETWEEN vDateInv AND util.VN_CURDATE()
|
WHERE t.shipped BETWEEN vDateInv AND util.VN_CURDATE()
|
||||||
AND t.warehouseOutFk = vWarehouse
|
AND t.warehouseOutFk = vWarehouse
|
||||||
AND NOT e.isRaid
|
AND NOT t.daysInForward
|
||||||
AND t.isDelivered
|
AND t.isDelivered
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT m.itemFk, -m.quantity
|
SELECT m.itemFk, -m.quantity
|
||||||
|
|
|
@ -11,7 +11,7 @@ BEGIN
|
||||||
e.id entryFk,
|
e.id entryFk,
|
||||||
t.id travelFk,
|
t.id travelFk,
|
||||||
b.itemFk,
|
b.itemFk,
|
||||||
e.isRaid,
|
t.daysInForward,
|
||||||
ADDTIME(t.shipped,
|
ADDTIME(t.shipped,
|
||||||
IFNULL(t.shipmentHour, '00:00:00')) shipped,
|
IFNULL(t.shipmentHour, '00:00:00')) shipped,
|
||||||
t.warehouseOutFk,
|
t.warehouseOutFk,
|
||||||
|
@ -50,7 +50,7 @@ BEGIN
|
||||||
itemFk,
|
itemFk,
|
||||||
TIMESTAMPADD(DAY, life, @dated),
|
TIMESTAMPADD(DAY, life, @dated),
|
||||||
quantity,
|
quantity,
|
||||||
IF(isIn, isReceived, isDelivered) AND !isRaid
|
IF(isIn, isReceived, isDelivered) AND NOT daysInForward
|
||||||
FROM tValues
|
FROM tValues
|
||||||
WHERE isIn OR !lessThanInventory;
|
WHERE isIn OR !lessThanInventory;
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ BEGIN
|
||||||
itemFk,
|
itemFk,
|
||||||
created,
|
created,
|
||||||
quantity,
|
quantity,
|
||||||
IF(isIn, isDelivered, isReceived) AND !isRaid
|
IF(isIn, isDelivered, isReceived) AND NOT daysInForward
|
||||||
FROM tValues
|
FROM tValues
|
||||||
WHERE !isIn OR !lessThanInventory;
|
WHERE !isIn OR !lessThanInventory;
|
||||||
|
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` EVENT `vn`.`raidUpdate`
|
|
||||||
ON SCHEDULE EVERY 1 DAY
|
|
||||||
STARTS '2017-12-29 00:05:00.000'
|
|
||||||
ON COMPLETION PRESERVE
|
|
||||||
ENABLE
|
|
||||||
DO CALL raidUpdate$$
|
|
||||||
DELIMITER ;
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`buy_getUltimate`(
|
||||||
|
vItemFk INT,
|
||||||
|
vWarehouseFk INT,
|
||||||
|
vDated DATE
|
||||||
|
)
|
||||||
|
RETURNS int(11)
|
||||||
|
DETERMINISTIC
|
||||||
|
BEGIN
|
||||||
|
/**
|
||||||
|
* Calcula las últimas compras realizadas hasta una fecha.
|
||||||
|
*
|
||||||
|
* @param vItemFk Id del artículo
|
||||||
|
* @param vWarehouseFk Id del almacén
|
||||||
|
* @param vDated Compras hasta fecha
|
||||||
|
* @return Id de compra
|
||||||
|
*/
|
||||||
|
DECLARE vBuyFk INT;
|
||||||
|
|
||||||
|
CALL buy_getUltimate(vItemFk, vWarehouseFk, vDated);
|
||||||
|
|
||||||
|
SELECT buyFk INTO vBuyFk
|
||||||
|
FROM tmp.buyUltimate;
|
||||||
|
|
||||||
|
DROP TEMPORARY TABLE IF EXISTS
|
||||||
|
tmp.buyUltimate,
|
||||||
|
tmp.buyUltimateFromInterval;
|
||||||
|
|
||||||
|
RETURN vBuyFk;
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -39,7 +39,7 @@ BEGIN
|
||||||
AND vWarehouseFk IN (tr.warehouseInFk, 0)
|
AND vWarehouseFk IN (tr.warehouseInFk, 0)
|
||||||
AND b.itemFk = vItemFk
|
AND b.itemFk = vItemFk
|
||||||
AND NOT e.isExcludedFromAvailable
|
AND NOT e.isExcludedFromAvailable
|
||||||
AND NOT e.isRaid
|
AND NOT tr.daysInForward
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT tr.shipped,
|
SELECT tr.shipped,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -58,7 +58,7 @@ BEGIN
|
||||||
AND s.id <> (SELECT supplierFk FROM inventoryConfig)
|
AND s.id <> (SELECT supplierFk FROM inventoryConfig)
|
||||||
AND b.itemFk = vItemFk
|
AND b.itemFk = vItemFk
|
||||||
AND NOT e.isExcludedFromAvailable
|
AND NOT e.isExcludedFromAvailable
|
||||||
AND NOT e.isRaid
|
AND NOT tr.daysInForward
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT t.shipped,
|
SELECT t.shipped,
|
||||||
NULL,
|
NULL,
|
||||||
|
|
|
@ -42,7 +42,7 @@ proc: BEGIN
|
||||||
WHERE t.landed BETWEEN vDatedInventory AND vDatedFrom
|
WHERE t.landed BETWEEN vDatedInventory AND vDatedFrom
|
||||||
AND t.warehouseInFk = vWarehouseLanding
|
AND t.warehouseInFk = vWarehouseLanding
|
||||||
AND NOT e.isExcludedFromAvailable
|
AND NOT e.isExcludedFromAvailable
|
||||||
AND NOT e.isRaid
|
AND NOT t.daysInForward
|
||||||
GROUP BY c.itemFk;
|
GROUP BY c.itemFk;
|
||||||
|
|
||||||
-- Tabla con el ultimo dia de last_buy para cada producto
|
-- Tabla con el ultimo dia de last_buy para cada producto
|
||||||
|
@ -57,7 +57,7 @@ proc: BEGIN
|
||||||
JOIN travel tr ON tr.id = e.travelFk
|
JOIN travel tr ON tr.id = e.travelFk
|
||||||
LEFT JOIN tItemRange i ON t.itemFk = i.itemFk
|
LEFT JOIN tItemRange i ON t.itemFk = i.itemFk
|
||||||
WHERE t.warehouseFk = vWarehouseShipment
|
WHERE t.warehouseFk = vWarehouseShipment
|
||||||
AND NOT e.isRaid
|
AND NOT tr.daysInForward
|
||||||
ON DUPLICATE KEY UPDATE tItemRange.dated = GREATEST(tItemRange.dated,
|
ON DUPLICATE KEY UPDATE tItemRange.dated = GREATEST(tItemRange.dated,
|
||||||
tr.landed);
|
tr.landed);
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ proc: BEGIN
|
||||||
JOIN tItemRangeLive ir ON ir.itemFk = b.itemFk
|
JOIN tItemRangeLive ir ON ir.itemFk = b.itemFk
|
||||||
WHERE NOT e.isExcludedFromAvailable
|
WHERE NOT e.isExcludedFromAvailable
|
||||||
AND b.quantity <> 0
|
AND b.quantity <> 0
|
||||||
AND NOT e.isRaid
|
AND NOT t.daysInForward
|
||||||
AND t.warehouseInFk = vWarehouseLanding
|
AND t.warehouseInFk = vWarehouseLanding
|
||||||
AND t.landed >= vDatedFrom
|
AND t.landed >= vDatedFrom
|
||||||
AND (ir.dated IS NULL OR t.landed <= ir.dated)
|
AND (ir.dated IS NULL OR t.landed <= ir.dated)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`buy_getUltimate`(
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`buy_getUltimate`(
|
||||||
vItemFk INT,
|
vItemFk INT,
|
||||||
vWarehouseFk SMALLINT,
|
vWarehouseFk INT,
|
||||||
vDated DATE
|
vDated DATE
|
||||||
)
|
)
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
|
@ -28,7 +28,7 @@ BEGIN
|
||||||
JOIN agencyMode am ON am.id = tr.agencyModeFk
|
JOIN agencyMode am ON am.id = tr.agencyModeFk
|
||||||
WHERE NOT b.quantity
|
WHERE NOT b.quantity
|
||||||
AND am.code = 'logiflora'
|
AND am.code = 'logiflora'
|
||||||
AND e.isRaid;
|
AND tr.daysInForward;
|
||||||
|
|
||||||
START TRANSACTION;
|
START TRANSACTION;
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,6 @@ BEGIN
|
||||||
supplierFk,
|
supplierFk,
|
||||||
dated,
|
dated,
|
||||||
isExcludedFromAvailable,
|
isExcludedFromAvailable,
|
||||||
isRaid,
|
|
||||||
commission,
|
commission,
|
||||||
currencyFk,
|
currencyFk,
|
||||||
companyFk,
|
companyFk,
|
||||||
|
@ -28,7 +27,6 @@ BEGIN
|
||||||
supplierFk,
|
supplierFk,
|
||||||
dated,
|
dated,
|
||||||
isExcludedFromAvailable,
|
isExcludedFromAvailable,
|
||||||
isRaid,
|
|
||||||
commission,
|
commission,
|
||||||
currencyFk,
|
currencyFk,
|
||||||
companyFk,
|
companyFk,
|
||||||
|
|
|
@ -166,7 +166,7 @@ BEGIN
|
||||||
LEFT JOIN tmp.buyUltimateFromInterval bufi ON bufi.itemFk = i.id
|
LEFT JOIN tmp.buyUltimateFromInterval bufi ON bufi.itemFk = i.id
|
||||||
LEFT JOIN buy b3 ON b3.id = bufi.buyFk
|
LEFT JOIN buy b3 ON b3.id = bufi.buyFk
|
||||||
WHERE ic.display
|
WHERE ic.display
|
||||||
AND NOT e.isRaid
|
AND NOT tr.daysInForward
|
||||||
AND (ti.visible OR ti.available)
|
AND (ti.visible OR ti.available)
|
||||||
ORDER BY i.typeFk, i.name, i.id, i.size, i.category, o.name;
|
ORDER BY i.typeFk, i.name, i.id, i.size, i.category, o.name;
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,8 @@ BEGIN
|
||||||
a.nickname,
|
a.nickname,
|
||||||
sub2.itemPackingTypeConcat,
|
sub2.itemPackingTypeConcat,
|
||||||
est.code,
|
est.code,
|
||||||
es.isScanned
|
es2.isScanned,
|
||||||
|
es2.scanOrder
|
||||||
FROM expedition e
|
FROM expedition e
|
||||||
JOIN ticket t ON t.id = e.ticketFk
|
JOIN ticket t ON t.id = e.ticketFk
|
||||||
JOIN ticketState ts ON ts.ticketFk = e.ticketFk
|
JOIN ticketState ts ON ts.ticketFk = e.ticketFk
|
||||||
|
@ -38,6 +39,7 @@ BEGIN
|
||||||
SELECT MAX(id)
|
SELECT MAX(id)
|
||||||
FROM expeditionState es
|
FROM expeditionState es
|
||||||
WHERE expeditionFk = e.id)
|
WHERE expeditionFk = e.id)
|
||||||
|
LEFT JOIN expeditionState es2 ON es2.id = es.id
|
||||||
WHERE t.routeFk = vRouteFk AND e.freightItemFk <> FALSE
|
WHERE t.routeFk = vRouteFk AND e.freightItemFk <> FALSE
|
||||||
ORDER BY r.created, t.priority DESC;
|
ORDER BY r.created, t.priority DESC;
|
||||||
END$$
|
END$$
|
||||||
|
|
|
@ -137,7 +137,7 @@ BEGIN
|
||||||
JOIN travel tr ON tr.id = e.travelFk
|
JOIN travel tr ON tr.id = e.travelFk
|
||||||
WHERE tr.warehouseInFk = vWarehouseFk
|
WHERE tr.warehouseInFk = vWarehouseFk
|
||||||
AND tr.landed BETWEEN vDateLastInventory AND vDateYesterday
|
AND tr.landed BETWEEN vDateLastInventory AND vDateYesterday
|
||||||
AND NOT isRaid
|
AND NOT tr.daysInForward
|
||||||
GROUP BY b.itemFk;
|
GROUP BY b.itemFk;
|
||||||
|
|
||||||
-- Transfers
|
-- Transfers
|
||||||
|
@ -150,7 +150,7 @@ BEGIN
|
||||||
JOIN travel tr ON tr.id = e.travelFk
|
JOIN travel tr ON tr.id = e.travelFk
|
||||||
WHERE tr.warehouseOutFk = vWarehouseFk
|
WHERE tr.warehouseOutFk = vWarehouseFk
|
||||||
AND tr.shipped BETWEEN vDateLastInventory AND vDateYesterday
|
AND tr.shipped BETWEEN vDateLastInventory AND vDateYesterday
|
||||||
AND NOT isRaid
|
AND NOT tr.daysInForward
|
||||||
GROUP BY b.itemFk
|
GROUP BY b.itemFk
|
||||||
) sub
|
) sub
|
||||||
ON DUPLICATE KEY UPDATE quantity = IFNULL(quantity, 0) + sub.quantityOut;
|
ON DUPLICATE KEY UPDATE quantity = IFNULL(quantity, 0) + sub.quantityOut;
|
||||||
|
|
|
@ -59,7 +59,7 @@ BEGIN
|
||||||
AND (s.id <> vSupplierInventoryFk OR vDated IS NULL)
|
AND (s.id <> vSupplierInventoryFk OR vDated IS NULL)
|
||||||
AND b.itemFk = vItemFk
|
AND b.itemFk = vItemFk
|
||||||
AND NOT e.isExcludedFromAvailable
|
AND NOT e.isExcludedFromAvailable
|
||||||
AND NOT e.isRaid
|
AND NOT tr.daysInForward
|
||||||
),
|
),
|
||||||
entriesOut AS (
|
entriesOut AS (
|
||||||
SELECT 'entry',
|
SELECT 'entry',
|
||||||
|
@ -95,7 +95,7 @@ BEGIN
|
||||||
AND b.itemFk = vItemFk
|
AND b.itemFk = vItemFk
|
||||||
AND NOT e.isExcludedFromAvailable
|
AND NOT e.isExcludedFromAvailable
|
||||||
AND NOT w.isFeedStock
|
AND NOT w.isFeedStock
|
||||||
AND NOT e.isRaid
|
AND NOT tr.daysInForward
|
||||||
),
|
),
|
||||||
sales AS (
|
sales AS (
|
||||||
WITH itemSales AS (
|
WITH itemSales AS (
|
||||||
|
|
|
@ -63,7 +63,7 @@ BEGIN
|
||||||
AND NOT e.isExcludedFromAvailable
|
AND NOT e.isExcludedFromAvailable
|
||||||
AND b.quantity <> 0
|
AND b.quantity <> 0
|
||||||
AND (vItemFk IS NULL OR b.itemFk = vItemFk)
|
AND (vItemFk IS NULL OR b.itemFk = vItemFk)
|
||||||
AND NOT e.isRaid
|
AND NOT t.daysInForward
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT r.itemFk,
|
SELECT r.itemFk,
|
||||||
r.shipment,
|
r.shipment,
|
||||||
|
|
|
@ -30,7 +30,7 @@ BEGIN
|
||||||
AND NOT s.name = 'INVENTARIO'
|
AND NOT s.name = 'INVENTARIO'
|
||||||
AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk)
|
AND (vWarehouseFk IS NULL OR t.warehouseInFk = vWarehouseFk)
|
||||||
AND w.isComparative
|
AND w.isComparative
|
||||||
AND NOT e.isRaid
|
AND NOT t.daysInForward
|
||||||
GROUP BY i.id;
|
GROUP BY i.id;
|
||||||
|
|
||||||
UPDATE tmp.itemInventory y
|
UPDATE tmp.itemInventory y
|
||||||
|
|
|
@ -109,7 +109,7 @@ BEGIN
|
||||||
JOIN warehouse w ON w.id = tr.warehouseInFk
|
JOIN warehouse w ON w.id = tr.warehouseInFk
|
||||||
WHERE tr.landed BETWEEN vInventoried AND vDateDayEnd
|
WHERE tr.landed BETWEEN vInventoried AND vDateDayEnd
|
||||||
AND IF(tr.landed = util.VN_CURDATE(), tr.isReceived, TRUE)
|
AND IF(tr.landed = util.VN_CURDATE(), tr.isReceived, TRUE)
|
||||||
AND NOT e.isRaid
|
AND NOT tr.daysInForward
|
||||||
AND w.valuatedInventory
|
AND w.valuatedInventory
|
||||||
AND t.isInventory
|
AND t.isInventory
|
||||||
AND e.supplierFk <> vInventorySupplierFk
|
AND e.supplierFk <> vInventorySupplierFk
|
||||||
|
@ -131,7 +131,7 @@ BEGIN
|
||||||
JOIN itemCategory ic ON ic.id = t.categoryFk
|
JOIN itemCategory ic ON ic.id = t.categoryFk
|
||||||
JOIN warehouse w ON w.id = tr.warehouseOutFk
|
JOIN warehouse w ON w.id = tr.warehouseOutFk
|
||||||
WHERE tr.shipped BETWEEN vInventoried AND vDateDayEnd
|
WHERE tr.shipped BETWEEN vInventoried AND vDateDayEnd
|
||||||
AND NOT e.isRaid
|
AND NOT tr.daysInForward
|
||||||
AND w.valuatedInventory
|
AND w.valuatedInventory
|
||||||
AND t.isInventory
|
AND t.isInventory
|
||||||
AND (t.id = vItemTypeFk OR vItemTypeFk IS NULL)
|
AND (t.id = vItemTypeFk OR vItemTypeFk IS NULL)
|
||||||
|
@ -196,7 +196,7 @@ BEGIN
|
||||||
JOIN warehouse wIn ON wIn.id = tr.warehouseInFk
|
JOIN warehouse wIn ON wIn.id = tr.warehouseInFk
|
||||||
JOIN warehouse wOut ON wOut.id = tr.warehouseOutFk
|
JOIN warehouse wOut ON wOut.id = tr.warehouseOutFk
|
||||||
WHERE vDated >= tr.shipped AND vDated < tr.landed
|
WHERE vDated >= tr.shipped AND vDated < tr.landed
|
||||||
AND NOT isRaid
|
AND NOT tr.daysInForward
|
||||||
AND wIn.valuatedInventory
|
AND wIn.valuatedInventory
|
||||||
AND t.isInventory
|
AND t.isInventory
|
||||||
AND e.isConfirmed
|
AND e.isConfirmed
|
||||||
|
|
|
@ -60,7 +60,7 @@ proc: BEGIN
|
||||||
AND IFNULL(vWarehouseFk, t.warehouseInFk) = t.warehouseInFk
|
AND IFNULL(vWarehouseFk, t.warehouseInFk) = t.warehouseInFk
|
||||||
AND w.isComparative
|
AND w.isComparative
|
||||||
AND NOT e.isExcludedFromAvailable
|
AND NOT e.isExcludedFromAvailable
|
||||||
AND NOT e.isRaid
|
AND NOT t.daysInForward
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT b.itemFk, - b.quantity
|
SELECT b.itemFk, - b.quantity
|
||||||
FROM buy b
|
FROM buy b
|
||||||
|
@ -71,7 +71,7 @@ proc: BEGIN
|
||||||
AND IFNULL(vWarehouseFk, t.warehouseOutFk) = t.warehouseOutFk
|
AND IFNULL(vWarehouseFk, t.warehouseOutFk) = t.warehouseOutFk
|
||||||
AND w.isComparative
|
AND w.isComparative
|
||||||
AND NOT e.isExcludedFromAvailable
|
AND NOT e.isExcludedFromAvailable
|
||||||
AND NOT e.isRaid
|
AND NOT t.daysInForward
|
||||||
) sub
|
) sub
|
||||||
GROUP BY itemFk;
|
GROUP BY itemFk;
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ proc: BEGIN
|
||||||
AND IFNULL(vWarehouseFk, t.warehouseInFk) = t.warehouseInFk
|
AND IFNULL(vWarehouseFk, t.warehouseInFk) = t.warehouseInFk
|
||||||
AND w.isComparative
|
AND w.isComparative
|
||||||
AND NOT e.isExcludedFromAvailable
|
AND NOT e.isExcludedFromAvailable
|
||||||
AND NOT e.isRaid
|
AND NOT t.daysInForward
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT b.itemFk, t.shipped, - b.quantity
|
SELECT b.itemFk, t.shipped, - b.quantity
|
||||||
FROM buy b
|
FROM buy b
|
||||||
|
@ -132,7 +132,7 @@ proc: BEGIN
|
||||||
AND IFNULL(vWarehouseFk, t.warehouseOutFk) = t.warehouseOutFk
|
AND IFNULL(vWarehouseFk, t.warehouseOutFk) = t.warehouseOutFk
|
||||||
AND w.isComparative
|
AND w.isComparative
|
||||||
AND NOT e.isExcludedFromAvailable
|
AND NOT e.isExcludedFromAvailable
|
||||||
AND NOT e.isRaid
|
AND NOT t.daysInForward
|
||||||
) sub
|
) sub
|
||||||
GROUP BY sub.itemFk, sub.dated;
|
GROUP BY sub.itemFk, sub.dated;
|
||||||
|
|
||||||
|
|
|
@ -1,31 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`raidUpdate`()
|
|
||||||
BEGIN
|
|
||||||
/**
|
|
||||||
* Actualiza el travel de las entradas de redadas
|
|
||||||
*/
|
|
||||||
UPDATE entry e
|
|
||||||
JOIN entryVirtual ev ON ev.entryFk = e.id
|
|
||||||
JOIN travel t ON t.id = e.travelFk
|
|
||||||
JOIN (
|
|
||||||
SELECT *
|
|
||||||
FROM (
|
|
||||||
SELECT t.id, t.landed, tt.warehouseInFk, tt.warehouseOutFk
|
|
||||||
FROM travel t
|
|
||||||
JOIN (
|
|
||||||
SELECT t.warehouseInFk, t.warehouseOutFk
|
|
||||||
FROM entryVirtual ev
|
|
||||||
JOIN entry e ON e.id = ev.entryFk
|
|
||||||
JOIN travel t ON t.id = e.travelFk
|
|
||||||
GROUP BY t.warehouseInFk, t.warehouseOutFk
|
|
||||||
) tt ON t.warehouseInFk = tt.warehouseInFk AND t.warehouseOutFk = tt.warehouseOutFk
|
|
||||||
WHERE shipped > util.VN_CURDATE() AND NOT isDelivered
|
|
||||||
ORDER BY t.landed
|
|
||||||
LIMIT 10000000000000000000
|
|
||||||
) t
|
|
||||||
GROUP BY t.warehouseInFk, t.warehouseOutFk
|
|
||||||
) tt ON t.warehouseInFk = tt.warehouseInFk AND t.warehouseOutFk = tt.warehouseOutFk
|
|
||||||
SET e.travelFk = t.id;
|
|
||||||
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -10,7 +10,7 @@ BEGIN
|
||||||
JOIN vn.entry e ON e.travelFk = tr.id
|
JOIN vn.entry e ON e.travelFk = tr.id
|
||||||
JOIN vn.buy b ON b.entryFk = e.id
|
JOIN vn.buy b ON b.entryFk = e.id
|
||||||
WHERE tr.landed BETWEEN vFromDated AND vToDated
|
WHERE tr.landed BETWEEN vFromDated AND vToDated
|
||||||
AND e.isRaid = FALSE
|
AND NOT tr.daysInForward
|
||||||
AND tr.warehouseInFk = vWarehouseFk
|
AND tr.warehouseInFk = vWarehouseFk
|
||||||
GROUP BY tr.landed , a.name ;
|
GROUP BY tr.landed , a.name ;
|
||||||
END$$
|
END$$
|
||||||
|
|
|
@ -62,7 +62,7 @@ BEGIN
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
CALL entry_cloneHeader(vAuxEntryFk, vNewEntryFk, vNewTravelFk);
|
CALL entry_cloneHeader(vAuxEntryFk, vNewEntryFk, vNewTravelFk);
|
||||||
CALL entry_copyBuys(vAuxEntryFk, vNewEntryFk);
|
CALL entry_copyBuys(vAuxEntryFk, vNewEntryFk);
|
||||||
|
|
||||||
SELECT evaNotes INTO vEvaNotes
|
SELECT evaNotes INTO vEvaNotes
|
||||||
FROM entry
|
FROM entry
|
||||||
|
@ -71,6 +71,8 @@ BEGIN
|
||||||
UPDATE entry
|
UPDATE entry
|
||||||
SET evaNotes = vEvaNotes
|
SET evaNotes = vEvaNotes
|
||||||
WHERE id = vNewEntryFk;
|
WHERE id = vNewEntryFk;
|
||||||
|
|
||||||
|
CALL buy_recalcPricesByEntry(vNewEntryFk);
|
||||||
END LOOP;
|
END LOOP;
|
||||||
|
|
||||||
SET @isModeInventory = FALSE;
|
SET @isModeInventory = FALSE;
|
||||||
|
|
|
@ -1,30 +1,31 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`travel_moveRaids`()
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`travel_moveRaids`()
|
||||||
BEGIN
|
BEGIN
|
||||||
|
/**
|
||||||
/*
|
* Desplaza los travels en el futuro y avisa a los compradores
|
||||||
* Desplaza al dia siguiente los travels que contengan redadas y avisa a los compradores
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
DECLARE vDone BOOL DEFAULT FALSE;
|
DECLARE vDone BOOL DEFAULT FALSE;
|
||||||
DECLARE vWorkerName VARCHAR(50);
|
DECLARE vBuyerEmail VARCHAR(40);
|
||||||
DECLARE vRaid TEXT;
|
DECLARE vTravelLink TEXT;
|
||||||
DECLARE vWorker VARCHAR(50) DEFAULT '';
|
|
||||||
DECLARE vMailBody TEXT DEFAULT '';
|
DECLARE vMailBody TEXT DEFAULT '';
|
||||||
|
|
||||||
DECLARE vCur CURSOR FOR
|
DECLARE vCur CURSOR FOR
|
||||||
SELECT GROUP_CONCAT( DISTINCT CONCAT('https://salix.verdnatura.es/#!/travel/', ttr.id, '/summary ') ORDER BY ttr.id SEPARATOR '\n\r'),
|
SELECT GROUP_CONCAT(DISTINCT
|
||||||
u.name
|
CONCAT('https://salix.verdnatura.es/#!/travel/',
|
||||||
FROM tmp.travel ttr
|
ttm.travelFk,
|
||||||
JOIN entry e ON e.travelFk = ttr.id
|
'/summary ')
|
||||||
|
ORDER BY ttm.travelFk SEPARATOR '\n\r') travelLink,
|
||||||
|
CONCAT(u.name, '@verdnatura.es') buyerEmail
|
||||||
|
FROM tTravelToMove ttm
|
||||||
|
JOIN entry e ON e.travelFk = ttm.travelFk
|
||||||
JOIN buy b ON b.entryFk = e.id
|
JOIN buy b ON b.entryFk = e.id
|
||||||
JOIN item i ON i.id = b.itemFk
|
JOIN item i ON i.id = b.itemFk
|
||||||
JOIN itemType it ON it.id = i.typeFk
|
JOIN itemType it ON it.id = i.typeFk
|
||||||
JOIN account.user u ON u.id = it.workerFk
|
JOIN account.user u ON u.id = it.workerFk
|
||||||
GROUP BY u.name;
|
GROUP BY u.name;
|
||||||
|
|
||||||
DECLARE CONTINUE HANDLER FOR NOT FOUND
|
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
||||||
SET vDone = TRUE;
|
|
||||||
|
|
||||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||||
BEGIN
|
BEGIN
|
||||||
|
@ -32,41 +33,36 @@ BEGIN
|
||||||
RESIGNAL;
|
RESIGNAL;
|
||||||
END;
|
END;
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.travel;
|
CREATE OR REPLACE TEMPORARY TABLE tTravelToMove
|
||||||
CREATE TEMPORARY TABLE tmp.travel
|
SELECT id travelFk,
|
||||||
SELECT tr.id,tr.landed
|
util.VN_CURDATE() + INTERVAL daysInForward DAY newLanded
|
||||||
FROM travel tr
|
FROM travel
|
||||||
JOIN entry e ON e.travelFk = tr.id
|
WHERE daysInForward;
|
||||||
WHERE tr.landed = util.tomorrow()
|
|
||||||
AND e.isRaid
|
|
||||||
GROUP BY tr.id;
|
|
||||||
|
|
||||||
START TRANSACTION;
|
START TRANSACTION;
|
||||||
|
|
||||||
UPDATE travel tr
|
UPDATE travel tr
|
||||||
JOIN tmp.travel ttr ON ttr.id = tr.id
|
JOIN tTravelToMove ttm ON ttm.travelFk = tr.id
|
||||||
SET tr.landed = TIMESTAMPADD(DAY, 1, tr.landed);
|
SET tr.landed = ttm.newLanded;
|
||||||
|
|
||||||
OPEN vCur;
|
OPEN vCur;
|
||||||
|
|
||||||
l: LOOP
|
l: LOOP
|
||||||
SET vDone = FALSE;
|
SET vDone = FALSE;
|
||||||
FETCH vCur INTO vRaid, vWorkerName;
|
FETCH vCur INTO vTravelLink, vBuyerEmail;
|
||||||
|
|
||||||
IF vDone THEN
|
IF vDone THEN
|
||||||
LEAVE l;
|
LEAVE l;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
CALL `vn`.`mail_insert`(CONCAT(vWorkerName, '@verdnatura.es'),
|
CALL `vn`.`mail_insert`(
|
||||||
'noreply@verdnatura.es',
|
vBuyerEmail,
|
||||||
'Cambio de fecha en Redadas',
|
'noreply@verdnatura.es',
|
||||||
CONCAT('Se ha movido las siguientes redadas: \n\r ', vRaid)
|
'Cambio de fecha en Redadas',
|
||||||
);
|
CONCAT('Se ha movido los siguientes travels: \n\r ', vTravelLink));
|
||||||
|
|
||||||
END LOOP;
|
END LOOP;
|
||||||
CLOSE vCur;
|
CLOSE vCur;
|
||||||
COMMIT;
|
COMMIT;
|
||||||
DROP TEMPORARY TABLE tmp.travel;
|
DROP TEMPORARY TABLE tTravelToMove;
|
||||||
|
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -3,7 +3,7 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`entry_beforeUpdate`
|
||||||
BEFORE UPDATE ON `entry`
|
BEFORE UPDATE ON `entry`
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
BEGIN
|
BEGIN
|
||||||
DECLARE vIsVirtual BOOL;
|
DECLARE vDaysInForward INT;
|
||||||
DECLARE vPrintedCount INT;
|
DECLARE vPrintedCount INT;
|
||||||
DECLARE vHasDistinctWarehouses BOOL;
|
DECLARE vHasDistinctWarehouses BOOL;
|
||||||
DECLARE vTotalBuy INT;
|
DECLARE vTotalBuy INT;
|
||||||
|
@ -38,17 +38,19 @@ BEGIN
|
||||||
CALL travel_throwAwb(NEW.travelFk);
|
CALL travel_throwAwb(NEW.travelFk);
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
SELECT COUNT(*) > 0 INTO vIsVirtual
|
SELECT daysInForward INTO vDaysInForward
|
||||||
FROM entryVirtual WHERE entryFk = NEW.id;
|
FROM travel t
|
||||||
|
JOIN entry e ON e.travelFk = t.id
|
||||||
|
WHERE entryFk = NEW.id;
|
||||||
|
|
||||||
SELECT NOT (o.warehouseInFk <=> n.warehouseInFk)
|
SELECT NOT (o.warehouseInFk <=> n.warehouseInFk)
|
||||||
OR NOT (o.warehouseOutFk <=> n.warehouseOutFk)
|
OR NOT (o.warehouseOutFk <=> n.warehouseOutFk)
|
||||||
INTO vHasDistinctWarehouses
|
INTO vHasDistinctWarehouses
|
||||||
FROM travel o, travel n
|
FROM travel o, travel n
|
||||||
WHERE o.id = OLD.travelFk
|
WHERE o.id = OLD.travelFk
|
||||||
AND n.id = NEW.travelFk;
|
AND n.id = NEW.travelFk;
|
||||||
|
|
||||||
IF vIsVirtual AND vHasDistinctWarehouses THEN
|
IF vDaysInForward AND vHasDistinctWarehouses THEN
|
||||||
SIGNAL SQLSTATE '45000'
|
SIGNAL SQLSTATE '45000'
|
||||||
SET MESSAGE_TEXT = 'A cloned entry cannot be moved to a travel with different warehouses';
|
SET MESSAGE_TEXT = 'A cloned entry cannot be moved to a travel with different warehouses';
|
||||||
END IF;
|
END IF;
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`itemType_afterDelete`
|
||||||
|
AFTER DELETE ON `itemType`
|
||||||
|
FOR EACH ROW
|
||||||
|
BEGIN
|
||||||
|
INSERT INTO itemTypeLog
|
||||||
|
SET `action` = 'delete',
|
||||||
|
`changedModel` = 'ItemType',
|
||||||
|
`changedModelId` = OLD.id,
|
||||||
|
`userFk` = account.myUser_getId();
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -0,0 +1,8 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`itemType_beforeInsert`
|
||||||
|
BEFORE INSERT ON `itemType`
|
||||||
|
FOR EACH ROW
|
||||||
|
BEGIN
|
||||||
|
SET NEW.editorFk = account.myUser_getId();
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -3,6 +3,7 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`itemType_beforeUpdate`
|
||||||
BEFORE UPDATE ON `itemType`
|
BEFORE UPDATE ON `itemType`
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
BEGIN
|
BEGIN
|
||||||
|
SET NEW.editorFk = account.myUser_getId();
|
||||||
IF NEW.itemPackingTypeFk = '' THEN
|
IF NEW.itemPackingTypeFk = '' THEN
|
||||||
|
|
||||||
SET NEW.itemPackingTypeFk = NULL;
|
SET NEW.itemPackingTypeFk = NULL;
|
||||||
|
|
|
@ -3,7 +3,7 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`productionConfig_afterD
|
||||||
AFTER DELETE ON `productionConfig`
|
AFTER DELETE ON `productionConfig`
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
BEGIN
|
BEGIN
|
||||||
INSERT INTO productionConfig
|
INSERT INTO productionConfigLog
|
||||||
SET `action` = 'delete',
|
SET `action` = 'delete',
|
||||||
`changedModel` = 'ProductionConfig',
|
`changedModel` = 'ProductionConfig',
|
||||||
`changedModelId` = OLD.id,
|
`changedModelId` = OLD.id,
|
||||||
|
|
|
@ -6,7 +6,7 @@ AS SELECT `t`.`warehouseInFk` AS `warehouseInFk`,
|
||||||
`b`.`itemFk` AS `itemFk`,
|
`b`.`itemFk` AS `itemFk`,
|
||||||
`b`.`quantity` AS `quantity`,
|
`b`.`quantity` AS `quantity`,
|
||||||
`t`.`isReceived` AS `isReceived`,
|
`t`.`isReceived` AS `isReceived`,
|
||||||
`e`.`isRaid` AS `isVirtualStock`,
|
`t`.`daysInForward` AS `isVirtualStock`,
|
||||||
`e`.`id` AS `entryFk`
|
`e`.`id` AS `entryFk`
|
||||||
FROM (
|
FROM (
|
||||||
(
|
(
|
||||||
|
|
|
@ -15,5 +15,5 @@ FROM (
|
||||||
JOIN `vn`.`travel` `t` ON(`e`.`travelFk` = `t`.`id`)
|
JOIN `vn`.`travel` `t` ON(`e`.`travelFk` = `t`.`id`)
|
||||||
)
|
)
|
||||||
WHERE `e`.`isExcludedFromAvailable` = 0
|
WHERE `e`.`isExcludedFromAvailable` = 0
|
||||||
AND `e`.`isRaid` = 0
|
AND NOT `t`.`daysInForward`
|
||||||
AND `b`.`quantity` <> 0
|
AND `b`.`quantity` <> 0
|
||||||
|
|
|
@ -31,5 +31,5 @@ FROM (
|
||||||
LEFT JOIN `edi`.`ekt` `ek` ON(`ek`.`id` = `b`.`ektFk`)
|
LEFT JOIN `edi`.`ekt` `ek` ON(`ek`.`id` = `b`.`ektFk`)
|
||||||
)
|
)
|
||||||
WHERE `tr`.`landed` BETWEEN `util`.`yesterday`() AND `util`.`tomorrow`()
|
WHERE `tr`.`landed` BETWEEN `util`.`yesterday`() AND `util`.`tomorrow`()
|
||||||
AND `e`.`isRaid` = 0
|
AND NOT `tr`.`daysInForward`
|
||||||
AND `b`.`stickers` > 0
|
AND `b`.`stickers` > 0
|
||||||
|
|
|
@ -8,7 +8,6 @@ AS SELECT `e`.`id` AS `Id_Entrada`,
|
||||||
`e`.`isExcludedFromAvailable` AS `Inventario`,
|
`e`.`isExcludedFromAvailable` AS `Inventario`,
|
||||||
`e`.`isConfirmed` AS `Confirmada`,
|
`e`.`isConfirmed` AS `Confirmada`,
|
||||||
`e`.`isOrdered` AS `Pedida`,
|
`e`.`isOrdered` AS `Pedida`,
|
||||||
`e`.`isRaid` AS `Redada`,
|
|
||||||
`e`.`commission` AS `comision`,
|
`e`.`commission` AS `comision`,
|
||||||
`e`.`created` AS `odbc_date`,
|
`e`.`created` AS `odbc_date`,
|
||||||
`e`.`evaNotes` AS `Notas_Eva`,
|
`e`.`evaNotes` AS `Notas_Eva`,
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
|
||||||
SQL SECURITY DEFINER
|
|
||||||
VIEW `vn2008`.`Entradas_Auto`
|
|
||||||
AS SELECT `ev`.`entryFk` AS `Id_Entrada`
|
|
||||||
FROM `vn`.`entryVirtual` `ev`
|
|
|
@ -8,7 +8,7 @@ AS SELECT `e`.`gestDocFk` AS `gestdoc_id`,
|
||||||
`e`.`isExcludedFromAvailable` AS `Inventario`,
|
`e`.`isExcludedFromAvailable` AS `Inventario`,
|
||||||
`e`.`isConfirmed` AS `Confirmada`,
|
`e`.`isConfirmed` AS `Confirmada`,
|
||||||
`e`.`isOrdered` AS `Pedida`,
|
`e`.`isOrdered` AS `Pedida`,
|
||||||
`e`.`isRaid` AS `Redada`,
|
`tr`.`daysInForward` AS `daysInForward`,
|
||||||
`e`.`evaNotes` AS `notas`,
|
`e`.`evaNotes` AS `notas`,
|
||||||
`e`.`supplierFk` AS `Id_Proveedor`,
|
`e`.`supplierFk` AS `Id_Proveedor`,
|
||||||
`tr`.`shipped` AS `shipment`,
|
`tr`.`shipped` AS `shipment`,
|
||||||
|
|
|
@ -17,5 +17,6 @@ AS SELECT `t`.`id` AS `id`,
|
||||||
`t`.`cargoSupplierFk` AS `cargoSupplierFk`,
|
`t`.`cargoSupplierFk` AS `cargoSupplierFk`,
|
||||||
`t`.`totalEntries` AS `totalEntries`,
|
`t`.`totalEntries` AS `totalEntries`,
|
||||||
`t`.`appointment` AS `appointment`,
|
`t`.`appointment` AS `appointment`,
|
||||||
`t`.`awbFk` AS `awbFk`
|
`t`.`awbFk` AS `awbFk`,
|
||||||
|
`t`.`daysInForward` AS `daysInForward`
|
||||||
FROM `vn`.`travel` `t`
|
FROM `vn`.`travel` `t`
|
||||||
|
|
|
@ -28,7 +28,6 @@ AS SELECT `TP`.`Id_Tipo` AS `Familia`,
|
||||||
`E`.`Id_Proveedor` AS `Id_Proveedor`,
|
`E`.`Id_Proveedor` AS `Id_Proveedor`,
|
||||||
`E`.`Fecha` AS `Fecha`,
|
`E`.`Fecha` AS `Fecha`,
|
||||||
`E`.`Confirmada` AS `Confirmada`,
|
`E`.`Confirmada` AS `Confirmada`,
|
||||||
`E`.`Redada` AS `Redada`,
|
|
||||||
`E`.`empresa_id` AS `empresa_id`,
|
`E`.`empresa_id` AS `empresa_id`,
|
||||||
`E`.`travel_id` AS `travel_id`,
|
`E`.`travel_id` AS `travel_id`,
|
||||||
`E`.`Pedida` AS `Pedida`,
|
`E`.`Pedida` AS `Pedida`,
|
||||||
|
@ -85,6 +84,6 @@ FROM (
|
||||||
)
|
)
|
||||||
JOIN `vn2008`.`Cubos` `cb` ON(`cb`.`Id_Cubo` = `C`.`Id_Cubo`)
|
JOIN `vn2008`.`Cubos` `cb` ON(`cb`.`Id_Cubo` = `C`.`Id_Cubo`)
|
||||||
)
|
)
|
||||||
WHERE `W_IN`.`isFeedStock` = 0
|
WHERE NOT `W_IN`.`isFeedStock`
|
||||||
AND `E`.`Inventario` = 0
|
AND NOT `E`.`Inventario`
|
||||||
AND `E`.`Redada` = 0
|
AND NOT `TR`.`daysInForward`
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
ALTER TABLE vn.itemType
|
||||||
|
ADD editorFk int(10) unsigned DEFAULT NULL NULL,
|
||||||
|
ADD CONSTRAINT itemType_user_FK FOREIGN KEY (editorFk) REFERENCES account.`user`(id);
|
||||||
|
|
||||||
|
CREATE TABLE `vn`.`itemTypeLog` (
|
||||||
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`originFk` int(11) DEFAULT NULL,
|
||||||
|
`userFk` int(10) unsigned DEFAULT NULL,
|
||||||
|
`action` set('insert','update','delete') NOT NULL,
|
||||||
|
`creationDate` timestamp NULL DEFAULT current_timestamp(),
|
||||||
|
`description` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
|
||||||
|
`changedModel` enum('ItemType') NOT NULL DEFAULT 'ItemType',
|
||||||
|
`oldInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`oldInstance`)),
|
||||||
|
`newInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`newInstance`)),
|
||||||
|
`changedModelId` int(11) NOT NULL,
|
||||||
|
`changedModelValue` varchar(45) DEFAULT NULL,
|
||||||
|
`summaryId` varchar(30) DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `itemTypeLogUserFk_idx` (`userFk`),
|
||||||
|
KEY `itemTypeLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`),
|
||||||
|
KEY `itemTypeLog_originFk` (`originFk`,`creationDate`),
|
||||||
|
KEY `itemTypeLog_creationDate_IDX` (`creationDate` DESC) USING BTREE,
|
||||||
|
CONSTRAINT `itemTypeLogUserFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci `PAGE_COMPRESSED`=1;
|
||||||
|
|
||||||
|
INSERT IGNORE INTO salix.ACL (model,property,principalId)
|
||||||
|
VALUES ('ItemTypeLog','find','employee');
|
|
@ -0,0 +1,3 @@
|
||||||
|
ALTER TABLE vn.itemType
|
||||||
|
ADD CONSTRAINT itemType_itemPackingType_FK FOREIGN KEY (itemPackingTypeFk)
|
||||||
|
REFERENCES vn.itemPackingType(code) ON DELETE RESTRICT ON UPDATE CASCADE;
|
|
@ -0,0 +1,3 @@
|
||||||
|
DELETE FROM salix.ACL
|
||||||
|
WHERE property = 'labelPdf'
|
||||||
|
AND model = 'Item';
|
|
@ -0,0 +1,7 @@
|
||||||
|
ALTER TABLE vn.travel ADD IF NOT EXISTS daysInForward INT UNSIGNED DEFAULT 0 NOT NULL
|
||||||
|
COMMENT 'Indica que sus entradas son redadas: 0 significa que no es un travel de redadas, y un valor distinto a 0 indica el número de días para el landed respecto a hoy';
|
||||||
|
|
||||||
|
ALTER TABLE vn.entry CHANGE isRaid isRaid_ tinyint(1) DEFAULT 0 NOT NULL COMMENT '@deprecated 2024-11-05';
|
||||||
|
|
||||||
|
RENAME TABLE vn.entryVirtual TO vn.entryVirtual__;
|
||||||
|
ALTER TABLE vn.entryVirtual__ COMMENT='@deprecated 2024-11-05';
|
|
@ -0,0 +1,3 @@
|
||||||
|
USE vn;
|
||||||
|
|
||||||
|
ALTER TABLE vn.expeditionState ADD scanOrder int(11) DEFAULT NULL NULL COMMENT 'Indica la posición al cargar la furgoneta';
|
|
@ -0,0 +1,3 @@
|
||||||
|
INSERT INTO vn.report (name, `method`)
|
||||||
|
VALUES ('LabelItemBarcode','Items/{id}/label-barcode-pdf'),
|
||||||
|
('LabelItemQr','Items/{id}/label-qr-pdf');
|
|
@ -0,0 +1,7 @@
|
||||||
|
UPDATE salix.ACL
|
||||||
|
SET property='buyLabelSupplier'
|
||||||
|
WHERE property = 'buyLabel'
|
||||||
|
AND model = 'Entry';
|
||||||
|
|
||||||
|
INSERT IGNORE INTO salix.ACL (model,property,principalId)
|
||||||
|
VALUES ('Entry','buyLabel','employee');
|
|
@ -0,0 +1,7 @@
|
||||||
|
DELETE FROM vn.report
|
||||||
|
WHERE `name` = 'LabelItemQr';
|
||||||
|
|
||||||
|
UPDATE vn.report
|
||||||
|
SET `method` = 'Entries/{id}/{itemType}/buy-label',
|
||||||
|
`name` = 'LabelBuy'
|
||||||
|
WHERE `name` = 'LabelItemBarcode';
|
|
@ -240,6 +240,10 @@
|
||||||
"There is already a tray with the same height": "There is already a tray with the same height",
|
"There is already a tray with the same height": "There is already a tray with the same height",
|
||||||
"The height must be greater than 50cm": "The height must be greater than 50cm",
|
"The height must be greater than 50cm": "The height must be greater than 50cm",
|
||||||
"The maximum height of the wagon is 200cm": "The maximum height of the wagon is 200cm",
|
"The maximum height of the wagon is 200cm": "The maximum height of the wagon is 200cm",
|
||||||
"The quantity claimed cannot be greater than the quantity of the line": "The quantity claimed cannot be greater than the quantity of the line",
|
"The quantity claimed cannot be greater than the quantity of the line": "The quantity claimed cannot be greater than the quantity of the line",
|
||||||
"There are tickets for this area, delete them first": "There are tickets for this area, delete them first"
|
"There are tickets for this area, delete them first": "There are tickets for this area, delete them first",
|
||||||
|
"ticketLostExpedition": "The ticket [{{ticketId}}]({{{ticketUrl}}}) has the following lost expedition:{{ expeditionId }}",
|
||||||
|
"null": "null",
|
||||||
|
"Invalid or expired verification code": "Invalid or expired verification code",
|
||||||
|
"Payment method is required": "Payment method is required"
|
||||||
}
|
}
|
|
@ -384,5 +384,8 @@
|
||||||
"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",
|
||||||
|
"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"
|
||||||
}
|
}
|
|
@ -123,8 +123,8 @@
|
||||||
"Added sale to ticket": "J'ai ajouté la ligne suivante au ticket [{{ticketId}}]({{{ticketUrl}}}): {{{addition}}}",
|
"Added sale to ticket": "J'ai ajouté la ligne suivante au ticket [{{ticketId}}]({{{ticketUrl}}}): {{{addition}}}",
|
||||||
"Changed sale discount": "J'ai changé le rabais des lignes suivantes du ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
|
"Changed sale discount": "J'ai changé le rabais des lignes suivantes du ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
|
||||||
"Created claim": "J'ai créé la réclamation [{{claimId}}]({{{claimUrl}}}) des lignes suivantes du ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
|
"Created claim": "J'ai créé la réclamation [{{claimId}}]({{{claimUrl}}}) des lignes suivantes du ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
|
||||||
"Changed sale price": " le prix de [{{itemId}} {{concept}}]({{{itemUrl}}}) ({{quantity}}) de {{oldPrice}}€ ➔ *{{newPrice}}€* du ticket [{{ticketId}}]({{{ticketUrl}}})",,
|
"Changed sale price": " le prix de [{{itemId}} {{concept}}]({{{itemUrl}}}) ({{quantity}}) de {{oldPrice}}€ ➔ *{{newPrice}}€* du ticket [{{ticketId}}]({{{ticketUrl}}})",
|
||||||
"Changed sale quantity": "J'ai changé {{changes}} du ticket [{{ticketId}}]({{{ticketUrl}}})",
|
"Changed sale quantity": "J'ai changé {{changes}} du ticket [{{ticketId}}]({{{ticketUrl}}})",
|
||||||
"Changes in sales": "la quantité de {{itemId}} {{concept}} de {{oldQuantity}} ➔ {{newQuantity}}",
|
"Changes in sales": "la quantité de {{itemId}} {{concept}} de {{oldQuantity}} ➔ {{newQuantity}}",
|
||||||
"State": "État",
|
"State": "État",
|
||||||
"regular": "normal",
|
"regular": "normal",
|
||||||
|
@ -362,6 +362,8 @@
|
||||||
"The invoices have been created but the PDFs could not be generated": "La facture a été émise mais le PDF n'a pas pu être généré",
|
"The invoices have been created but the PDFs could not be generated": "La facture a été émise mais le PDF n'a pas pu être généré",
|
||||||
"It has been invoiced but the PDF of refund not be generated": "Il a été facturé mais le PDF de remboursement n'a pas été généré",
|
"It has been invoiced but the PDF of refund not be generated": "Il a été facturé mais le PDF de remboursement n'a pas été généré",
|
||||||
"Cannot send mail": "Impossible d'envoyer le mail",
|
"Cannot send mail": "Impossible d'envoyer le mail",
|
||||||
"Original invoice not found": "Facture originale introuvable",
|
"Original invoice not found": "Facture originale introuvable",
|
||||||
"The quantity claimed cannot be greater than the quantity of the line": "Le montant réclamé ne peut pas être supérieur au montant de la ligne"
|
"The quantity claimed cannot be greater than the quantity of the line": "Le montant réclamé ne peut pas être supérieur au montant de la ligne",
|
||||||
|
"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à"
|
||||||
}
|
}
|
|
@ -124,7 +124,7 @@
|
||||||
"Changed sale discount": "Desconto da venda alterado no ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
|
"Changed sale discount": "Desconto da venda alterado no ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
|
||||||
"Created claim": "Reclamação criada [{{claimId}}]({{{claimUrl}}}) no ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
|
"Created claim": "Reclamação criada [{{claimId}}]({{{claimUrl}}}) no ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
|
||||||
"Changed sale price": "Preço da venda alterado para [{{itemId}} {{concept}}]({{{itemUrl}}}) ({{quantity}}) de {{oldPrice}}€ ➔ *{{newPrice}}€* no ticket [{{ticketId}}]({{{ticketUrl}}})",
|
"Changed sale price": "Preço da venda alterado para [{{itemId}} {{concept}}]({{{itemUrl}}}) ({{quantity}}) de {{oldPrice}}€ ➔ *{{newPrice}}€* no ticket [{{ticketId}}]({{{ticketUrl}}})",
|
||||||
"Changed sale quantity": "Quantidade da venda alterada para {{changes}} no ticket [{{ticketId}}]({{{ticketUrl}}})",
|
"Changed sale quantity": "Quantidade da venda alterada para {{changes}} no ticket [{{ticketId}}]({{{ticketUrl}}})",
|
||||||
"Changes in sales": " [{{itemId}} {{concept}}]({{{itemUrl}}}) de {{oldQuantity}} ➔ *{{newQuantity}}* ",
|
"Changes in sales": " [{{itemId}} {{concept}}]({{{itemUrl}}}) de {{oldQuantity}} ➔ *{{newQuantity}}* ",
|
||||||
"State": "Estado",
|
"State": "Estado",
|
||||||
"regular": "normal",
|
"regular": "normal",
|
||||||
|
@ -361,7 +361,9 @@
|
||||||
"It was not able to create the invoice": "Não foi possível criar a fatura",
|
"It was not able to create the invoice": "Não foi possível criar a fatura",
|
||||||
"The invoices have been created but the PDFs could not be generated": "Foi faturado, mas o PDF não pôde ser gerado",
|
"The invoices have been created but the PDFs could not be generated": "Foi faturado, mas o PDF não pôde ser gerado",
|
||||||
"It has been invoiced but the PDF of refund not be generated": "Foi faturado mas não foi gerado o PDF do reembolso",
|
"It has been invoiced but the PDF of refund not be generated": "Foi faturado mas não foi gerado o PDF do reembolso",
|
||||||
"Original invoice not found": "Fatura original não encontrada",
|
"Original invoice not found": "Fatura original não encontrada",
|
||||||
"Cannot send mail": "Não é possível enviar o email",
|
"Cannot send mail": "Não é possível enviar o email",
|
||||||
"The quantity claimed cannot be greater than the quantity of the line": "O valor reclamado não pode ser superior ao valor da linha"
|
"The quantity claimed cannot be greater than the quantity of the line": "O valor reclamado não pode ser superior ao valor da linha",
|
||||||
|
"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."
|
||||||
}
|
}
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint max-len: ["error", { "code": 150 }]*/
|
||||||
const UserError = require('vn-loopback/util/user-error');
|
const UserError = require('vn-loopback/util/user-error');
|
||||||
|
|
||||||
module.exports = function(Self) {
|
module.exports = function(Self) {
|
||||||
|
@ -98,6 +99,8 @@ module.exports = function(Self) {
|
||||||
return client;
|
return client;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (tx) await tx.rollback();
|
if (tx) await tx.rollback();
|
||||||
|
if (e.message && e.message.includes(`Email already exists`)) throw new UserError(`The web user's email already exists`);
|
||||||
|
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -9,7 +9,6 @@ columns:
|
||||||
notes: notes
|
notes: notes
|
||||||
isConfirmed: confirmed
|
isConfirmed: confirmed
|
||||||
isVirtual: virtual
|
isVirtual: virtual
|
||||||
isRaid: raid
|
|
||||||
commission: commission
|
commission: commission
|
||||||
isOrdered: price3
|
isOrdered: price3
|
||||||
created: created
|
created: created
|
||||||
|
|
|
@ -9,7 +9,6 @@ columns:
|
||||||
notes: notas
|
notes: notas
|
||||||
isConfirmed: confirmado
|
isConfirmed: confirmado
|
||||||
isVirtual: virtual
|
isVirtual: virtual
|
||||||
isRaid: redada
|
|
||||||
commission: comisión
|
commission: comisión
|
||||||
isOrdered: pedida
|
isOrdered: pedida
|
||||||
created: creado
|
created: creado
|
||||||
|
|
|
@ -1,14 +1,28 @@
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
Self.remoteMethodCtx('buyLabel', {
|
Self.remoteMethodCtx('buyLabel', {
|
||||||
description: 'Returns the entry buy labels',
|
description: 'Returns the buy label',
|
||||||
accessType: 'READ',
|
accessType: 'READ',
|
||||||
accepts: [
|
accepts: [
|
||||||
{
|
{
|
||||||
arg: 'id',
|
arg: 'id',
|
||||||
type: 'number',
|
type: 'number',
|
||||||
required: true,
|
required: true,
|
||||||
description: 'The entry id',
|
description: 'The buy id',
|
||||||
http: {source: 'path'}
|
http: {source: 'path'}
|
||||||
|
}, {
|
||||||
|
arg: 'labelType',
|
||||||
|
type: 'string',
|
||||||
|
required: true,
|
||||||
|
description: 'The label type',
|
||||||
|
http: {source: 'path'}
|
||||||
|
}, {
|
||||||
|
arg: 'packing',
|
||||||
|
type: 'number',
|
||||||
|
required: false
|
||||||
|
}, {
|
||||||
|
arg: 'copies',
|
||||||
|
type: 'number',
|
||||||
|
required: false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
returns: [
|
returns: [
|
||||||
|
@ -27,11 +41,16 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
http: {
|
http: {
|
||||||
path: '/:id/buy-label',
|
path: '/:id/:labelType/buy-label',
|
||||||
verb: 'GET'
|
verb: 'GET'
|
||||||
},
|
},
|
||||||
accessScopes: ['DEFAULT', 'read:multimedia']
|
accessScopes: ['DEFAULT', 'read:multimedia']
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.buyLabel = (ctx, id) => Self.printReport(ctx, id, 'buy-label');
|
Self.buyLabel = (ctx, id, labelType) => {
|
||||||
|
if (labelType == 'qr')
|
||||||
|
return Self.printReport(ctx, id, 'buy-label-qr');
|
||||||
|
else
|
||||||
|
return Self.printReport(ctx, id, 'buy-label-barcode');
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
module.exports = Self => {
|
||||||
|
Self.remoteMethodCtx('buyLabelSupplier', {
|
||||||
|
description: 'Returns the entry buy labels',
|
||||||
|
accessType: 'READ',
|
||||||
|
accepts: [
|
||||||
|
{
|
||||||
|
arg: 'id',
|
||||||
|
type: 'number',
|
||||||
|
required: true,
|
||||||
|
description: 'The entry id',
|
||||||
|
http: {source: 'path'}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
returns: [
|
||||||
|
{
|
||||||
|
arg: 'body',
|
||||||
|
type: 'file',
|
||||||
|
root: true
|
||||||
|
}, {
|
||||||
|
arg: 'Content-Type',
|
||||||
|
type: 'String',
|
||||||
|
http: {target: 'header'}
|
||||||
|
}, {
|
||||||
|
arg: 'Content-Disposition',
|
||||||
|
type: 'String',
|
||||||
|
http: {target: 'header'}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
http: {
|
||||||
|
path: '/:id/buy-label-supplier',
|
||||||
|
verb: 'GET'
|
||||||
|
},
|
||||||
|
accessScopes: ['DEFAULT', 'read:multimedia']
|
||||||
|
});
|
||||||
|
|
||||||
|
Self.buyLabelSupplier = (ctx, id) => Self.printReport(ctx, id, 'buy-label-supplier');
|
||||||
|
};
|
|
@ -194,7 +194,7 @@ module.exports = Self => {
|
||||||
e.evaNotes observation,
|
e.evaNotes observation,
|
||||||
e.isConfirmed,
|
e.isConfirmed,
|
||||||
e.isOrdered,
|
e.isOrdered,
|
||||||
e.isRaid,
|
t.daysInForward,
|
||||||
e.commission,
|
e.commission,
|
||||||
e.created,
|
e.created,
|
||||||
e.travelFk,
|
e.travelFk,
|
||||||
|
|
|
@ -48,7 +48,9 @@ module.exports = Self => {
|
||||||
'warehouseInFk',
|
'warehouseInFk',
|
||||||
'isReceived',
|
'isReceived',
|
||||||
'isDelivered',
|
'isDelivered',
|
||||||
'ref'],
|
'ref',
|
||||||
|
'daysInForward',
|
||||||
|
],
|
||||||
include: [
|
include: [
|
||||||
{
|
{
|
||||||
relation: 'agency',
|
relation: 'agency',
|
||||||
|
@ -85,7 +87,6 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
return models.Entry.findOne(filter, myOptions);
|
return models.Entry.findOne(filter, myOptions);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,4 +2,5 @@ module.exports = Self => {
|
||||||
require('../methods/entry/editLatestBuys')(Self);
|
require('../methods/entry/editLatestBuys')(Self);
|
||||||
require('../methods/entry/latestBuysFilter')(Self);
|
require('../methods/entry/latestBuysFilter')(Self);
|
||||||
require('../methods/entry/deleteBuys')(Self);
|
require('../methods/entry/deleteBuys')(Self);
|
||||||
|
require('../methods/entry/buyLabel')(Self);
|
||||||
};
|
};
|
||||||
|
|
|
@ -33,15 +33,6 @@
|
||||||
"isConfirmed": {
|
"isConfirmed": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
"isVirtual": {
|
|
||||||
"type": "boolean",
|
|
||||||
"mysql": {
|
|
||||||
"columnName": "isRaid"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"isRaid": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"commission": {
|
"commission": {
|
||||||
"type": "number"
|
"type": "number"
|
||||||
},
|
},
|
||||||
|
@ -88,7 +79,8 @@
|
||||||
"travel": {
|
"travel": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "Travel",
|
"model": "Travel",
|
||||||
"foreignKey": "travelFk"
|
"foreignKey": "travelFk",
|
||||||
|
"daysInForward": "daysInForward"
|
||||||
},
|
},
|
||||||
"company": {
|
"company": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
|
|
|
@ -23,14 +23,14 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="icons">
|
<div class="icons">
|
||||||
<vn-icon
|
<vn-icon
|
||||||
vn-tooltip="Is inventory entry"
|
vn-tooltip="It is a raid {{$ctrl.entryData.travel.daysInForward}} days forward"
|
||||||
icon="icon-inventory"
|
icon="icon-inventory"
|
||||||
ng-if="$ctrl.entry.isExcludedFromAvailable">
|
ng-if="$ctrl.entry.isExcludedFromAvailable">
|
||||||
</vn-icon>
|
</vn-icon>
|
||||||
<vn-icon
|
<vn-icon
|
||||||
vn-tooltip="Is virtual entry"
|
vn-tooltip="Is virtual entry"
|
||||||
icon="icon-net"
|
icon="icon-net"
|
||||||
ng-if="$ctrl.entry.isRaid">
|
ng-if="$ctrl.entryData.travel.daysInForward">
|
||||||
</vn-icon>
|
</vn-icon>
|
||||||
</div>
|
</div>
|
||||||
<div class="quicklinks">
|
<div class="quicklinks">
|
||||||
|
|
|
@ -86,7 +86,7 @@ auto-load="true">
|
||||||
</vn-check>
|
</vn-check>
|
||||||
<vn-check
|
<vn-check
|
||||||
label="Raid"
|
label="Raid"
|
||||||
ng-model="$ctrl.entryData.isRaid"
|
ng-model="$ctrl.entryData.travel.daysInForward"
|
||||||
disabled="true">
|
disabled="true">
|
||||||
</vn-check>
|
</vn-check>
|
||||||
<vn-check
|
<vn-check
|
||||||
|
|
|
@ -38,13 +38,23 @@ module.exports = Self => {
|
||||||
type: 'integer',
|
type: 'integer',
|
||||||
description: 'Type id',
|
description: 'Type id',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
arg: 'producerFk',
|
||||||
|
type: 'integer',
|
||||||
|
description: 'Producer id',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
arg: 'instrastatFk',
|
||||||
|
type: 'string',
|
||||||
|
description: 'intrastat id',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
arg: 'isActive',
|
arg: 'isActive',
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
description: 'Whether the item is or not active',
|
description: 'Whether the item is or not active',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
arg: 'buyerFk',
|
arg: 'workerFk',
|
||||||
type: 'integer',
|
type: 'integer',
|
||||||
description: 'The buyer of the item',
|
description: 'The buyer of the item',
|
||||||
},
|
},
|
||||||
|
@ -126,14 +136,16 @@ module.exports = Self => {
|
||||||
return {'i.stemMultiplier': value};
|
return {'i.stemMultiplier': value};
|
||||||
case 'categoryFk':
|
case 'categoryFk':
|
||||||
return {'ic.id': value};
|
return {'ic.id': value};
|
||||||
case 'buyerFk':
|
case 'workerFk':
|
||||||
return {'it.workerFk': value};
|
return {'it.workerFk': value};
|
||||||
|
case 'producerFk':
|
||||||
|
return {'pr.id': value};
|
||||||
case 'supplierFk':
|
case 'supplierFk':
|
||||||
return {'s.id': value};
|
return {'s.id': value};
|
||||||
case 'origin':
|
case 'origin':
|
||||||
return {'ori.code': value};
|
return {'ori.code': value};
|
||||||
case 'intrastat':
|
case 'intrastatFk':
|
||||||
return {'intr.description': value};
|
return {'i.intrastatFk': value};
|
||||||
case 'landed':
|
case 'landed':
|
||||||
return {'lb.landed': value};
|
return {'lb.landed': value};
|
||||||
}
|
}
|
||||||
|
@ -172,6 +184,7 @@ module.exports = Self => {
|
||||||
u.name AS userName,
|
u.name AS userName,
|
||||||
ori.code AS origin,
|
ori.code AS origin,
|
||||||
ic.name AS category,
|
ic.name AS category,
|
||||||
|
i.intrastatFk,
|
||||||
intr.description AS intrastat,
|
intr.description AS intrastat,
|
||||||
b.grouping,
|
b.grouping,
|
||||||
b.packing,
|
b.packing,
|
||||||
|
|
|
@ -1,59 +0,0 @@
|
||||||
module.exports = Self => {
|
|
||||||
Self.remoteMethodCtx('labelPdf', {
|
|
||||||
description: 'Returns the item label pdf',
|
|
||||||
accessType: 'READ',
|
|
||||||
accepts: [
|
|
||||||
{
|
|
||||||
arg: 'id',
|
|
||||||
type: 'number',
|
|
||||||
required: true,
|
|
||||||
description: 'The item id',
|
|
||||||
http: {source: 'path'}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
arg: 'recipientId',
|
|
||||||
type: 'number',
|
|
||||||
description: 'The recipient id',
|
|
||||||
required: false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
arg: 'warehouseId',
|
|
||||||
type: 'number',
|
|
||||||
description: 'The warehouse id',
|
|
||||||
required: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
arg: 'labelNumber',
|
|
||||||
type: 'number',
|
|
||||||
required: false
|
|
||||||
},
|
|
||||||
{
|
|
||||||
arg: 'totalLabels',
|
|
||||||
type: 'number',
|
|
||||||
required: false
|
|
||||||
}
|
|
||||||
],
|
|
||||||
returns: [
|
|
||||||
{
|
|
||||||
arg: 'body',
|
|
||||||
type: 'file',
|
|
||||||
root: true
|
|
||||||
}, {
|
|
||||||
arg: 'Content-Type',
|
|
||||||
type: 'String',
|
|
||||||
http: {target: 'header'}
|
|
||||||
}, {
|
|
||||||
arg: 'Content-Disposition',
|
|
||||||
type: 'String',
|
|
||||||
http: {target: 'header'}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
http: {
|
|
||||||
path: '/:id/label-pdf',
|
|
||||||
verb: 'GET'
|
|
||||||
},
|
|
||||||
accessScopes: ['DEFAULT', 'read:multimedia']
|
|
||||||
});
|
|
||||||
|
|
||||||
Self.labelPdf = (ctx, id) => Self.printReport(ctx, id, 'item-label');
|
|
||||||
};
|
|
|
@ -86,7 +86,7 @@ describe('item filter()', () => {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const filter = {};
|
const filter = {};
|
||||||
const ctx = {args: {filter: filter, buyerFk: 16}, req: {accessToken: {userId: 1}}};
|
const ctx = {args: {filter: filter, workerFk: 16}, req: {accessToken: {userId: 1}}};
|
||||||
const result = await models.Item.filter(ctx, filter, options);
|
const result = await models.Item.filter(ctx, filter, options);
|
||||||
|
|
||||||
expect(result.length).toEqual(2);
|
expect(result.length).toEqual(2);
|
||||||
|
|
|
@ -47,6 +47,9 @@
|
||||||
"ItemType": {
|
"ItemType": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
"ItemTypeLog": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
"ItemTypeTag": {
|
"ItemTypeTag": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"name": "ItemTypeLog",
|
||||||
|
"base": "Log",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "itemTypeLog"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -29,6 +29,12 @@
|
||||||
},
|
},
|
||||||
"isLaid": {
|
"isLaid": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"maxRefs": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"isFragile": {
|
||||||
|
"type": "boolean"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"relations": {
|
"relations": {
|
||||||
|
|
|
@ -15,7 +15,6 @@ module.exports = Self => {
|
||||||
require('../methods/item/getWasteByItem')(Self);
|
require('../methods/item/getWasteByItem')(Self);
|
||||||
require('../methods/item/createIntrastat')(Self);
|
require('../methods/item/createIntrastat')(Self);
|
||||||
require('../methods/item/buyerWasteEmail')(Self);
|
require('../methods/item/buyerWasteEmail')(Self);
|
||||||
require('../methods/item/labelPdf')(Self);
|
|
||||||
require('../methods/item/setVisibleDiscard')(Self);
|
require('../methods/item/setVisibleDiscard')(Self);
|
||||||
require('../methods/item/get')(Self);
|
require('../methods/item/get')(Self);
|
||||||
|
|
||||||
|
|
|
@ -38,5 +38,13 @@
|
||||||
"model": "Sector",
|
"model": "Sector",
|
||||||
"foreignKey": "sectorFk"
|
"foreignKey": "sectorFk"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"scope": {
|
||||||
|
"include": {
|
||||||
|
"relation": "sector",
|
||||||
|
"scope": {
|
||||||
|
"fields": ["id", "description"]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,7 @@ module.exports = Self => {
|
||||||
|
|
||||||
const typeFk = expeditionStateType.id;
|
const typeFk = expeditionStateType.id;
|
||||||
expeditionId = expedition.expeditionFk;
|
expeditionId = expedition.expeditionFk;
|
||||||
|
expeditionPosition = expedition?.scanOrder ?? null;
|
||||||
const isScannedExpedition = expedition.isScanned ?? false;
|
const isScannedExpedition = expedition.isScanned ?? false;
|
||||||
|
|
||||||
await models.ExpeditionState.create({
|
await models.ExpeditionState.create({
|
||||||
|
@ -51,6 +52,7 @@ module.exports = Self => {
|
||||||
typeFk,
|
typeFk,
|
||||||
userFk: userId,
|
userFk: userId,
|
||||||
isScanned: isScannedExpedition,
|
isScanned: isScannedExpedition,
|
||||||
|
scanOrder: expeditionPosition
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ const models = require('vn-loopback/server/server').models;
|
||||||
|
|
||||||
describe('expeditionState addExpeditionState()', () => {
|
describe('expeditionState addExpeditionState()', () => {
|
||||||
const ctx = beforeAll.getCtx();
|
const ctx = beforeAll.getCtx();
|
||||||
|
beforeAll.mockLoopBackContext();
|
||||||
it('should update the expedition states', async() => {
|
it('should update the expedition states', async() => {
|
||||||
const tx = await models.ExpeditionState.beginTransaction({});
|
const tx = await models.ExpeditionState.beginTransaction({});
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -48,7 +48,7 @@ module.exports = Self => {
|
||||||
CALL vn.sale_recalcComponent(null);
|
CALL vn.sale_recalcComponent(null);
|
||||||
DROP TEMPORARY TABLE tmp.recalculateSales;`;
|
DROP TEMPORARY TABLE tmp.recalculateSales;`;
|
||||||
|
|
||||||
const recalculation = await Self.rawSql(query, salesIds, myOptions);
|
const recalculation = await Self.rawSql(query, [salesIds], myOptions);
|
||||||
|
|
||||||
if (tx) await tx.commit();
|
if (tx) await tx.commit();
|
||||||
|
|
||||||
|
|
|
@ -85,6 +85,25 @@ describe('sale updatePrice()', () => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should check if priceFixed has changed', async() => {
|
||||||
|
const tx = await models.Sale.beginTransaction({});
|
||||||
|
|
||||||
|
try {
|
||||||
|
const options = {transaction: tx};
|
||||||
|
|
||||||
|
const price = 3;
|
||||||
|
const beforeUpdate = await models.Sale.findById(saleId, null, options);
|
||||||
|
await models.Sale.updatePrice(ctx, saleId, price, options);
|
||||||
|
const afterUpdate = await models.Sale.findById(saleId, null, options);
|
||||||
|
|
||||||
|
expect(beforeUpdate.priceFixed).not.toEqual(afterUpdate.priceFixed);
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
it('should set price as a decimal number and check the sale has the mana component changing the salesPersonMana', async() => {
|
it('should set price as a decimal number and check the sale has the mana component changing the salesPersonMana', async() => {
|
||||||
const tx = await models.Sale.beginTransaction({});
|
const tx = await models.Sale.beginTransaction({});
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,21 @@ module.exports = Self => {
|
||||||
value: componentValue
|
value: componentValue
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
}
|
}
|
||||||
await sale.updateAttributes({price: newPrice}, myOptions);
|
|
||||||
|
const [priceFixed] = await Self.rawSql(`
|
||||||
|
SELECT SUM(value) value
|
||||||
|
FROM sale s
|
||||||
|
JOIN saleComponent sc ON sc.saleFk = s.id
|
||||||
|
JOIN component c ON c.id = sc.componentFk
|
||||||
|
JOIN componentType ct ON ct.id = c.typeFk
|
||||||
|
WHERE ct.isBase
|
||||||
|
AND s.id = ?
|
||||||
|
`, [id], myOptions);
|
||||||
|
|
||||||
|
await sale.updateAttributes({
|
||||||
|
price: newPrice,
|
||||||
|
priceFixed: priceFixed.value
|
||||||
|
}, myOptions);
|
||||||
|
|
||||||
await Self.rawSql('CALL vn.manaSpellersRequery(?)', [userId], myOptions);
|
await Self.rawSql('CALL vn.manaSpellersRequery(?)', [userId], myOptions);
|
||||||
await Self.rawSql('CALL vn.ticket_recalc(?, NULL)', [sale.ticketFk], myOptions);
|
await Self.rawSql('CALL vn.ticket_recalc(?, NULL)', [sale.ticketFk], myOptions);
|
||||||
|
|
|
@ -1,4 +1,66 @@
|
||||||
|
const LoopBackContext = require('loopback-context');
|
||||||
|
|
||||||
module.exports = function(Self) {
|
module.exports = function(Self) {
|
||||||
require('../methods/expedition-state/filter')(Self);
|
require('../methods/expedition-state/filter')(Self);
|
||||||
require('../methods/expedition-state/addExpeditionState')(Self);
|
require('../methods/expedition-state/addExpeditionState')(Self);
|
||||||
|
|
||||||
|
Self.observe('before save', async ctx => {
|
||||||
|
const models = Self.app.models;
|
||||||
|
const changes = ctx.data || ctx.instance;
|
||||||
|
const instance = ctx.currentInstance;
|
||||||
|
const loopBackContext = LoopBackContext.getCurrentContext();
|
||||||
|
const httpCtx = {req: loopBackContext.active};
|
||||||
|
const httpRequest = httpCtx.req.http.req;
|
||||||
|
const $t = httpRequest.__;
|
||||||
|
const myOptions = {};
|
||||||
|
|
||||||
|
if (ctx.options && ctx.options.transaction)
|
||||||
|
myOptions.transaction = ctx.options.transaction;
|
||||||
|
|
||||||
|
const newStateType = changes?.typeFk;
|
||||||
|
if (newStateType == null) return;
|
||||||
|
|
||||||
|
const expeditionId = changes?.expeditionFk || instance?.expeditionFk;
|
||||||
|
|
||||||
|
const {code} = await models.ExpeditionStateType.findById(
|
||||||
|
newStateType,
|
||||||
|
{
|
||||||
|
fields: ['code']
|
||||||
|
},
|
||||||
|
myOptions);
|
||||||
|
|
||||||
|
if (code !== 'LOST') return;
|
||||||
|
|
||||||
|
const dataExpedition = await models.Expedition.findById(
|
||||||
|
expeditionId, {
|
||||||
|
fields: ['ticketFk'],
|
||||||
|
include: [{
|
||||||
|
relation: 'ticket',
|
||||||
|
scope: {
|
||||||
|
fields: ['clientFk'],
|
||||||
|
include: [{
|
||||||
|
relation: 'client',
|
||||||
|
scope: {
|
||||||
|
fields: ['name', 'salesPersonFk']
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
}],
|
||||||
|
|
||||||
|
}, myOptions);
|
||||||
|
|
||||||
|
const salesPersonFk = dataExpedition.ticket()?.client()?.salesPersonFk;
|
||||||
|
|
||||||
|
if (salesPersonFk) {
|
||||||
|
const url = await Self.app.models.Url.getUrl();
|
||||||
|
const fullUrl = `${url}ticket/${dataExpedition.ticketFk}/expedition`;
|
||||||
|
const message = $t('ticketLostExpedition', {
|
||||||
|
ticketId: dataExpedition.ticketFk,
|
||||||
|
expeditionId: expeditionId,
|
||||||
|
url: fullUrl
|
||||||
|
});
|
||||||
|
await models.Chat.sendCheckingPresence(httpCtx, salesPersonFk, message);
|
||||||
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -19,13 +19,17 @@
|
||||||
"type": "number"
|
"type": "number"
|
||||||
},
|
},
|
||||||
"typeFk": {
|
"typeFk": {
|
||||||
"type": "number"
|
"type": "number",
|
||||||
|
"required": true
|
||||||
},
|
},
|
||||||
"userFk": {
|
"userFk": {
|
||||||
"type": "number"
|
"type": "number"
|
||||||
},
|
},
|
||||||
"isScanned": {
|
"isScanned": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"scanOrder": {
|
||||||
|
"type": "number"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"relations": {
|
"relations": {
|
||||||
|
|
|
@ -28,6 +28,9 @@
|
||||||
"discount": {
|
"discount": {
|
||||||
"type": "number"
|
"type": "number"
|
||||||
},
|
},
|
||||||
|
"priceFixed": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
"reserved": {
|
"reserved": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
|
|
|
@ -155,6 +155,7 @@ module.exports = Self => {
|
||||||
t.landingHour,
|
t.landingHour,
|
||||||
t.cargoSupplierFk,
|
t.cargoSupplierFk,
|
||||||
t.totalEntries,
|
t.totalEntries,
|
||||||
|
t.daysInForward,
|
||||||
am.name agencyModeName,
|
am.name agencyModeName,
|
||||||
win.name warehouseInName,
|
win.name warehouseInName,
|
||||||
wout.name warehouseOutName,
|
wout.name warehouseOutName,
|
||||||
|
|
|
@ -44,7 +44,6 @@ module.exports = Self => {
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
let travel = await Self.app.models.Travel.findOne(filter);
|
return Self.app.models.Travel.findOne(filter);
|
||||||
return travel;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -50,6 +50,9 @@
|
||||||
},
|
},
|
||||||
"landingHour": {
|
"landingHour": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
},
|
||||||
|
"daysInForward": {
|
||||||
|
"type": "number"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"relations": {
|
"relations": {
|
||||||
|
|
|
@ -204,6 +204,15 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"summary": {
|
"summary": {
|
||||||
|
"fields": [
|
||||||
|
"id",
|
||||||
|
"firstName",
|
||||||
|
"lastName",
|
||||||
|
"bossFk",
|
||||||
|
"sex",
|
||||||
|
"phone",
|
||||||
|
"mobileExtension"
|
||||||
|
],
|
||||||
"include": [
|
"include": [
|
||||||
{
|
{
|
||||||
"relation": "user",
|
"relation": "user",
|
||||||
|
@ -247,10 +256,21 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"relation": "boss"
|
"relation": "boss",
|
||||||
|
"scope": {
|
||||||
|
"fields": [
|
||||||
|
"id",
|
||||||
|
"name"
|
||||||
|
]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"relation": "client"
|
"relation": "client",
|
||||||
|
"scope": {
|
||||||
|
"fields": [
|
||||||
|
"id"
|
||||||
|
]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"relation": "sip",
|
"relation": "sip",
|
||||||
|
@ -272,14 +292,16 @@
|
||||||
"fields": [
|
"fields": [
|
||||||
"id",
|
"id",
|
||||||
"fiDueDate",
|
"fiDueDate",
|
||||||
"sex",
|
|
||||||
"seniority",
|
"seniority",
|
||||||
"fi",
|
"fi",
|
||||||
"isFreelance",
|
"isFreelance",
|
||||||
"isSsDiscounted",
|
"isSsDiscounted",
|
||||||
"hasMachineryAuthorized",
|
"hasMachineryAuthorized",
|
||||||
"isDisable",
|
"isDisable",
|
||||||
"birth"
|
"birth",
|
||||||
|
"educationLevelFk",
|
||||||
|
"originCountryFk",
|
||||||
|
"maritalStatus"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,84 @@
|
||||||
|
html {
|
||||||
|
font-family: "Roboto", "Helvetica", "Arial", sans-serif;
|
||||||
|
margin-top: -9px;
|
||||||
|
margin-left: -3px;
|
||||||
|
}
|
||||||
|
table {
|
||||||
|
width: 100%;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
td {
|
||||||
|
border: 6px solid white;
|
||||||
|
}
|
||||||
|
.center {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.right {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
.cursive {
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
.bold {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.black-bg {
|
||||||
|
background-color: black;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
.xs-txt {
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
|
.md-txt {
|
||||||
|
font-size: 26px;
|
||||||
|
}
|
||||||
|
.xl-txt {
|
||||||
|
font-size: 50px;
|
||||||
|
}
|
||||||
|
.cell {
|
||||||
|
border: 2px solid black;
|
||||||
|
box-sizing: content-box;
|
||||||
|
width: 100%;
|
||||||
|
height: 30px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.padding {
|
||||||
|
padding: 7px;
|
||||||
|
}
|
||||||
|
.xs-height {
|
||||||
|
height: 50px;
|
||||||
|
max-height: 50px;
|
||||||
|
}
|
||||||
|
.md-height {
|
||||||
|
height: 70px;
|
||||||
|
max-height: 70px;
|
||||||
|
}
|
||||||
|
.sm-width {
|
||||||
|
width: 60px;
|
||||||
|
max-width: 60px;
|
||||||
|
}
|
||||||
|
.md-width {
|
||||||
|
width: 125px;
|
||||||
|
max-width: 125px;
|
||||||
|
}
|
||||||
|
.lg-width {
|
||||||
|
width: 380px;
|
||||||
|
max-width: 380px;
|
||||||
|
}
|
||||||
|
.overflow-multiline {
|
||||||
|
max-height: inherit;
|
||||||
|
display: -webkit-box;
|
||||||
|
overflow: hidden;
|
||||||
|
word-wrap: break-word;
|
||||||
|
line-clamp: 2;
|
||||||
|
-webkit-line-clamp: 2;
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
|
}
|
||||||
|
.overflow-line {
|
||||||
|
width: inherit;
|
||||||
|
max-width: inherit;
|
||||||
|
overflow: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
|
@ -0,0 +1,94 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<body table v-for="buy in buys" style="break-before: page">
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td class="md-txt bold center black-bg lg-width md-height">
|
||||||
|
<div class="overflow-multiline">
|
||||||
|
{{buy.item}}
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td colspan="2" class="xl-txt bold center black-bg md-height md-width">
|
||||||
|
<div class="overflow-line">
|
||||||
|
{{buy.size}}
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="right lg-width">
|
||||||
|
<div class="overflow-line">
|
||||||
|
{{
|
||||||
|
(buy.longName && buy.size && buy.subName)
|
||||||
|
? `${buy.longName} ${buy.size} ${buy.subName}`
|
||||||
|
: buy.comment
|
||||||
|
}}
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td class="center sm-width">
|
||||||
|
<div class="overflow-line">
|
||||||
|
{{buy.producerName || buy.producerFk}}
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td class="center sm-width">
|
||||||
|
<div class="overflow-line">
|
||||||
|
{{buy.inkFk}}
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="md-txt xl-width bold center">
|
||||||
|
<div class="overflow-line">
|
||||||
|
{{buy.itemFk}}
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td colspan="2" class="md-txt md-width center">
|
||||||
|
<div class="overflow-line">
|
||||||
|
{{`${(packing || buy.packing)} x ${buy.stems || ''}`}}
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td rowspan="2" class="center">
|
||||||
|
<div v-html="getBarcode(buy.buyFk)"></div>
|
||||||
|
</td>
|
||||||
|
<td colspan="2" class="center md-width xs-height xs-txt">
|
||||||
|
<div v-if="buy.isLaid && typeId === 'buy'" class="overflow-line black-bg bold">
|
||||||
|
{{'LAID'}}
|
||||||
|
</div>
|
||||||
|
<div v-else class="overflow-line">
|
||||||
|
{{buy.entryFk}}
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="center xs-txt sm-width">
|
||||||
|
<div class="overflow-line">
|
||||||
|
{{buy.buyerName}}
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td class="center xs-txt sm-width">
|
||||||
|
<div class="overflow-line">
|
||||||
|
{{buy.origin}}
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="center xl-width">
|
||||||
|
<div class="overflow-line">
|
||||||
|
{{buy.buyFk}}
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td class="xs-txt sm-width center">
|
||||||
|
<div class="overflow-line">
|
||||||
|
{{date}}
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td class="xs-txt sm-width cursive center bold">
|
||||||
|
<div class="overflow-line">
|
||||||
|
{{`${buy.labelNum}/${buy.quantity / (packing || buy.packing)}`}}
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,49 @@
|
||||||
|
const UserError = require('vn-loopback/util/user-error');
|
||||||
|
const {DOMImplementation, XMLSerializer} = require('xmldom');
|
||||||
|
const moment = require('moment');
|
||||||
|
const jsbarcode = require('jsbarcode');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: 'buy-label-barcode',
|
||||||
|
async serverPrefetch() {
|
||||||
|
this.date = Date.vnNew();
|
||||||
|
this.buys = await this.rawSqlFromDef('buy', [this.copies || 1, this.id]);
|
||||||
|
if (!this.buys.length) throw new UserError(`Empty data source`);
|
||||||
|
this.date = moment(this.date).format('WW/E');
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getBarcode(data) {
|
||||||
|
const document = new DOMImplementation().createDocument('http://www.w3.org/1999/xhtml', 'html', null);
|
||||||
|
const svgNode = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
||||||
|
|
||||||
|
jsbarcode(svgNode, data, {
|
||||||
|
xmlDocument: document,
|
||||||
|
format: 'code128',
|
||||||
|
displayValue: false,
|
||||||
|
width: 3.8,
|
||||||
|
height: 85,
|
||||||
|
margin: 0
|
||||||
|
});
|
||||||
|
return new XMLSerializer().serializeToString(svgNode);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
id: {
|
||||||
|
type: Number,
|
||||||
|
required: true,
|
||||||
|
description: 'The item id'
|
||||||
|
},
|
||||||
|
warehouseId: {
|
||||||
|
type: Number
|
||||||
|
},
|
||||||
|
packing: {
|
||||||
|
type: Number
|
||||||
|
},
|
||||||
|
copies: {
|
||||||
|
type: Number
|
||||||
|
},
|
||||||
|
typeId: {
|
||||||
|
type: String
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
|
@ -0,0 +1 @@
|
||||||
|
reportName: Etiqueta de artículo barcode
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"width": "10.4cm",
|
||||||
|
"height": "4.9cm",
|
||||||
|
"margin": {
|
||||||
|
"top": "0.17cm",
|
||||||
|
"right": "0.37cm",
|
||||||
|
"bottom": "0cm",
|
||||||
|
"left": "0cm"
|
||||||
|
},
|
||||||
|
"printBackground": true
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
WITH RECURSIVE numbers AS (
|
||||||
|
SELECT 1 n
|
||||||
|
UNION ALL
|
||||||
|
SELECT n + 1
|
||||||
|
FROM numbers
|
||||||
|
WHERE n < ?
|
||||||
|
)
|
||||||
|
SELECT ROW_NUMBER() OVER() labelNum,
|
||||||
|
b.itemFk,
|
||||||
|
i.name item,
|
||||||
|
b.id buyFk,
|
||||||
|
b.quantity,
|
||||||
|
b.packing,
|
||||||
|
b.entryFk,
|
||||||
|
o.code origin,
|
||||||
|
p.`name` producerName,
|
||||||
|
p.id producerFk,
|
||||||
|
i.`size`,
|
||||||
|
i.category,
|
||||||
|
i.stems,
|
||||||
|
i.inkFk,
|
||||||
|
ig.longName,
|
||||||
|
ig.subName,
|
||||||
|
i.comment,
|
||||||
|
w.code buyerName,
|
||||||
|
i.isLaid,
|
||||||
|
c.code company
|
||||||
|
FROM vn.buy b
|
||||||
|
JOIN vn.item i ON i.id = b.itemFk
|
||||||
|
LEFT JOIN vn.item ig ON ig.id = b.itemOriginalFk
|
||||||
|
JOIN vn.origin o ON o.id = i.originFk
|
||||||
|
LEFT JOIN vn.producer p ON p.id = i.producerFk
|
||||||
|
JOIN vn.itemType it ON it.id = i.typeFk
|
||||||
|
JOIN vn.worker w ON w.id = it.workerFk
|
||||||
|
JOIN vn.entry e ON e.id = b.entryFk
|
||||||
|
JOIN vn.company c ON c.id = e.companyFk
|
||||||
|
JOIN numbers num
|
||||||
|
WHERE b.id = ?
|
|
@ -0,0 +1,89 @@
|
||||||
|
html {
|
||||||
|
font-family: "Roboto", "Helvetica", "Arial", sans-serif;
|
||||||
|
margin-top: -7px;
|
||||||
|
margin-left: -3px;
|
||||||
|
}
|
||||||
|
.leftTable {
|
||||||
|
width: 47%;
|
||||||
|
font-size: 12px;
|
||||||
|
float: left;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.leftTable img {
|
||||||
|
margin-top: 3px;
|
||||||
|
width: 110px;
|
||||||
|
}
|
||||||
|
.rightTable {
|
||||||
|
width: 53%;
|
||||||
|
font-size: 14px;
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
.rightTable td {
|
||||||
|
border: 3px solid white;
|
||||||
|
}
|
||||||
|
.center {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.cursive {
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
.bold {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.black-bg {
|
||||||
|
background-color: black;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
.md-txt {
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
.xl-txt {
|
||||||
|
font-size: 36px;
|
||||||
|
}
|
||||||
|
.cell {
|
||||||
|
border: 2px solid black;
|
||||||
|
box-sizing: content-box;
|
||||||
|
width: 100%;
|
||||||
|
height: 30px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.padding {
|
||||||
|
padding: 7px;
|
||||||
|
}
|
||||||
|
.md-height {
|
||||||
|
height: 68px;
|
||||||
|
max-height: 68px;
|
||||||
|
}
|
||||||
|
.xs-width {
|
||||||
|
width: 60px;
|
||||||
|
max-width: 60px;
|
||||||
|
}
|
||||||
|
.sm-width {
|
||||||
|
width: 130px;
|
||||||
|
max-width: 130px;
|
||||||
|
}
|
||||||
|
.md-width {
|
||||||
|
width: 190px;
|
||||||
|
max-width: 190px;
|
||||||
|
}
|
||||||
|
.lg-width {
|
||||||
|
width: 240px;
|
||||||
|
max-width: 240px;
|
||||||
|
}
|
||||||
|
.overflow-multiline {
|
||||||
|
max-height: inherit;
|
||||||
|
display: -webkit-box;
|
||||||
|
overflow: hidden;
|
||||||
|
word-wrap: break-word;
|
||||||
|
line-clamp: 2;
|
||||||
|
-webkit-line-clamp: 2;
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
|
}
|
||||||
|
.overflow-line {
|
||||||
|
width: inherit;
|
||||||
|
max-width: inherit;
|
||||||
|
overflow: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
|
@ -0,0 +1,123 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<body v-for="buy in buys" style="break-before: page">
|
||||||
|
<table class="leftTable">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<img v-bind:src="qr"/>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<img v-bind:src="qr"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
{{buy.buyFk}}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<img v-bind:src="qr"/>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<img v-bind:src="qr"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<table class="rightTable">
|
||||||
|
<tr>
|
||||||
|
<td colspan="3" class="lg-width black-bg center bold xl-txt padding">
|
||||||
|
<div class="overflow-line">
|
||||||
|
{{buy.itemFk}}
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2" class="black-bg center bold md-txt md-width md-height">
|
||||||
|
<div class="overflow-multiline">
|
||||||
|
{{buy.item}}
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td class="xs-width black-bg center bold xl-txt">
|
||||||
|
<div class="overflow-line">
|
||||||
|
{{buy.size}}
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="sm-width">
|
||||||
|
<div class="overflow-line">
|
||||||
|
<i>Color:</i> <b>{{buy.inkFk}}</b>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td rowspan="2" class="xs-width center md-txt">
|
||||||
|
<div class="overflow-line cell">
|
||||||
|
{{packing || buy.packing}}
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td rowspan="2" class="xs-width center md-txt">
|
||||||
|
<div class="overflow-line cell">
|
||||||
|
{{buy.stems}}
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="sm-width">
|
||||||
|
<div class="overflow-line">
|
||||||
|
<i>Origen:</i> {{buy.origin}}
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2" class="md-width">
|
||||||
|
<div class="overflow-line">
|
||||||
|
<i>Productor:</i> {{buy.producerName || buy.producerFk}}
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td class="center xs-width xs-txt">
|
||||||
|
<div v-if="buy.isLaid && typeId === 'buy'" class="overflow-line black-bg bold">
|
||||||
|
{{'LAID'}}
|
||||||
|
</div>
|
||||||
|
<div v-else class="overflow-line">
|
||||||
|
{{buy.entryFk}}
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="sm-width">
|
||||||
|
<div class="overflow-line">
|
||||||
|
<i>Comprador:</i> {{buy.buyerName}}
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td rowspan="2" class="xs-width">
|
||||||
|
<div class="overflow-line">
|
||||||
|
<i>F:</i> {{date}}
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td rowspan="2" class="xs-width center cursive bold md-txt">
|
||||||
|
<div class="overflow-line">
|
||||||
|
{{`${buy.labelNum}/${buy.quantity / (packing || buy.packing)}`}}
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="sm-width">
|
||||||
|
<div class="overflow-line">
|
||||||
|
<i>Entrada:</i> {{buy.entryFk}}
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="3" class="lg-width center cursive bold">
|
||||||
|
<div class="overflow-line">
|
||||||
|
{{
|
||||||
|
(buy.longName && buy.size && buy.subName)
|
||||||
|
? `${buy.longName} ${buy.size} ${buy.subName}`
|
||||||
|
: buy.comment
|
||||||
|
}}
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,51 @@
|
||||||
|
const UserError = require('vn-loopback/util/user-error');
|
||||||
|
const moment = require('moment');
|
||||||
|
const qrcode = require('qrcode');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: 'buy-label-qr',
|
||||||
|
async serverPrefetch() {
|
||||||
|
this.date = Date.vnNew();
|
||||||
|
this.buys = await this.rawSqlFromDef('buy', [this.copies || 1, this.id]);
|
||||||
|
if (!this.buys.length) throw new UserError(`Empty data source`);
|
||||||
|
this.qr = await this.getQr(this.buys[0].buyFk);
|
||||||
|
this.date = moment(this.date).format('WW/E');
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getQr(data) {
|
||||||
|
data = {
|
||||||
|
company: this.buys.company,
|
||||||
|
user: this.userId,
|
||||||
|
created: this.date,
|
||||||
|
table: 'buy',
|
||||||
|
id: data
|
||||||
|
};
|
||||||
|
return qrcode.toDataURL(JSON.stringify(data), {
|
||||||
|
margin: 0,
|
||||||
|
errorCorrectionLevel: 'L'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
id: {
|
||||||
|
type: Number,
|
||||||
|
required: true,
|
||||||
|
description: 'The item id'
|
||||||
|
},
|
||||||
|
warehouseId: {
|
||||||
|
type: Number
|
||||||
|
},
|
||||||
|
packing: {
|
||||||
|
type: Number
|
||||||
|
},
|
||||||
|
copies: {
|
||||||
|
type: Number
|
||||||
|
},
|
||||||
|
userId: {
|
||||||
|
type: Number
|
||||||
|
},
|
||||||
|
typeId: {
|
||||||
|
type: String
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
|
@ -0,0 +1 @@
|
||||||
|
reportName: Etiqueta de artículo QR
|
|
@ -1,9 +1,9 @@
|
||||||
{
|
{
|
||||||
"width": "10.4cm",
|
"width": "10.4cm",
|
||||||
"height": "4.8cm",
|
"height": "4.9cm",
|
||||||
"margin": {
|
"margin": {
|
||||||
"top": "0cm",
|
"top": "0.17cm",
|
||||||
"right": "0cm",
|
"right": "0.3cm",
|
||||||
"bottom": "0cm",
|
"bottom": "0cm",
|
||||||
"left": "0cm"
|
"left": "0cm"
|
||||||
},
|
},
|
|
@ -0,0 +1,38 @@
|
||||||
|
WITH RECURSIVE numbers AS (
|
||||||
|
SELECT 1 n
|
||||||
|
UNION ALL
|
||||||
|
SELECT n + 1
|
||||||
|
FROM numbers
|
||||||
|
WHERE n < ?
|
||||||
|
)
|
||||||
|
SELECT ROW_NUMBER() OVER() labelNum,
|
||||||
|
b.itemFk,
|
||||||
|
i.name item,
|
||||||
|
b.id buyFk,
|
||||||
|
b.quantity,
|
||||||
|
b.packing,
|
||||||
|
b.entryFk,
|
||||||
|
o.code origin,
|
||||||
|
p.`name` producerName,
|
||||||
|
p.id producerFk,
|
||||||
|
i.`size`,
|
||||||
|
i.category,
|
||||||
|
i.stems,
|
||||||
|
i.inkFk,
|
||||||
|
ig.longName,
|
||||||
|
ig.subName,
|
||||||
|
i.comment,
|
||||||
|
w.code buyerName,
|
||||||
|
i.isLaid,
|
||||||
|
c.code company
|
||||||
|
FROM vn.buy b
|
||||||
|
JOIN vn.item i ON i.id = b.itemFk
|
||||||
|
LEFT JOIN vn.item ig ON ig.id = b.itemOriginalFk
|
||||||
|
JOIN vn.origin o ON o.id = i.originFk
|
||||||
|
LEFT JOIN vn.producer p ON p.id = i.producerFk
|
||||||
|
JOIN vn.itemType it ON it.id = i.typeFk
|
||||||
|
JOIN vn.worker w ON w.id = it.workerFk
|
||||||
|
JOIN vn.entry e ON e.id = b.entryFk
|
||||||
|
JOIN vn.company c ON c.id = e.companyFk
|
||||||
|
JOIN numbers num
|
||||||
|
WHERE b.id = ?
|
|
@ -0,0 +1,12 @@
|
||||||
|
const Stylesheet = require(`vn-print/core/stylesheet`);
|
||||||
|
|
||||||
|
const path = require('path');
|
||||||
|
const vnPrintPath = path.resolve('print');
|
||||||
|
|
||||||
|
module.exports = new Stylesheet([
|
||||||
|
`${vnPrintPath}/common/css/spacing.css`,
|
||||||
|
`${vnPrintPath}/common/css/misc.css`,
|
||||||
|
`${vnPrintPath}/common/css/layout.css`,
|
||||||
|
`${vnPrintPath}/common/css/report.css`,
|
||||||
|
`${__dirname}/style.css`])
|
||||||
|
.mergeStyles();
|
|
@ -5,7 +5,7 @@ const jsBarcode = require('jsbarcode');
|
||||||
const moment = require('moment');
|
const moment = require('moment');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'buy-label',
|
name: 'buy-label-supplier',
|
||||||
mixins: [vnReport],
|
mixins: [vnReport],
|
||||||
async serverPrefetch() {
|
async serverPrefetch() {
|
||||||
const buy = await models.Buy.findById(this.id, null);
|
const buy = await models.Buy.findById(this.id, null);
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue