From 2bb6c1c1da55b90f5c16244e290101b6d6703378 Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 1 Dec 2022 07:54:32 +0100 Subject: [PATCH 1/8] fix: borra registros aunq no tengan file adjunto --- back/methods/dms/deleteTrashFiles.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/back/methods/dms/deleteTrashFiles.js b/back/methods/dms/deleteTrashFiles.js index 63d7021c5..f14e65e9f 100644 --- a/back/methods/dms/deleteTrashFiles.js +++ b/back/methods/dms/deleteTrashFiles.js @@ -51,7 +51,7 @@ module.exports = Self => { const dstFile = path.join(dmsContainer.client.root, pathHash, dms.file); await fs.unlink(dstFile); } catch (err) { - if (err.code != 'ENOENT') + if (err.code != 'ENOENT' && dms.file) throw err; } From e815292d6b4a0f85d62c42edced6026ef20b1ae5 Mon Sep 17 00:00:00 2001 From: joan Date: Thu, 1 Dec 2022 09:24:56 +0100 Subject: [PATCH 2/8] fix(componentUpdate): updated filter where sintax --- modules/ticket/back/methods/ticket/componentUpdate.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ticket/back/methods/ticket/componentUpdate.js b/modules/ticket/back/methods/ticket/componentUpdate.js index e33428bf0..f4a4bb98d 100644 --- a/modules/ticket/back/methods/ticket/componentUpdate.js +++ b/modules/ticket/back/methods/ticket/componentUpdate.js @@ -137,7 +137,7 @@ module.exports = Self => { const params = [args.id, args.shipped, args.warehouseFk]; const [salesMovable] = await Self.rawSql(query, params, myOptions); - const sales = await models.Sale.find({ticketFk: args.id}, myOptions); + const sales = await models.Sale.find({where: {ticketFk: args.id}}, myOptions); const salesNewTicket = salesMovable.filter(sale => (sale.movable ? sale.movable : 0) >= sale.quantity); const salesNewTicketLength = salesNewTicket.length; From e7173fe15604ae68afdd9328065b857947715e9d Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 1 Dec 2022 11:59:30 +0100 Subject: [PATCH 3/8] fix: backTest --- back/methods/chat/spec/notifyIssue.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/back/methods/chat/spec/notifyIssue.spec.js b/back/methods/chat/spec/notifyIssue.spec.js index e20d43142..1aab51793 100644 --- a/back/methods/chat/spec/notifyIssue.spec.js +++ b/back/methods/chat/spec/notifyIssue.spec.js @@ -27,7 +27,7 @@ describe('Chat notifyIssue()', () => { subject: 'Issue title'} ]); // eslint-disable-next-line max-len - const expectedMessage = `@all ➔ There's a new urgent ticket:\r\n[ID: *00001* - Issue title (@batman)](https://cau.verdnatura.es/scp/tickets.php?id=1)`; + const expectedMessage = `@all ➔ There's a new urgent ticket:\r\n[ID: 00001 - Issue title @batman](https://cau.verdnatura.es/scp/tickets.php?id=1)`; const department = await app.models.Department.findById(departmentId); let orgChatName = department.chatName; From 12cfa0569682c4e45b944d8b0c9a2e6a5944235b Mon Sep 17 00:00:00 2001 From: joan Date: Fri, 2 Dec 2022 08:33:56 +0100 Subject: [PATCH 4/8] fix(invoicePdf): invoice correction --- .../templates/reports/invoice/sql/rectified.sql | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/print/templates/reports/invoice/sql/rectified.sql b/print/templates/reports/invoice/sql/rectified.sql index ea814a05a..49db8f68b 100644 --- a/print/templates/reports/invoice/sql/rectified.sql +++ b/print/templates/reports/invoice/sql/rectified.sql @@ -1,10 +1,10 @@ -SELECT - io.amount, - io.ref, - io.issued, +SELECT + io.amount, + io.ref, + io.issued, ict.description -FROM vn.invoiceCorrection ic - JOIN vn.invoiceOut io ON io.id = ic.correctedFk - JOIN vn.invoiceCorrectionType ict ON ict.id = ic.invoiceCorrectionTypeFk +FROM invoiceOut io + JOIN invoiceCorrection ic ON ic.correctingFk = io.id + JOIN invoiceCorrectionType ict ON ict.id = ic.invoiceCorrectionTypeFk LEFT JOIN ticket t ON t.refFk = io.ref -WHERE t.refFk = ? \ No newline at end of file +WHERE io.ref = ? \ No newline at end of file From 6562b683412972d7070eaf6cad33079e24b003bd Mon Sep 17 00:00:00 2001 From: joan Date: Fri, 2 Dec 2022 11:16:49 +0100 Subject: [PATCH 5/8] fix(agencyTerm): permitir decimales en m3 minimos --- modules/supplier/front/agency-term/create/index.html | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/supplier/front/agency-term/create/index.html b/modules/supplier/front/agency-term/create/index.html index e43f6396a..3c987cc13 100644 --- a/modules/supplier/front/agency-term/create/index.html +++ b/modules/supplier/front/agency-term/create/index.html @@ -46,6 +46,7 @@ type="number" label="M3 Price" ng-model="$ctrl.supplierAgencyTerm.m3Price" + step="0.1" rule> From 0c4ab815fd817c76e33b85a8d5c6f664b446a83c Mon Sep 17 00:00:00 2001 From: joan Date: Fri, 2 Dec 2022 11:24:08 +0100 Subject: [PATCH 6/8] decimal --- modules/supplier/front/agency-term/create/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/supplier/front/agency-term/create/index.html b/modules/supplier/front/agency-term/create/index.html index 3c987cc13..fff94695d 100644 --- a/modules/supplier/front/agency-term/create/index.html +++ b/modules/supplier/front/agency-term/create/index.html @@ -46,7 +46,7 @@ type="number" label="M3 Price" ng-model="$ctrl.supplierAgencyTerm.m3Price" - step="0.1" + step="0.01" rule> From 6128414685fcf5d62938e45608377a3afdb52a9f Mon Sep 17 00:00:00 2001 From: joan Date: Fri, 2 Dec 2022 11:26:21 +0100 Subject: [PATCH 7/8] m3 decimal --- modules/supplier/front/agency-term/create/index.html | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/supplier/front/agency-term/create/index.html b/modules/supplier/front/agency-term/create/index.html index fff94695d..29d7b9b6a 100644 --- a/modules/supplier/front/agency-term/create/index.html +++ b/modules/supplier/front/agency-term/create/index.html @@ -26,6 +26,7 @@ type="number" label="Minimum M3" ng-model="$ctrl.supplierAgencyTerm.minimumM3" + step="0.01" rule> From 14a3a815da11e780009fce9e635aece4a0413221 Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 2 Dec 2022 12:05:25 +0100 Subject: [PATCH 8/8] =?UTF-8?q?fix(invoiceOut):=20pdf=20adjunto=20correcto?= =?UTF-8?q?.=20Corregido=20valor=20NaN=20en=20intrastat.=20S=C3=B3lo=20mue?= =?UTF-8?q?stra=20intrstar=20en=20fact=20CEE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../back/methods/invoiceOut/invoiceClient.js | 2 +- print/templates/reports/invoice/invoice.js | 2 +- .../reports/invoice/sql/intrastat.sql | 71 ++++++++++--------- 3 files changed, 41 insertions(+), 34 deletions(-) diff --git a/modules/invoiceOut/back/methods/invoiceOut/invoiceClient.js b/modules/invoiceOut/back/methods/invoiceOut/invoiceClient.js index b04747d16..95c51a96d 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/invoiceClient.js +++ b/modules/invoiceOut/back/methods/invoiceOut/invoiceClient.js @@ -138,7 +138,7 @@ module.exports = Self => { recipient: invoiceOut.client().email }; try { - await models.InvoiceOut.invoiceEmail(ctx); + await models.InvoiceOut.invoiceEmail(ctx, invoiceOut.ref); } catch (err) {} return invoiceId; diff --git a/print/templates/reports/invoice/invoice.js b/print/templates/reports/invoice/invoice.js index eebbde8ef..48848c079 100755 --- a/print/templates/reports/invoice/invoice.js +++ b/print/templates/reports/invoice/invoice.js @@ -82,7 +82,7 @@ module.exports = { return this.rawSqlFromDef(`taxes`, [reference]); }, fetchIntrastat(reference) { - return this.rawSqlFromDef(`intrastat`, [reference, reference, reference, reference]); + return this.rawSqlFromDef(`intrastat`, [reference, reference, reference, reference, reference]); }, fetchRectified(reference) { return this.rawSqlFromDef(`rectified`, [reference]); diff --git a/print/templates/reports/invoice/sql/intrastat.sql b/print/templates/reports/invoice/sql/intrastat.sql index 5cc3ebd7f..7f5fbdf39 100644 --- a/print/templates/reports/invoice/sql/intrastat.sql +++ b/print/templates/reports/invoice/sql/intrastat.sql @@ -1,32 +1,39 @@ -(SELECT - ir.id code, - ir.description description, - CAST(SUM(IFNULL(i.stems, 1) * s.quantity) AS DECIMAL(10,2)) stems, - CAST(SUM(CAST(IFNULL(i.stems, 1) * s.quantity * IF(ic.grams, ic.grams, i.density * ic.cm3delivery / 1000) / 1000 AS DECIMAL(10,2)) * - IF(sub.weight, sub.weight / vn.invoiceOut_getWeight(?), 1)) AS DECIMAL(10,2)) netKg, - CAST(SUM((s.quantity * s.price * (100 - s.discount) / 100 )) AS DECIMAL(10,2)) subtotal - FROM vn.ticket t - JOIN vn.sale s ON s.ticketFk = t.id - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.itemCost ic ON ic.itemFk = i.id AND ic.warehouseFk = t.warehouseFk - JOIN vn.intrastat ir ON ir.id = i.intrastatFk - LEFT JOIN ( - SELECT t2.weight - FROM vn.ticket t2 - WHERE refFk = ? AND weight - LIMIT 1 - ) sub ON TRUE - WHERE t.refFk = ? - AND i.intrastatFk - GROUP BY i.intrastatFk - ORDER BY i.intrastatFk) -UNION ALL -(SELECT - NULL AS code, - NULL AS description, - 0 AS stems, - 0 AS netKg, - CAST(SUM((ts.quantity * ts.price)) AS DECIMAL(10,2)) AS subtotal - FROM vn.ticketService ts - JOIN vn.ticket t ON ts.ticketFk = t.id - WHERE t.refFk = ?); \ No newline at end of file +SELECT * + FROM invoiceOut io + JOIN invoiceOutSerial ios ON io.serial = ios.code + JOIN + (SELECT + t.refFk, + ir.id code, + ir.description description, + CAST(SUM(IFNULL(i.stems, 1) * s.quantity) AS DECIMAL(10,2)) stems, + CAST(SUM(CAST(IFNULL(i.stems, 1) * s.quantity * IF(ic.grams, ic.grams, i.density * ic.cm3delivery / 1000) / 1000 AS DECIMAL(10,2)) * + IF(sub.weight, sub.weight / vn.invoiceOut_getWeight(?), 1)) AS DECIMAL(10,2)) netKg, + CAST(SUM((s.quantity * s.price * (100 - s.discount) / 100 )) AS DECIMAL(10,2)) subtotal + FROM vn.ticket t + JOIN vn.sale s ON s.ticketFk = t.id + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.itemCost ic ON ic.itemFk = i.id AND ic.warehouseFk = t.warehouseFk + JOIN vn.intrastat ir ON ir.id = i.intrastatFk + LEFT JOIN ( + SELECT t2.weight + FROM vn.ticket t2 + WHERE refFk = ? AND weight + LIMIT 1 + ) sub ON TRUE + WHERE t.refFk = ? + AND i.intrastatFk + GROUP BY i.intrastatFk + UNION ALL + SELECT + NULL AS refFk, + NULL AS code, + NULL AS description, + 0 AS stems, + 0 AS netKg, + IF(CAST(SUM((ts.quantity * ts.price)) AS DECIMAL(10,2)), CAST(SUM((ts.quantity * ts.price)) AS DECIMAL(10,2)), 0) AS subtotal + FROM vn.ticketService ts + JOIN vn.ticket t ON ts.ticketFk = t.id + WHERE t.refFk = ?) sub + WHERE io.`ref` = ? AND ios.isCEE + ORDER BY sub.code;