Merge branch 'dev' into 7378-productionLogConfig
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
eb60a1ed77
|
@ -60,15 +60,17 @@ module.exports = Self => {
|
||||||
if (print) await Self.rawSql('CALL vn.collection_printSticker(?,NULL)', [id], myOptions);
|
if (print) await Self.rawSql('CALL vn.collection_printSticker(?,NULL)', [id], myOptions);
|
||||||
|
|
||||||
for (let ticket of tickets) {
|
for (let ticket of tickets) {
|
||||||
let observations = ticket.observaciones.split(' ');
|
if (ticket.observaciones) {
|
||||||
|
let observations = ticket.observaciones.split(' ');
|
||||||
|
|
||||||
for (let observation of observations) {
|
for (let observation of observations) {
|
||||||
const salesPerson = ticket.salesPersonFk;
|
const salesPerson = ticket.salesPersonFk;
|
||||||
if (observation.startsWith('#') || observation.startsWith('@')) {
|
if (observation.startsWith('#') || observation.startsWith('@')) {
|
||||||
await models.Chat.send(ctx,
|
await models.Chat.send(ctx,
|
||||||
observation,
|
observation,
|
||||||
$t('ticketCommercial', {ticket: ticket.ticketFk, salesPerson})
|
$t('ticketCommercial', {ticket: ticket.ticketFk, salesPerson})
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51399,9 +51399,9 @@ BEGIN
|
||||||
SELECT (pc.maxNotReadyCollections - COUNT(*)) <= 0
|
SELECT (pc.maxNotReadyCollections - COUNT(*)) <= 0
|
||||||
INTO vHasTooMuchCollections
|
INTO vHasTooMuchCollections
|
||||||
FROM productionConfig pc
|
FROM productionConfig pc
|
||||||
LEFT JOIN tCollection ON TRUE;
|
LEFT JOIN tmp.collection ON TRUE;
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tCollection;
|
DROP TEMPORARY TABLE tmp.collection;
|
||||||
|
|
||||||
IF vHasTooMuchCollections THEN
|
IF vHasTooMuchCollections THEN
|
||||||
CALL util.throw('Hay colecciones pendientes');
|
CALL util.throw('Hay colecciones pendientes');
|
||||||
|
@ -51478,9 +51478,9 @@ BEGIN
|
||||||
* @param vWorkerFk id del worker.
|
* @param vWorkerFk id del worker.
|
||||||
* @table Devuelve tabla temporal con las colecciones pendientes
|
* @table Devuelve tabla temporal con las colecciones pendientes
|
||||||
*/
|
*/
|
||||||
DROP TEMPORARY TABLE IF EXISTS tCollection;
|
DROP TEMPORARY TABLE IF EXISTS tmp.collection;
|
||||||
|
|
||||||
CREATE TEMPORARY TABLE tCollection
|
CREATE TEMPORARY TABLE tmp.collection
|
||||||
SELECT c.id collectionFk,
|
SELECT c.id collectionFk,
|
||||||
date(c.created) created,
|
date(c.created) created,
|
||||||
COUNT(DISTINCT tc.ticketFk) ticketTotalCount
|
COUNT(DISTINCT tc.ticketFk) ticketTotalCount
|
||||||
|
@ -51499,7 +51499,7 @@ BEGIN
|
||||||
GROUP BY c.id
|
GROUP BY c.id
|
||||||
HAVING COUNT(*) > COUNT(DISTINCT st.id);
|
HAVING COUNT(*) > COUNT(DISTINCT st.id);
|
||||||
|
|
||||||
SELECT * FROM tCollection;
|
SELECT * FROM tmp.collection;
|
||||||
END ;;
|
END ;;
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
/*!50003 SET sql_mode = @saved_sql_mode */ ;
|
||||||
|
|
|
@ -3911,3 +3911,19 @@ VALUES(1, '');
|
||||||
INSERT INTO dipole.expedition_PrintOut (expeditionFk, ticketFk, addressFk, street, postalCode, city, shopName, isPrinted, created, printerFk, routeFk, parkingCode,
|
INSERT INTO dipole.expedition_PrintOut (expeditionFk, ticketFk, addressFk, street, postalCode, city, shopName, isPrinted, created, printerFk, routeFk, parkingCode,
|
||||||
truckName, clientFk, phone, province, agency, m3, workerCode, itemFk, quantity, longName, shelvingFk, comments)
|
truckName, clientFk, phone, province, agency, m3, workerCode, itemFk, quantity, longName, shelvingFk, comments)
|
||||||
VALUES(1, 1, 0, ' ', ' ', ' ', ' ', 0, '2001-01-01 00:00:00', 1, 0, ' ', ' ', 0, NULL, '', NULL, 0.000, NULL, 10, NULL, NULL, 'NCC', NULL);
|
VALUES(1, 1, 0, ' ', ' ', ' ', ' ', 0, '2001-01-01 00:00:00', 1, 0, ' ', ' ', 0, NULL, '', NULL, 0.000, NULL, 10, NULL, NULL, 'NCC', NULL);
|
||||||
|
|
||||||
|
INSERT INTO vn.accountDetail
|
||||||
|
(id, value, accountDetailTypeFk, supplierAccountFk)
|
||||||
|
VALUES
|
||||||
|
(21, 'ES12345B12345678', 3, 241),
|
||||||
|
(35, 'ES12346B12345679', 3, 241);
|
||||||
|
|
||||||
|
INSERT INTO vn.accountDetailType
|
||||||
|
(id, description)
|
||||||
|
VALUES
|
||||||
|
(1, 'IBAN'),
|
||||||
|
(2, 'SWIFT'),
|
||||||
|
(3, 'Referencia Remesas'),
|
||||||
|
(4, 'Referencia Transferencias'),
|
||||||
|
(5, 'Referencia Nominas'),
|
||||||
|
(6, 'ABA');
|
||||||
|
|
|
@ -47,9 +47,9 @@ BEGIN
|
||||||
INTO vHasTooMuchCollections,
|
INTO vHasTooMuchCollections,
|
||||||
vLockName
|
vLockName
|
||||||
FROM productionConfig pc
|
FROM productionConfig pc
|
||||||
LEFT JOIN tCollection ON TRUE;
|
LEFT JOIN tmp.collection ON TRUE;
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tCollection;
|
DROP TEMPORARY TABLE tmp.collection;
|
||||||
|
|
||||||
IF vHasTooMuchCollections THEN
|
IF vHasTooMuchCollections THEN
|
||||||
CALL util.throw('Hay colecciones pendientes');
|
CALL util.throw('Hay colecciones pendientes');
|
||||||
|
|
|
@ -7,27 +7,32 @@ BEGIN
|
||||||
* @param vWorkerFk id del worker.
|
* @param vWorkerFk id del worker.
|
||||||
* @table Devuelve tabla temporal con las colecciones pendientes
|
* @table Devuelve tabla temporal con las colecciones pendientes
|
||||||
*/
|
*/
|
||||||
DROP TEMPORARY TABLE IF EXISTS tCollection;
|
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||||
|
BEGIN
|
||||||
|
RESIGNAL;
|
||||||
|
END;
|
||||||
|
|
||||||
CREATE TEMPORARY TABLE tCollection
|
CREATE OR REPLACE TEMPORARY TABLE tmp.collection
|
||||||
SELECT c.id collectionFk,
|
ENGINE = MEMORY
|
||||||
date(c.created) created,
|
SELECT c.id collectionFk,
|
||||||
COUNT(DISTINCT tc.ticketFk) ticketTotalCount
|
DATE(c.created) created,
|
||||||
FROM collection c
|
COUNT(DISTINCT tc.ticketFk) ticketTotalCount
|
||||||
JOIN ticketCollection tc ON tc.collectionFk = c.id
|
FROM collection c
|
||||||
JOIN sale s ON s.ticketFk = tc.ticketFk
|
JOIN ticketCollection tc ON tc.collectionFk = c.id
|
||||||
JOIN ticketState ts ON ts.ticketFk = tc.ticketFk
|
JOIN sale s ON s.ticketFk = tc.ticketFk
|
||||||
JOIN state s2 ON s2.id = ts.stateFk
|
JOIN ticketState ts ON ts.ticketFk = tc.ticketFk
|
||||||
JOIN productionConfig pc
|
JOIN state s2 ON s2.id = ts.stateFk
|
||||||
JOIN vn.state ss on ss.code = 'PREPARED'
|
JOIN productionConfig pc
|
||||||
LEFT JOIN vn.saleTracking st on st.saleFk = s.id AND st.stateFk = ss.id
|
JOIN vn.state ss ON ss.code = 'PREPARED'
|
||||||
WHERE c.workerFk = vWorkerFk
|
LEFT JOIN vn.saleTracking st ON st.saleFk = s.id
|
||||||
AND TIMESTAMPDIFF(HOUR, c.created , util.VN_NOW()) < pc.pendingCollectionsAge
|
AND st.stateFk = ss.id
|
||||||
AND s.quantity != 0
|
WHERE c.workerFk = vWorkerFk
|
||||||
AND s2.order < pc.pendingCollectionsOrder
|
AND TIMESTAMPDIFF(HOUR, c.created , util.VN_NOW()) < pc.pendingCollectionsAge
|
||||||
GROUP BY c.id
|
AND s.quantity
|
||||||
HAVING COUNT(*) > COUNT(DISTINCT st.id);
|
AND s2.order < pc.pendingCollectionsOrder
|
||||||
|
GROUP BY c.id
|
||||||
|
HAVING COUNT(*) > COUNT(DISTINCT st.id);
|
||||||
|
|
||||||
SELECT * FROM tCollection;
|
SELECT * FROM tmp.collection;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -34,10 +34,10 @@ BEGIN
|
||||||
pc.collection_assign_lockname
|
pc.collection_assign_lockname
|
||||||
INTO vHasTooMuchCollections,
|
INTO vHasTooMuchCollections,
|
||||||
vLockName
|
vLockName
|
||||||
FROM tCollection tc
|
FROM tmp.collection c
|
||||||
JOIN productionConfig pc;
|
JOIN productionConfig pc;
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tCollection;
|
DROP TEMPORARY TABLE tmp.collection;
|
||||||
|
|
||||||
IF vHasTooMuchCollections THEN
|
IF vHasTooMuchCollections THEN
|
||||||
CALL util.throw('There are pending collections');
|
CALL util.throw('There are pending collections');
|
||||||
|
|
|
@ -18,7 +18,7 @@ BEGIN
|
||||||
AND e.id = vSelf;
|
AND e.id = vSelf;
|
||||||
|
|
||||||
IF vIsEditable AND NOT IFNULL(@isModeInventory, FALSE) THEN
|
IF vIsEditable AND NOT IFNULL(@isModeInventory, FALSE) THEN
|
||||||
CALL util.throw('Entry is not editable');
|
CALL util.throw(CONCAT('Entry ', vSelf, ' is not editable'));
|
||||||
END IF;
|
END IF;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -17,34 +17,19 @@ BEGIN
|
||||||
SELECT bb.id buyFk,
|
SELECT bb.id buyFk,
|
||||||
FLOOR(ish.visible / ish.packing) ishStickers,
|
FLOOR(ish.visible / ish.packing) ishStickers,
|
||||||
bb.stickers buyStickers
|
bb.stickers buyStickers
|
||||||
FROM vn.itemShelving ish
|
FROM itemShelving ish
|
||||||
JOIN (SELECT b.id, b.itemFk, b.stickers
|
JOIN (SELECT b.id, b.itemFk, b.stickers
|
||||||
FROM vn.buy b
|
FROM buy b
|
||||||
WHERE b.entryFk = vFromEntryFk
|
WHERE b.entryFk = vFromEntryFk
|
||||||
ORDER BY b.stickers DESC
|
ORDER BY b.stickers DESC
|
||||||
LIMIT 10000000000000000000) bb ON bb.itemFk = ish.itemFk
|
LIMIT 10000000000000000000) bb ON bb.itemFk = ish.itemFk
|
||||||
AND bb.stickers >= FLOOR(ish.visible / ish.packing)
|
AND bb.stickers >= FLOOR(ish.visible / ish.packing)
|
||||||
WHERE shelvingFk = vShelvingFk COLLATE utf8_general_ci
|
WHERE ish.shelvingFk = vShelvingFk COLLATE utf8_general_ci
|
||||||
|
AND NOT ish.isSplit
|
||||||
GROUP BY ish.id;
|
GROUP BY ish.id;
|
||||||
|
|
||||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
||||||
|
|
||||||
-- Cantidades de la matrícula que exceden la de las entradas
|
|
||||||
SELECT ish.itemFk,
|
|
||||||
i.longName,
|
|
||||||
FLOOR(ish.visible / ish.packing) AS etiEnMatricula,
|
|
||||||
bb.stickers etiEnEntrada
|
|
||||||
FROM vn.itemShelving ish
|
|
||||||
JOIN vn.item i ON i.id = ish.itemFk
|
|
||||||
LEFT JOIN (SELECT b.id, b.itemFk, b.stickers
|
|
||||||
FROM vn.buy b
|
|
||||||
WHERE b.entryFk = vFromEntryFk
|
|
||||||
ORDER BY b.stickers DESC
|
|
||||||
LIMIT 10000000000000000000) bb ON bb.itemFk = ish.itemFk
|
|
||||||
WHERE shelvingFk = vShelvingFk COLLATE utf8_general_ci
|
|
||||||
AND IFNULL(bb.stickers,0) < FLOOR(ish.visible / ish.packing)
|
|
||||||
GROUP BY ish.id;
|
|
||||||
|
|
||||||
OPEN cur;
|
OPEN cur;
|
||||||
|
|
||||||
read_loop: LOOP
|
read_loop: LOOP
|
||||||
|
@ -57,16 +42,16 @@ BEGIN
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
IF vIshStickers = vBuyStickers THEN
|
IF vIshStickers = vBuyStickers THEN
|
||||||
UPDATE vn.buy
|
UPDATE buy
|
||||||
SET entryFk = vToEntryFk
|
SET entryFk = vToEntryFk
|
||||||
WHERE id = vBuyFk;
|
WHERE id = vBuyFk;
|
||||||
ELSE
|
ELSE
|
||||||
UPDATE vn.buy
|
UPDATE buy
|
||||||
SET stickers = stickers - vIshStickers,
|
SET stickers = stickers - vIshStickers,
|
||||||
quantity = stickers * packing
|
quantity = stickers * packing
|
||||||
WHERE id = vBuyFk;
|
WHERE id = vBuyFk;
|
||||||
|
|
||||||
INSERT INTO vn.buy(entryFk,
|
INSERT INTO buy(entryFk,
|
||||||
itemFk,
|
itemFk,
|
||||||
quantity,
|
quantity,
|
||||||
buyingValue,
|
buyingValue,
|
||||||
|
@ -117,13 +102,16 @@ BEGIN
|
||||||
weight,
|
weight,
|
||||||
deliveryFk,
|
deliveryFk,
|
||||||
itemOriginalFk
|
itemOriginalFk
|
||||||
FROM vn.buy
|
FROM buy
|
||||||
WHERE id = vBuyFk;
|
WHERE id = vBuyFk;
|
||||||
|
|
||||||
UPDATE buy SET printedStickers = vIshStickers WHERE id = LAST_INSERT_ID();
|
UPDATE buy SET printedStickers = vIshStickers WHERE id = LAST_INSERT_ID();
|
||||||
END IF;
|
END IF;
|
||||||
END LOOP;
|
|
||||||
|
|
||||||
|
UPDATE itemShelving
|
||||||
|
SET isSplit = TRUE
|
||||||
|
WHERE shelvingFk = vShelvingFk;
|
||||||
|
END LOOP;
|
||||||
CLOSE cur;
|
CLOSE cur;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -13,20 +13,32 @@ BEGIN
|
||||||
* @param vBookEntry Id de asiento, si es NULL se genera uno nuevo
|
* @param vBookEntry Id de asiento, si es NULL se genera uno nuevo
|
||||||
*/
|
*/
|
||||||
DECLARE vFiscalYear INT;
|
DECLARE vFiscalYear INT;
|
||||||
DECLARE vHasDistinctTransactions INT;
|
DECLARE vDistinctTransactions INT;
|
||||||
|
DECLARE vHasRepeatedTransactions BOOL;
|
||||||
|
|
||||||
SELECT COUNT(DISTINCT transactionTypeSageFk) INTO vHasDistinctTransactions
|
SELECT COUNT(DISTINCT iit.transactionTypeSageFk) INTO vDistinctTransactions
|
||||||
FROM invoiceIn ii
|
FROM invoiceIn ii
|
||||||
JOIN invoiceInTax iit ON iit.invoiceInFk = ii.id
|
JOIN invoiceInTax iit ON iit.invoiceInFk = ii.id
|
||||||
JOIN invoiceInSerial iis ON iis.code = ii.serial
|
JOIN invoiceInSerial iis ON iis.code = ii.serial
|
||||||
WHERE ii.id = vSelf
|
WHERE iit.invoiceInFk = vSelf
|
||||||
AND iis.taxAreaFk = 'CEE'
|
AND iis.taxAreaFk = 'CEE'
|
||||||
AND transactionTypeSageFk;
|
AND iit.transactionTypeSageFk;
|
||||||
|
|
||||||
IF vHasDistinctTransactions > 1 THEN
|
IF vDistinctTransactions > 1 THEN
|
||||||
CALL util.throw ('This invoice does not allow different types of transactions');
|
CALL util.throw ('This invoice does not allow different types of transactions');
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
|
SELECT TRUE INTO vHasRepeatedTransactions
|
||||||
|
FROM invoiceInTax
|
||||||
|
WHERE invoiceInFk = vSelf
|
||||||
|
GROUP BY transactionTypeSageFk
|
||||||
|
HAVING COUNT(transactionTypeSageFk) > 1
|
||||||
|
LIMIT 1;
|
||||||
|
|
||||||
|
IF vHasRepeatedTransactions THEN
|
||||||
|
CALL util.throw ('This invoice contains repeated types of transactions');
|
||||||
|
END IF;
|
||||||
|
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tInvoiceIn
|
CREATE OR REPLACE TEMPORARY TABLE tInvoiceIn
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
SELECT ii.bookEntried,
|
SELECT ii.bookEntried,
|
||||||
|
|
|
@ -40,8 +40,7 @@ proc: BEGIN
|
||||||
(PRIMARY KEY (itemFk))
|
(PRIMARY KEY (itemFk))
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
SELECT itemFk,
|
SELECT itemFk,
|
||||||
SUM(quantity) quantity,
|
SUM(quantity) quantity
|
||||||
SUM(quantity) visible
|
|
||||||
FROM (
|
FROM (
|
||||||
SELECT s.itemFk, - s.quantity quantity
|
SELECT s.itemFk, - s.quantity quantity
|
||||||
FROM sale s
|
FROM sale s
|
||||||
|
@ -75,56 +74,59 @@ proc: BEGIN
|
||||||
) sub
|
) sub
|
||||||
GROUP BY itemFk;
|
GROUP BY itemFk;
|
||||||
|
|
||||||
-- Cálculo del visible
|
|
||||||
UPDATE tItemInventoryCalc iic
|
|
||||||
JOIN (
|
|
||||||
SELECT itemFk, SUM(quantity) visible
|
|
||||||
FROM (
|
|
||||||
SELECT s.itemFk, s.quantity
|
|
||||||
FROM sale s
|
|
||||||
JOIN ticket t ON t.id = s.ticketFk
|
|
||||||
JOIN warehouse w ON w.id = t.warehouseFk
|
|
||||||
WHERE t.shipped >= vDate
|
|
||||||
AND t.shipped < vDateTomorrow
|
|
||||||
AND (NOT isPicked AND NOT t.isLabeled AND t.refFk IS NULL)
|
|
||||||
AND IFNULL(vWarehouseFk, t.warehouseFk) = t.warehouseFk
|
|
||||||
AND w.isComparative
|
|
||||||
UNION ALL
|
|
||||||
SELECT b.itemFk, - b.quantity
|
|
||||||
FROM buy b
|
|
||||||
JOIN entry e ON e.id = b.entryFk
|
|
||||||
JOIN travel t ON t.id = e.travelFk
|
|
||||||
JOIN warehouse w ON w.id = t.warehouseInFk
|
|
||||||
WHERE t.landed = vDate
|
|
||||||
AND NOT t.isReceived
|
|
||||||
AND NOT e.isExcludedFromAvailable
|
|
||||||
AND NOT e.isRaid
|
|
||||||
AND IFNULL(vWarehouseFk, t.warehouseInFk) = t.warehouseInFk
|
|
||||||
AND w.isComparative
|
|
||||||
UNION ALL
|
|
||||||
SELECT b.itemFk, b.quantity
|
|
||||||
FROM buy b
|
|
||||||
JOIN entry e ON e.id = b.entryFk
|
|
||||||
JOIN travel t ON t.id = e.travelFk
|
|
||||||
JOIN warehouse w ON w.id = t.warehouseOutFk
|
|
||||||
WHERE t.shipped = vDate
|
|
||||||
AND NOT t.isReceived
|
|
||||||
AND NOT e.isExcludedFromAvailable
|
|
||||||
AND NOT e.isRaid
|
|
||||||
AND IFNULL(vWarehouseFk, t.warehouseOutFk) = t.warehouseOutFk
|
|
||||||
AND w.isComparative
|
|
||||||
) sub2
|
|
||||||
GROUP BY itemFk
|
|
||||||
) sub ON sub.itemFk = iic.itemFk
|
|
||||||
SET iic.visible = iic.visible + sub.visible;
|
|
||||||
|
|
||||||
UPDATE tmp.itemInventory ai
|
UPDATE tmp.itemInventory ai
|
||||||
JOIN tItemInventoryCalc iic ON iic.itemFk = ai.id
|
JOIN tItemInventoryCalc iic ON iic.itemFk = ai.id
|
||||||
SET ai.inventory = iic.quantity,
|
SET ai.inventory = iic.quantity,
|
||||||
ai.visible = iic.visible,
|
ai.visible = iic.quantity,
|
||||||
ai.avalaible = iic.quantity,
|
ai.avalaible = iic.quantity,
|
||||||
ai.sd = iic.quantity;
|
ai.sd = iic.quantity;
|
||||||
|
|
||||||
|
-- Cálculo del visible
|
||||||
|
CREATE OR REPLACE TEMPORARY TABLE tItemVisibleCalc
|
||||||
|
(PRIMARY KEY (itemFk))
|
||||||
|
ENGINE = MEMORY
|
||||||
|
SELECT itemFk, SUM(quantity) visible
|
||||||
|
FROM (
|
||||||
|
SELECT s.itemFk, s.quantity
|
||||||
|
FROM sale s
|
||||||
|
JOIN ticket t ON t.id = s.ticketFk
|
||||||
|
JOIN warehouse w ON w.id = t.warehouseFk
|
||||||
|
WHERE t.shipped >= vDate
|
||||||
|
AND t.shipped < vDateTomorrow
|
||||||
|
AND (NOT isPicked AND NOT t.isLabeled AND t.refFk IS NULL)
|
||||||
|
AND IFNULL(vWarehouseFk, t.warehouseFk) = t.warehouseFk
|
||||||
|
AND w.isComparative
|
||||||
|
UNION ALL
|
||||||
|
SELECT b.itemFk, - b.quantity
|
||||||
|
FROM buy b
|
||||||
|
JOIN entry e ON e.id = b.entryFk
|
||||||
|
JOIN travel t ON t.id = e.travelFk
|
||||||
|
JOIN warehouse w ON w.id = t.warehouseInFk
|
||||||
|
WHERE t.landed = vDate
|
||||||
|
AND NOT t.isReceived
|
||||||
|
AND NOT e.isExcludedFromAvailable
|
||||||
|
AND NOT e.isRaid
|
||||||
|
AND IFNULL(vWarehouseFk, t.warehouseInFk) = t.warehouseInFk
|
||||||
|
AND w.isComparative
|
||||||
|
UNION ALL
|
||||||
|
SELECT b.itemFk, b.quantity
|
||||||
|
FROM buy b
|
||||||
|
JOIN entry e ON e.id = b.entryFk
|
||||||
|
JOIN travel t ON t.id = e.travelFk
|
||||||
|
JOIN warehouse w ON w.id = t.warehouseOutFk
|
||||||
|
WHERE t.shipped = vDate
|
||||||
|
AND NOT t.isReceived
|
||||||
|
AND NOT e.isExcludedFromAvailable
|
||||||
|
AND NOT e.isRaid
|
||||||
|
AND IFNULL(vWarehouseFk, t.warehouseOutFk) = t.warehouseOutFk
|
||||||
|
AND w.isComparative
|
||||||
|
) sub2
|
||||||
|
GROUP BY itemFk;
|
||||||
|
|
||||||
|
UPDATE tmp.itemInventory ai
|
||||||
|
JOIN tItemVisibleCalc ivc ON ivc.itemFk = ai.id
|
||||||
|
SET ai.visible = ai.visible + ivc.visible;
|
||||||
|
|
||||||
-- Calculo del disponible
|
-- Calculo del disponible
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tmp.itemCalc
|
CREATE OR REPLACE TEMPORARY TABLE tmp.itemCalc
|
||||||
(INDEX (itemFk, warehouseFk))
|
(INDEX (itemFk, warehouseFk))
|
||||||
|
@ -195,6 +197,7 @@ proc: BEGIN
|
||||||
tmp.itemTravel,
|
tmp.itemTravel,
|
||||||
tmp.itemCalc,
|
tmp.itemCalc,
|
||||||
tItemInventoryCalc,
|
tItemInventoryCalc,
|
||||||
|
tItemVisibleCalc,
|
||||||
tmp.itemAtp;
|
tmp.itemAtp;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -15,6 +15,11 @@ proc: BEGIN
|
||||||
DECLARE vEndingDate DATETIME;
|
DECLARE vEndingDate DATETIME;
|
||||||
DECLARE vIsTodayRelative BOOLEAN;
|
DECLARE vIsTodayRelative BOOLEAN;
|
||||||
|
|
||||||
|
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||||
|
BEGIN
|
||||||
|
RESIGNAL;
|
||||||
|
END;
|
||||||
|
|
||||||
SELECT util.dayEnd(util.VN_CURDATE()) + INTERVAL LEAST(vScopeDays, maxProductionScopeDays) DAY
|
SELECT util.dayEnd(util.VN_CURDATE()) + INTERVAL LEAST(vScopeDays, maxProductionScopeDays) DAY
|
||||||
INTO vEndingDate
|
INTO vEndingDate
|
||||||
FROM productionConfig;
|
FROM productionConfig;
|
||||||
|
@ -31,7 +36,8 @@ proc: BEGIN
|
||||||
CALL prepareClientList();
|
CALL prepareClientList();
|
||||||
|
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tmp.sale_getProblems
|
CREATE OR REPLACE TEMPORARY TABLE tmp.sale_getProblems
|
||||||
(INDEX (ticketFk)) ENGINE = MEMORY
|
(INDEX (ticketFk))
|
||||||
|
ENGINE = MEMORY
|
||||||
SELECT tt.ticketFk, tt.clientFk, t.warehouseFk, t.shipped
|
SELECT tt.ticketFk, tt.clientFk, t.warehouseFk, t.shipped
|
||||||
FROM tmp.productionTicket tt
|
FROM tmp.productionTicket tt
|
||||||
JOIN ticket t ON t.id = tt.ticketFk;
|
JOIN ticket t ON t.id = tt.ticketFk;
|
||||||
|
|
|
@ -278,12 +278,11 @@ BEGIN
|
||||||
-- Redondeo: Cantidad pedida incorrecta en al grouping de la última compra
|
-- Redondeo: Cantidad pedida incorrecta en al grouping de la última compra
|
||||||
CALL buyUltimate(vWarehouseFk, vDate);
|
CALL buyUltimate(vWarehouseFk, vDate);
|
||||||
INSERT INTO tmp.sale_problems(ticketFk, hasRounding, saleFk)
|
INSERT INTO tmp.sale_problems(ticketFk, hasRounding, saleFk)
|
||||||
SELECT ticketFk, problem, saleFk
|
SELECT ticketFk, problem ,saleFk
|
||||||
FROM (
|
FROM (
|
||||||
SELECT tl.ticketFk,
|
SELECT tl.ticketFk,
|
||||||
s.id saleFk ,
|
s.id saleFk,
|
||||||
LEFT(GROUP_CONCAT('RE: ',i.id, ' ', IFNULL(i.longName,''), ' '), 250) problem,
|
LEFT(GROUP_CONCAT('RE: ',i.id, ' ', IFNULL(i.longName,'') SEPARATOR ', '), 250) problem
|
||||||
MOD(s.quantity, b.`grouping`) hasRounding
|
|
||||||
FROM tmp.ticket_list tl
|
FROM tmp.ticket_list tl
|
||||||
JOIN ticket t ON t.id = tl.ticketFk
|
JOIN ticket t ON t.id = tl.ticketFk
|
||||||
AND t.warehouseFk = vWarehouseFk
|
AND t.warehouseFk = vWarehouseFk
|
||||||
|
@ -291,9 +290,9 @@ BEGIN
|
||||||
JOIN item i ON i.id = s.itemFk
|
JOIN item i ON i.id = s.itemFk
|
||||||
JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk
|
JOIN tmp.buyUltimate bu ON bu.itemFk = s.itemFk
|
||||||
JOIN buy b ON b.id = bu.buyFk
|
JOIN buy b ON b.id = bu.buyFk
|
||||||
|
WHERE MOD(s.quantity, b.`grouping`)
|
||||||
GROUP BY tl.ticketFk
|
GROUP BY tl.ticketFk
|
||||||
HAVING hasRounding
|
)sub
|
||||||
) sub
|
|
||||||
ON DUPLICATE KEY UPDATE hasRounding = sub.problem, saleFk = sub.saleFk;
|
ON DUPLICATE KEY UPDATE hasRounding = sub.problem, saleFk = sub.saleFk;
|
||||||
END LOOP;
|
END LOOP;
|
||||||
CLOSE vCursor;
|
CLOSE vCursor;
|
||||||
|
|
|
@ -9,6 +9,11 @@ BEGIN
|
||||||
*/
|
*/
|
||||||
DECLARE vStateFk INT;
|
DECLARE vStateFk INT;
|
||||||
|
|
||||||
|
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
||||||
|
BEGIN
|
||||||
|
RESIGNAL;
|
||||||
|
END;
|
||||||
|
|
||||||
INSERT INTO ticket (
|
INSERT INTO ticket (
|
||||||
clientFk,
|
clientFk,
|
||||||
shipped,
|
shipped,
|
||||||
|
|
|
@ -9,6 +9,8 @@ BEGIN
|
||||||
*/
|
*/
|
||||||
DECLARE vLastIn DATETIME ;
|
DECLARE vLastIn DATETIME ;
|
||||||
DECLARE vIsMiddleOdd BOOLEAN ;
|
DECLARE vIsMiddleOdd BOOLEAN ;
|
||||||
|
DECLARE vMailTo VARCHAR(50) DEFAULT NULL;
|
||||||
|
DECLARE vUserName VARCHAR(50) DEFAULT NULL;
|
||||||
|
|
||||||
IF (vTimed IS NULL) THEN
|
IF (vTimed IS NULL) THEN
|
||||||
SET vTimed = util.VN_NOW();
|
SET vTimed = util.VN_NOW();
|
||||||
|
@ -57,5 +59,18 @@ BEGIN
|
||||||
VALUES('in', NULL);
|
VALUES('in', NULL);
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
|
IF (SELECT option1 IS NULL AND option2 IS NULL FROM tmp.workerTimeControlDirection) THEN
|
||||||
|
SELECT CONCAT(u.name, '@verdnatura.es'), CONCAT(w.firstName, ' ', w.lastName)
|
||||||
|
INTO vMailTo, vUserName
|
||||||
|
FROM account.user u
|
||||||
|
JOIN worker w ON w.bossFk = u.id
|
||||||
|
WHERE w.id = vWorkerFk;
|
||||||
|
|
||||||
|
CALL mail_insert(
|
||||||
|
vMailTo,
|
||||||
|
vMailTo,
|
||||||
|
'Error al fichar',
|
||||||
|
CONCAT(vUserName, ' tiene problemas para fichar'));
|
||||||
|
END IF;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -11,11 +11,9 @@ BEGIN
|
||||||
IF NEW.isBooked = OLD.isBooked AND (
|
IF NEW.isBooked = OLD.isBooked AND (
|
||||||
NOT (NEW.supplierFk <=> OLD.supplierFk) OR
|
NOT (NEW.supplierFk <=> OLD.supplierFk) OR
|
||||||
NOT (NEW.dated <=> OLD.dated) OR
|
NOT (NEW.dated <=> OLD.dated) OR
|
||||||
NOT (NEW.invoiceNumber <=> OLD.invoiceNumber) OR
|
|
||||||
NOT (NEW.travelFk <=> OLD.travelFk) OR
|
NOT (NEW.travelFk <=> OLD.travelFk) OR
|
||||||
NOT (NEW.companyFk <=> OLD.companyFk) OR
|
NOT (NEW.companyFk <=> OLD.companyFk) OR
|
||||||
NOT (NEW.invoiceInFk <=> OLD.invoiceInFk) OR
|
NOT (NEW.invoiceInFk <=> OLD.invoiceInFk) OR
|
||||||
NOT (NEW.invoiceAmount <=> OLD.invoiceAmount) OR
|
|
||||||
NOT (NEW.typeFk <=> OLD.typeFk)
|
NOT (NEW.typeFk <=> OLD.typeFk)
|
||||||
) THEN
|
) THEN
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
ALTER TABLE vn.calendar ADD created timestamp DEFAULT current_timestamp() NOT NULL AFTER dated;
|
|
@ -0,0 +1 @@
|
||||||
|
ALTER TABLE vn.greuge CHANGE Id id int(10) unsigned auto_increment NOT NULL;
|
|
@ -0,0 +1 @@
|
||||||
|
ALTER TABLE vn.itemShelving ADD isSplit tinyint(1) NULL COMMENT 'Este valor cambia al splitar un carro que se ha quedado en holanda';
|
|
@ -0,0 +1,42 @@
|
||||||
|
USE `vn`;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS vn.`tillSerial` (
|
||||||
|
`code` varchar(2) COLLATE utf8mb3_unicode_ci NOT NULL,
|
||||||
|
`description` varchar(30) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
|
||||||
|
`account` varchar(10) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`code`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
|
||||||
|
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES(' S', 'Saldos final / inicial', NULL);
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('A', 'Factura cliente', NULL);
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('B', 'Factura cliente', NULL);
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('C', 'Facturas Contado', NULL);
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('CC', 'Cuadre caja', '6780000000');
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('CD', 'Cuenta Director Comercial', '5510000002');
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('CH', 'Cheques', NULL);
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('CM', 'Cambio', NULL);
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('CR', 'Ingreso/Reintegro Caja Rural', NULL);
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('CT', 'Correos y telégrafos', '6290000005');
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('DC', 'Dietas conductores', '6290000010');
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('DH', 'Deudas Holland', NULL);
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('DT', 'Dietas', '6290000011');
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('E', 'Entrada mercancia', NULL);
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('EN', 'Enric Martinez', NULL);
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('GC', 'Cuenta con dto. Comercial', '5510000003');
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('GP', 'Gastos de personal', NULL);
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('GR', 'Gastos RRPP dpto comercial', '6290001002');
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('GS', 'Gasoil', '6280000002');
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('GV', 'Gastos viaje', '6290001000');
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('JV', 'Juanvi', '6290000553');
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('MB', 'Movimiento bancario', NULL);
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('MP', 'Materias Primas', '6000000000');
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('OG', 'Otros gastos', '6290000000');
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('PM', 'Pequeño material', '6290000007');
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('R', 'Factura proveedor', NULL);
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('RC', 'Ingreso/Reintegro Ruralcaja', NULL);
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('RN', 'Reparación nave', '6220000004');
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('SS', 'Gastos Silla', NULL);
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('T', 'Ticket', NULL);
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('TA', 'Factura rapida', NULL);
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('TC', 'Ticket contado', NULL);
|
||||||
|
INSERT IGNORE vn.tillSerial (code, `description`, account) VALUES('TR', 'Traspaso', NULL);
|
|
@ -0,0 +1,4 @@
|
||||||
|
ALTER TABLE vn.expeditionState
|
||||||
|
MODIFY COLUMN userFk INT(10) UNSIGNED,
|
||||||
|
ADD CONSTRAINT expeditionState_userFk FOREIGN KEY (userFk)
|
||||||
|
REFERENCES account.`user`(id);
|
|
@ -0,0 +1,8 @@
|
||||||
|
ALTER TABLE `vn`.`claimDestination`
|
||||||
|
ADD COLUMN `code` varchar(45) DEFAULT NULL;
|
||||||
|
|
||||||
|
UPDATE IGNORE vn.claimDestination SET code='Good' WHERE description= 'Bueno';
|
||||||
|
UPDATE IGNORE vn.claimDestination SET code='Garbage/Loss' WHERE description = 'Basura/Perd.';
|
||||||
|
UPDATE IGNORE vn.claimDestination SET code='Manufacturing' WHERE description = 'Confeccion';
|
||||||
|
UPDATE IGNORE vn.claimDestination SET code='Claim' WHERE description = 'Reclam.PRAG';
|
||||||
|
UPDATE IGNORE vn.claimDestination SET code='Corrected' WHERE description = 'Corregido';
|
|
@ -146,10 +146,11 @@ module.exports = Self => {
|
||||||
});
|
});
|
||||||
filter = mergeFilters(ctx.args.filter, {where});
|
filter = mergeFilters(ctx.args.filter, {where});
|
||||||
const userId = ctx.req.accessToken.userId;
|
const userId = ctx.req.accessToken.userId;
|
||||||
const isSupplier = await Self.app.models.Supplier.findById(userId, options);
|
const client = await Self.app.models.Client.findById(userId, myOptions);
|
||||||
if (isSupplier) {
|
const supplier = await Self.app.models.Supplier.findOne({where: {nif: client.fi}}, myOptions);
|
||||||
|
if (supplier) {
|
||||||
if (!filter.where) filter.where = {};
|
if (!filter.where) filter.where = {};
|
||||||
filter.where[`e.supplierFk`] = ctx.req.accessToken.userId;
|
filter.where[`e.supplierFk`] = supplier.id;
|
||||||
}
|
}
|
||||||
const stmts = [];
|
const stmts = [];
|
||||||
let stmt;
|
let stmt;
|
||||||
|
@ -180,6 +181,7 @@ module.exports = Self => {
|
||||||
cu.code currencyCode,
|
cu.code currencyCode,
|
||||||
t.shipped,
|
t.shipped,
|
||||||
t.landed,
|
t.landed,
|
||||||
|
t.ref AS travelRef,
|
||||||
t.warehouseInFk,
|
t.warehouseInFk,
|
||||||
w.name warehouseInName
|
w.name warehouseInName
|
||||||
FROM vn.entry e
|
FROM vn.entry e
|
||||||
|
|
|
@ -36,9 +36,10 @@ module.exports = Self => {
|
||||||
|
|
||||||
if (typeof options == 'object')
|
if (typeof options == 'object')
|
||||||
Object.assign(myOptions, options);
|
Object.assign(myOptions, options);
|
||||||
const isSupplier = await Self.app.models.Supplier.findById(userId, myOptions);
|
const client = await Self.app.models.Client.findById(userId, myOptions);
|
||||||
if (isSupplier) {
|
const supplier = await Self.app.models.Supplier.findOne({where: {nif: client.fi}}, myOptions);
|
||||||
const isEntryOwner = (await Self.findById(id)).supplierFk === userId;
|
if (supplier) {
|
||||||
|
const isEntryOwner = (await Self.findById(id)).supplierFk === supplier.id;
|
||||||
|
|
||||||
if (!isEntryOwner) throw new UserError('Access Denied');
|
if (!isEntryOwner) throw new UserError('Access Denied');
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ describe('Entry filter()', () => {
|
||||||
try {
|
try {
|
||||||
const ctx = {
|
const ctx = {
|
||||||
args: {},
|
args: {},
|
||||||
req: {accessToken: {userId: 2}}
|
req: {accessToken: {userId: 1102}}
|
||||||
};
|
};
|
||||||
|
|
||||||
const result = await models.Entry.filter(ctx, options);
|
const result = await models.Entry.filter(ctx, options);
|
||||||
|
@ -79,7 +79,7 @@ describe('Entry filter()', () => {
|
||||||
args: {
|
args: {
|
||||||
supplierFk: 1
|
supplierFk: 1
|
||||||
},
|
},
|
||||||
req: {accessToken: {userId: 2}}
|
req: {accessToken: {userId: 1102}}
|
||||||
};
|
};
|
||||||
|
|
||||||
const result = await models.Entry.filter(ctx, options);
|
const result = await models.Entry.filter(ctx, options);
|
||||||
|
|
|
@ -40,7 +40,7 @@ describe('entry getBuys()', () => {
|
||||||
args: {
|
args: {
|
||||||
search: 1
|
search: 1
|
||||||
},
|
},
|
||||||
req: {accessToken: {userId: 2}}
|
req: {accessToken: {userId: 1102}}
|
||||||
};
|
};
|
||||||
|
|
||||||
const result = await models.Entry.getBuys(ctx, entryId, options);
|
const result = await models.Entry.getBuys(ctx, entryId, options);
|
||||||
|
|
|
@ -63,7 +63,7 @@ module.exports = Self => {
|
||||||
FROM tItemShelving ti
|
FROM tItemShelving ti
|
||||||
JOIN tItemInSector tis ON tis.itemFk = ti.itemFk
|
JOIN tItemInSector tis ON tis.itemFk = ti.itemFk
|
||||||
JOIN vn.productionConfig pc
|
JOIN vn.productionConfig pc
|
||||||
WHERE ti.created > tis.created + INTERVAL pc.itemOlderReviewHours HOUR;`,
|
WHERE ti.created + INTERVAL pc.itemOlderReviewHours HOUR < tis.created ;`,
|
||||||
[shelvingFk, shelvingFk], myOptions);
|
[shelvingFk, shelvingFk], myOptions);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,29 +3,16 @@ const {models} = require('vn-loopback/server/server');
|
||||||
|
|
||||||
describe('itemShelving getListItemNewer()', () => {
|
describe('itemShelving getListItemNewer()', () => {
|
||||||
it('should return true because there is an older item', async() => {
|
it('should return true because there is an older item', async() => {
|
||||||
const shelving = 'NCC';
|
const shelving = 'NBB';
|
||||||
const parking = 'A-47-1';
|
const parking = '700-01';
|
||||||
|
|
||||||
const sectorCamHighCode = 'CAMARA SECTOR D';
|
const sectorCamHighCode = 'FIRST';
|
||||||
const sectorCamCode = 'NAVE ALGEMESI';
|
const sectorCamCode = 'NS';
|
||||||
|
|
||||||
const sectorCamCodeHighId = 1;
|
|
||||||
const sectorCamCodeId = 9991;
|
|
||||||
|
|
||||||
const tx = await models.Sector.beginTransaction({});
|
const tx = await models.Sector.beginTransaction({});
|
||||||
const myOptions = {transaction: tx};
|
const myOptions = {transaction: tx};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const sectorHighCam = await models.Sector.findById(sectorCamCodeHighId, null, myOptions);
|
|
||||||
await sectorHighCam.updateAttributes({
|
|
||||||
code: sectorCamHighCode
|
|
||||||
});
|
|
||||||
|
|
||||||
const sectorCam = await models.Sector.findById(sectorCamCodeId, null, myOptions);
|
|
||||||
await sectorCam.updateAttributes({
|
|
||||||
code: sectorCamCode
|
|
||||||
});
|
|
||||||
|
|
||||||
const config = await models.ProductionConfig.findOne();
|
const config = await models.ProductionConfig.findOne();
|
||||||
|
|
||||||
await config.updateAttributes({
|
await config.updateAttributes({
|
||||||
|
@ -35,7 +22,7 @@ describe('itemShelving getListItemNewer()', () => {
|
||||||
|
|
||||||
const result = await models.ItemShelving.getListItemNewer(shelving, parking, myOptions);
|
const result = await models.ItemShelving.getListItemNewer(shelving, parking, myOptions);
|
||||||
|
|
||||||
expect(result.length).toEqual(2);
|
expect(result.length).toEqual(3);
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
|
|
|
@ -66,6 +66,10 @@ module.exports = Self => {
|
||||||
promises.push(deletedSale);
|
promises.push(deletedSale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const deletedSales = await Promise.all(promises);
|
||||||
|
|
||||||
|
if (tx) await tx.commit();
|
||||||
|
|
||||||
const salesPerson = ticket.client().salesPersonUser();
|
const salesPerson = ticket.client().salesPersonUser();
|
||||||
if (salesPerson) {
|
if (salesPerson) {
|
||||||
const url = await Self.app.models.Url.getUrl();
|
const url = await Self.app.models.Url.getUrl();
|
||||||
|
@ -75,13 +79,9 @@ module.exports = Self => {
|
||||||
ticketUrl: `${url}ticket/${ticketId}/sale`,
|
ticketUrl: `${url}ticket/${ticketId}/sale`,
|
||||||
deletions: deletions
|
deletions: deletions
|
||||||
});
|
});
|
||||||
await models.Chat.sendCheckingPresence(ctx, salesPerson.id, message, myOptions);
|
await models.Chat.sendCheckingPresence(ctx, salesPerson.id, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
const deletedSales = await Promise.all(promises);
|
|
||||||
|
|
||||||
if (tx) await tx.commit();
|
|
||||||
|
|
||||||
return deletedSales;
|
return deletedSales;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (tx) await tx.rollback();
|
if (tx) await tx.rollback();
|
||||||
|
|
|
@ -59,7 +59,7 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="3" class="barcode">
|
<td colspan="3" class="barcode">
|
||||||
<div v-html="getBarcode(buy.id)"></div>
|
<div v-html="getBarcode(buy.id)"></div>
|
||||||
<span>{{buy.id}}</span>
|
<span>{{buy.itemFk}}</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
@ -8,6 +8,7 @@ SELECT ROW_NUMBER() OVER(ORDER BY b.id) labelNum,
|
||||||
b.`grouping`,
|
b.`grouping`,
|
||||||
i.stems,
|
i.stems,
|
||||||
b.id,
|
b.id,
|
||||||
|
b.itemFk,
|
||||||
p.name producer
|
p.name producer
|
||||||
FROM buy b
|
FROM buy b
|
||||||
JOIN item i ON i.id = b.itemFk
|
JOIN item i ON i.id = b.itemFk
|
||||||
|
|
|
@ -81,6 +81,7 @@
|
||||||
<span v-if="sale.value5"> <strong>{{sale.tag5}}</strong> {{sale.value5}} </span>
|
<span v-if="sale.value5"> <strong>{{sale.tag5}}</strong> {{sale.value5}} </span>
|
||||||
<span v-if="sale.value6"> <strong>{{sale.tag6}}</strong> {{sale.value6}} </span>
|
<span v-if="sale.value6"> <strong>{{sale.tag6}}</strong> {{sale.value6}} </span>
|
||||||
<span v-if="sale.value7"> <strong>{{sale.tag7}}</strong> {{sale.value7}} </span>
|
<span v-if="sale.value7"> <strong>{{sale.tag7}}</strong> {{sale.value7}} </span>
|
||||||
|
<span v-if="sale.subName"> <strong>{{$t('producer')}}</strong> {{ sale.subName }}</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
@ -20,6 +20,7 @@ vatType: VAT Type
|
||||||
digitalSignature: Digital signature
|
digitalSignature: Digital signature
|
||||||
plantPassport: Plant passport
|
plantPassport: Plant passport
|
||||||
packages: Packages
|
packages: Packages
|
||||||
|
producer: Producer
|
||||||
services:
|
services:
|
||||||
title: Services
|
title: Services
|
||||||
theader:
|
theader:
|
||||||
|
|
|
@ -15,6 +15,7 @@ discount: Dto.
|
||||||
vat: IVA
|
vat: IVA
|
||||||
amount: Importe
|
amount: Importe
|
||||||
total: Total
|
total: Total
|
||||||
|
producer: Productor
|
||||||
subtotal: Subtotal
|
subtotal: Subtotal
|
||||||
vatType: Tipo de IVA
|
vatType: Tipo de IVA
|
||||||
digitalSignature: Firma digital
|
digitalSignature: Firma digital
|
||||||
|
|
|
@ -14,6 +14,7 @@ price: PRIX/u
|
||||||
discount: Remise
|
discount: Remise
|
||||||
vat: TVA
|
vat: TVA
|
||||||
amount: Montant
|
amount: Montant
|
||||||
|
producer: producteur
|
||||||
total: Total
|
total: Total
|
||||||
subtotal: Total partiel
|
subtotal: Total partiel
|
||||||
vatType: Type de TVA
|
vatType: Type de TVA
|
||||||
|
|
|
@ -14,6 +14,7 @@ price: PVP/u
|
||||||
discount: Dto.
|
discount: Dto.
|
||||||
vat: IVA
|
vat: IVA
|
||||||
amount: Importe
|
amount: Importe
|
||||||
|
producer: Produtor
|
||||||
total: Total
|
total: Total
|
||||||
subtotal: Sub-total
|
subtotal: Sub-total
|
||||||
vatType: Tipo de IVA
|
vatType: Tipo de IVA
|
||||||
|
|
|
@ -19,7 +19,8 @@ SELECT s.id,
|
||||||
i.tag6,
|
i.tag6,
|
||||||
i.value6,
|
i.value6,
|
||||||
i.tag7,
|
i.tag7,
|
||||||
i.value7
|
i.value7,
|
||||||
|
i.subName
|
||||||
FROM vn.sale s
|
FROM vn.sale s
|
||||||
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
|
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
|
||||||
LEFT JOIN component cr ON cr.id = sc.componentFk
|
LEFT JOIN component cr ON cr.id = sc.componentFk
|
||||||
|
|
|
@ -27,8 +27,7 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{$t('supplier.identifier')}}</td>
|
<td>{{$t('supplier.identifier')}}</td>
|
||||||
<th>
|
<th>
|
||||||
<div>{{supplier.iban}}</div>
|
<div>{{supplier.accountDetailValue.join(', ')}}</div>
|
||||||
<div>{{supplier.nif}}</div>
|
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
@ -7,7 +7,11 @@ module.exports = {
|
||||||
async serverPrefetch() {
|
async serverPrefetch() {
|
||||||
this.client = await this.findOneFromDef('client', [this.companyId, this.companyId, this.id]);
|
this.client = await this.findOneFromDef('client', [this.companyId, this.companyId, this.id]);
|
||||||
this.checkMainEntity(this.client);
|
this.checkMainEntity(this.client);
|
||||||
this.supplier = await this.findOneFromDef('supplier', [this.companyId, this.companyId, this.id]);
|
const suppliers = await this.rawSqlFromDef('supplier', [this.companyId, this.companyId, this.id]);
|
||||||
|
this.supplier = {
|
||||||
|
...suppliers[0],
|
||||||
|
accountDetailValue: suppliers.map(val => val?.accountDetailValue)
|
||||||
|
};
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
id: {
|
id: {
|
||||||
|
@ -23,11 +27,11 @@ module.exports = {
|
||||||
methods: {
|
methods: {
|
||||||
getSupplierCif() {
|
getSupplierCif() {
|
||||||
return db.findOne(`
|
return db.findOne(`
|
||||||
SELECT sa.iban, s.nif
|
SELECT DISTINCT ad.value
|
||||||
FROM supplierAccount sa
|
FROM supplierAccount sa
|
||||||
JOIN company co ON co.supplierAccountFk = sa.id
|
JOIN accountDetail ad ON ad.supplierAccountFk = sa.id
|
||||||
JOIN supplier s ON sa.supplierFk = s.id
|
JOIN accountDetailType adt ON adt.id = ad.accountDetailTypeFk AND adt.id = 3
|
||||||
WHERE co.id = ?`) [this.companyId];
|
WHERE sa.supplierFk = ?`) [this.companyId];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,8 @@ SELECT
|
||||||
s.nif,
|
s.nif,
|
||||||
sa.iban,
|
sa.iban,
|
||||||
sa.supplierFk,
|
sa.supplierFk,
|
||||||
be.name bankName
|
be.name bankName,
|
||||||
|
ad.value accountDetailValue
|
||||||
FROM
|
FROM
|
||||||
client c
|
client c
|
||||||
LEFT JOIN mandate m ON m.clientFk = c.id AND m.companyFk = ? AND m.finished IS NULL
|
LEFT JOIN mandate m ON m.clientFk = c.id AND m.companyFk = ? AND m.finished IS NULL
|
||||||
|
@ -19,9 +20,10 @@ FROM
|
||||||
LEFT JOIN province p ON p.id = c.provinceFk
|
LEFT JOIN province p ON p.id = c.provinceFk
|
||||||
LEFT JOIN supplierAccount sa ON sa.supplierFk = s.id
|
LEFT JOIN supplierAccount sa ON sa.supplierFk = s.id
|
||||||
LEFT JOIN bankEntity be ON sa.bankEntityFk = be.id
|
LEFT JOIN bankEntity be ON sa.bankEntityFk = be.id
|
||||||
|
LEFT JOIN accountDetail ad ON ad.supplierAccountFk = sa.id
|
||||||
|
LEFT JOIN accountDetailType adt ON adt.id = ad.accountDetailTypeFk AND adt.id = 3
|
||||||
WHERE
|
WHERE
|
||||||
(m.companyFk = ? OR m.companyFk IS NULL)
|
(m.companyFk = ? OR m.companyFk IS NULL)
|
||||||
AND (c.id = ? OR (c.id IS NULL AND c.countryFk = sa.countryFk))
|
AND (c.id = ? OR (c.id IS NULL AND c.countryFk = sa.countryFk))
|
||||||
ORDER BY
|
ORDER BY
|
||||||
m.created DESC
|
m.created DESC;
|
||||||
LIMIT 1;
|
|
||||||
|
|
Loading…
Reference in New Issue