From b7fa4dca4c450b47a65c886c2797e50963fa8797 Mon Sep 17 00:00:00 2001 From: guillermo Date: Tue, 29 Nov 2022 14:16:44 +0100 Subject: [PATCH 1/7] refs #4550 changed font-family of collection-label --- .../templates/reports/collection-label/assets/css/style.css | 3 ++- .../reports/collection-label/collection-label.html | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/print/templates/reports/collection-label/assets/css/style.css b/print/templates/reports/collection-label/assets/css/style.css index 597921c92..f62d35c97 100644 --- a/print/templates/reports/collection-label/assets/css/style.css +++ b/print/templates/reports/collection-label/assets/css/style.css @@ -1,5 +1,5 @@ html { - font-family: "Roboto"; + font-family: Arial, Helvetica, sans-serif; margin-top: -6px; } * { @@ -15,6 +15,7 @@ html { .outline { border: 1px solid black; padding: 5px; + height: 37px; } #nickname { font-size: 22px; diff --git a/print/templates/reports/collection-label/collection-label.html b/print/templates/reports/collection-label/collection-label.html index 6716d1fe5..c64c12aed 100644 --- a/print/templates/reports/collection-label/collection-label.html +++ b/print/templates/reports/collection-label/collection-label.html @@ -5,7 +5,7 @@ - {{labelData.collectionFk ? `${labelData.collectionFk} ~ ${labelData.wagon}-${labelData.level}` : '-'.repeat(23)}} + {{labelData.collectionFk ? `${labelData.collectionFk} ~ ${labelData.wagon}-${labelData.level}` : '-'.repeat(19)}} {{labelData.clientFk ? `${labelData.ticketFk} « ${labelData.clientFk}` : labelData.ticketFk}} @@ -23,11 +23,11 @@ {{labelData.code == 'plant' ? labelData.size + 'cm' : labelData.volume + 'm³'}} -
{{labelData.agencyDescription}}
+
{{labelData.agencyDescription.toUpperCase()}}
{{labelData.lineCount ? labelData.lineCount : 0}} - {{labelData.nickName ? labelData.nickName : '---'}} + {{labelData.nickName ? labelData.nickName.toUpperCase() : '---'}} {{labelData.shipped ? labelData.shippedHour : labelData.zoneHour}} From d0acd3e4c0eee2c8a55d50908fd14af3a6bb4cbd Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 30 Nov 2022 08:18:37 +0100 Subject: [PATCH 2/7] refs #4550 collection-label changes --- .../collection-label/assets/css/style.css | 7 ++++--- .../collection-label/collection-label.html | 16 ++++++++-------- .../reports/collection-label/collection-label.js | 9 ++++++++- .../reports/collection-label/sql/labelsData.sql | 16 ++++++++-------- 4 files changed, 28 insertions(+), 20 deletions(-) diff --git a/print/templates/reports/collection-label/assets/css/style.css b/print/templates/reports/collection-label/assets/css/style.css index f62d35c97..f9ead378a 100644 --- a/print/templates/reports/collection-label/assets/css/style.css +++ b/print/templates/reports/collection-label/assets/css/style.css @@ -9,7 +9,8 @@ html { } #vertical { writing-mode: vertical-rl; - height: 240px; + height: 235px; + font-size: 30px; margin-left: -13px; } .outline { @@ -34,6 +35,6 @@ html { #shipped { font-weight: bold; } -#ticketFk, #vertical { - font-size: 34px; +#ticketFk { + font-size: 32px; } \ No newline at end of file diff --git a/print/templates/reports/collection-label/collection-label.html b/print/templates/reports/collection-label/collection-label.html index c64c12aed..de9e5fcc3 100644 --- a/print/templates/reports/collection-label/collection-label.html +++ b/print/templates/reports/collection-label/collection-label.html @@ -5,30 +5,30 @@ - {{labelData.collectionFk ? `${labelData.collectionFk} ~ ${labelData.wagon}-${labelData.level}` : '-'.repeat(19)}} + {{labelData.collectionFk ? `${labelData.collectionFk} ~ ${getVertical(labelData.code, labelData.wagon, labelData.level, labelData.color)}` : '-'.repeat(19)}} {{labelData.clientFk ? `${labelData.ticketFk} « ${labelData.clientFk}` : labelData.ticketFk}} - {{labelData.shipped ? labelData.shipped : '---'}} + {{labelData.shipped || '---'}}
- {{labelData.workerCode ? labelData.workerCode : '---'}} + {{labelData.workerCode || '---'}} - {{labelData.labelCount ? labelData.labelCount : 0}} + {{labelData.labelCount || 0}} - {{labelData.code == 'plant' ? labelData.size + 'cm' : labelData.volume + 'm³'}} + {{labelData.code == 'V' ? (labelData.size || 0) + 'cm' : (labelData.volume || 0) + 'm³'}} -
{{labelData.agencyDescription.toUpperCase()}}
- {{labelData.lineCount ? labelData.lineCount : 0}} +
{{labelData.agencyDescription ? labelData.agencyDescription.toUpperCase() : '---'}}
+ {{labelData.lineCount || 0}} {{labelData.nickName ? labelData.nickName.toUpperCase() : '---'}} - {{labelData.shipped ? labelData.shippedHour : labelData.zoneHour}} + {{labelData.shippedHour || labelData.zoneHour}} diff --git a/print/templates/reports/collection-label/collection-label.js b/print/templates/reports/collection-label/collection-label.js index d2d5f6417..93c13e49b 100644 --- a/print/templates/reports/collection-label/collection-label.js +++ b/print/templates/reports/collection-label/collection-label.js @@ -25,7 +25,6 @@ module.exports = { ticketIds = [this.id]; this.labelsData = await this.rawSqlFromDef('labelsData', [ticketIds]); - if (!this.labelsData.length) throw new UserError('Empty data source'); }, @@ -44,6 +43,14 @@ module.exports = { }); return xmlSerializer.serializeToString(svgNode); }, + getVertical(code, wagon, level, color) { + let value; + if (code == 'V') + value = `${wagon}-${level}`; + else + value = `${color.substring(0, 4)}`; + return value; + }, }, components: { 'report-body': reportBody.build() diff --git a/print/templates/reports/collection-label/sql/labelsData.sql b/print/templates/reports/collection-label/sql/labelsData.sql index b799b289b..d2dafea1d 100644 --- a/print/templates/reports/collection-label/sql/labelsData.sql +++ b/print/templates/reports/collection-label/sql/labelsData.sql @@ -1,13 +1,13 @@ -SELECT tc.collectionFk, +SELECT c.itemPackingTypeFk code, + tc.collectionFk, SUBSTRING('ABCDEFGH', tc.wagon, 1) wagon, tc.`level`, t.id ticketFk, COALESCE(et.description, zo.name, am.name) agencyDescription, - am.name, + cc.code color, t.clientFk, CAST(SUM(sv.volume) AS DECIMAL(5, 2)) volume, MAX(i.`size`) `size`, - ic.code, w.code workerCode, TIME_FORMAT(t.shipped, '%H:%i') shippedHour, TIME_FORMAT(zo.`hour`, '%H:%i') zoneHour, @@ -21,13 +21,13 @@ SELECT tc.collectionFk, LEFT JOIN vn.collectionColors cc ON cc.shelve = tc.`level` AND cc.wagon = tc.wagon AND cc.trainFk = c.trainFk - JOIN vn.sale s ON s.ticketFk = t.id + LEFT JOIN vn.sale s ON s.ticketFk = t.id LEFT JOIN vn.saleVolume sv ON sv.saleFk = s.id - JOIN vn.item i ON i.id = s.itemFk - JOIN vn.itemType it ON it.id = i.typeFk - JOIN vn.itemCategory ic ON ic.id = it.categoryFk + LEFT JOIN vn.item i ON i.id = s.itemFk + LEFT JOIN vn.itemType it ON it.id = i.typeFk + LEFT JOIN vn.itemCategory ic ON ic.id = it.categoryFk LEFT JOIN vn.worker w ON w.id = c.workerFk - JOIN vn.agencyMode am ON am.id = t.agencyModeFk + LEFT JOIN vn.agencyMode am ON am.id = t.agencyModeFk LEFT JOIN vn.ticketTrolley tt ON tt.ticket = t.id LEFT JOIN vn.`zone` zo ON t.zoneFk = zo.id LEFT JOIN vn.routesMonitor rm ON rm.routeFk = t.routeFk From 27078595ce1828356b5f34d50426212d84346722 Mon Sep 17 00:00:00 2001 From: alexandre Date: Wed, 30 Nov 2022 08:39:04 +0100 Subject: [PATCH 3/7] fix balances --- modules/client/back/methods/receipt/filter.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/client/back/methods/receipt/filter.js b/modules/client/back/methods/receipt/filter.js index 9549fb001..c4ebc6fcf 100644 --- a/modules/client/back/methods/receipt/filter.js +++ b/modules/client/back/methods/receipt/filter.js @@ -57,14 +57,16 @@ module.exports = Self => { r.clientFk, FALSE hasPdf, FALSE isInvoice, - CASE WHEN at2.code LIKE 'compensation' THEN True ELSE False END as isCompensation + at2.id IS NOT NULL as isCompensation FROM vn.receipt r LEFT JOIN vn.worker w ON w.id = r.workerFk LEFT JOIN account.user u ON u.id = w.userFk JOIN vn.company c ON c.id = r.companyFk - JOIN vn.accounting a ON a.id = r.bankFk - JOIN vn.accountingType at2 ON at2.id = a.accountingTypeFk - WHERE r.clientFk = ? AND r.companyFk = ? + LEFT JOIN vn.accounting a ON a.id = r.bankFk + LEFT JOIN vn.accountingType at2 ON at2.id = a.accountingTypeFk AND at2.code = 'compensation' + WHERE + r.clientFk = ? + AND r.companyFk = ? UNION ALL SELECT i.id, @@ -81,11 +83,9 @@ module.exports = Self => { i.clientFk, i.hasPdf, TRUE isInvoice, - CASE WHEN at2.code LIKE 'compensation' THEN True ELSE False END as isCompensation + NULL FROM vn.invoiceOut i JOIN vn.company c ON c.id = i.companyFk - JOIN vn.accounting a ON a.id = i.bankFk - JOIN vn.accountingType at2 ON at2.id = a.accountingTypeFk WHERE i.clientFk = ? AND i.companyFk = ? ORDER BY payed DESC, created DESC ) t ORDER BY payed DESC, created DESC`, From 492b852be8597ca297dd205349515b290b937ab6 Mon Sep 17 00:00:00 2001 From: alexandre Date: Wed, 30 Nov 2022 09:22:53 +0100 Subject: [PATCH 4/7] delete orderBy --- modules/client/back/methods/receipt/filter.js | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/client/back/methods/receipt/filter.js b/modules/client/back/methods/receipt/filter.js index c4ebc6fcf..6df5e73f8 100644 --- a/modules/client/back/methods/receipt/filter.js +++ b/modules/client/back/methods/receipt/filter.js @@ -87,7 +87,6 @@ module.exports = Self => { FROM vn.invoiceOut i JOIN vn.company c ON c.id = i.companyFk WHERE i.clientFk = ? AND i.companyFk = ? - ORDER BY payed DESC, created DESC ) t ORDER BY payed DESC, created DESC`, [ clientId, From 497e3e54a2a171068543c3e91caadaf5db832fbc Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 30 Nov 2022 10:52:52 +0100 Subject: [PATCH 5/7] refs #4550 changes --- .../collection-label/collection-label.html | 4 +--- .../reports/collection-label/collection-label.js | 15 ++++++++++----- .../reports/collection-label/sql/labelsData.sql | 16 ++++++++-------- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/print/templates/reports/collection-label/collection-label.html b/print/templates/reports/collection-label/collection-label.html index de9e5fcc3..b7f783a88 100644 --- a/print/templates/reports/collection-label/collection-label.html +++ b/print/templates/reports/collection-label/collection-label.html @@ -4,9 +4,7 @@ - + diff --git a/print/templates/reports/collection-label/collection-label.js b/print/templates/reports/collection-label/collection-label.js index 93c13e49b..fd412791b 100644 --- a/print/templates/reports/collection-label/collection-label.js +++ b/print/templates/reports/collection-label/collection-label.js @@ -43,12 +43,17 @@ module.exports = { }); return xmlSerializer.serializeToString(svgNode); }, - getVertical(code, wagon, level, color) { + getVertical(labelData) { let value; - if (code == 'V') - value = `${wagon}-${level}`; - else - value = `${color.substring(0, 4)}`; + if (labelData.collectionFk) { + value = `${labelData.collectionFk} ~ `; + if (labelData.code == 'V') + value = value + `${labelData.wagon}-${labelData.level}`; + else + value = value + `${labelData.color.substring(0, 4)}`; + } else + value = '-'.repeat(19); + return value; }, }, diff --git a/print/templates/reports/collection-label/sql/labelsData.sql b/print/templates/reports/collection-label/sql/labelsData.sql index d2dafea1d..9afac79d0 100644 --- a/print/templates/reports/collection-label/sql/labelsData.sql +++ b/print/templates/reports/collection-label/sql/labelsData.sql @@ -16,18 +16,18 @@ SELECT c.itemPackingTypeFk code, tt.labelCount, COUNT(*) lineCount FROM vn.ticket t - LEFT JOIN vn.ticketCollection tc ON tc.ticketFk = t.id - LEFT JOIN vn.collection c ON c.id = tc.collectionFk + JOIN vn.ticketCollection tc ON tc.ticketFk = t.id + JOIN vn.collection c ON c.id = tc.collectionFk LEFT JOIN vn.collectionColors cc ON cc.shelve = tc.`level` AND cc.wagon = tc.wagon AND cc.trainFk = c.trainFk - LEFT JOIN vn.sale s ON s.ticketFk = t.id + JOIN vn.sale s ON s.ticketFk = t.id LEFT JOIN vn.saleVolume sv ON sv.saleFk = s.id - LEFT JOIN vn.item i ON i.id = s.itemFk - LEFT JOIN vn.itemType it ON it.id = i.typeFk - LEFT JOIN vn.itemCategory ic ON ic.id = it.categoryFk - LEFT JOIN vn.worker w ON w.id = c.workerFk - LEFT JOIN vn.agencyMode am ON am.id = t.agencyModeFk + JOIN vn.item i ON i.id = s.itemFk + JOIN vn.itemType it ON it.id = i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + JOIN vn.worker w ON w.id = c.workerFk + JOIN vn.agencyMode am ON am.id = t.agencyModeFk LEFT JOIN vn.ticketTrolley tt ON tt.ticket = t.id LEFT JOIN vn.`zone` zo ON t.zoneFk = zo.id LEFT JOIN vn.routesMonitor rm ON rm.routeFk = t.routeFk From 23f429d94a1c960d15ccac4d98eb1db06eea4046 Mon Sep 17 00:00:00 2001 From: guillermo Date: Wed, 30 Nov 2022 12:44:33 +0100 Subject: [PATCH 6/7] refs #4550 fixed no ellipsize in agencyDescription --- .../reports/collection-label/assets/css/style.css | 10 +++++++--- print/templates/reports/collection-label/options.json | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/print/templates/reports/collection-label/assets/css/style.css b/print/templates/reports/collection-label/assets/css/style.css index f9ead378a..f92d5bf1e 100644 --- a/print/templates/reports/collection-label/assets/css/style.css +++ b/print/templates/reports/collection-label/assets/css/style.css @@ -9,14 +9,15 @@ html { } #vertical { writing-mode: vertical-rl; - height: 235px; - font-size: 30px; + height: 230px; + font-size: 29px; margin-left: -13px; } .outline { border: 1px solid black; padding: 5px; height: 37px; + width: 100px; } #nickname { font-size: 22px; @@ -24,16 +25,19 @@ html { } #agencyDescripton { font-size: 32px; + width: 375px; font-weight: bold; } #bold { font-weight: bold; } #barcode{ - width: 390px; + width: 370px; } #shipped { font-weight: bold; + width: 50px; + max-width: 100px; } #ticketFk { font-size: 32px; diff --git a/print/templates/reports/collection-label/options.json b/print/templates/reports/collection-label/options.json index ae88e6c0c..a555c5723 100644 --- a/print/templates/reports/collection-label/options.json +++ b/print/templates/reports/collection-label/options.json @@ -1,6 +1,6 @@ { "width": "10.4cm", - "height": "4.8cm", + "height": "4.9cm", "margin": { "top": "0.3cm", "right": "0.6cm", From b769845a287f25e4c67b8c268e1a20eca429b2b2 Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 30 Nov 2022 14:29:44 +0100 Subject: [PATCH 7/7] hotFix: not transfer all sales if all sales is negatives --- modules/ticket/back/methods/ticket/componentUpdate.js | 4 +++- modules/ticket/front/basic-data/step-two/index.js | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/ticket/back/methods/ticket/componentUpdate.js b/modules/ticket/back/methods/ticket/componentUpdate.js index baa6a0b41..e33428bf0 100644 --- a/modules/ticket/back/methods/ticket/componentUpdate.js +++ b/modules/ticket/back/methods/ticket/componentUpdate.js @@ -137,9 +137,11 @@ 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 salesNewTicket = salesMovable.filter(sale => (sale.movable ? sale.movable : 0) >= sale.quantity); - if (salesNewTicket.length) { + const salesNewTicketLength = salesNewTicket.length; + if (salesNewTicketLength && sales.length != salesNewTicketLength) { const newTicket = await models.Ticket.transferSales(ctx, args.id, null, salesNewTicket, myOptions); args.id = newTicket.id; } diff --git a/modules/ticket/front/basic-data/step-two/index.js b/modules/ticket/front/basic-data/step-two/index.js index 32d6b2cd6..4ac9f292e 100644 --- a/modules/ticket/front/basic-data/step-two/index.js +++ b/modules/ticket/front/basic-data/step-two/index.js @@ -67,6 +67,7 @@ class Controller extends Component { ticketHaveNegatives() { let haveNegatives = false; let haveNotNegatives = false; + this.ticket.withoutNegatives = false; const haveDifferences = this.ticket.sale.haveDifferences; this.ticket.sale.items.forEach(item => { @@ -76,8 +77,9 @@ class Controller extends Component { haveNotNegatives = true; }); - this.ticket.withoutNegatives = true; this.haveNegatives = (haveNegatives && haveNotNegatives && haveDifferences); + if (this.haveNegatives) + this.ticket.withoutNegatives = true; } onSubmit() {
- {{labelData.collectionFk ? `${labelData.collectionFk} ~ ${getVertical(labelData.code, labelData.wagon, labelData.level, labelData.color)}` : '-'.repeat(19)}} - {{getVertical(labelData)}} {{labelData.clientFk ? `${labelData.ticketFk} « ${labelData.clientFk}` : labelData.ticketFk}}