Merge branch 'dev' into 6336-claimState_removeSome
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Alex Moreno 2024-03-06 08:08:25 +00:00
commit 31dc2db838
35 changed files with 760 additions and 875 deletions

1
Jenkinsfile vendored
View File

@ -71,7 +71,6 @@ pipeline {
stage('Back') {
steps {
sh 'pnpm install --prefer-offline'
sh 'pnpx puppeteer browsers install chrome'
}
}
stage('Print') {

View File

@ -0,0 +1,52 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`balanceNestTree_addChild`(
vSelf INT,
vName VARCHAR(45)
)
BEGIN
/**
* Agrega un nuevo nodo hijo a un nodo existente dentro de la estructura
* de árbol de vn.balanceNestTree.
*
* @param vSelf Identificador del nodo
* @param vName Nombre del nuevo nodo hijo
*/
DECLARE vTable VARCHAR(45) DEFAULT util.quoteIdentifier('balanceNestTree');
DECLARE vLeft INT;
CREATE OR REPLACE TEMPORARY TABLE tAux
SELECT 0 lft;
EXECUTE IMMEDIATE CONCAT(
'UPDATE tAux
SET lft = (SELECT lft
FROM ', vTable,
' WHERE id = ?)')
USING vSelf;
SELECT lft INTO vLeft FROM tAux;
EXECUTE IMMEDIATE CONCAT(
'UPDATE ', vTable, '
SET rgt = rgt + 2
WHERE rgt > ?
ORDER BY rgt DESC')
USING vLeft;
EXECUTE IMMEDIATE CONCAT(
'UPDATE ', vTable, '
SET lft = lft + 2
WHERE lft > ?
ORDER BY lft DESC')
USING vLeft;
EXECUTE IMMEDIATE CONCAT(
'INSERT INTO ', vTable, ' (name, lft, rgt)
VALUES(?, ? + 1, ? + 2)')
USING vName,
vLeft,
vLeft;
DROP TEMPORARY TABLE tAux;
END$$
DELIMITER ;

View File

@ -0,0 +1,53 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`balanceNestTree_delete`(
vSelf INT
)
BEGIN
/**
* Elimina un nodo dentro de la estructura de árbol de vn.balanceNestTree.
*
* @param vSelf Identificador del nodo
*/
DECLARE vTable VARCHAR(45) DEFAULT util.quoteIdentifier('balanceNestTree');
DECLARE vRight INT;
DECLARE vLeft INT;
DECLARE vWidth INT;
CREATE OR REPLACE TEMPORARY TABLE tAux
SELECT 0 rgt, 0 lft, 0 wdt;
EXECUTE IMMEDIATE CONCAT(
'UPDATE tAux a
JOIN ', vTable, ' t
SET a.rgt = t.rgt,
a.lft = t.lft,
a.wdt = t.rgt - t.lft + 1
WHERE t.id = ?')
USING vSelf;
SELECT rgt, lft, wdt
INTO vRight, vLeft, vWidth
FROM tAux;
EXECUTE IMMEDIATE CONCAT(
'DELETE FROM ', vTable,
' WHERE lft BETWEEN ? AND ?')
USING vLeft, vRight;
EXECUTE IMMEDIATE CONCAT(
'UPDATE ', vTable,
' SET rgt = rgt - ?
WHERE rgt > ?
ORDER BY rgt')
USING vWidth,vRight;
EXECUTE IMMEDIATE CONCAT(
'UPDATE ', vTable,
' SET lft = lft - ?
WHERE lft > ?
ORDER BY lft')
USING vWidth, vRight;
DROP TEMPORARY TABLE tAux;
END$$
DELIMITER ;

View File

@ -0,0 +1,117 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`balanceNestTree_move`(
vSelf INT,
vFather INT
)
BEGIN
/**
* Mueve un nodo dentro de la estructura de árbol de vn.balanceNestTree.
*
* @param vSelf Identificador del nodo
* @param vFather Identificador del nuevo padre del nodo
*/
DECLARE vTable VARCHAR(45) DEFAULT util.quoteIdentifier('balanceNestTree');
DECLARE vRight INT;
DECLARE vLeft INT;
DECLARE vWidth INT;
DECLARE vFatherRight INT;
DECLARE vFatherLeft INT;
DECLARE vGap INT;
CREATE OR REPLACE TEMPORARY TABLE tAux
SELECT 0 rgt, 0 lft, 0 wdt, 0 frg, 0 flf;
-- Averiguamos el ancho de la rama
EXECUTE IMMEDIATE CONCAT(
'UPDATE tAux a
JOIN ', vTable, ' t
SET a.wdt = t.rgt - t.lft + 1
WHERE t.id = ?')
USING vSelf;
-- Averiguamos la posicion del nuevo padre
EXECUTE IMMEDIATE CONCAT(
'UPDATE tAux a
JOIN ', vTable, ' t
SET a.frg = t.rgt,
a.flf = t.lft
WHERE t.id = ?')
USING vFather;
SELECT wdt, frg, flf
INTO vWidth, vFatherRight, vFatherLeft
FROM tAux;
-- 1º Incrementamos los valores de todos los nodos a la derecha
-- del punto de inserción (vFatherRight) , para hacer sitio
EXECUTE IMMEDIATE CONCAT(
'UPDATE ', vTable,
'SET rgt = rgt + ?
WHERE rgt >= ?
ORDER BY rgt DESC')
USING vWidth,
vFatherRight;
EXECUTE IMMEDIATE CONCAT(
'UPDATE ', vTable,
'SET lft = lft + ?
WHERE lft >= ?
ORDER BY lft DESC')
USING vWidth,
vFatherRight;
-- Es preciso recalcular los valores del nodo en el
-- caso de que estuviera a la derecha del nuevo padre
EXECUTE IMMEDIATE CONCAT(
'UPDATE tAux a
JOIN ', vTable, ' t
SET a.rgt = t.rgt,
a.lft = t.lft
WHERE t.id = ?')
USING vSelf;
SELECT lft, rgt, frg - lft
INTO vLeft, vRight, vGap
FROM tAux;
-- 2º Incrementamos el valor de todos los nodos a
-- trasladar hasta alcanzar su nueva posicion
EXECUTE IMMEDIATE CONCAT(
'UPDATE ', vTable,
'SET lft = lft + ?
WHERE lft BETWEEN ? AND ?
ORDER BY lft DESC')
USING vGap,
vLeft,
vRight;
EXECUTE IMMEDIATE CONCAT(
'UPDATE ', vTable,
'SET rgt = rgt + ?
WHERE rgt BETWEEN ? AND ?
ORDER BY rgt DESC')
USING vGap,
vLeft,
vRight;
-- 3º Restaremos a todos los nodos resultantes, a la derecha
-- de la posicion arrancada el ancho de la rama escindida
EXECUTE IMMEDIATE CONCAT(
'UPDATE ', vTable,
'SET lft = lft - ?
WHERE lft > ?
ORDER BY lft')
USING vWidth,
vLeft;
EXECUTE IMMEDIATE CONCAT(
'UPDATE ', vTable,
'SET rgt = rgt - ?
WHERE rgt > ?
ORDER BY rgt')
USING vWidth,
vRight;
DROP TEMPORARY TABLE tAux;
END$$
DELIMITER ;

View File

@ -0,0 +1,103 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`confection_controlSource`(
vDated DATE,
vScopeDays INT,
vMaxAlertLevel INT,
vWarehouseFk INT
)
BEGIN
/**
* Obtiene la información para el control de confección,
* ya sean tickets y/o entradas.
*
* @param vDated Fecha a calcular
* @param vScopeDays Número de días desde hoy en adelante que entran en el cálculo.
* @param vMaxAlertLevel Id nivel de alerta
* @param vWarehouseFk Id de almacén
*/
DECLARE vEndingDate DATETIME DEFAULT util.dayEnd(vDated) + INTERVAL vScopeDays DAY;
SELECT t.shipped,
t.id ticketFk,
s.id saleFk,
s.quantity,
s.concept,
ABS(s.reserved) isReserved,
i.category,
it.name itemType,
t.nickname,
wh.name warehouse,
t.warehouseFk warehouseFk,
a.provinceFk,
am.agencyFk,
ct.description,
stock.visible,
stock.available
FROM ticket t
JOIN agencyMode am ON am.id = t.agencyModeFk
JOIN warehouse wh ON wh.id = t.warehouseFk
JOIN sale s ON s.ticketFk = t.id
JOIN item i ON i.id = s.itemFk
JOIN itemType it ON it.id = i.typeFk
JOIN confectionType ct ON ct.id = it.making
JOIN `address` a on a.id = t.addressFk
LEFT JOIN ticketState tls on tls.ticketFk = t.id
LEFT JOIN
(
SELECT item_id,
SUM(visible) visible,
SUM(available) available
FROM (
SELECT a.item_id,
0 visible,
a.available
FROM cache.cache_calc cc
LEFT JOIN cache.available a ON a.calc_id = cc.id
WHERE cc.cache_id IN ('visible', 'available')
AND cc.params = CONCAT(vWarehouseFk, "/", util.VN_CURDATE())
UNION ALL
SELECT v.item_id,
v.visible,
0
FROM cache.cache_calc cc
LEFT JOIN cache.visible v ON v.calc_id = cc.id
WHERE cc.cacheName IN ('visible', 'available')
AND cc.params = vWarehouseFk
) sub
GROUP BY item_id
) stock ON stock.item_id = s.itemFk
WHERE it.making
AND tls.alertLevel < vMaxAlertLevel
AND wh.hasConfectionTeam
AND t.shipped BETWEEN vDated AND vEndingDate
AND s.quantity > 0
UNION ALL
SELECT tr.shipped,
e.id,
NULL,
b.quantity,
i.name,
NULL,
i.category,
NULL,
whi.name,
who.name,
NULL,
NULL,
NULL,
ct.description,
NULL,
NULL
FROM buy b
JOIN `entry` e ON e.id = b.entryFk
JOIN travel tr ON tr.id = e.travelFk
JOIN warehouse whi ON whi.id = tr.warehouseInFk
JOIN warehouse who ON who.id = tr.warehouseOutFk
JOIN item i ON i.id = b.itemFk
JOIN itemType it ON it.id = i.typeFk
JOIN confectionType ct ON ct.id = it.making
WHERE who.hasConfectionTeam
AND it.making
AND tr.shipped BETWEEN vDated AND vEndingDate;
END$$
DELIMITER ;

View File

@ -13,15 +13,15 @@ BEGIN
DECLARE vWarehouseIn INT;
DECLARE vWarehouseOut INT;
DECLARE vCalcVisible INT;
DECLARE vInventoryDate DATE DEFAULT vn.getInventoryDate();
DECLARE vInventoryDate DATE DEFAULT getInventoryDate();
SELECT shipped, landed, warehouseInFk, warehouseOutFk
INTO vDateShipped, vDateLanded, vWarehouseIn, vWarehouseOut
FROM vn.travel t
JOIN vn.entry e ON e.travelFk = t.id
FROM travel t
JOIN entry e ON e.travelFk = t.id
WHERE e.id = vSelf;
CALL vn.rate_getPrices(vDateShipped, vWarehouseIn);
CALL rate_getPrices(vDateShipped, vWarehouseIn);
-- Traslado en almacen origen
CREATE OR REPLACE TEMPORARY TABLE tBuy
@ -84,7 +84,7 @@ BEGIN
WHERE a.available
ON DUPLICATE KEY UPDATE availableLanding = a.available;
ELSE
CALL vn.item_getStock(vWarehouseOut, vDateShipped, NULL);
CALL item_getStock(vWarehouseOut, vDateShipped, NULL);
CREATE OR REPLACE TEMPORARY TABLE tItem
(UNIQUE INDEX i USING HASH (itemFk))
@ -97,7 +97,7 @@ BEGIN
FROM tmp.itemList;
END IF;
CALL vn.buyUltimateFromInterval(vWarehouseIn,vInventoryDate, vDateLanded);
CALL buyUltimateFromInterval(vWarehouseIn,vInventoryDate, vDateLanded);
CREATE OR REPLACE TEMPORARY TABLE tTransfer
ENGINE = MEMORY
@ -145,26 +145,26 @@ BEGIN
b.id buyFkOrigin,
pa.returnCost,
b.weight
FROM vn.item i
FROM item i
JOIN tItem ti ON ti.itemFk = i.id
LEFT JOIN vn.producer p ON p.id = i.producerFk
LEFT JOIN vn.itemType it ON it.id = i.typeFk
JOIN vn.itemCategory ic ON ic.id = it.categoryFk
LEFT JOIN vn.origin o ON o.id = i.originFk
LEFT JOIN producer p ON p.id = i.producerFk
LEFT JOIN itemType it ON it.id = i.typeFk
JOIN itemCategory ic ON ic.id = it.categoryFk
LEFT JOIN origin o ON o.id = i.originFk
LEFT JOIN tBuy lb ON lb.itemFk = i.id
LEFT JOIN vn.buy b ON b.id = lb.buyFk
LEFT JOIN vn.packaging pa ON pa.id = b.packagingFk
LEFT JOIN vn.entry e2 ON e2.id = b.entryFk
LEFT JOIN vn.supplier s ON s.id = e2.supplierFk
LEFT JOIN vn.entry e ON e.id = vSelf
LEFT JOIN vn.travel tr ON tr.id = e.travelFk
LEFT JOIN vn.agencyMode am ON am.id = tr.agencyModeFk
LEFT JOIN vn.buy b2 ON b2.itemFk = i.id
LEFT JOIN buy b ON b.id = lb.buyFk
LEFT JOIN packaging pa ON pa.id = b.packagingFk
LEFT JOIN entry e2 ON e2.id = b.entryFk
LEFT JOIN supplier s ON s.id = e2.supplierFk
LEFT JOIN entry e ON e.id = vSelf
LEFT JOIN travel tr ON tr.id = e.travelFk
LEFT JOIN agencyMode am ON am.id = tr.agencyModeFk
LEFT JOIN buy b2 ON b2.itemFk = i.id
AND b2.entryFk = vSelf
LEFT JOIN vn.packaging pa2 ON pa2.id = b.packagingFk
LEFT JOIN packaging pa2 ON pa2.id = b.packagingFk
LEFT JOIN tmp.rate r ON TRUE
LEFT JOIN tmp.buyUltimateFromInterval bufi ON bufi.itemFk = i.id
LEFT JOIN vn.buy b3 ON b3.id = bufi.buyFk
LEFT JOIN buy b3 ON b3.id = bufi.buyFk
WHERE ic.display
AND NOT e.isRaid
AND (ti.visible OR ti.available)
@ -172,11 +172,6 @@ BEGIN
CREATE INDEX tIndex USING HASH ON tTransfer (itemFk);
SET @carriage := 0;
SET @comission := 0;
SET @packaging := 0;
SET @rate3 := 0;
SET @cost := 0;
SELECT *,
quantity - MOD(quantity , `grouping`) subQuantity,
MOD(quantity, `grouping`) soll,

View File

@ -1,87 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemProposal`(vItemFk INT, vTicketFk INT,vShowType BOOL)
BEGIN
/**
* Propone articulos disponible ordenado, con la cantidad de veces usado y segun sus caracteristicas
*
* @param vItemFk item id
* @param vTicketFk ticket id
* @param vShowType mostrar tipos
*/
DECLARE vWarehouseFk INT;
DECLARE vShipped DATE;
DECLARE vCalcFk INT;
DECLARE vTypeFk INT;
DECLARE vTag1 VARCHAR(25);
DECLARE vTag5 VARCHAR(25);
DECLARE vTag6 VARCHAR(25);
DECLARE vTag7 VARCHAR(25);
DECLARE vTag8 VARCHAR(25);
DECLARE vValue1 VARCHAR(50);
DECLARE vValue5 VARCHAR(50);
DECLARE vValue6 VARCHAR(50);
DECLARE vValue7 VARCHAR(50);
DECLARE vValue8 VARCHAR(50);
SELECT warehouseFk, shipped INTO vWarehouseFk, vShipped
FROM vn.ticket
WHERE id = vTicketFk;
SELECT typeFk, tag5, value5, tag6, value6, tag7, value7, tag8, value8, t1.name, it1.value
INTO vTypeFk, vTag5, vValue5, vTag6, vValue6, vTag7, vValue7, vTag8, vValue8, vTag1, vValue1
FROM vn.item i
LEFT JOIN vn.itemTag it1 ON it1.itemFk = i.id AND it1.priority = 1
LEFT JOIN vn.tag t1 ON t1.id = it1.tagFk
WHERE i.id = vItemFk;
CALL cache.available_refresh(vCalcFk, FALSE, vWarehouseFk, vShipped);
SELECT i.id itemFk,
i.longName,
i.subName,
i.tag5,
i.value5,
(i.value5 <=> vValue5 COLLATE utf8_general_ci) match5,
i.tag6,
i.value6,
(i.value6 <=> vValue6 COLLATE utf8_general_ci) match6,
i.tag7,
i.value7,
(i.value7 <=> vValue7 COLLATE utf8_general_ci) match7,
i.tag8,
i.value8,
(i.value8 <=> vValue8 COLLATE utf8_general_ci) match8,
a.available,
IFNULL(ip.counter,0) counter,
IF(b.groupingMode = 1, b.grouping, b.packing) as minQuantity,
iss.visible located
FROM item i
JOIN cache.available a ON a.item_id = i.id
LEFT JOIN itemProposal ip ON ip.mateFk = i.id AND ip.itemFk = vItemFk
LEFT JOIN itemTag it1 ON it1.itemFk = i.id AND it1.priority = 1
LEFT JOIN tag t1 ON t1.id = it1.tagFk
LEFT JOIN cache.last_buy lb ON lb.item_id = i.id AND lb.warehouse_id = vWarehouseFk
LEFT JOIN buy b ON b.id = lb.buy_id
LEFT JOIN itemShelvingStock iss ON iss.itemFk = i.id AND iss.warehouseFk = vWarehouseFk
WHERE a.calc_id = vCalcFk
AND available > 0
AND IF(vShowType,i.typeFk = vTypeFk,true)
AND i.id != vItemFk
ORDER BY counter DESC,
(t1.name = vTag1 COLLATE utf8_general_ci) DESC,
(it1.value = vValue1 COLLATE utf8_general_ci) DESC,
(i.tag5 = vTag5 COLLATE utf8_general_ci) DESC,
(i.value5 = vValue5 COLLATE utf8_general_ci) DESC,
(i.tag6 = vTag6 COLLATE utf8_general_ci) DESC,
(i.value6 = vValue6 COLLATE utf8_general_ci) DESC,
(i.tag7 = vTag7 COLLATE utf8_general_ci) DESC,
(i.value7 = vValue7 COLLATE utf8_general_ci) DESC,
(i.tag8 = vTag8 COLLATE utf8_general_ci) DESC,
(i.value8 = vValue8 COLLATE utf8_general_ci) DESC;
END$$
DELIMITER ;

View File

@ -1,76 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemProposal_beta`(vItemFk INT, vTicketFk INT)
BEGIN
DECLARE vWarehouseFk INT;
DECLARE vShipped DATE;
DECLARE vCalcFk INT;
DECLARE vTypeFk INT;
DECLARE vResultsMax INT DEFAULT 10;
DECLARE vTag1 VARCHAR(25);
DECLARE vTag5 VARCHAR(25);
DECLARE vTag6 VARCHAR(25);
DECLARE vTag7 VARCHAR(25);
DECLARE vTag8 VARCHAR(25);
DECLARE vValue1 VARCHAR(50);
DECLARE vValue5 VARCHAR(50);
DECLARE vValue6 VARCHAR(50);
DECLARE vValue7 VARCHAR(50);
DECLARE vValue8 VARCHAR(50);
SELECT warehouseFk, shipped INTO vWarehouseFk, vShipped
FROM vn.ticket
WHERE id = vTicketFk;
SELECT typeFk, tag5, value5, tag6, value6, tag7, value7, tag8, value8, t1.name, it1.value
INTO vTypeFk, vTag5, vValue5, vTag6, vValue6, vTag7, vValue7, vTag8, vValue8, vTag1, vValue1
FROM vn.item i
LEFT JOIN vn.itemTag it1 ON it1.itemFk = i.id AND it1.priority = 1
LEFT JOIN vn.tag t1 ON t1.id = it1.tagFk
WHERE i.id = vItemFk;
CALL cache.available_refresh(vCalcFk, FALSE, vWarehouseFk, vShipped);
SELECT i.id itemFk,
i.longName,
i.subName,
i.tag5,
i.value5,
(i.value5 <=> vValue5 COLLATE utf8_general_ci) match5,
i.tag6,
i.value6,
(i.value6 <=> vValue6 COLLATE utf8_general_ci) match6,
i.tag7,
i.value7,
(i.value7 <=> vValue7 COLLATE utf8_general_ci) match7,
i.tag8,
i.value8,
(i.value8 <=> vValue8 COLLATE utf8_general_ci) match8,
a.available,
IFNULL(ip.counter,0) counter
FROM vn.item i
JOIN cache.available a ON a.item_id = i.id
LEFT JOIN vn.itemProposal ip ON ip.mateFk = i.id AND ip.itemFk = vItemFk
LEFT JOIN vn.itemTag it1 ON it1.itemFk = i.id AND it1.priority = 1
LEFT JOIN vn.tag t1 ON t1.id = it1.tagFk
WHERE a.calc_id = vCalcFk
AND available > 0
AND i.typeFk = vTypeFk
AND i.id != vItemFk
ORDER BY counter DESC,
(t1.name = vTag1 COLLATE utf8_general_ci) DESC,
(it1.value = vValue1 COLLATE utf8_general_ci) DESC,
(i.tag5 = vTag5 COLLATE utf8_general_ci) DESC,
(i.value5 = vValue5 COLLATE utf8_general_ci) DESC,
(i.tag6 = vTag6 COLLATE utf8_general_ci) DESC,
(i.value6 = vValue6 COLLATE utf8_general_ci) DESC,
(i.tag7 = vTag7 COLLATE utf8_general_ci) DESC,
(i.value7 = vValue7 COLLATE utf8_general_ci) DESC,
(i.tag8 = vTag8 COLLATE utf8_general_ci) DESC,
(i.value8 = vValue8 COLLATE utf8_general_ci) DESC
LIMIT vResultsMax;
END$$
DELIMITER ;

View File

@ -1,19 +1,23 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_getSimilar`(vItemFk INT, vWarehouseFk INT, vDate DATE, vIsShowedByType BOOL)
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`item_getSimilar`(
vSelf INT,
vTicketFk INT,
vShowType BOOL
)
BEGIN
/**
* Propone articulos similares para posible cambio,
* ordenado con la cantidad de veces usado y segun sus caracteristicas
* Propone articulos disponibles ordenados, con la cantidad
* de veces usado y segun sus caracteristicas.
*
* @param vItemFk item id
* @param vWarehouseFk warehouse id
* @param vDate fecha para revisar disponible
* @param vIsShowedByType para mostrar solo artículos de ese tipo
* @param vSelf Id de artículo
* @param vTicketFk Id de ticket
* @param vShowType Mostrar tipos
*/
DECLARE vWarehouseFk INT;
DECLARE vShipped DATE;
DECLARE vCalcFk INT;
DECLARE vTypeFk INT;
DECLARE vPriority INT DEFAULT 1;
DECLARE vTag1 VARCHAR(25) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci';
DECLARE vTag5 VARCHAR(25) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci';
@ -27,15 +31,40 @@ BEGIN
DECLARE vValue7 VARCHAR(50) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci';
DECLARE vValue8 VARCHAR(50) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci';
SELECT warehouseFk, shipped
INTO vWarehouseFk, vShipped
FROM ticket
WHERE id = vTicketFk;
SELECT typeFk, tag5, value5, tag6, value6, tag7, value7, tag8, value8, t1.name, it1.value
INTO vTypeFk, vTag5, vValue5, vTag6, vValue6, vTag7, vValue7, vTag8, vValue8, vTag1, vValue1
FROM vn.item i
LEFT JOIN vn.itemTag it1 ON it1.itemFk = i.id AND it1.priority = 1
LEFT JOIN vn.tag t1 ON t1.id = it1.tagFk
WHERE i.id = vItemFk;
SELECT typeFk,
tag5,
value5,
tag6,
value6,
tag7,
value7,
tag8,
value8,
t.name,
it.value
INTO vTypeFk,
vTag5,
vValue5,
vTag6,
vValue6,
vTag7,
vValue7,
vTag8,
vValue8,
vTag1,
vValue1
FROM item i
LEFT JOIN itemTag it ON it.itemFk = i.id
AND it.priority = vPriority
LEFT JOIN tag t ON t.id = it.tagFk
WHERE i.id = vSelf;
CALL cache.available_refresh(vCalcFk, FALSE, vWarehouseFk, vDate);
CALL cache.available_refresh(vCalcFk, FALSE, vWarehouseFk, vShipped);
SELECT i.id itemFk,
i.longName,
@ -53,32 +82,35 @@ BEGIN
i.value8,
(i.value8 <=> vValue8) match8,
a.available,
IFNULL(ip.counter,0) counter,
IF(b.groupingMode = 1, b.grouping, b.packing) as minQuantity
FROM vn.item i
IFNULL(ip.counter, 0) `counter`,
IF(b.groupingMode = 1, b.grouping, b.packing) minQuantity,
iss.visible located
FROM item i
JOIN cache.available a ON a.item_id = i.id
LEFT JOIN vn.itemProposal ip ON ip.mateFk = i.id AND ip.itemFk = vItemFk
LEFT JOIN vn.itemTag it1 ON it1.itemFk = i.id AND it1.priority = 1
LEFT JOIN vn.tag t1 ON t1.id = it1.tagFk
LEFT JOIN cache.last_buy lb ON lb.item_id = i.id AND lb.warehouse_id = vWarehouseFk
LEFT JOIN vn.buy b ON b.id = lb.buy_id
LEFT JOIN itemProposal ip ON ip.mateFk = i.id
AND ip.itemFk = vSelf
LEFT JOIN itemTag it ON it.itemFk = i.id
AND it.priority = vPriority
LEFT JOIN tag t ON t.id = it.tagFk
LEFT JOIN cache.last_buy lb ON lb.item_id = i.id
AND lb.warehouse_id = vWarehouseFk
LEFT JOIN buy b ON b.id = lb.buy_id
LEFT JOIN itemShelvingStock iss ON iss.itemFk = i.id
AND iss.warehouseFk = vWarehouseFk
WHERE a.calc_id = vCalcFk
AND available > 0
AND IF(vIsShowedByType, i.typeFk = vTypeFk, TRUE)
AND i.id != vItemFk
ORDER BY counter DESC,
(t1.name = vTag1) DESC,
(it1.value = vValue1) DESC,
(i.tag6 = vTag6) DESC,
(i.value6 = vValue6) DESC,
AND a.available > 0
AND IF(vShowType, i.typeFk = vTypeFk, TRUE)
AND i.id <> vSelf
ORDER BY `counter` DESC,
(t.name = vTag1) DESC,
(it.value = vValue1) DESC,
(i.tag5 = vTag5) DESC,
(i.value5 = vValue5) DESC,
match5 DESC,
(i.tag6 = vTag6) DESC,
match6 DESC,
(i.tag7 = vTag7) DESC,
(i.value7 = vValue7) DESC,
match7 DESC,
(i.tag8 = vTag8) DESC,
(i.value8 = vValue8) DESC
LIMIT 30;
match8 DESC;
END$$
DELIMITER ;

View File

@ -0,0 +1,84 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`payment_add`(
vDated DATE,
vSupplierFk INT,
vAmount DOUBLE,
vCurrencyFk INT,
vForeignValue DOUBLE,
vBankFk INT,
vPayMethodFk INT,
vExpenseFk DOUBLE,
vConcept VARCHAR(40),
vCompanyFk INT)
BEGIN
/**
* Registra un pago realizado a un proveedor y
* su correspondiente registro en caja.
*
* @param vDated Fecha del pago
* @param vSupplierFk Id del proveedor
* @param vAmount Cantidad a pagar
* @param vCurrencyFk Id de la moneda
* @param vForeignValue Tipo de cambio utilizado
* @param vBankFk Id del banco
* @param vPayMethodFk Id del método de pago
* @param vExpenseFk Id de gasto
* @param vConcept Concepto del pago
* @param vCompanyFk Id de la empresa
* @return paymentFk Id de pago insertado
*/
INSERT INTO till(
concept,
serie,
`number`,
`out`,
dated,
isAccountable,
bankFk,
workerFk,
companyFk,
isConciliate
)
SELECT CONCAT('n/pago a ', `name`),
'R',
vSupplierFk,
vAmount,
vDated,
1,
vBankFk,
account.myUser_getId(),
vCompanyFk,
1
FROM supplier
WHERE id = vSupplierFk;
INSERT INTO payment(
received,
dueDated,
supplierFk,
amount,
currencyFk,
divisa,
bankFk,
payMethodFk,
bankingFees,
concept,
companyFk
)
VALUES(
vDated,
vDated,
vSupplierFk,
vAmount,
vCurrencyFk,
IF(NOT vForeignValue, NULL, vForeignValue),
vBankFk,
vPayMethodFk,
vExpenseFk,
vConcept,
vCompanyFk
);
SELECT LAST_INSERT_ID() paymentFk;
END$$
DELIMITER ;

View File

@ -0,0 +1,70 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`remittance_calc`(
vDated DATE
)
BEGIN
/**
* Calcula los datos de remesa, incluyendo el importe,
* el vencimiento, y otros datos relevantes.
*
* @param vDated Fecha a calcular
* @return tmp.remittance
*/
CREATE OR REPLACE TEMPORARY TABLE tmp.remittance
SELECT CONCAT(s.nif, REPEAT('0', 12 - LENGTH(s.nif))) cif,
c.id clientFk,
c.name client,
c.fi,
sub.paymentDate,
0 invoiceAmount,
CAST(sub.receipt AS DECIMAL(10,2)) receiptAmount,
0 currentAmount,
sub.companyFk,
c.socialName,
CAST(sub.receipt AS DECIMAL(10,2)) totalAmount,
CAST(sub.receipt AS DECIMAL(10,2)) balance,
s.name company,
co.code companyCode,
c.accountingAccount,
c.iban,
c.hasSepaVnl,
c.hasCoreVnl,
c.hasLcr,
be.bic,
be.`name` entityName
FROM client c
JOIN (
SELECT risk.companyFk,
c.id,
SUM(risk.amount) receipt,
IF((c.dueDay + graceDays) MOD 30.001 <= DAY(vDated),
LAST_DAY(vDated - INTERVAL 1 MONTH) + INTERVAL (c.dueDay + graceDays) MOD 30.001 DAY,
LAST_DAY(vDated - INTERVAL 2 MONTH) + INTERVAL (c.dueDay + graceDays) MOD 30.001 DAY
) paymentDate
FROM client c
JOIN payMethod pm ON pm.id = c.payMethodFk
JOIN (
SELECT cr.companyFk, cr.clientFk, cr.amount
FROM client c
JOIN clientRisk cr ON cr.clientFk = c.id
JOIN payMethod pm ON pm.id = c.payMethodFk
WHERE pm.code = 'bankDraft'
UNION ALL
SELECT io.companyFk, io.clientFk, - io.amount
FROM invoiceOut io
JOIN client c ON c.id = io.clientFk
JOIN payMethod pm ON pm.id = c.payMethodFk
WHERE io.dued > vDated
AND pm.code = 'bankDraft'
AND pm.outstandingDebt
AND io.amount > 0
) risk ON risk.clientFk = c.id
GROUP BY risk.companyFk, c.id
HAVING receipt > 10
) sub ON sub.id = c.id
JOIN supplier s ON s.id = sub.companyFk
JOIN company co ON co.id = sub.companyFk
LEFT JOIN bankEntity be ON be.id = c.bankEntityFk;
END$$
DELIMITER ;

View File

@ -27,7 +27,7 @@ BEGIN
s.quantity,
MAKETIME(pb.HH,pb.mm,0) etd,
pb.routeFk,
FLOOR(s.quantity / ish.packing) stickers,
FLOOR(s.quantity / IF(i.isBoxPickingMode, ish.packing, i.packingOut)) stickers,
IF(i.isBoxPickingMode, ish.packing, i.packingOut) packing,
b.packagingFk
FROM sale s
@ -71,5 +71,3 @@ BEGIN
DROP TEMPORARY TABLE tmp.sale;
END$$
DELIMITER ;
CALL `vn`.`sale_getBoxPickingList`(1, curdate());

View File

@ -15,7 +15,7 @@ BEGIN
JOIN agencyMode am ON am.id = t.agencyModeFk
LEFT JOIN ticketState ts ON ts.ticketFk = t.id
JOIN alertLevel al ON al.id = ts.alertLevel
WHERE al.code = 'PACKED' OR (am.code = 'refund' AND al.code != 'delivered')
WHERE (al.code = 'PACKED' OR (am.code = 'refund' AND al.code != 'delivered'))
AND t.id = vTicketFk
AND t.refFk IS NULL
GROUP BY t.id);

View File

@ -1,66 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`CalculoRemesas`(IN vFechaRemesa DATE)
BEGIN
DROP TEMPORARY TABLE IF EXISTS TMP_REMESAS;
CREATE TEMPORARY TABLE TMP_REMESAS
SELECT
CONCAT(p.NIF,REPEAT('0', 12-LENGTH(p.NIF))) as CIF1,
cli.Id_Cliente,
cli.Cliente,
cli.`IF` as NIF,
c.PaymentDate as Vencimiento,
0 ImporteFac,
cast(c.Recibo as decimal(10,2)) as ImporteRec,
0 as ImporteActual,
c.companyFk empresa_id,
cli.RazonSocial,
cast(c.Recibo as decimal(10,2)) as ImporteTotal,
cast(c.Recibo as decimal(10,2)) as Saldo,
p.Proveedor as Empresa,
e.abbreviation as EMP,
cli.cuenta,
iban AS Iban,
CONVERT(SUBSTRING(iban,5,4),UNSIGNED INT) AS nrbe,
sepavnl as SEPA,
corevnl as RecibidoCORE,
hasLcr,
be.bic,
be.`name` entityName
FROM Clientes cli
JOIN
(SELECT risk.companyFk,
c.Id_Cliente,
sum(risk.amount) as Recibo,
IF((c.Vencimiento + graceDays) mod 30.001 <= day(vFechaRemesa)
,TIMESTAMPADD(DAY, (c.Vencimiento + graceDays) MOD 30.001, LAST_DAY(TIMESTAMPADD(MONTH,-1,vFechaRemesa)))
,TIMESTAMPADD(DAY, (c.Vencimiento + graceDays) MOD 30.001, LAST_DAY(TIMESTAMPADD(MONTH,-2,vFechaRemesa)))
) as PaymentDate
FROM Clientes c
JOIN pay_met pm on pm.id = pay_met_id
JOIN
(
SELECT companyFk, clientFk, amount
FROM Clientes c
JOIN vn.clientRisk cr ON cr.clientFk = c.Id_Cliente
WHERE pay_met_id = 4
UNION ALL
SELECT io.companyFk, io.clientFk Id_Cliente, - io.amount
FROM vn.invoiceOut io
JOIN Clientes c ON c.Id_Cliente = io.clientFk
JOIN pay_met pm on pm.id = pay_met_id
WHERE io.dued > vFechaRemesa
AND pay_met_id = 4 AND pm.deudaviva
AND io.amount > 0
) risk ON c.Id_Cliente = risk.clientFk
GROUP BY risk.companyFk, Id_Cliente
HAVING Recibo > 10
) c on c.Id_Cliente = cli.Id_Cliente
JOIN Proveedores p on p.Id_Proveedor = c.companyFk
JOIN empresa e on e.id = c.companyFk
LEFT JOIN vn.bankEntity be ON be.id = cli.bankEntityFk;
END$$
DELIMITER ;

View File

@ -1,11 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`cacheReset`(vCacheName VARCHAR(10), vParams VARCHAR(15))
BEGIN
UPDATE cache.cache_calc
SET expires = util.VN_NOW()
WHERE cacheName = vCacheName collate utf8_unicode_ci
AND params = vParams collate utf8_unicode_ci;
END$$
DELIMITER ;

View File

@ -1,23 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`camiones`(vWarehouse INT, vDate DATE)
BEGIN
SELECT Temperatura
,ROUND(SUM(Etiquetas * volume)) AS cm3
,ROUND(SUM(IF(scanned, Etiquetas, 0) * volume)) AS cm3s
,ROUND(SUM(Vida * volume)) AS cm3e
FROM (
SELECT t.Temperatura, c.Etiquetas, b.scanned, c.Vida,
IF(cu.Volumen > 0, cu.Volumen, cu.x * cu.y * IF(cu.z > 0, cu.z, a.Medida + 10)) volume
FROM Compres c
LEFT JOIN buy_edi b ON b.id = c.buy_edi_id
JOIN Articles a ON a.Id_Article = c.Id_Article
JOIN Tipos t ON t.tipo_id = a.tipo_id
JOIN Entradas e ON e.Id_Entrada = c.Id_Entrada
JOIN travel tr ON tr.id = e.travel_id
JOIN Cubos cu ON cu.Id_Cubo = c.Id_Cubo
WHERE tr.warehouse_id = vWarehouse
AND tr.landing = vDate
) sub
GROUP BY Temperatura;
END$$
DELIMITER ;

View File

@ -1,79 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`cobro`(IN datFEC DATE
, IN idCLI INT
, IN dblIMPORTE DOUBLE
, IN idCAJA INT
, IN idPAYMET INT
, IN strCONCEPTO VARCHAR(40)
, IN idEMP INT
, IN idWH INT
, IN idTRABAJADOR INT)
BEGIN
DECLARE bolCASH BOOLEAN;
DECLARE cuenta_banco BIGINT;
DECLARE cuenta_cliente BIGINT;
DECLARE max_asien INT;
-- XDIARIO
-- No se asientan los cobros directamente, salvo en el caso de las cajas de CASH
SELECT (at2.code = 'cash') INTO bolCASH FROM Bancos b JOIN vn.accountingType at2 ON at2.id = b.cash WHERE b.Id_Banco = idCAJA;
IF bolCASH THEN
SELECT Cuenta INTO cuenta_banco
FROM Bancos
WHERE Id_Banco = idCAJA;
SELECT Cuenta INTO cuenta_cliente
FROM Clientes
WHERE Id_Cliente = idCLI;
CALL vn.ledger_next(max_asien);
INSERT INTO vn.XDiario (ASIEN,FECHA,SUBCTA,CONTRA,CONCEPTO,EURODEBE,EUROHABER,empresa_id)
SELECT max_asien,datFEC,SUBCTA,CONTRA,strCONCEPTO,EURODEBE,EUROHABER,idEMP
FROM(SELECT cuenta_banco SUBCTA, cuenta_cliente CONTRA, 0 EURODEBE, dblIMPORTE EUROHABER
UNION ALL
SELECT cuenta_cliente SUBCTA, cuenta_banco CONTRA, dblIMPORTE EURODEBE, 0 EUROHABER
) gf;
END IF;
-- CAJERA
INSERT INTO Cajas(Id_Trabajador,
Id_Banco,
Entrada,
Concepto,
Cajafecha,
Serie,
Partida,
Numero,
empresa_id,
warehouse_id
)
VALUES (idTRABAJADOR,
idCAJA,
dblIMPORTE,
strCONCEPTO,
datFEC,
'A',
TRUE,
idCLI,
idEMP,
idWH
);
-- RECIBO
INSERT INTO Recibos(Entregado,
Fechacobro,
Id_Trabajador,
Id_Banco,
Id_Cliente,
Id_Factura,
empresa_id
)
VALUES ( dblIMPORTE,
datFEC,
idTRABAJADOR,
idCAJA,
idCLI,
strCONCEPTO,
idEMP
);
END$$
DELIMITER ;

View File

@ -1,105 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`confection_control_source`(vDated DATE, vScopeDays TINYINT)
BEGIN
DECLARE vMidnight DATETIME DEFAULT TIMESTAMP(vDated,'23:59:59');
DECLARE vEndingDate DATETIME DEFAULT TIMESTAMPADD(DAY,vScopeDays,vMidnight);
DECLARE maxAlertLevel INT DEFAULT 2;
DROP TEMPORARY TABLE IF EXISTS tmp.production_buffer;
CREATE TEMPORARY TABLE tmp.production_buffer
ENGINE = MEMORY
SELECT
date(t.Fecha) as Fecha,
hour(t.Fecha) as Hora,
hour(t.Fecha) as Departure,
t.Id_Ticket,
m.Id_Movimiento,
m.Cantidad,
m.Concepte,
ABS(m.Reservado) Reservado,
i.Categoria,
tp.Tipo,
t.Alias as Cliente,
wh.name as Almacen,
t.warehouse_id,
cs.province_id,
a.agency_id,
ct.description as Taller,
stock.visible,
stock.available
FROM vn2008.Tickets t
JOIN vn2008.Agencias a ON a.Id_Agencia = t.Id_Agencia
JOIN vn.warehouse wh ON wh.id = t.warehouse_id
JOIN vn2008.Movimientos m ON m.Id_Ticket = t.Id_Ticket
JOIN vn2008.Articles i ON i.Id_Article = m.Id_Article
JOIN vn2008.Tipos tp ON tp.tipo_id = i.tipo_id
JOIN vn.confectionType ct ON ct.id = tp.confeccion
JOIN vn2008.Consignatarios cs on cs.Id_Consigna = t.Id_Consigna
LEFT JOIN vn.ticketState tls on tls.ticketFk = t.Id_Ticket
LEFT JOIN
(
SELECT item_id, sum(visible) visible, sum(available) available
FROM
(
SELECT a.item_id, 0 as visible, a.available
FROM cache.cache_calc cc
LEFT JOIN cache.available a ON a.calc_id = cc.id
WHERE cc.cache_id IN (2,8)
AND cc.params IN (concat("1/", util.VN_CURDATE()),concat("44/", util.VN_CURDATE()))
UNION ALL
SELECT v.item_id, v.visible, 0 as available
FROM cache.cache_calc cc
LEFT JOIN cache.visible v ON v.calc_id = cc.id
where cc.cache_id IN (2,8) and cc.params IN ("1","44")
) sub
GROUP BY item_id
) stock ON stock.item_id = m.Id_Article
WHERE tp.confeccion
AND tls.alertLevel < maxAlertLevel
AND wh.hasConfectionTeam
AND t.Fecha BETWEEN vDated AND vEndingDate
AND m.Cantidad > 0;
-- Entradas
INSERT INTO tmp.production_buffer(
Fecha,
Id_Ticket,
Cantidad,
Concepte,
Categoria,
Cliente,
Almacen,
Taller
)
SELECT
tr.shipment AS Fecha,
e.Id_Entrada AS Id_Ticket,
c.Cantidad,
a.Article,
a.Categoria,
whi.name as Cliente,
who.name as Almacen,
ct.description as Taller
FROM vn2008.Compres c
JOIN vn2008.Entradas e ON e.Id_Entrada = c.Id_Entrada
JOIN vn2008.travel tr ON tr.id = e.travel_id
JOIN vn.warehouse whi ON whi.id = tr.warehouse_id
JOIN vn.warehouse who ON who.id = tr.warehouse_id_out
JOIN vn2008.Articles a ON a.Id_Article = c.Id_Article
JOIN vn2008.Tipos tp ON tp.tipo_id = a.tipo_id
JOIN vn.confectionType ct ON ct.id = tp.confeccion
WHERE who.hasConfectionTeam
AND tp.confeccion
AND tr.shipment BETWEEN vDated AND vEndingDate;
SELECT * FROM tmp.production_buffer;
END$$
DELIMITER ;

View File

@ -1,48 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`nest_child_add`(
vTable VARCHAR(45)
,vChild VARCHAR(45)
,vFatherId INT
)
BEGIN
DECLARE vMyLeft INT;
SET vTable = util.quoteIdentifier(vTable);
DROP TEMPORARY TABLE IF EXISTS aux;
CREATE TEMPORARY TABLE aux
SELECT 0 as lft;
EXECUTE IMMEDIATE CONCAT(
'UPDATE aux
SET lft = (SELECT lft
FROM ', vTable,
' WHERE id = ?)')
USING vFatherId;
SELECT lft INTO vMyLeft FROM aux;
DROP TEMPORARY TABLE aux;
EXECUTE IMMEDIATE CONCAT(
'UPDATE ', vTable, '
SET rgt = rgt + 2
WHERE rgt > ?
ORDER BY rgt DESC')
USING vMyLeft;
EXECUTE IMMEDIATE CONCAT(
'UPDATE ', vTable, '
SET lft = lft + 2
WHERE lft > ?
ORDER BY lft DESC')
USING vMyLeft;
EXECUTE IMMEDIATE CONCAT(
'INSERT INTO ', vTable, ' (name, lft, rgt)
VALUES(?, ? + 1, ? + 2)')
USING vChild,
vMyLeft,
vMyLeft;
END$$
DELIMITER ;

View File

@ -1,51 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`nest_delete`(
vTable VARCHAR(45)
,vNodeId INT
)
BEGIN
DECLARE vMyRight INT;
DECLARE vMyLeft INT;
DECLARE vMyWidth INT;
DROP TEMPORARY TABLE IF EXISTS aux;
CREATE TEMPORARY TABLE aux
SELECT 0 rgt, 0 lft, 0 wdt;
SET vTable = util.quoteIdentifier(vTable);
EXECUTE IMMEDIATE CONCAT(
'UPDATE aux a
JOIN ', vTable, ' t
SET a.rgt = t.rgt,
a.lft = t.lft,
a.wdt = t.rgt - t.lft + 1
WHERE t.id = ?')
USING vNodeId;
SELECT rgt, lft, wdt
INTO vMyRight, vMyLeft, vMyWidth
FROM aux;
DROP TEMPORARY TABLE aux;
EXECUTE IMMEDIATE CONCAT(
'DELETE FROM ', vTable,
' WHERE lft BETWEEN ? AND ?')
USING vMyLeft, vMyRight;
EXECUTE IMMEDIATE CONCAT(
'UPDATE ', vTable,
' SET rgt = rgt - ?
WHERE rgt > ?
ORDER BY rgt')
USING vMyWidth,vMyRight;
EXECUTE IMMEDIATE CONCAT(
'UPDATE ', vTable,
' SET lft = lft - ?
WHERE lft > ?
ORDER BY lft')
USING vMyWidth, vMyRight;
END$$
DELIMITER ;

View File

@ -1,108 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`nest_move`(
vTable VARCHAR(45)
,idNODE INT
,idFATHER INT
)
BEGIN
DECLARE myRight INT;
DECLARE myLeft INT;
DECLARE myWidth INT;
DECLARE fatherRight INT;
DECLARE fatherLeft INT;
DECLARE gap INT;
SET vTable = util.quoteIdentifier(vTable);
DROP TEMPORARY TABLE IF EXISTS aux;
CREATE TEMPORARY TABLE aux
SELECT 0 as rgt, 0 as lft, 0 as wdt, 0 as frg, 0 as flf;
-- Averiguamos el ancho de la rama
EXECUTE IMMEDIATE CONCAT(
'UPDATE aux a
JOIN ', vTable, ' t
SET a.wdt = t.rgt - t.lft + 1
WHERE t.id = ?')
USING idNODE;
-- Averiguamos la posicion del nuevo padre
EXECUTE IMMEDIATE CONCAT(
'UPDATE aux a
JOIN ', vTable, ' t
SET a.frg = t.rgt,
a.flf = t.lft
WHERE t.id = ?')
USING idFATHER;
SELECT wdt, frg, flf INTO myWidth, fatherRight, fatherLeft
FROM aux;
-- 1º Incrementamos los valores de todos los nodos a la derecha del punto de inserción (fatherRight) , para hacer sitio
EXECUTE IMMEDIATE CONCAT(
'UPDATE ', vTable,
'SET rgt = rgt + ?
WHERE rgt >= ?
ORDER BY rgt DESC')
USING myWidth,
fatherRight;
EXECUTE IMMEDIATE CONCAT(
'UPDATE ', vTable,
'SET lft = lft + ?
WHERE lft >= ?
ORDER BY lft DESC')
USING myWidth,
fatherRight;
-- Es preciso recalcular los valores del nodo en el caso de que estuviera a la derecha del nuevo padre
EXECUTE IMMEDIATE CONCAT(
'UPDATE aux a
JOIN ', vTable, ' t
SET a.rgt = t.rgt,
a.lft = t.lft
WHERE t.id = ?')
USING idNODE;
SELECT lft, rgt, frg - lft INTO myLeft, myRight, gap
FROM aux;
-- 2º Incrementamos el valor de todos los nodos a trasladar hasta alcanzar su nueva posicion
EXECUTE IMMEDIATE CONCAT(
'UPDATE ', vTable,
'SET lft = lft + ?
WHERE lft BETWEEN ? AND ?
ORDER BY lft DESC')
USING gap,
myLeft,
myRight;
EXECUTE IMMEDIATE CONCAT(
'UPDATE ', vTable,
'SET rgt = rgt + ?
WHERE rgt BETWEEN ? AND ?
ORDER BY rgt DESC')
USING gap,
myLeft,
myRight;
-- 3º Restaremos a todos los nodos resultantes, a la derecha de la posicion arrancada el ancho de la rama escindida
EXECUTE IMMEDIATE CONCAT(
'UPDATE ', vTable,
'SET lft = lft - ?
WHERE lft > ?
ORDER BY lft')
USING myWidth,
myLeft;
EXECUTE IMMEDIATE CONCAT(
'UPDATE ', vTable,
'SET rgt = rgt - ?
WHERE rgt > ?
ORDER BY rgt')
USING myWidth,
myRight;
DROP TEMPORARY TABLE aux;
END$$
DELIMITER ;

View File

@ -1,67 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`pay`(IN datFEC DATE
, IN idPROV INT
, IN dblIMPORTE DOUBLE
, IN idMONEDA INT
, IN dblDIVISA DOUBLE
, IN idCAJA INT
, IN idPAYMET INT
, IN dblGASTOS DOUBLE
, IN strCONCEPTO VARCHAR(40)
, IN idEMP INT)
BEGIN
-- Registro en la tabla Cajas
INSERT INTO Cajas ( Concepto
, Serie
, Numero
, Salida
, Cajafecha
, Partida
, Id_Banco
, Id_Trabajador
,empresa_id
,conciliado)
SELECT CONCAT('n/pago a ', Proveedor)
, 'R'
, idPROV
, dblIMPORTE
, datFEC
, 1
, idCAJA
, account.myUser_getId()
, idEMP
, 1
FROM Proveedores
WHERE Id_Proveedor = idPROV;
-- Registro en la tabla pago
INSERT INTO pago(fecha
, dueDated
, id_proveedor
, importe
, id_moneda
, divisa
, id_banco
, pay_met_id
, g_bancarios
, concepte
, empresa_id)
VALUES(datFEC
, datFEC
, idPROV
, dblIMPORTE
, idMONEDA
, IF(dblDIVISA = 0, NULL, dblDIVISA)
, idCAJA
, idPAYMET
, dblGASTOS
, strCONCEPTO
, idEMP);
SELECT LAST_INSERT_ID() as pago_id;
END$$
DELIMITER ;

View File

@ -0,0 +1,6 @@
-- Place your SQL code here
ALTER TABLE IF EXISTS vn2008.dock__ RENAME vn2008.dock;
ALTER TABLE IF EXISTS vn2008.dock COMMENT='';
ALTER TABLE IF EXISTS vn2008.Tramos__ RENAME vn2008.Tramos;
ALTER TABLE IF EXISTS vn2008.Tramos COMMENT='';

View File

@ -0,0 +1 @@
ALTER TABLE vn.warehouse AUTO_INCREMENT=92;

View File

@ -0,0 +1,31 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`balanceNestTree_addChild`()
BEGIN
SELECT 1;
END$$
DELIMITER ;
GRANT EXECUTE ON PROCEDURE vn.balanceNestTree_addChild TO adminBoss;
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`balanceNestTree_delete`()
BEGIN
SELECT 1;
END$$
DELIMITER ;
GRANT EXECUTE ON PROCEDURE vn.balanceNestTree_delete TO adminBoss;
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`balanceNestTree_move`()
BEGIN
SELECT 1;
END$$
DELIMITER ;
GRANT EXECUTE ON PROCEDURE vn.balanceNestTree_move TO adminBoss;
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`payment_add`()
BEGIN
SELECT 1;
END$$
DELIMITER ;
GRANT EXECUTE ON PROCEDURE vn.payment_add TO financial;

View File

@ -0,0 +1,15 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`confection_controlSource`()
BEGIN
SELECT 1;
END$$
DELIMITER ;
GRANT EXECUTE ON PROCEDURE vn.confection_controlSource TO handmadeBoss, productionAssi, artificialBoss;
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`remittance_calc`()
BEGIN
SELECT 1;
END$$
DELIMITER ;
GRANT EXECUTE ON PROCEDURE vn.remittance_calc TO financial;

View File

@ -0,0 +1,2 @@
-- Place your SQL code here
ALTER TABLE dipole.expedition_PrintOut MODIFY COLUMN street varchar(42) CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT ' ' NOT NULL;

View File

@ -346,5 +346,6 @@
"You cannot update these fields": "No puedes actualizar estos campos",
"CountryFK cannot be empty": "El país no puede estar vacío",
"Cmr file does not exist": "El archivo del cmr no existe",
"You are not allowed to modify the alias": "No estás autorizado a modificar el alias"
"You are not allowed to modify the alias": "No estás autorizado a modificar el alias",
"The address of the customer must have information about Incoterms and Customs Agent": "El consignatario del cliente debe tener informado Incoterms y Agente de aduanas"
}

View File

@ -80,6 +80,6 @@ module.exports = Self => {
const content = toCSV(sales);
return [content, 'text/csv', `inline; filename="doc-${reference}.pdf"`];
return [content, 'text/csv', `inline; filename="doc-${reference}.csv"`];
};
};

View File

@ -79,6 +79,6 @@ module.exports = Self => {
ORDER BY s.ticketFk, s.created`, [id]);
const content = toCSV(sales);
return [content, 'text/csv', `inline; filename="doc-${id}.pdf"`];
return [content, 'text/csv', `inline; filename="doc-${id}.csv"`];
};
};

View File

@ -22,6 +22,7 @@
"log4js": "^6.7.0",
"mysql2": "^1.7.0",
"nodemailer": "^4.7.0",
"puppeteer": "^22.4.0",
"puppeteer-cluster": "^0.23.0",
"qrcode": "^1.4.2",
"strftime": "^0.10.0",

View File

@ -32,9 +32,12 @@ dependencies:
nodemailer:
specifier: ^4.7.0
version: 4.7.0
puppeteer:
specifier: ^22.4.0
version: 22.4.0
puppeteer-cluster:
specifier: ^0.23.0
version: 0.23.0(puppeteer@21.10.0)
version: 0.23.0(puppeteer@22.4.0)
qrcode:
specifier: ^1.4.2
version: 1.5.3
@ -100,16 +103,17 @@ packages:
to-fast-properties: 2.0.0
dev: false
/@puppeteer/browsers@1.9.1:
resolution: {integrity: sha512-PuvK6xZzGhKPvlx3fpfdM2kYY3P/hB1URtK8wA7XUJ6prn6pp22zvJHu48th0SGcHL9SutbPHrFuQgfXTFobWA==}
engines: {node: '>=16.3.0'}
/@puppeteer/browsers@2.1.0:
resolution: {integrity: sha512-xloWvocjvryHdUjDam/ZuGMh7zn4Sn3ZAaV4Ah2e2EwEt90N3XphZlSsU3n0VDc1F7kggCjMuH0UuxfPQ5mD9w==}
engines: {node: '>=18'}
hasBin: true
dependencies:
debug: 4.3.4
extract-zip: 2.0.1
progress: 2.0.3
proxy-agent: 6.3.1
tar-fs: 3.0.4
proxy-agent: 6.4.0
semver: 7.6.0
tar-fs: 3.0.5
unbzip2-stream: 1.4.3
yargs: 17.7.2
transitivePeerDependencies:
@ -243,6 +247,37 @@ packages:
resolution: {integrity: sha512-fpWrvyVHEKyeEvbKZTVOeZF3VSKKWtJxFIxX/jaVPf+cLbGUSitjb49pHLqPV2BUNNZ0LcoeEGfE/YCpyDYHIw==}
dev: false
/bare-events@2.2.1:
resolution: {integrity: sha512-9GYPpsPFvrWBkelIhOhTWtkeZxVxZOdb3VnFTCzlOo3OjvmTvzLoZFUT8kNFACx0vJej6QPney1Cf9BvzCNE/A==}
requiresBuild: true
dev: false
optional: true
/bare-fs@2.2.1:
resolution: {integrity: sha512-+CjmZANQDFZWy4PGbVdmALIwmt33aJg8qTkVjClU6X4WmZkTPBDxRHiBn7fpqEWEfF3AC2io++erpViAIQbSjg==}
requiresBuild: true
dependencies:
bare-events: 2.2.1
bare-os: 2.2.0
bare-path: 2.1.0
streamx: 2.15.6
dev: false
optional: true
/bare-os@2.2.0:
resolution: {integrity: sha512-hD0rOPfYWOMpVirTACt4/nK8mC55La12K5fY1ij8HAdfQakD62M+H4o4tpfKzVGLgRDTuk3vjA4GqGXXCeFbag==}
requiresBuild: true
dev: false
optional: true
/bare-path@2.1.0:
resolution: {integrity: sha512-DIIg7ts8bdRKwJRJrUMy/PICEaQZaPGZ26lsSx9MJSwIhSrcdHn7/C8W+XmnG/rKi6BaRcz+JO00CjZteybDtw==}
requiresBuild: true
dependencies:
bare-os: 2.2.0
dev: false
optional: true
/base64-js@1.5.1:
resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==}
dev: false
@ -326,12 +361,12 @@ packages:
lodash.some: 4.6.0
dev: false
/chromium-bidi@0.5.6(devtools-protocol@0.0.1232444):
resolution: {integrity: sha512-ber8smgoAs4EqSUHRb0I8fpx371ZmvsdQav8HRM9oO4fk5Ox16vQiNYXlsZkRj4FfvVL2dCef+zBFQixp+79CA==}
/chromium-bidi@0.5.12(devtools-protocol@0.0.1249869):
resolution: {integrity: sha512-sZMgEBWKbupD0Q7lyFu8AWkrE+rs5ycE12jFkGwIgD/VS8lDPtelPlXM7LYaq4zrkZ/O2L3f4afHUHL0ICdKog==}
peerDependencies:
devtools-protocol: '*'
dependencies:
devtools-protocol: 0.0.1232444
devtools-protocol: 0.0.1249869
mitt: 3.0.1
urlpattern-polyfill: 10.0.0
dev: false
@ -545,8 +580,8 @@ packages:
resolution: {integrity: sha512-3NdhDuEXnfun/z7x9GOElY49LoqVHoGScmOKwmxhsS8N5Y+Z8KyPPDnaSzqWgYt/ji4mqwfTS34Htrk0zPIXVg==}
dev: false
/devtools-protocol@0.0.1232444:
resolution: {integrity: sha512-pM27vqEfxSxRkTMnF+XCmxSEb6duO5R+t8A9DEEJgy4Wz2RVanje2mmj99B6A3zv2r/qGfYlOvYznUhuokizmg==}
/devtools-protocol@0.0.1249869:
resolution: {integrity: sha512-Ctp4hInA0BEavlUoRy9mhGq0i+JSo/AwVyX2EFgZmV1kYB+Zq+EMBAn52QWu6FbRr10hRb6pBl420upbp4++vg==}
dev: false
/dijkstrajs@1.0.3:
@ -968,8 +1003,8 @@ packages:
statuses: 1.3.1
dev: false
/http-proxy-agent@7.0.0:
resolution: {integrity: sha512-+ZT+iBxVUQ1asugqnD6oWoRiS25AkjNfG085dKJGtGxkdwLQrMKU5wJr2bOOFAXzKcTuqq+7fZlTMgG3SRfIYQ==}
/http-proxy-agent@7.0.2:
resolution: {integrity: sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==}
engines: {node: '>= 14'}
dependencies:
agent-base: 7.1.0
@ -987,8 +1022,8 @@ packages:
sshpk: 1.18.0
dev: false
/https-proxy-agent@7.0.2:
resolution: {integrity: sha512-NmLNjm6ucYwtcUmL7JQC1ZQ57LmHP4lT15FQ8D61nak1rO6DH+fz5qNK2Ap5UN4ZapYICE3/0KodcLYSPsPbaA==}
/https-proxy-agent@7.0.4:
resolution: {integrity: sha512-wlwpilI7YdjSkWaQ/7omYBMTliDcmCN8OLihO6I9B86g06lMyAoqgoDpV0XqoaPOKj+0DIdAvnsWfyAAhmimcg==}
engines: {node: '>= 14'}
dependencies:
agent-base: 7.1.0
@ -1258,6 +1293,13 @@ packages:
yallist: 3.1.1
dev: false
/lru-cache@6.0.0:
resolution: {integrity: sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==}
engines: {node: '>=10'}
dependencies:
yallist: 4.0.0
dev: false
/lru-cache@7.18.3:
resolution: {integrity: sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==}
engines: {node: '>=12'}
@ -1308,10 +1350,6 @@ packages:
resolution: {integrity: sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==}
dev: false
/mkdirp-classic@0.5.3:
resolution: {integrity: sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==}
dev: false
/ms@0.7.1:
resolution: {integrity: sha512-lRLiIR9fSNpnP6TC4v8+4OU7oStC01esuNowdQ34L+Gk8e5Puoc88IqJ+XAY/B3Mn2ZKis8l8HX90oU8ivzUHg==}
dev: false
@ -1432,8 +1470,8 @@ packages:
agent-base: 7.1.0
debug: 4.3.4
get-uri: 6.0.2
http-proxy-agent: 7.0.0
https-proxy-agent: 7.0.2
http-proxy-agent: 7.0.2
https-proxy-agent: 7.0.4
pac-resolver: 7.0.0
socks-proxy-agent: 8.0.2
transitivePeerDependencies:
@ -1536,14 +1574,14 @@ packages:
ipaddr.js: 1.4.0
dev: false
/proxy-agent@6.3.1:
resolution: {integrity: sha512-Rb5RVBy1iyqOtNl15Cw/llpeLH8bsb37gM1FUfKQ+Wck6xHlbAhWGUFiTRHtkjqGTA5pSHz6+0hrPW/oECihPQ==}
/proxy-agent@6.4.0:
resolution: {integrity: sha512-u0piLU+nCOHMgGjRbimiXmA9kM/L9EHh3zL81xCdp7m+Y2pHIsnmbdDoEDoAz5geaonNR6q6+yOPQs6n4T6sBQ==}
engines: {node: '>= 14'}
dependencies:
agent-base: 7.1.0
debug: 4.3.4
http-proxy-agent: 7.0.0
https-proxy-agent: 7.0.2
http-proxy-agent: 7.0.2
https-proxy-agent: 7.0.4
lru-cache: 7.18.3
pac-proxy-agent: 7.0.1
proxy-from-env: 1.1.0
@ -1572,26 +1610,26 @@ packages:
engines: {node: '>=6'}
dev: false
/puppeteer-cluster@0.23.0(puppeteer@21.10.0):
/puppeteer-cluster@0.23.0(puppeteer@22.4.0):
resolution: {integrity: sha512-108terIWDzPrQopmoYSPd5yDoy3FGJ2dNnoGMkGYPs6xtkdhgaECwpfZkzaRToMQPZibUOz0/dSSGgPEdXEhkQ==}
peerDependencies:
puppeteer: '>=1.5.0'
dependencies:
debug: 4.3.4
puppeteer: 21.10.0
puppeteer: 22.4.0
transitivePeerDependencies:
- supports-color
dev: false
/puppeteer-core@21.10.0:
resolution: {integrity: sha512-NVaqO3K462qwMuLO4Gurs/Mau1Wss+08QgNYzF0dIqZWMvpskrt/TbxbmHU+7zMTUOvPEq/lR4BLJmjMBgBGfQ==}
engines: {node: '>=16.13.2'}
/puppeteer-core@22.4.0:
resolution: {integrity: sha512-MZttAbttrxi6O/B//rY6zQihjFe/vXeCLb5YvKH2xG6yrcVESo0Hc5/Cv49omwZyZzAJ1BK8BnDeatDsj+3hMw==}
engines: {node: '>=18'}
dependencies:
'@puppeteer/browsers': 1.9.1
chromium-bidi: 0.5.6(devtools-protocol@0.0.1232444)
'@puppeteer/browsers': 2.1.0
chromium-bidi: 0.5.12(devtools-protocol@0.0.1249869)
cross-fetch: 4.0.0
debug: 4.3.4
devtools-protocol: 0.0.1232444
devtools-protocol: 0.0.1249869
ws: 8.16.0
transitivePeerDependencies:
- bufferutil
@ -1600,15 +1638,15 @@ packages:
- utf-8-validate
dev: false
/puppeteer@21.10.0:
resolution: {integrity: sha512-Y1yQjcLE00hHTDAmv3M3A6hhW0Ytjdp6xr6nyjl7FZ7E7hzp/6Rsw80FbaTJzJHFCplBNi082wrgynbmD7RlYw==}
engines: {node: '>=16.13.2'}
/puppeteer@22.4.0:
resolution: {integrity: sha512-tR+JsDbA2qD1DqRX4F9k9SxQhk6UzcaCN+Qux7+WrDceS7wcR7tlFmMNB8+g8zE4Fmr/iRTOtf5wNnTW9cGUFQ==}
engines: {node: '>=18'}
hasBin: true
requiresBuild: true
dependencies:
'@puppeteer/browsers': 1.9.1
'@puppeteer/browsers': 2.1.0
cosmiconfig: 9.0.0
puppeteer-core: 21.10.0
puppeteer-core: 22.4.0
transitivePeerDependencies:
- bufferutil
- encoding
@ -1640,6 +1678,7 @@ packages:
/queue-tick@1.0.1:
resolution: {integrity: sha512-kJt5qhMxoszgU/62PLP1CJytzd2NKetjSRnyuj31fDd3Rlcz3fzlFdFLD1SItunPwyqEOkca6GbV612BWfaBag==}
requiresBuild: true
dev: false
/randombytes@2.1.0:
@ -1729,6 +1768,14 @@ packages:
hasBin: true
dev: false
/semver@7.6.0:
resolution: {integrity: sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==}
engines: {node: '>=10'}
hasBin: true
dependencies:
lru-cache: 6.0.0
dev: false
/send@0.14.1:
resolution: {integrity: sha512-1Ru269QpUVUgD32Y9jdyBXiX+pHYuYnTzR17w+DhyOWvGMPjJILrnLhl9c4LQjtIy2BSAa6Ykq0ZdGcAjaXlwQ==}
engines: {node: '>= 0.8.0'}
@ -1950,12 +1997,14 @@ packages:
engines: {node: '>= 0.4'}
dev: false
/tar-fs@3.0.4:
resolution: {integrity: sha512-5AFQU8b9qLfZCX9zp2duONhPmZv0hGYiBPJsyUdqMjzq/mqVpy/rEUSeHk1+YitmxugaptgBh5oDGU3VsAJq4w==}
/tar-fs@3.0.5:
resolution: {integrity: sha512-JOgGAmZyMgbqpLwct7ZV8VzkEB6pxXFBVErLtb+XCOqzc6w1xiWKI9GVd6bwk68EX7eJ4DWmfXVmq8K2ziZTGg==}
dependencies:
mkdirp-classic: 0.5.3
pump: 3.0.0
tar-stream: 3.1.7
optionalDependencies:
bare-fs: 2.2.1
bare-path: 2.1.0
dev: false
/tar-stream@3.1.7:
@ -2200,6 +2249,10 @@ packages:
resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==}
dev: false
/yallist@4.0.0:
resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==}
dev: false
/yargs-parser@18.1.3:
resolution: {integrity: sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==}
engines: {node: '>=6'}

View File

@ -40,17 +40,6 @@ table.repeatable > tbody > tr > td {
padding-top: 0.5em;
}
section.text-area {
margin-top: 1em;
padding: 0.19em;
padding-left: 1em;
padding-right: 1em;
background-color: #e5e5e5;
& > p {
word-break: break-all;
}
}
.route-block {
margin-bottom: 100px;
page-break-after: always;

View File

@ -128,8 +128,8 @@
</tr>
</tbody>
</table>
<div v-if="ticket.description" class="text-area">
<p>{{ticket.description}}</p>
<div v-if="ticket.description">
<p style="word-break: break-all">{{ticket.description}}</p>
</div>
</div>
</div>

View File

@ -1,4 +1,5 @@
const vnReport = require('../../../core/mixins/vn-report.js');
const UserError = require('vn-loopback/util/user-error');
module.exports = {
name: 'invoice-incoterms',
@ -7,7 +8,10 @@ module.exports = {
this.invoice = await this.findOneFromDef('invoice', [this.reference]);
this.checkMainEntity(this.invoice);
this.client = await this.findOneFromDef('client', [this.reference]);
this.incoterms = await this.findOneFromDef('incoterms', [this.reference, this.reference, this.reference, this.reference]);
this.incoterms =
await this.findOneFromDef('incoterms', [this.reference, this.reference, this.reference, this.reference]);
if (!this.incoterms)
throw new UserError(`The address of the customer must have information about Incoterms and Customs Agent`);
},
props: {
reference: {