From 8fedfbd090fa3dce0e9b309dfbd8e1f0361a3a47 Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 16 Sep 2024 13:32:14 +0200 Subject: [PATCH 1/4] fix: refs #7524 getAmountPaid wip --- modules/client/front/balance/create/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/client/front/balance/create/index.js b/modules/client/front/balance/create/index.js index f1474e10c..c0bc11c0b 100644 --- a/modules/client/front/balance/create/index.js +++ b/modules/client/front/balance/create/index.js @@ -7,6 +7,10 @@ class Controller extends Dialog { this.vnReport = vnReport; this.vnEmail = vnEmail; this.receipt = {}; + + this.$.$watch(() => this.clientFk, (newVal, oldVal) => { + if (!this.receipt.amountPaid && newVal != oldVal) this.getAmountPaid(); + }); } set payed(value) { @@ -51,7 +55,6 @@ class Controller extends Dialog { set companyFk(value) { this.receipt.companyFk = value; - this.getAmountPaid(); } set description(value) { From 4332fccfcccd76774f3cdc6be54dde7cdce6d5ae Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 17 Sep 2024 11:43:34 +0200 Subject: [PATCH 2/4] chore: refs #7524 rollback --- modules/client/front/balance/create/index.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/modules/client/front/balance/create/index.js b/modules/client/front/balance/create/index.js index c0bc11c0b..f1474e10c 100644 --- a/modules/client/front/balance/create/index.js +++ b/modules/client/front/balance/create/index.js @@ -7,10 +7,6 @@ class Controller extends Dialog { this.vnReport = vnReport; this.vnEmail = vnEmail; this.receipt = {}; - - this.$.$watch(() => this.clientFk, (newVal, oldVal) => { - if (!this.receipt.amountPaid && newVal != oldVal) this.getAmountPaid(); - }); } set payed(value) { @@ -55,6 +51,7 @@ class Controller extends Dialog { set companyFk(value) { this.receipt.companyFk = value; + this.getAmountPaid(); } set description(value) { From 529be86d8430176d54070ce8d2d6bf68e8a37bb8 Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 17 Sep 2024 11:44:09 +0200 Subject: [PATCH 3/4] fix: refs #7524 too records error --- modules/ticket/front/descriptor-menu/index.html | 7 ------- 1 file changed, 7 deletions(-) diff --git a/modules/ticket/front/descriptor-menu/index.html b/modules/ticket/front/descriptor-menu/index.html index 82094d7b8..b861b0c0e 100644 --- a/modules/ticket/front/descriptor-menu/index.html +++ b/modules/ticket/front/descriptor-menu/index.html @@ -349,13 +349,6 @@ message="Recalculate components"> - - - - Date: Tue, 17 Sep 2024 12:10:47 +0200 Subject: [PATCH 4/4] fix: refs #7564 Ticket volume item cost --- .../vn/procedures/ticket_setVolume.sql | 2 +- .../procedures/ticket_setVolumeItemCost.sql | 32 ++++++++++++------- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/db/routines/vn/procedures/ticket_setVolume.sql b/db/routines/vn/procedures/ticket_setVolume.sql index 060a6fa57..d0fe9740c 100644 --- a/db/routines/vn/procedures/ticket_setVolume.sql +++ b/db/routines/vn/procedures/ticket_setVolume.sql @@ -4,7 +4,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setVolume`( ) BEGIN /** - * Update the volume ticket + * Update the volume ticket. * * @param vSelf Ticket id */ diff --git a/db/routines/vn/procedures/ticket_setVolumeItemCost.sql b/db/routines/vn/procedures/ticket_setVolumeItemCost.sql index f266cd769..d7fb4473d 100644 --- a/db/routines/vn/procedures/ticket_setVolumeItemCost.sql +++ b/db/routines/vn/procedures/ticket_setVolumeItemCost.sql @@ -4,26 +4,36 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setVolumeIte ) BEGIN /** - * Update the volume tickets of item + * Update the volume of tickets containing the item. * - * @param vSelf Ticket id + * @param vItemFk Item id */ - CREATE OR REPLACE TEMPORARY TABLE tTicket - (PRIMARY KEY (id)) - ENGINE = MEMORY - SELECT t.id, SUM(s.quantity * ic.cm3delivery / 1000000) volume + DECLARE vTicket INT; + DECLARE vDone BOOL; + + DECLARE vTickets CURSOR FOR + SELECT DISTINCT t.id FROM sale s JOIN ticket t ON t.id = s.ticketFk JOIN itemCost ic ON ic.itemFk = s.itemFk AND ic.warehouseFk = t.warehouseFk WHERE s.itemFk = vItemFk AND t.shipped >= util.VN_CURDATE() - GROUP BY t.id; + AND t.refFk IS NULL; - UPDATE ticket t - JOIN tTicket tt ON tt.id = t.id - SET t.volume = tt.volume; + DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - DROP TEMPORARY TABLE tTicket; + OPEN vTickets; + l: LOOP + FETCH vTickets INTO vTicket; + + IF vDone THEN + LEAVE l; + END IF; + + CALL ticket_setVolume(vTicket); + + END LOOP l; + CLOSE vTickets; END$$ DELIMITER ;