From 87182abf7ed82754f44e66bc42c34471aa9a6ee9 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Wed, 11 Sep 2024 12:47:51 +0200 Subject: [PATCH 1/3] fix: available refs #6861 --- db/routines/vn/procedures/itemShelving_add.sql | 5 ++++- db/routines/vn/procedures/sale_boxPickingPrint.sql | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/db/routines/vn/procedures/itemShelving_add.sql b/db/routines/vn/procedures/itemShelving_add.sql index a1bca5b6c..ed22b9d92 100644 --- a/db/routines/vn/procedures/itemShelving_add.sql +++ b/db/routines/vn/procedures/itemShelving_add.sql @@ -46,7 +46,8 @@ BEGIN AND buyFk = vBuyFk) THEN UPDATE itemShelving - SET visible = visible + vQuantity + SET visible = visible + vQuantity, + available = available + vQuantity WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk AND itemFk = vItemFk AND packing = vPacking; ELSE @@ -55,6 +56,7 @@ BEGIN itemFk, shelvingFk, visible, + available, grouping, packing, packagingFk, @@ -62,6 +64,7 @@ BEGIN SELECT vItemFk, vShelvingFk, vQuantity, + available, IFNULL(vGrouping, b.grouping), IFNULL(vPacking, b.packing), IFNULL(vPackagingFk, b.packagingFk), diff --git a/db/routines/vn/procedures/sale_boxPickingPrint.sql b/db/routines/vn/procedures/sale_boxPickingPrint.sql index dbb3b6c14..bf7afbf7d 100644 --- a/db/routines/vn/procedures/sale_boxPickingPrint.sql +++ b/db/routines/vn/procedures/sale_boxPickingPrint.sql @@ -160,7 +160,10 @@ w1: WHILE vQuantity >= vPacking DO UPDATE sale SET quantity = quantity - vPacking WHERE id = vSaleFk; - UPDATE itemShelving SET visible = visible - vPacking WHERE id = vItemShelvingFk; + UPDATE itemShelving + SET visible = visible - vPacking, + available = available - vPacking + WHERE id = vItemShelvingFk; SET vNewSaleFk = NULL; From db7d5c5e5289769d642663242727680309a07eb5 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Wed, 11 Sep 2024 13:18:09 +0200 Subject: [PATCH 2/3] fix: available refs #6861 --- db/routines/vn/procedures/itemShelving_add.sql | 2 -- 1 file changed, 2 deletions(-) diff --git a/db/routines/vn/procedures/itemShelving_add.sql b/db/routines/vn/procedures/itemShelving_add.sql index ed22b9d92..3f6c1f39d 100644 --- a/db/routines/vn/procedures/itemShelving_add.sql +++ b/db/routines/vn/procedures/itemShelving_add.sql @@ -56,7 +56,6 @@ BEGIN itemFk, shelvingFk, visible, - available, grouping, packing, packagingFk, @@ -64,7 +63,6 @@ BEGIN SELECT vItemFk, vShelvingFk, vQuantity, - available, IFNULL(vGrouping, b.grouping), IFNULL(vPacking, b.packing), IFNULL(vPackagingFk, b.packagingFk), From 7e06c2ab37eefd06b850c01645cf4d66f99e2515 Mon Sep 17 00:00:00 2001 From: sergiodt Date: Wed, 11 Sep 2024 13:57:03 +0200 Subject: [PATCH 3/3] fix: available refs #6861 --- db/routines/vn/procedures/itemShelving_add.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/routines/vn/procedures/itemShelving_add.sql b/db/routines/vn/procedures/itemShelving_add.sql index 3f6c1f39d..98ec9b088 100644 --- a/db/routines/vn/procedures/itemShelving_add.sql +++ b/db/routines/vn/procedures/itemShelving_add.sql @@ -69,6 +69,6 @@ BEGIN id FROM buy b WHERE id = vBuyFk; - END IF; + END IF; END$$ DELIMITER ; \ No newline at end of file