From 7c016da8f9bb16218965e991fc4b5b14a46581b6 Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 11 Nov 2024 16:16:42 +0100 Subject: [PATCH 01/10] refactor: refs #7641 entry report style --- .../reports/entry-order/assets/css/style.css | 5 +++ .../reports/entry-order/entry-order.html | 44 +++++++++---------- 2 files changed, 27 insertions(+), 22 deletions(-) diff --git a/print/templates/reports/entry-order/assets/css/style.css b/print/templates/reports/entry-order/assets/css/style.css index 767b1185a..1a5ea3eb6 100644 --- a/print/templates/reports/entry-order/assets/css/style.css +++ b/print/templates/reports/entry-order/assets/css/style.css @@ -17,4 +17,9 @@ h3 { .tags { font-size: 10px; margin: 0; +} + +.column-oriented th, +.column-oriented td{ + padding: 5px } \ No newline at end of file diff --git a/print/templates/reports/entry-order/entry-order.html b/print/templates/reports/entry-order/entry-order.html index e5d3bfb6d..ff5159aa2 100644 --- a/print/templates/reports/entry-order/entry-order.html +++ b/print/templates/reports/entry-order/entry-order.html @@ -41,36 +41,36 @@ + - + - - - - - - - - + + + + + + + + - - - - - + + + - - - - - + + + + From e38adf4296c55492ff62fb9c14fd6c1e0adb3d92 Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 11 Nov 2024 16:23:17 +0100 Subject: [PATCH 02/10] fix: refs #7641 align columns --- print/templates/reports/entry-order/entry-order.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/print/templates/reports/entry-order/entry-order.html b/print/templates/reports/entry-order/entry-order.html index ff5159aa2..5ce306827 100644 --- a/print/templates/reports/entry-order/entry-order.html +++ b/print/templates/reports/entry-order/entry-order.html @@ -77,8 +77,8 @@ - + From b025a8b80431bd1d15d85d7aa3383b85d1b7f829 Mon Sep 17 00:00:00 2001 From: pablone Date: Wed, 13 Nov 2024 09:10:18 +0100 Subject: [PATCH 03/10] fix: refs #7404 filter an rounding issues --- .../vn/procedures/stockBought_calculate.sql | 2 +- .../methods/stock-bought/getStockBought.js | 9 ++++--- .../stock-bought/getStockBoughtDetail.js | 27 +++++++++++++------ 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/db/routines/vn/procedures/stockBought_calculate.sql b/db/routines/vn/procedures/stockBought_calculate.sql index ba044604a..c3b5a0dc6 100644 --- a/db/routines/vn/procedures/stockBought_calculate.sql +++ b/db/routines/vn/procedures/stockBought_calculate.sql @@ -59,7 +59,7 @@ proc: BEGIN INSERT INTO stockBought(workerFk, bought, dated) SELECT tb.workerFk, - ROUND(GREATEST(tb.bought - IFNULL(ts.sold, 0), 0), 1), + ROUND(GREATEST(tb.bought - IFNULL(ts.sold, 0), 0), 2), vDated FROM tStockBought tb LEFT JOIN tStockSold ts ON ts.workerFk = tb.workerFk; diff --git a/modules/entry/back/methods/stock-bought/getStockBought.js b/modules/entry/back/methods/stock-bought/getStockBought.js index c1f99c496..9768b58e7 100644 --- a/modules/entry/back/methods/stock-bought/getStockBought.js +++ b/modules/entry/back/methods/stock-bought/getStockBought.js @@ -6,6 +6,9 @@ module.exports = Self => { arg: 'workerFk', type: 'number', description: 'The id for a buyer', + }, { + arg: 'filter', + type: 'object', }, { arg: 'dated', @@ -23,7 +26,7 @@ module.exports = Self => { } }); - Self.getStockBought = async(workerFk, dated = Date.vnNew()) => { + Self.getStockBought = async(workerFk, filter, dated = Date.vnNew()) => { const models = Self.app.models; const today = Date.vnNew(); dated.setHours(0, 0, 0, 0); @@ -31,7 +34,7 @@ module.exports = Self => { await models.StockBought.rawSql(`CALL vn.stockBought_calculate(?)`, [dated]); - const filter = { + const defaultFilter = { where: {dated}, include: [ { @@ -53,6 +56,6 @@ module.exports = Self => { if (workerFk) filter.where.workerFk = workerFk; - return models.StockBought.find(filter); + return models.StockBought.find({...filter, ...defaultFilter}); }; }; diff --git a/modules/entry/back/methods/stock-bought/getStockBoughtDetail.js b/modules/entry/back/methods/stock-bought/getStockBoughtDetail.js index d5f712edf..60b099682 100644 --- a/modules/entry/back/methods/stock-bought/getStockBoughtDetail.js +++ b/modules/entry/back/methods/stock-bought/getStockBoughtDetail.js @@ -1,3 +1,4 @@ +const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; module.exports = Self => { Self.remoteMethod('getStockBoughtDetail', { description: 'Returns the detail of stock bought for a given date and a worker', @@ -12,6 +13,9 @@ module.exports = Self => { type: 'string', description: 'The date to filter', required: true, + }, { + arg: 'filter', + type: 'object', } ], returns: { @@ -24,11 +28,10 @@ module.exports = Self => { } }); - Self.getStockBoughtDetail = async(workerFk, dated) => { - const models = Self.app.models; + Self.getStockBoughtDetail = async(workerFk, dated, filter, options) => { + const conn = Self.dataSource.connector; const myOptions = {}; let tx; - let result; if (typeof options == 'object') Object.assign(myOptions, options); @@ -39,8 +42,10 @@ module.exports = Self => { } try { - await models.StockBought.rawSql(`CALL vn.item_calculateStock(?)`, [dated], myOptions); - result = await Self.rawSql( + const stmts = []; + stmts.push(new ParameterizedSQL(`CALL vn.item_calculateStock(?)`, [dated])); + + const query = new ParameterizedSQL( `SELECT b.entryFk entryFk, i.id itemFk, i.name itemName, @@ -61,11 +66,17 @@ module.exports = Self => { JOIN volumeConfig vc WHERE ic.display AND w.id = ?`, - [workerFk], myOptions + [workerFk] ); - await Self.rawSql(`DROP TEMPORARY TABLE tmp.item, tmp.buyUltimate;`, [], myOptions); + + stmts.push(query.merge(conn.makeSuffix(filter))); + + stmts.push(new ParameterizedSQL(`DROP TEMPORARY TABLE tmp.item, tmp.buyUltimate`)); + + const sql = ParameterizedSQL.join(stmts, ';'); + const result = await conn.executeStmt(sql, myOptions); if (tx) await tx.commit(); - return result; + return result[1]; } catch (e) { await tx.rollback(); throw e; From 5d908fd5f9e3ff6d553ab90ce24a1698f6e12979 Mon Sep 17 00:00:00 2001 From: jorgep Date: Wed, 13 Nov 2024 09:33:28 +0100 Subject: [PATCH 04/10] feat: refs #7641 improve style --- .../reports/entry-order/assets/css/style.css | 5 ++++ .../reports/entry-order/entry-order.html | 25 ++++++++++++------- .../reports/entry-order/locale/es.yml | 3 ++- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/print/templates/reports/entry-order/assets/css/style.css b/print/templates/reports/entry-order/assets/css/style.css index 1a5ea3eb6..858ae704e 100644 --- a/print/templates/reports/entry-order/assets/css/style.css +++ b/print/templates/reports/entry-order/assets/css/style.css @@ -22,4 +22,9 @@ h3 { .column-oriented th, .column-oriented td{ padding: 5px +} + +[row] { + display: flex; + column-gap: 5px; } \ No newline at end of file diff --git a/print/templates/reports/entry-order/entry-order.html b/print/templates/reports/entry-order/entry-order.html index 5ce306827..cbdfa631f 100644 --- a/print/templates/reports/entry-order/entry-order.html +++ b/print/templates/reports/entry-order/entry-order.html @@ -41,12 +41,13 @@
{{$t('reference')}} {{$t('boxes')}} {{$t('packing')}}{{$t('concept')}}{{$t('reference')}}{{$t('tags')}}{{$t('quantity')}}{{$t('price')}}{{$t('amount')}}{{$t('concept')}}{{$t('tags')}}{{$t('quantity')}}{{$t('price')}}{{$t('amount')}}
{{buy.comment}} {{buy.stickers}}x{{buy.packing}}{{buy.name}}{{buy.comment}} - {{buy.tag5}} → {{buy.value5}} - {{buy.tag6}} → {{buy.value6}} - {{buy.tag7}} → {{buy.value7}} + x{{buy.packing}}{{buy.name}} + {{buy.tag5}} → {{buy.value5}} + {{buy.tag6}} → {{buy.value6}} + {{buy.tag7}} → {{buy.value7}} {{buy.quantity | number($i18n.locale)}}x{{buy.buyingValue | currency('EUR', $i18n.locale)}}= + {{buy.quantity | number($i18n.locale)}}x{{buy.buyingValue | currency('EUR', $i18n.locale)}}= {{buy.buyingValue * buy.quantity | currency('EUR', $i18n.locale)}}
{{getTotalBy('stickers')}} {{getTotalBy('stickers')}}
- + - - + + + @@ -56,15 +57,20 @@ - + - - + + @@ -83,6 +89,7 @@ + diff --git a/print/templates/reports/entry-order/locale/es.yml b/print/templates/reports/entry-order/locale/es.yml index 5a6716ba1..9ec357802 100644 --- a/print/templates/reports/entry-order/locale/es.yml +++ b/print/templates/reports/entry-order/locale/es.yml @@ -16,4 +16,5 @@ entry: Entrada {0} supplierData: Datos del proveedor notes: Notas reference: Referencia -tags: Tags \ No newline at end of file +tags: Etiquetas +code: Código \ No newline at end of file From 274a365ec0b7edf5d6a87166dc655b2194f8fc00 Mon Sep 17 00:00:00 2001 From: pablone Date: Wed, 13 Nov 2024 11:03:57 +0100 Subject: [PATCH 05/10] feat: refs #6403 add debug on cancel shipment --- back/methods/mrw-config/cancelShipment.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/back/methods/mrw-config/cancelShipment.js b/back/methods/mrw-config/cancelShipment.js index 56d206529..98aa8be39 100644 --- a/back/methods/mrw-config/cancelShipment.js +++ b/back/methods/mrw-config/cancelShipment.js @@ -39,6 +39,9 @@ module.exports = Self => { const xmlString = response.data; const parser = new DOMParser(); const xmlDoc = parser.parseFromString(xmlString, 'text/xml'); + + await Self.rawSql('CALL util.debugAdd(?,?);', ['cancelShipment', xmlDoc]); + const result = xmlDoc.getElementsByTagName('Mensaje')[0].textContent; return result.toLowerCase().includes('se ha cancelado correctamente'); }; From 21693cfd718e47eb84ffc654161ff304c84fec05 Mon Sep 17 00:00:00 2001 From: ivanm Date: Wed, 13 Nov 2024 14:33:52 +0100 Subject: [PATCH 06/10] feat: refs #7994 new version script fix --- db/versions/11251-navyChrysanthemum/00-firstScript.sql | 5 ++--- db/versions/11344-grayBamboo/00-firstScript.sql | 3 +++ .../01-firstScript.sql | 0 3 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 db/versions/11344-grayBamboo/00-firstScript.sql rename db/versions/{11251-navyChrysanthemum => 11344-grayBamboo}/01-firstScript.sql (100%) diff --git a/db/versions/11251-navyChrysanthemum/00-firstScript.sql b/db/versions/11251-navyChrysanthemum/00-firstScript.sql index 801405e59..7c2c69839 100644 --- a/db/versions/11251-navyChrysanthemum/00-firstScript.sql +++ b/db/versions/11251-navyChrysanthemum/00-firstScript.sql @@ -1,3 +1,2 @@ -UPDATE vn.sale - SET originalQuantity = quantity - WHERE originalQuantity IS NULL +-- Debido a que tardaba mucho en la subida a master, se ha creado una nueva versión para que el proceso no se vea afectado y se ejecute por la noche. +-- Se crea de nuevo en la versión 11344-grayBamboo diff --git a/db/versions/11344-grayBamboo/00-firstScript.sql b/db/versions/11344-grayBamboo/00-firstScript.sql new file mode 100644 index 000000000..1fbd2a0d8 --- /dev/null +++ b/db/versions/11344-grayBamboo/00-firstScript.sql @@ -0,0 +1,3 @@ +UPDATE vn.sale + SET originalQuantity = quantity + WHERE originalQuantity IS NULL \ No newline at end of file diff --git a/db/versions/11251-navyChrysanthemum/01-firstScript.sql b/db/versions/11344-grayBamboo/01-firstScript.sql similarity index 100% rename from db/versions/11251-navyChrysanthemum/01-firstScript.sql rename to db/versions/11344-grayBamboo/01-firstScript.sql From c4375b2505efee560cd0c710dc130368118a7422 Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 14 Nov 2024 15:29:18 +0100 Subject: [PATCH 07/10] feat: refs #7641 fine tunning --- print/templates/reports/entry-order/entry-order.html | 7 ++++++- print/templates/reports/entry-order/sql/buys.sql | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/print/templates/reports/entry-order/entry-order.html b/print/templates/reports/entry-order/entry-order.html index cbdfa631f..a4e153fa9 100644 --- a/print/templates/reports/entry-order/entry-order.html +++ b/print/templates/reports/entry-order/entry-order.html @@ -67,9 +67,14 @@
Color→ Lavanda
Altura→ 100cm
+
{{buy.tag5}}→ {{buy.value5}}
+
{{buy.tag6}}→ {{buy.value6}}
- label→ valor +
Color→ Lavanda
+
Altura→ 100cm
+
{{buy.tag7}}→ {{buy.value7}}
+
{{buy.tag8}}→ {{buy.value8}}
diff --git a/print/templates/reports/entry-order/sql/buys.sql b/print/templates/reports/entry-order/sql/buys.sql index 92c055483..545849908 100644 --- a/print/templates/reports/entry-order/sql/buys.sql +++ b/print/templates/reports/entry-order/sql/buys.sql @@ -10,7 +10,9 @@ SELECT b.itemFk, i.tag6, i.value6, i.tag7, - i.value7 + i.value7, + i.tag8, + i.value8 FROM buy b JOIN item i ON i.id = b.itemFk LEFT JOIN item i2 ON i2.id = b.itemOriginalFk From ab2e88806e70f748e23800662b3cb40a3bdd8a5c Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 14 Nov 2024 15:29:54 +0100 Subject: [PATCH 08/10] fix: refs #7641 drop boilerplate code --- print/templates/reports/entry-order/entry-order.html | 4 ---- 1 file changed, 4 deletions(-) diff --git a/print/templates/reports/entry-order/entry-order.html b/print/templates/reports/entry-order/entry-order.html index a4e153fa9..90a95481f 100644 --- a/print/templates/reports/entry-order/entry-order.html +++ b/print/templates/reports/entry-order/entry-order.html @@ -65,14 +65,10 @@
{{$t('reference')}}{{$t('code')}} {{$t('boxes')}} {{$t('packing')}}{{$t('concept')}}{{$t('tags')}}{{$t('concept')}}{{$t('reference')}}{{$t('tags')}} {{$t('quantity')}} {{$t('price')}}
{{buy.comment}}{{buy.itemFk}} {{buy.stickers}} x {{buy.packing}}{{buy.name}} - {{buy.tag5}} → {{buy.value5}} - {{buy.tag6}} → {{buy.value6}} - {{buy.tag7}} → {{buy.value7}} + {{buy.name}}referencia de prueba +
+
Color→ Lavanda
+
Altura→ 100cm
+
+
+ label→ valor +
{{buy.quantity | number($i18n.locale)}} x {{getTotalBy('quantity') | number($i18n.locale)}} {{buy.quantity | number($i18n.locale)}}referencia de prueba
-
Color→ Lavanda
-
Altura→ 100cm
{{buy.tag5}}→ {{buy.value5}}
{{buy.tag6}}→ {{buy.value6}}
-
Color→ Lavanda
-
Altura→ 100cm
{{buy.tag7}}→ {{buy.value7}}
{{buy.tag8}}→ {{buy.value8}}
From eff251fbb5d002e446ef0093f87aa8d7be3459d7 Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 14 Nov 2024 15:46:51 +0100 Subject: [PATCH 09/10] feat: refs #7874 add default type --- db/versions/11348-bronzeCamellia/00-firstScript.sql | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 db/versions/11348-bronzeCamellia/00-firstScript.sql diff --git a/db/versions/11348-bronzeCamellia/00-firstScript.sql b/db/versions/11348-bronzeCamellia/00-firstScript.sql new file mode 100644 index 000000000..fa466f1a4 --- /dev/null +++ b/db/versions/11348-bronzeCamellia/00-firstScript.sql @@ -0,0 +1,2 @@ +ALTER TABLE vn.clientObservation MODIFY COLUMN observationTypeFk tinyint(3) unsigned DEFAULT 4 NOT NULL; +UPDATE vn.clientObservation SET observationTypeFk=4 WHERE observationTypeFk=0; From 4766d25ddaddf7a551e4a9b5af88cc775f758e0c Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 14 Nov 2024 15:54:53 +0100 Subject: [PATCH 10/10] feat: refs #7874 use name --- modules/client/back/models/client-observation.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/client/back/models/client-observation.json b/modules/client/back/models/client-observation.json index 86351862d..1d906420a 100644 --- a/modules/client/back/models/client-observation.json +++ b/modules/client/back/models/client-observation.json @@ -55,7 +55,7 @@ "relation": "user", "scope": { "fields": [ - "nickname" + "name" ] } }