From 79485236853b1f22220a94fd487da4f2a5a84bd4 Mon Sep 17 00:00:00 2001 From: alexandre Date: Tue, 25 Oct 2022 15:03:09 +0200 Subject: [PATCH] refs #4650 cambios en la query --- .../reports/delivery-note/delivery-note.html | 579 +++++++++--------- .../reports/delivery-note/delivery-note.js | 6 +- .../reports/delivery-note/sql/ticket.sql | 10 +- 3 files changed, 300 insertions(+), 295 deletions(-) diff --git a/print/templates/reports/delivery-note/delivery-note.html b/print/templates/reports/delivery-note/delivery-note.html index e34620591..a07c851aa 100644 --- a/print/templates/reports/delivery-note/delivery-note.html +++ b/print/templates/reports/delivery-note/delivery-note.html @@ -1,299 +1,304 @@ - - - - - + + +
- - - - -
-
-
-
-
-

{{$t(deliverNoteType)}}

- - - - - - - - - - - - - - - - - - - -
{{$t('clientId')}}{{client.id}}
{{$t(deliverNoteType)}}{{ticket.id}}
{{$t('date')}}{{ticket.shipped | date('%d-%m-%Y')}}
{{$t('packages')}}{{ticket.packages}}
-
-
-
-
-
{{$t('deliveryAddress')}}
-
-

{{address.nickname}}

-
- {{address.street}} -
-
- {{address.postalCode}}, {{address.city}} ({{address.province}}) -
-
-
- -
-
{{$t('fiscalData')}}
-
-
- {{client.socialName}} -
-
- {{client.street}} -
-
- {{client.fi}} -
-
-
-
-
- - -

{{$t('saleLines')}}

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{{$t('reference')}}{{$t('quantity')}}{{$t('concept')}}{{$t('price')}}{{$t('discount')}}{{$t('vat')}}{{$t('amount')}}
{{sale.itemFk | zerofill('000000')}}{{sale.quantity}}{{sale.concept}}{{sale.price | currency('EUR', $i18n.locale)}}{{(sale.discount / 100) | percentage}}{{sale.vatType}}{{sale.price * sale.quantity * (1 - sale.discount / 100) | currency('EUR', $i18n.locale)}}
- - {{sale.tag5}} {{sale.value5}} - - - {{sale.tag6}} {{sale.value6}} - - - {{sale.tag7}} {{sale.value7}} - -
- {{$t('subtotal')}} - {{getSubTotal() | currency('EUR', $i18n.locale)}}
- - -
- -
-

{{$t('services.title')}}

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{{$t('services.theader.quantity')}}{{$t('services.theader.concept')}}{{$t('services.theader.price')}}{{$t('services.theader.vat')}}{{$t('services.theader.amount')}}
{{service.quantity}}{{service.description}}{{service.price | currency('EUR', $i18n.locale)}}{{service.taxDescription}}{{service.price | currency('EUR', $i18n.locale)}}
- {{$t('services.tfoot.subtotal')}} - {{serviceTotal | currency('EUR', $i18n.locale)}}
- * {{ $t('services.warning') }} -
- -
-
- -
-

{{$t('packagings.title')}}

- - - - - - - - - - - - - - - -
{{$t('packagings.theader.reference')}}{{$t('packagings.theader.quantity')}}{{$t('packagings.theader.concept')}}
{{packaging.itemFk | zerofill('000000')}}{{packaging.quantity}}{{packaging.name}}
-
- -
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{{$t('taxes.title')}}
{{$t('taxes.theader.type')}}{{$t('taxes.theader.taxBase')}}{{$t('taxes.theader.tax')}}{{$t('taxes.theader.fee')}}
{{tax.name}} - {{tax.Base | currency('EUR', $i18n.locale)}} - {{tax.vatPercent | percentage}}{{tax.tax | currency('EUR', $i18n.locale)}}
{{$t('subtotal')}} - {{getTotalBase() | currency('EUR', $i18n.locale)}} - {{getTotalTax()| currency('EUR', $i18n.locale)}}
{{$t('total')}}{{getTotal() | currency('EUR', $i18n.locale)}}
-
- - -
-
-
-
-
-
- -
-
- {{$t('plantPassport')}}
-
-
-
-
-
- A - {{getBotanical()}} -
-
- B - ES17462130 -
-
- C - {{ticket.id}} -
-
- D - ES -
-
-
-
+ + + + + - - -
+ + + + +
+
+
+
+
+

{{$t(deliverNoteType)}}

+ + + + + + + + + + + + + + + + + + + +
{{$t('clientId')}}{{client.id}}
{{$t(deliverNoteType)}}{{ticket.id}}
{{$t('date')}}{{ticket.shipped | date('%d-%m-%Y')}}
{{$t('packages')}}{{ticket.packages}}
-
-
- -
-

{{$t('observations')}}

-

{{ticket.description}}

-
-
- -
-
-
{{$t('digitalSignature')}}
-
- -
{{signature.created | date('%d-%m-%Y')}}
+
+
+
{{$t('deliveryAddress')}}
+
+

{{address.nickname}}

+
+ {{address.street}} +
+
+ {{address.postalCode}}, {{address.city}} ({{address.province}})
- + +
+
{{$t('fiscalData')}}
+
+
+ {{client.socialName}} +
+
+ {{client.street}} +
+
+ {{client.fi}} +
+
+
+
+
+ + +

{{$t('saleLines')}}

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{{$t('reference')}}{{$t('quantity')}}{{$t('concept')}}{{$t('price')}}{{$t('discount')}}{{$t('vat')}}{{$t('amount')}}
{{sale.itemFk | zerofill('000000')}}{{sale.quantity}}{{sale.concept}}{{sale.price | currency('EUR', + $i18n.locale)}}{{(sale.discount / 100) | + percentage}}{{sale.vatType}}{{sale.price * sale.quantity * (1 - + sale.discount / 100) | currency('EUR', $i18n.locale)}}
+ + {{sale.tag5}} {{sale.value5}} + + + {{sale.tag6}} {{sale.value6}} + + + {{sale.tag7}} {{sale.value7}} + +
+ {{$t('subtotal')}} + {{getSubTotal() | currency('EUR', $i18n.locale)}}
+ + +
+ +
+

{{$t('services.title')}}

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{{$t('services.theader.quantity')}}{{$t('services.theader.concept')}}{{$t('services.theader.price')}}{{$t('services.theader.vat')}}{{$t('services.theader.amount')}}
{{service.quantity}}{{service.description}}{{service.price | currency('EUR', $i18n.locale)}} + {{service.taxDescription}}{{service.price | currency('EUR', $i18n.locale)}} +
+ {{$t('services.tfoot.subtotal')}} + {{serviceTotal | currency('EUR', $i18n.locale)}}
+ * {{ $t('services.warning') }} +
+ +
+
+ +
+

{{$t('packagings.title')}}

+ + + + + + + + + + + + + + + +
{{$t('packagings.theader.reference')}}{{$t('packagings.theader.quantity')}}{{$t('packagings.theader.concept')}}
{{packaging.itemFk | zerofill('000000')}}{{packaging.quantity}}{{packaging.name}}
+
+ +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{{$t('taxes.title')}}
{{$t('taxes.theader.type')}}{{$t('taxes.theader.taxBase')}}{{$t('taxes.theader.tax')}}{{$t('taxes.theader.fee')}}
{{tax.name}} + {{tax.Base | currency('EUR', $i18n.locale)}} + {{tax.vatPercent | percentage}}{{tax.tax | currency('EUR', $i18n.locale)}}
{{$t('subtotal')}} + {{getTotalBase() | currency('EUR', $i18n.locale)}} + {{getTotalTax()| currency('EUR', $i18n.locale)}}
{{$t('total')}}{{getTotal() | currency('EUR', + $i18n.locale)}}
+
+ + + +
+
+
+
+
+
+ +
+
+ {{$t('plantPassport')}}
+
+
+
+
+
+ A + {{getBotanical()}} +
+
+ B + ES17462130 +
+
+ C + {{ticket.id}} +
+
+ D + ES +
+
+
+
+
+ +
+
+ +
+
+
{{$t('digitalSignature')}}
+
+ +
{{signature.created | date('%d-%m-%Y')}}
+
+
+
+ +
+
+ +
+

{{$t('observations')}}

+

{{ticket.description}}

- - - -
- +
+ + + +
+ + \ No newline at end of file diff --git a/print/templates/reports/delivery-note/delivery-note.js b/print/templates/reports/delivery-note/delivery-note.js index 78f0f7662..2e356f62e 100755 --- a/print/templates/reports/delivery-note/delivery-note.js +++ b/print/templates/reports/delivery-note/delivery-note.js @@ -54,6 +54,9 @@ module.exports = { footerType() { const translatedType = this.$t(this.deliverNoteType); return `${translatedType} ${this.id}`; + }, + hasObservations() { + return this.ticket.description !== null; } }, @@ -120,9 +123,6 @@ module.exports = { return phytosanitary.filter((item, index) => phytosanitary.indexOf(item) == index ).join(', '); - }, - hasObservations() { - return this.ticket.code == 'deliveryNote' && this.ticket.description != null; } }, components: { diff --git a/print/templates/reports/delivery-note/sql/ticket.sql b/print/templates/reports/delivery-note/sql/ticket.sql index 3d16b53d8..9eac2d322 100644 --- a/print/templates/reports/delivery-note/sql/ticket.sql +++ b/print/templates/reports/delivery-note/sql/ticket.sql @@ -3,10 +3,10 @@ SELECT t.shipped, c.code companyCode, t.packages, - tto.description, - ot.code + tto.description FROM ticket t JOIN company c ON c.id = t.companyFk - LEFT JOIN ticketObservation tto ON tto.ticketFk = t.id - LEFT JOIN observationType ot ON tto.observationTypeFk = ot.id -WHERE t.id = 1; \ No newline at end of file + LEFT JOIN ticketObservation tto + ON tto.ticketFk = t.id + AND tto.observationTypeFk = (SELECT id FROM observationType WHERE code = 'deliveryNote') +WHERE t.id = ? \ No newline at end of file