From 000a967a03404c047f41b510caad37d3d66f933c Mon Sep 17 00:00:00 2001 From: pablone Date: Fri, 26 Jul 2024 07:12:51 +0200 Subject: [PATCH 1/2] feat: refs #6403 packingSite to productionConfig --- db/versions/11170-redPaniculata/00-firstScript.sql | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 db/versions/11170-redPaniculata/00-firstScript.sql diff --git a/db/versions/11170-redPaniculata/00-firstScript.sql b/db/versions/11170-redPaniculata/00-firstScript.sql new file mode 100644 index 000000000..b5d34c082 --- /dev/null +++ b/db/versions/11170-redPaniculata/00-firstScript.sql @@ -0,0 +1,6 @@ +-- Place your SQL code here + +ALTER TABLE vn.packingSite DROP COLUMN IF EXISTS hasNewLabelMrwMethod; + +ALTER TABLE vn.productionConfig ADD IF NOT EXISTS hasNewLabelMrwMethod BOOL DEFAULT TRUE NOT NULL + COMMENT 'column to activate the new mrw integration'; From cf13aa917ef8198a491633bd802b99185d9ed524 Mon Sep 17 00:00:00 2001 From: guillermo Date: Fri, 9 Aug 2024 08:18:30 +0200 Subject: [PATCH 2/2] feat: refs #7126 saleQuantity to saleWasteQuantity --- db/dump/fixtures.before.sql | 2 +- db/routines/bs/procedures/waste_addSales.sql | 14 +++++++------- db/versions/11182-redAralia/00-firstScript.sql | 2 ++ 3 files changed, 10 insertions(+), 8 deletions(-) create mode 100644 db/versions/11182-redAralia/00-firstScript.sql diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index 60c96abb4..6563292dd 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -1516,7 +1516,7 @@ INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed (9, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY), 10, 0, 442, 'IN2009', 'Movement 9', 1, 1, ''), (10, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY), 10, 0, 442, 'IN2009', 'Movement 9', 1, 1, ''); -INSERT INTO `bs`.`waste`(`buyerFk`, `year`, `week`, `itemFk`, `itemTypeFk`, `saleTotal`, `saleQuantity`, `saleInternalWaste`, `saleExternalWaste`) +INSERT INTO `bs`.`waste`(`buyerFk`, `year`, `week`, `itemFk`, `itemTypeFk`, `saleTotal`, `saleWasteQuantity`, `saleInternalWaste`, `saleExternalWaste`) VALUES ('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 1, 1, '1062', '51', '56.20', '56.20'), ('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 2, 1, '35074', '687', '53.12', '89.69'), diff --git a/db/routines/bs/procedures/waste_addSales.sql b/db/routines/bs/procedures/waste_addSales.sql index 3e189d2e6..b855e8b0d 100644 --- a/db/routines/bs/procedures/waste_addSales.sql +++ b/db/routines/bs/procedures/waste_addSales.sql @@ -1,7 +1,7 @@ DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`waste_addSales`() BEGIN - DECLARE vDateFrom DATE DEFAULT util.VN_CURDATE() - INTERVAL WEEKDAY(CURDATE()) DAY; + DECLARE vDateFrom DATE DEFAULT util.VN_CURDATE() - INTERVAL WEEKDAY(util.VN_CURDATE()) DAY; DECLARE vDateTo DATE DEFAULT vDateFrom + INTERVAL 6 DAY; CALL cache.last_buy_refresh(FALSE); @@ -12,16 +12,16 @@ BEGIN it.workerFk, it.id, s.itemFk, - SUM(s.quantity), - SUM((b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity) `value`, - SUM ( + SUM((b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity), + SUM(IF(aw.`type`, s.quantity, 0)), + SUM( IF( aw.`type` = 'internal', (b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity, 0 ) - ) internalWaste, - SUM ( + ), + SUM( IF( aw.`type` = 'external', (b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity, @@ -30,7 +30,7 @@ BEGIN 0 ) ) - ) externalWaste + ) FROM vn.sale s JOIN vn.item i ON i.id = s.itemFk JOIN vn.itemType it ON it.id = i.typeFk diff --git a/db/versions/11182-redAralia/00-firstScript.sql b/db/versions/11182-redAralia/00-firstScript.sql new file mode 100644 index 000000000..72c06de65 --- /dev/null +++ b/db/versions/11182-redAralia/00-firstScript.sql @@ -0,0 +1,2 @@ +ALTER TABLE bs.waste CHANGE saleQuantity saleWasteQuantity decimal(10,2) DEFAULT NULL NULL AFTER saleTotal; +ALTER TABLE bs.waste MODIFY COLUMN saleTotal decimal(10,2) DEFAULT NULL NULL COMMENT 'Coste';