From 7365a1e001671f952c8e830b8c025c2d4d91f0de Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Mon, 11 Feb 2019 10:06:26 +0100 Subject: [PATCH] updated delivery-note, fixed fallback locale --- Dockerfile | 2 +- gulpfile.js | 1 + .../item/front/ticket-descriptor/index.html | 9 +- modules/item/front/ticket-descriptor/index.js | 8 +- .../front/ticket-descriptor/index.spec.js | 12 +- .../front/ticket-descriptor/locale/es.yml | 3 +- print/common/css/layout.css | 181 ++++++---------- print/common/css/misc.css | 4 + print/lib/filters/index.js | 0 print/lib/reportEngine.js | 5 +- .../report/report-footer/assets/css/style.css | 6 +- print/report/report-footer/index.html | 2 +- print/report/report-footer/locale.js | 3 +- .../report/report-header/assets/css/style.css | 6 +- print/report/report-header/index.html | 2 +- .../report/rpt-claim-pickup-order/index.html | 13 +- print/report/rpt-claim-pickup-order/locale.js | 1 + .../rpt-delivery-note/assets/css/style.css | 23 ++- print/report/rpt-delivery-note/index.html | 187 ++++++++++++----- print/report/rpt-delivery-note/index.js | 193 +++++++++++++----- print/report/rpt-delivery-note/locale.js | 20 +- print/report/rpt-informe/index.html | 4 +- print/report/rpt-letter-debtor/index.html | 6 +- print/report/rpt-sepa-core/index.html | 6 +- print/report/sample-report/index.html | 4 +- 25 files changed, 441 insertions(+), 260 deletions(-) create mode 100644 print/lib/filters/index.js diff --git a/Dockerfile b/Dockerfile index 12708bcc2..9f203033a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ RUN apt-get update \ ca-certificates \ gnupg2 \ libfontconfig \ - && curl -sL https://deb.nodesource.com/setup_8.x | bash - \ + && curl -sL https://deb.nodesource.com/setup_10.x | bash - \ && apt-get install -y --no-install-recommends \ nodejs \ && apt-get purge -y --auto-remove \ diff --git a/gulpfile.js b/gulpfile.js index eb071a931..b57ec7c81 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -51,6 +51,7 @@ function backWatch(done) { nodemon({ exec: commands.join(' && '), + ext: 'js html css', args: ['backOnly'], watch: backSources, done: done diff --git a/modules/item/front/ticket-descriptor/index.html b/modules/item/front/ticket-descriptor/index.html index 3e23a2175..956d15a91 100644 --- a/modules/item/front/ticket-descriptor/index.html +++ b/modules/item/front/ticket-descriptor/index.html @@ -154,4 +154,11 @@ message="Continue anyway?"> - \ No newline at end of file + + + asd + \ No newline at end of file diff --git a/modules/item/front/ticket-descriptor/index.js b/modules/item/front/ticket-descriptor/index.js index 53f13eb1a..a236b0d5a 100644 --- a/modules/item/front/ticket-descriptor/index.js +++ b/modules/item/front/ticket-descriptor/index.js @@ -9,9 +9,10 @@ class Controller { this.$translate = $translate; this.moreOptions = [ {callback: this.showAddTurnDialog, name: 'Add turn', show: true}, - {callback: this.showDeleteTicketDialog, name: 'Delete ticket', show: true}, {callback: this.showAddStowaway, name: 'Add stowaway', show: () => this.isTicketModule()}, {callback: this.showRemoveStowaway, name: 'Remove stowaway', show: () => this.shouldShowRemoveStowaway()}, + {callback: this.showDeliveryNote, name: 'Show Delivery Note', show: true}, + {callback: this.showDeleteTicketDialog, name: 'Delete ticket', show: true}, /* callback: this.showChangeShipped, name: 'Change shipped hour', show: true} */ ]; } @@ -157,6 +158,11 @@ class Controller { get quicklinks() { return this._quicklinks; } + + showDeliveryNote() { + let url = `/api/report/rpt-delivery-note?ticketFk=${this.ticket.id}`; + window.open(url); + } } Controller.$inject = ['$state', '$scope', '$http', 'vnApp', '$translate']; diff --git a/modules/item/front/ticket-descriptor/index.spec.js b/modules/item/front/ticket-descriptor/index.spec.js index 58cc4b0a2..0ff45b246 100644 --- a/modules/item/front/ticket-descriptor/index.spec.js +++ b/modules/item/front/ticket-descriptor/index.spec.js @@ -1,6 +1,6 @@ import './index.js'; -xdescribe('Item Component vnTicketDescriptor', () => { +describe('Item Component vnTicketDescriptor', () => { let $httpBackend; let controller; @@ -69,5 +69,15 @@ xdescribe('Item Component vnTicketDescriptor', () => { expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Ticket deleted'); }); }); + + fdescribe('showDeliveryNote()', () => { + it('should open a new window showing a delivery note PDF document', () => { + let expectedPath = '/api/report/rpt-delivery-note?ticketFk=2'; + spyOn(window, 'open'); + controller.showDeliveryNote(); + + expect(window.open).toHaveBeenCalledWith(expectedPath); + }); + }); }); diff --git a/modules/item/front/ticket-descriptor/locale/es.yml b/modules/item/front/ticket-descriptor/locale/es.yml index 7a76abe55..ecc1821fd 100644 --- a/modules/item/front/ticket-descriptor/locale/es.yml +++ b/modules/item/front/ticket-descriptor/locale/es.yml @@ -6,4 +6,5 @@ Stowaways to add: Polizones a añadir Stowaways of the ticket: Polizones del ticket Add stowaway: Añadir polizón Remove stowaway: Borrar polizón -Are you sure you want to delete this stowaway?: ¿Estas seguro de que quieres borrar este polizón? \ No newline at end of file +Are you sure you want to delete this stowaway?: ¿Estas seguro de que quieres borrar este polizón? +Show Delivery Note: Ver albarán \ No newline at end of file diff --git a/print/common/css/layout.css b/print/common/css/layout.css index ee5a189d6..9b605e41b 100644 --- a/print/common/css/layout.css +++ b/print/common/css/layout.css @@ -38,93 +38,26 @@ clear: both } -.row { - margin-bottom: 15px; - overflow: hidden; - display: block; - clear: both; - width: 100% -} - -.row.small { - margin-bottom: 5px -} - -.row .text { - margin-bottom: 5px -} - -.row .control { - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box -} - -.row:last-child { - margin-bottom: 0 -} - -.row.inline .text { - display: table-cell; - margin-bottom: 0; - width: 30% -} - -.row.inline .control { - display: table-cell; - padding-left: 20px; - font-weight: bold; - color: #000; - width: 70% -} - -.row.inline .description { - position: static; - overflow: visible -} - -.row .description { - position: relative; - padding-top: 2px; - font-size: 9px; - overflow: hidden; - display: block; - clear: both -} - -.row .line { - border-bottom: 1px solid #DDD; - border-right: 1px solid #DDD; - border-left: 1px solid #DDD; - margin-top: 10px; - color: #999; - padding: 5px -} - -.row .description span { - background-color: #FFF; - margin: -5px 0 0 50px; - display: block; - padding: 5px; - float: left -} - .panel { - position: relative + position: relative; + margin-bottom: 20px; + padding-top: 10px; + break-inside: avoid; + break-before: always; + break-after: always; } .panel .header { background-color: #FFF; - padding: 2.5px 5px; + padding: 2.5px 10px; position: absolute; font-weight: bold; + top: 0px; left: 17.5px; - top: -12px } .panel .body { border: 1px solid #CCC; - margin-top: 10px; overflow: hidden; padding: 20px } @@ -133,7 +66,17 @@ margin-top: 0 } -.field { +.panel.dark .header { + border: 1px solid #808080; + background-color: #FFF; +} + +.panel.dark .body { + border: 1px solid #808080; + background-color: #c0c0c0 +} + +.field { border-bottom: 1px solid #CCC; border-left: 1px solid #CCC; border-top: 1px solid #CCC; @@ -157,20 +100,20 @@ } .pull-left { - float: left + float: left !important } .pull-right { - float: right + float: right !important } .vertical-text { - -moz-transform: rotate(90deg); - -webkit-transform: rotate(90deg); - transform: rotate(90deg); + -moz-transform: rotate(90deg); + -webkit-transform: rotate(90deg); + transform: rotate(90deg); position: absolute; - text-align: center; - font-size: .65em; + text-align: center; + font-size: .65em; right: -108px; width: 200px; top: 50% @@ -186,58 +129,38 @@ table { width: 100% } -.row-oriented .description, -.column-oriented .description { - font-size: 0.6em; - color: #888; - padding: 0 !important -} - -.row-oriented .description .line, -.column-oriented .description .line { - border-bottom: 1px solid #DDD; - border-right: 1px solid #DDD; - border-left: 1px solid #DDD; - margin-top: 10px; - color: #999; - padding: 5px -} - -.row-oriented .description span, -.column-oriented .description span { - background-color: #FFF; - margin: -5px 0 0 50px; - display: block; - padding: 5px; - float: left -} - .column-oriented { margin: 20px 0 } -.column-oriented tfoot { - border-top: 1px solid #808080; -} - -.column-oriented td, .column-oriented th { +.column-oriented td, +.column-oriented th { padding: 5px 10px } .column-oriented thead { - background-color: #c0c0c0 + background-color: #e5e5e5 } .column-oriented thead tr { border-bottom: 1px solid #808080; border-top: 1px solid #808080; - background-color: #c0c0c0 + background-color: #e5e5e5 +} + +.column-oriented tfoot { + border-top: 2px solid #808080; } .column-oriented tfoot tr:first-child td { padding-top: 20px !important; } +.column-oriented .description { + border-bottom: 1px solid #DDD; + font-size: 0.8em +} + .panel .row-oriented td, .panel .row-oriented th { padding: 10px 0 } @@ -249,4 +172,28 @@ table { .row-oriented > tbody > tr > th { padding-left: 30px; width: 70% -} \ No newline at end of file +} + +.row-oriented .description { + padding: 0 !important; + font-size: 0.6em; + color: #888 +} + + +.line { + border-bottom: 1px solid #DDD; + border-right: 1px solid #DDD; + border-left: 1px solid #DDD; + margin-top: 10px; + color: #999; + padding: 5px +} + +.line span { + background-color: #FFF; + margin: -5px 0 0 50px; + display: block; + padding: 5px; + float: left +} diff --git a/print/common/css/misc.css b/print/common/css/misc.css index 4a1cee352..a31279ee2 100644 --- a/print/common/css/misc.css +++ b/print/common/css/misc.css @@ -24,4 +24,8 @@ .font.small { font-size: 0.65em +} + +.font.bold { + font-weight: bold } \ No newline at end of file diff --git a/print/lib/filters/index.js b/print/lib/filters/index.js new file mode 100644 index 000000000..e69de29bb diff --git a/print/lib/reportEngine.js b/print/lib/reportEngine.js index b6e5de906..e4cfce6df 100644 --- a/print/lib/reportEngine.js +++ b/print/lib/reportEngine.js @@ -26,7 +26,7 @@ module.exports = { const result = await this.preFetch(component, ctx); const i18n = new VueI18n({ locale: 'es', - fallbackLocale: 'en' + fallbackLocale: 'es' }); const app = new Vue({i18n, render: h => h(result.component)}); @@ -106,9 +106,6 @@ module.exports = { const options = { format: 'A4', border: '1.5cm', - header: { - height: '80px', - }, footer: { height: '60px', } diff --git a/print/report/report-footer/assets/css/style.css b/print/report/report-footer/assets/css/style.css index 3422b3cc2..e7ee162a8 100644 --- a/print/report/report-footer/assets/css/style.css +++ b/print/report/report-footer/assets/css/style.css @@ -1,5 +1,5 @@ footer { - font-family: verdana, sans-serif; + font-family: "Roboto", "Helvetica", "Arial", sans-serif; font-size: 0.55em; color: #555; zoom: 0.65 @@ -9,6 +9,10 @@ footer, footer p { text-align: center } +p.privacy { + font-size: 0.8em +} + footer .page { border-bottom: 2px solid #CCC; padding-bottom: 2px diff --git a/print/report/report-footer/index.html b/print/report/report-footer/index.html index 5d3caa86d..11b314af0 100644 --- a/print/report/report-footer/index.html +++ b/print/report/report-footer/index.html @@ -5,5 +5,5 @@
{{$t('numPages')}}

{{$t('law.phytosanitary')}}

-

+

diff --git a/print/report/report-footer/locale.js b/print/report/report-footer/locale.js index 51eddc31b..41430ab2b 100644 --- a/print/report/report-footer/locale.js +++ b/print/report/report-footer/locale.js @@ -7,8 +7,7 @@ module.exports = { privacy: `En cumplimiento de lo dispuesto en la Ley Orgánica 15/1999, de Protección de Datos de Carácter Personal, le comunicamos que los datos personales que facilite se incluirán en ficheros automatizados de VERDNATURA LEVANTE S.L., pudiendo en todo momento ejercitar los derechos de acceso, rectificación, cancelación y oposición, comunicándolo - por escrito al domicilio social de la entidad.
- La finalidad del fichero es la gestión administrativa, contabilidad, y facturación.`, + por escrito al domicilio social de la entidad. La finalidad del fichero es la gestión administrativa, contabilidad, y facturación.`, } }, }, diff --git a/print/report/report-header/assets/css/style.css b/print/report/report-header/assets/css/style.css index 1f3c13501..cb8cd55c0 100644 --- a/print/report/report-header/assets/css/style.css +++ b/print/report/report-header/assets/css/style.css @@ -2,10 +2,10 @@ header { font-family: "Roboto", "Helvetica", "Arial", sans-serif; border-bottom: 1px solid #DDD; padding-bottom: 10px; + margin-bottom: 20px; text-align: center; - font-size: 0.60em; - color: #555; - zoom: 0.65 + font-size: 0.55em; + color: #555 } header img { diff --git a/print/report/report-header/index.html b/print/report/report-header/index.html index d81afd084..879675492 100644 --- a/print/report/report-header/index.html +++ b/print/report/report-header/index.html @@ -1,5 +1,5 @@
Verdnatura -
{{$t('company.registry')}}
{{$t('company.fiscalAddress')}}
+
{{$t('company.registry')}}
diff --git a/print/report/rpt-claim-pickup-order/index.html b/print/report/rpt-claim-pickup-order/index.html index 9a0a529eb..9a8f48098 100644 --- a/print/report/rpt-claim-pickup-order/index.html +++ b/print/report/rpt-claim-pickup-order/index.html @@ -3,9 +3,7 @@
- - +
@@ -53,22 +51,23 @@ {{$t('reference')}} - {{$t('quantity')}} - {{$t('claims')}} + {{$t('quantity')}} + {{$t('claims')}} {{$t('concept')}} {{sale.id}} - {{sale.quantity}} - {{sale.claimQuantity}} + {{sale.quantity}} + {{sale.claimQuantity}} {{sale.concept}}
+
{{$t('clientSignature')}}

{{clientName}}

diff --git a/print/report/rpt-claim-pickup-order/locale.js b/print/report/rpt-claim-pickup-order/locale.js index 6aefd199e..b1533efc9 100644 --- a/print/report/rpt-claim-pickup-order/locale.js +++ b/print/report/rpt-claim-pickup-order/locale.js @@ -10,6 +10,7 @@ module.exports = { claims: 'Reclama', reference: 'Referencia', concept: 'Concepto', + clientSignature: 'Firma del cliente', claim: 'Reclamación {0}', sections: { agency: { diff --git a/print/report/rpt-delivery-note/assets/css/style.css b/print/report/rpt-delivery-note/assets/css/style.css index e621f3e23..bd40f5796 100644 --- a/print/report/rpt-delivery-note/assets/css/style.css +++ b/print/report/rpt-delivery-note/assets/css/style.css @@ -1,3 +1,22 @@ -table.column-oriented { - margin-top: 50px !important +#signature { + margin-top: 80px +} + +#signature img { + margin-bottom: 20px; + width: 150px +} + +#packagings { + box-sizing: border-box; + padding-right: 10px +} + +#taxes { + box-sizing: border-box; + padding-left: 10px +} + +.description.phytosanitary { + background-color: #e5e5e5 } \ No newline at end of file diff --git a/print/report/rpt-delivery-note/index.html b/print/report/rpt-delivery-note/index.html index 4d2b986e8..24919353a 100644 --- a/print/report/rpt-delivery-note/index.html +++ b/print/report/rpt-delivery-note/index.html @@ -1,13 +1,11 @@ -
+
- - + -
+
@@ -16,15 +14,15 @@ {{$t('clientId')}} - {{clientId}} + {{client.id}} {{$t('ticketId')}} - {{ticketId}} + {{ticket.id}} {{$t('date')}} - {{dated()}} + {{shipped}} @@ -32,70 +30,165 @@
-
{{$t('clientData')}}
+
{{$t('deliveryAddress')}}
-

{{clientName}}

+

{{address.nickname}}

- {{street}} + {{address.street}}
- {{postcode}}, {{city}} ({{province}}) + {{address.postalCode}}, {{address.city}} ({{address.province}}) +
+
+
+ +
+
{{$t('fiscalData')}}
+
+
+ {{client.socialName}}
- {{country}} + {{client.street}} +
+
+ {{client.fi}}
- - - - - - - - - - - + + + + + + + - - - - - - + + + + - + + + +
{{$t('reference')}}{{$t('quantity')}}{{$t('concept')}}{{$t('size')}}{{$t('cat')}}{{$t('col')}}{{$t('VAT')}}{{$t('price')}}{{$t('%')}}{{$t('amount')}}{{$t('reference')}}{{$t('quantity')}}{{$t('concept')}}{{$t('price')}}{{$t('discount')}}{{$t('vat')}}{{$t('amount')}}
{{sale.ref{{sale}}{{sale}}{{sale}}{{a}}
+ {{$t('subtotal')}} + {{getSubTotal() | currency('EUR')}}
- -
-
Firma digital
- -
{{dmsCreated}}
-
- +
+
+

{{$t('packaging')}}

+ + + + + + + + + + + + + + + + + + + + + +
Id{{$t('concept')}}{{$t('quantity')}}
{{packaging.itemFk}}{{packaging.name}}{{packaging.quantity}}
{{$t('total')}}0
+
+
+

{{$t('taxBreakdown')}}

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{{$t('type')}}{{$t('taxBase')}}{{$t('tax')}}{{$t('fee')}}
{{tax.name}}{{tax.Base | currency('EUR')}}{{tax.vatPercent | percent}}{{tax.tax | currency('EUR')}}
{{$t('subtotal')}}{{getTotalBase() | currency('EUR')}}{{getTotalTax()| currency('EUR')}}
{{$t('total')}}{{getTotal() | currency('EUR')}}
+
+
+
+
Firma digital
+
+ +
{{signature.created | date}}
+
+
+ :left-text="$t('ticket', [ticket.id])" + :center-text="client.socialName" + :locale="client.locale">
diff --git a/print/report/rpt-delivery-note/index.js b/print/report/rpt-delivery-note/index.js index 2ed01a8c3..14d6bfdc8 100755 --- a/print/report/rpt-delivery-note/index.js +++ b/print/report/rpt-delivery-note/index.js @@ -5,65 +5,94 @@ const UserException = require(`${appPath}/lib/exceptions/userException`); module.exports = { name: 'rpt-delivery-note', async asyncData(ctx, params) { - const promises = []; - const data = {}; + Object.assign(this, this.methods); - if (!params.ticketFk) - throw new UserException('No ticket id specified'); + const [[client]] = await this.fetchClient(params.ticketFk); + const [[ticket]] = await this.fetchTicket(params.ticketFk); + const [[address]] = await this.fetchAddress(params.ticketFk); + const [[signature]] = await this.fetchSignature(params.ticketFk); + const [[taxes]] = await this.fetchTaxes(params.ticketFk); + const [sales] = await this.fetchSales(params.ticketFk); + const [packagings] = await this.fetchPackagings(params.ticketFk); - promises.push(this.methods.fetchClient(params.ticketFk)); - promises.push(this.methods.fetchSales(params.ticketFk)); + if (!ticket) + throw new UserException('No ticket data found'); - return Promise.all(promises).then(result => { - const [[client]] = result[0]; - const [sales] = result[1]; - - if (!client) - throw new UserException('No client data found'); - - Object.assign(data, client, {sales}); - - return data; - }); + return {client, ticket, address, sales, taxes, packagings, signature}; }, created() { - if (this.locale) - this.$i18n.locale = this.locale; + if (this.client.locale) + this.$i18n.locale = this.client.locale; }, data() { return {totalBalance: 0.00}; }, computed: { dmsPath() { - return `http://windows.verdnatura.es/signatures/tickets/1161229.png`; + const hostPath = 'http://windows.verdnatura.es/signatures/tickets'; + if (this.signature && this.signature.id) + return `${hostPath}/${this.signature.id}.png`; + }, + shipped() { + return strftime('%d-%m-%Y', this.ticket.shipped); + } + }, + filters: { + currency(input, currency = 'EUR') { + return new Intl.NumberFormat('es', { + style: 'currency', currency + }).format(parseFloat(input)); + }, + percent(input) { + return new Intl.NumberFormat('es', { + style: 'percent', + minimumFractionDigits: 0, + maximumFractionDigits: 0 + }).format(parseFloat(input)); + }, + date(input) { + return strftime('%d-%m-%Y', input); } }, methods: { fetchClient(ticketFk) { return database.pool.query( `SELECT - c.id clientId, - t.id ticketId, - u.lang locale, + c.id, c.email AS recipient, - c.socialName AS clientName, + c.socialName, c.street, - c.postcode, - c.city, c.fi, - p.name AS province, - ct.country, - dt.dmsFk, - d.created AS dmsCreated + u.lang locale FROM ticket t JOIN client c ON c.id = t.clientFk JOIN account.user u ON u.id = c.id - JOIN country ct ON ct.id = c.countryFk - LEFT JOIN province p ON p.id = c.provinceFk - LEFT JOIN dmsTicket dt ON dt.ticketFk = t.id - LEFT JOIN dms d ON d.id = dt.dmsFk WHERE t.id = ?`, [ticketFk]); }, + fetchTicket(ticketFk) { + return database.pool.query( + `SELECT + t.id, + t.shipped + FROM ticket t + JOIN client c ON c.id = t.clientFk + JOIN account.user u ON u.id = c.id + WHERE t.id = ?`, [ticketFk]); + }, + fetchAddress(ticketFk) { + return database.pool.query( + `SELECT + a.nickname, + a.street, + a.postalCode, + a.city, + p.name province + FROM ticket t + JOIN address a ON a.clientFk = t.clientFk + LEFT JOIN province p ON p.id = a.provinceFk + WHERE t.id = ?`, [ticketFk]); + }, + fetchSales(ticketFk) { return database.pool.query( `SELECT @@ -78,45 +107,105 @@ module.exports = { s.discount, i.size, i.stems, - ic.type taxType, i.category, it.id itemTypeId, o.code AS origin, i.inkFk, s.ticketFk, + tcl.code vatType, + ibwg.ediBotanic, + ppa.denomination, + pp.number passportNumber, + be.isProtectedZone, + c.code AS countryCode, ita.tag1, ita.val1, ita.tag2, ita.val2, ita.tag3, ita.val3 - FROM sale s + FROM vn.sale s LEFT JOIN saleComponent sc ON sc.saleFk = s.id LEFT JOIN componentRate cr ON cr.id = sc.componentFk LEFT JOIN componentTypeRate ctr ON ctr.id = cr.componentTypeRate LEFT JOIN item i ON i.id = s.itemFk LEFT JOIN ticket t ON t.id = s.ticketFk LEFT JOIN origin o ON o.id = i.originFk - INNER JOIN supplier sp ON sp.id = t.companyFk - INNER JOIN itemType it ON it.id = i.typeFk - LEFT JOIN - (SELECT * - FROM - (SELECT tt.countryFk, tcc.taxClassFk, tc.type - FROM taxClassCode tcc - JOIN taxCode tc ON tc.id = tcc.taxCodeFk - JOIN taxType tt ON tt.id = tc.taxTypeFk - WHERE tcc.effectived <= '2019-01-29 13:00:00' - ORDER BY tcc.effectived DESC) tx - GROUP BY tx.countryFk, tx.taxClassFk) ic ON ic.countryFk = sp.countryFk - AND ic.taxClassFk = i.taxClassFk - JOIN vn.itemTagArranged ita ON ita.itemFk = s.itemFk + LEFT JOIN country c ON c.id = o.countryFk + LEFT JOIN supplier sp ON sp.id = t.companyFk + LEFT JOIN itemType it ON it.id = i.typeFk + LEFT JOIN itemTaxCountry itc ON itc.itemFk = i.id + AND itc.countryFk = sp.countryFk + LEFT JOIN taxClass tcl ON tcl.id = itc.taxClassFk + LEFT JOIN itemTagArranged ita ON ita.itemFk = s.itemFk + LEFT JOIN plantpassport pp ON pp.producerFk = i.producerFk + LEFT JOIN plantpassportAuthority ppa ON ppa.id = pp.plantpassportAuthorityFk + LEFT JOIN itemBotanicalWithGenus ibwg ON ibwg.itemFk = i.id + LEFT JOIN botanicExport be ON be.restriction = 'pasaporte fitosanitario' + LEFT JOIN ediGenus eg ON eg.id = be.ediGenusFk + LEFT JOIN ediSpecie es ON es.id = be.ediSpecieFk + AND ibwg.ediBotanic LIKE CONCAT( + IFNULL(eg.latinGenusName, ''), + IF(es.latinSpeciesName > '', + CONCAT(' ', es.latinSpeciesName), ''), + '%') WHERE s.ticketFk = ? GROUP BY s.id ORDER BY (it.isPackaging), s.concept, s.itemFk`, [ticketFk]); }, - dated: () => { - return strftime('%d-%m-%Y', new Date()); + fetchTaxes(ticketFk) { + return database.pool.query( + `CALL vn.ticketGetTaxAdd(?)`, [ticketFk]); + }, + fetchPackagings(ticketFk) { + return database.pool.query( + `SELECT + tp.quantity, + i.name, + p.itemFk + FROM ticketPackaging tp + JOIN packaging p ON p.id = tp.packagingFk + JOIN item i ON i.id = p.itemFk + WHERE tp.ticketFk = ? + ORDER BY itemFk`, [ticketFk]); + }, + fetchSignature(ticketFk) { + return database.pool.query( + `SELECT + d.id, + d.created + FROM ticket t + JOIN dmsTicket dt ON dt.ticketFk = t.id + JOIN dms d ON d.id = dt.dmsFk + AND d.file LIKE '%.png' + WHERE t.id = ?`, [ticketFk]); + }, + getSubTotal() { + let subTotal = 0.00; + this.sales.forEach(sale => { + subTotal += sale.quantity * sale.price * (1 - sale.discount / 100); + }); + + return subTotal; + }, + getTotalBase() { + let totalBase = 0.00; + this.taxes.forEach(tax => { + totalBase += parseFloat(tax.Base); + }); + + return totalBase; + }, + getTotalTax() { + let totalTax = 0.00; + this.taxes.forEach(tax => { + totalTax += parseFloat(tax.tax); + }); + + return totalTax; + }, + getTotal() { + return this.getTotalBase() + this.getTotalTax(); }, }, components: { diff --git a/print/report/rpt-delivery-note/locale.js b/print/report/rpt-delivery-note/locale.js index d08c50144..afc54c72c 100644 --- a/print/report/rpt-delivery-note/locale.js +++ b/print/report/rpt-delivery-note/locale.js @@ -4,12 +4,24 @@ module.exports = { title: 'Albarán', ticketId: 'Albarán', clientId: 'Cliente', - clientData: 'Datos del cliente', + deliveryAddress: 'Dirección de entrega', + fiscalData: 'Datos fiscales', date: 'Fecha', + reference: 'Ref.', + quantity: 'Cant.', concept: 'Concepto', - invoiced: 'Facturado', - payed: 'Pagado', - balance: 'Saldo', + price: 'PVP/u', + discount: 'Dto.', + vat: 'IVA', + amount: 'Importe', + type: 'Tipo', + taxBase: 'Base imp.', + tax: 'Tasa', + fee: 'Cuota', + packaging: 'Cubos y embalajes', + taxBreakdown: 'Desglose impositivo', + total: 'Total', + subtotal: 'Subtotal', ticket: 'Albarán {0}' }, }, diff --git a/print/report/rpt-informe/index.html b/print/report/rpt-informe/index.html index 633f23783..f77c5d2ae 100644 --- a/print/report/rpt-informe/index.html +++ b/print/report/rpt-informe/index.html @@ -3,9 +3,7 @@
- - +
diff --git a/print/report/rpt-letter-debtor/index.html b/print/report/rpt-letter-debtor/index.html index 8d984dadf..6763bfbe7 100644 --- a/print/report/rpt-letter-debtor/index.html +++ b/print/report/rpt-letter-debtor/index.html @@ -3,9 +3,7 @@
- - +
@@ -77,7 +75,7 @@
diff --git a/print/report/rpt-sepa-core/index.html b/print/report/rpt-sepa-core/index.html index 0330573e6..bc53c305c 100644 --- a/print/report/rpt-sepa-core/index.html +++ b/print/report/rpt-sepa-core/index.html @@ -3,9 +3,7 @@
- - +

{{$t('title')}}

@@ -145,7 +143,7 @@
diff --git a/print/report/sample-report/index.html b/print/report/sample-report/index.html index 543946979..9a60114fd 100644 --- a/print/report/sample-report/index.html +++ b/print/report/sample-report/index.html @@ -3,9 +3,7 @@
- - +