From 0dc1848870d84049cf8a256ebaf038fb5a91fcf0 Mon Sep 17 00:00:00 2001 From: alexm <alexm@verdnatura.es> Date: Tue, 22 Mar 2022 15:13:34 +0100 Subject: [PATCH 1/3] feat(print_deliveryNote): add withoutPrices type --- .../ticket/front/descriptor-menu/index.html | 9 +++++-- modules/ticket/front/descriptor-menu/index.js | 3 ++- .../front/descriptor-menu/locale/es.yml | 1 + .../reports/delivery-note/delivery-note.html | 24 +++++++++---------- .../reports/delivery-note/delivery-note.js | 4 ++++ 5 files changed, 26 insertions(+), 15 deletions(-) diff --git a/modules/ticket/front/descriptor-menu/index.html b/modules/ticket/front/descriptor-menu/index.html index d613fb5de3..03a23c780d 100644 --- a/modules/ticket/front/descriptor-menu/index.html +++ b/modules/ticket/front/descriptor-menu/index.html @@ -21,7 +21,7 @@ <vn-list> <vn-item ng-if="!$ctrl.hasDocuwareFile" - ng-click="$ctrl.showPdfDeliveryNote()" + ng-click="$ctrl.showPdfDeliveryNote('deliveryNote')" translate> as PDF </vn-item> @@ -32,6 +32,12 @@ translate> as PDF </a> + <vn-item + ng-if="!$ctrl.hasDocuwareFile" + ng-click="$ctrl.showPdfDeliveryNote('withoutPrices')" + translate> + as PDF without prices + </vn-item> <vn-item ng-click="$ctrl.showCsvDeliveryNote()" translate> @@ -44,7 +50,6 @@ vn-click-stop="sendDeliveryNoteMenu.show($event, 'left')" translate> Send Delivery Note... - <vn-menu vn-id="sendDeliveryNoteMenu"> <vn-list> <vn-item diff --git a/modules/ticket/front/descriptor-menu/index.js b/modules/ticket/front/descriptor-menu/index.js index 841dfa4099..6465c43ace 100644 --- a/modules/ticket/front/descriptor-menu/index.js +++ b/modules/ticket/front/descriptor-menu/index.js @@ -116,10 +116,11 @@ class Controller extends Section { }); } - showPdfDeliveryNote() { + showPdfDeliveryNote(type) { this.vnReport.show('delivery-note', { recipientId: this.ticket.client.id, ticketId: this.id, + type: type }); } diff --git a/modules/ticket/front/descriptor-menu/locale/es.yml b/modules/ticket/front/descriptor-menu/locale/es.yml index 4a61556db8..6bb30965f8 100644 --- a/modules/ticket/front/descriptor-menu/locale/es.yml +++ b/modules/ticket/front/descriptor-menu/locale/es.yml @@ -2,6 +2,7 @@ Show Delivery Note...: Ver albarán... Send Delivery Note...: Enviar albarán... as PDF: como PDF as CSV: como CSV +as PDF without prices: como PDF sin precios Send PDF: Enviar PDF Send CSV: Enviar CSV Send CSV Delivery Note: Enviar albarán en CSV diff --git a/print/templates/reports/delivery-note/delivery-note.html b/print/templates/reports/delivery-note/delivery-note.html index 36d9abde14..09b7990761 100644 --- a/print/templates/reports/delivery-note/delivery-note.html +++ b/print/templates/reports/delivery-note/delivery-note.html @@ -15,7 +15,7 @@ <div class="columns"> <div class="size50"> <div class="size75 vn-mt-ml"> - <h1 class="title uppercase">{{$t('title')}}</h1> + <h1 class="title uppercase">{{$t(type)}}</h1> <table class="row-oriented ticket-info"> <tbody> <tr> @@ -23,7 +23,7 @@ <th>{{client.id}}</th> </tr> <tr> - <td class="font gray uppercase">{{$t('ticketId')}}</td> + <td class="font gray uppercase">{{$t(type)}}</td> <th>{{ticket.id}}</th> </tr> <tr> @@ -77,10 +77,10 @@ <th width="5%">{{$t('reference')}}</th> <th class="number">{{$t('quantity')}}</th> <th width="50%">{{$t('concept')}}</th> - <th class="number">{{$t('price')}}</th> - <th class="centered" width="5%">{{$t('discount')}}</th> - <th class="centered">{{$t('vat')}}</th> - <th class="number">{{$t('amount')}}</th> + <th class="number" v-if="type != 'withoutPrices'">{{$t('price')}}</th> + <th class="centered" width="5%" v-if="type != 'withoutPrices'">{{$t('discount')}}</th> + <th class="centered" v-if="type != 'withoutPrices'">{{$t('vat')}}</th> + <th class="number" v-if="type != 'withoutPrices'">{{$t('amount')}}</th> </tr> </thead> <tbody v-for="sale in sales" class="no-page-break"> @@ -88,10 +88,10 @@ <td width="5%">{{sale.itemFk | zerofill('000000')}}</td> <td class="number">{{sale.quantity}}</td> <td width="50%">{{sale.concept}}</td> - <td class="number">{{sale.price | currency('EUR', $i18n.locale)}}</td> - <td class="centered" width="5%">{{(sale.discount / 100) | percentage}}</td> - <td class="centered">{{sale.vatType}}</td> - <td class="number">{{sale.price * sale.quantity * (1 - sale.discount / 100) | currency('EUR', $i18n.locale)}}</td> + <td class="number" v-if="type != 'withoutPrices'">{{sale.price | currency('EUR', $i18n.locale)}}</td> + <td class="centered" width="5%" v-if="type != 'withoutPrices'">{{(sale.discount / 100) | percentage}}</td> + <td class="centered" v-if="type != 'withoutPrices'">{{sale.vatType}}</td> + <td class="number" v-if="type != 'withoutPrices'">{{sale.price * sale.quantity * (1 - sale.discount / 100) | currency('EUR', $i18n.locale)}}</td> </tr> <tr class="description font light-gray"> <td colspan="7"> @@ -107,7 +107,7 @@ </td> </tr> </tbody> - <tfoot> + <tfoot v-if="type != 'withoutPrices'"> <tr> <td colspan="6" class="font bold"> <span class="pull-right">{{$t('subtotal')}}</span> @@ -181,7 +181,7 @@ </div> <!-- End of packages block --> </div> - <div class="columns vn-mt-xl"> + <div class="columns vn-mt-xl" v-if="type != 'withoutPrices'"> <!-- Taxes block --> <div id="taxes" class="size50 pull-right no-page-break" v-if="taxes"> <table class="column-oriented"> diff --git a/print/templates/reports/delivery-note/delivery-note.js b/print/templates/reports/delivery-note/delivery-note.js index 0ee7c8c910..7f9ca7d0f7 100755 --- a/print/templates/reports/delivery-note/delivery-note.js +++ b/print/templates/reports/delivery-note/delivery-note.js @@ -119,6 +119,10 @@ module.exports = { ticketId: { type: [Number, String], required: true + }, + type: { + type: String, + required: true } } }; From 1051a9cafbe764b9201bd32e2df877219f1db21a Mon Sep 17 00:00:00 2001 From: alexm <alexm@verdnatura.es> Date: Wed, 23 Mar 2022 09:42:00 +0100 Subject: [PATCH 2/3] traductions --- print/templates/reports/delivery-note/locale/en.yml | 1 + print/templates/reports/delivery-note/locale/es.yml | 1 + print/templates/reports/delivery-note/locale/fr.yml | 1 + print/templates/reports/delivery-note/locale/pt.yml | 1 + 4 files changed, 4 insertions(+) diff --git a/print/templates/reports/delivery-note/locale/en.yml b/print/templates/reports/delivery-note/locale/en.yml index 16d0954e2d..05b6d73edf 100644 --- a/print/templates/reports/delivery-note/locale/en.yml +++ b/print/templates/reports/delivery-note/locale/en.yml @@ -1,5 +1,6 @@ reportName: delivery-note title: Delivery note +withoutPrices: Delivery note ticketId: Delivery note clientId: Client deliveryAddress: Delivery address diff --git a/print/templates/reports/delivery-note/locale/es.yml b/print/templates/reports/delivery-note/locale/es.yml index ca670ad59c..1a6e156ccd 100644 --- a/print/templates/reports/delivery-note/locale/es.yml +++ b/print/templates/reports/delivery-note/locale/es.yml @@ -1,6 +1,7 @@ reportName: albaran title: Albarán ticketId: Albarán +withoutPrices: Albarán clientId: Cliente deliveryAddress: Dirección de entrega fiscalData: Datos fiscales diff --git a/print/templates/reports/delivery-note/locale/fr.yml b/print/templates/reports/delivery-note/locale/fr.yml index 6b3779a5b7..1cc1716693 100644 --- a/print/templates/reports/delivery-note/locale/fr.yml +++ b/print/templates/reports/delivery-note/locale/fr.yml @@ -1,5 +1,6 @@ reportName: bon-de-livraison title: Bon de livraison +withoutPrices: Bon de livraison ticketId: BL clientId: Client deliveryAddress: Adresse de livraison diff --git a/print/templates/reports/delivery-note/locale/pt.yml b/print/templates/reports/delivery-note/locale/pt.yml index 1a9c1fbd1e..ca25041f26 100644 --- a/print/templates/reports/delivery-note/locale/pt.yml +++ b/print/templates/reports/delivery-note/locale/pt.yml @@ -1,5 +1,6 @@ reportName: nota-de-entrega title: Nota de Entrega +withoutPrices: Nota de Entrega ticketId: Nota de Entrega clientId: Cliente deliveryAddress: Morada de Entrega From ebfd0bdb29b4bfba2b3ff48422fbdee6831bc217 Mon Sep 17 00:00:00 2001 From: alexm <alexm@verdnatura.es> Date: Wed, 23 Mar 2022 09:46:44 +0100 Subject: [PATCH 3/3] use computed function --- .../reports/delivery-note/delivery-note.html | 20 +++++++++---------- .../reports/delivery-note/delivery-note.js | 3 +++ 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/print/templates/reports/delivery-note/delivery-note.html b/print/templates/reports/delivery-note/delivery-note.html index 09b7990761..93e1c22555 100644 --- a/print/templates/reports/delivery-note/delivery-note.html +++ b/print/templates/reports/delivery-note/delivery-note.html @@ -77,10 +77,10 @@ <th width="5%">{{$t('reference')}}</th> <th class="number">{{$t('quantity')}}</th> <th width="50%">{{$t('concept')}}</th> - <th class="number" v-if="type != 'withoutPrices'">{{$t('price')}}</th> - <th class="centered" width="5%" v-if="type != 'withoutPrices'">{{$t('discount')}}</th> - <th class="centered" v-if="type != 'withoutPrices'">{{$t('vat')}}</th> - <th class="number" v-if="type != 'withoutPrices'">{{$t('amount')}}</th> + <th class="number" v-if="showPrices">{{$t('price')}}</th> + <th class="centered" width="5%" v-if="showPrices">{{$t('discount')}}</th> + <th class="centered" v-if="showPrices">{{$t('vat')}}</th> + <th class="number" v-if="showPrices">{{$t('amount')}}</th> </tr> </thead> <tbody v-for="sale in sales" class="no-page-break"> @@ -88,10 +88,10 @@ <td width="5%">{{sale.itemFk | zerofill('000000')}}</td> <td class="number">{{sale.quantity}}</td> <td width="50%">{{sale.concept}}</td> - <td class="number" v-if="type != 'withoutPrices'">{{sale.price | currency('EUR', $i18n.locale)}}</td> - <td class="centered" width="5%" v-if="type != 'withoutPrices'">{{(sale.discount / 100) | percentage}}</td> - <td class="centered" v-if="type != 'withoutPrices'">{{sale.vatType}}</td> - <td class="number" v-if="type != 'withoutPrices'">{{sale.price * sale.quantity * (1 - sale.discount / 100) | currency('EUR', $i18n.locale)}}</td> + <td class="number" v-if="showPrices">{{sale.price | currency('EUR', $i18n.locale)}}</td> + <td class="centered" width="5%" v-if="showPrices">{{(sale.discount / 100) | percentage}}</td> + <td class="centered" v-if="showPrices">{{sale.vatType}}</td> + <td class="number" v-if="showPrices">{{sale.price * sale.quantity * (1 - sale.discount / 100) | currency('EUR', $i18n.locale)}}</td> </tr> <tr class="description font light-gray"> <td colspan="7"> @@ -107,7 +107,7 @@ </td> </tr> </tbody> - <tfoot v-if="type != 'withoutPrices'"> + <tfoot v-if="showPrices"> <tr> <td colspan="6" class="font bold"> <span class="pull-right">{{$t('subtotal')}}</span> @@ -181,7 +181,7 @@ </div> <!-- End of packages block --> </div> - <div class="columns vn-mt-xl" v-if="type != 'withoutPrices'"> + <div class="columns vn-mt-xl" v-if="showPrices"> <!-- Taxes block --> <div id="taxes" class="size50 pull-right no-page-break" v-if="taxes"> <table class="column-oriented"> diff --git a/print/templates/reports/delivery-note/delivery-note.js b/print/templates/reports/delivery-note/delivery-note.js index 7f9ca7d0f7..48aef8b64b 100755 --- a/print/templates/reports/delivery-note/delivery-note.js +++ b/print/templates/reports/delivery-note/delivery-note.js @@ -44,6 +44,9 @@ module.exports = { }); return total; + }, + showPrices() { + return this.type != 'withoutPrices'; } }, methods: {