diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 1e4595aa3..879c4c6ee 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -442,13 +442,13 @@ INSERT INTO `vn`.`supplierAccount`(`id`, `supplierFk`, `iban`, `bankEntityFk`) VALUES (241, 442, 'ES111122333344111122221111', 128); -INSERT INTO `vn`.`company`(`id`, `code`, `supplierAccountFk`, `workerManagerFk`, `companyCode`, `sage200Company`, `expired`) +INSERT INTO `vn`.`company`(`id`, `code`, `supplierAccountFk`, `workerManagerFk`, `companyCode`, `sage200Company`, `expired`, `phytosanitary`) VALUES - (69 , 'CCs', NULL, 30, NULL, 0, NULL), - (442 , 'VNL', 241, 30, 2 , 1, NULL), - (567 , 'VNH', NULL, 30, NULL, 4, NULL), - (791 , 'FTH', NULL, 30, NULL, 3, '2015-11-30'), - (1381, 'ORN', NULL, 30, NULL, 7, NULL); + (69 , 'CCs', NULL, 30, NULL, 0, NULL, NULL), + (442 , 'VNL', 241, 30, 2 , 1, NULL, 'VNL Company - Plant passport'), + (567 , 'VNH', NULL, 30, NULL, 4, NULL, 'VNH Company - Plant passport'), + (791 , 'FTH', NULL, 30, NULL, 3, '2015-11-30', NULL), + (1381, 'ORN', NULL, 30, NULL, 7, NULL, 'ORN Company - Plant passport'); INSERT INTO `vn`.`invoiceOut`(`id`, `serial`, `amount`, `issued`,`clientFk`, `created`, `companyFk`, `dued`, `booked`, `bankFk`, `hasPdf`) VALUES diff --git a/print/common/css/layout.css b/print/common/css/layout.css index 3b2643dc9..c709191bb 100644 --- a/print/common/css/layout.css +++ b/print/common/css/layout.css @@ -4,7 +4,7 @@ */ .grid { - font-family: Arial, sans-serif; + font-family: Arial, Helvetica, sans-serif; font-size: 16px !important; width: 100% } @@ -63,7 +63,6 @@ .panel { position: relative; margin-bottom: 15px; - padding-top: 10px; break-inside: avoid; break-before: always; break-after: always; @@ -72,10 +71,11 @@ .panel .header { background-color: #FFF; padding: 2.5px 10px; - position: absolute; + position: relative; font-weight: bold; - top: 0px; + display: inline-block; left: 17.5px; + top: 10px; } .panel .body { @@ -168,18 +168,22 @@ table { .column-oriented td, .column-oriented th { - padding: 5px 10px + padding: 10px } .column-oriented thead { - display: table-header-group; - background-color: #e5e5e5 + display: table-header-group } .column-oriented thead tr { - border-bottom: 1px solid #808080; - border-top: 1px solid #808080; - background-color: #e5e5e5 + border-top: 1px solid #AFB1B2; + background-color: #BABDBD; + border-bottom: 1px solid #AFB1B2; +} + +.column-oriented thead.light tr { + background-color: #FFF; + color: #AFB1B2 } .column-oriented tfoot { @@ -193,13 +197,10 @@ table { } .column-oriented tfoot tr:first-child td { + border-top: 2px solid #AFB1B2; padding-top: 20px !important; } -.column-oriented tfoot tr:first-child { - border-top: 2px solid #808080; -} - .column-oriented .description { font-size: 0.8em } diff --git a/print/common/css/report.css b/print/common/css/report.css index 796b99c4f..9331481f4 100644 --- a/print/common/css/report.css +++ b/print/common/css/report.css @@ -9,6 +9,6 @@ body { .title { margin-bottom: 20px; font-weight: 100; - font-size: 2em; + font-size: 3em; margin-top: 0 } \ No newline at end of file diff --git a/print/core/filters/index.js b/print/core/filters/index.js index bfd99c504..efc398508 100644 --- a/print/core/filters/index.js +++ b/print/core/filters/index.js @@ -4,4 +4,5 @@ require('./uppercase'); require('./currency'); require('./percentage'); require('./number'); +require('./zerofill'); diff --git a/print/core/filters/zerofill.js b/print/core/filters/zerofill.js new file mode 100644 index 000000000..c7df519b0 --- /dev/null +++ b/print/core/filters/zerofill.js @@ -0,0 +1,11 @@ +const {KeyValueModel} = require('loopback'); +const Vue = require('vue'); + +const zerofill = function(value, pad) { + const valueStr = String(value); + return pad.substring(0, pad.length - valueStr.length) + valueStr; +}; + +Vue.filter('zerofill', zerofill); + +module.exports = zerofill; diff --git a/print/templates/reports/delivery-note/assets/css/style.css b/print/templates/reports/delivery-note/assets/css/style.css index c6d2ab2bf..cbe894097 100644 --- a/print/templates/reports/delivery-note/assets/css/style.css +++ b/print/templates/reports/delivery-note/assets/css/style.css @@ -9,15 +9,32 @@ max-width: 150px } -.description.phytosanitary { - background-color: #e5e5e5 +.description strong { + text-transform: uppercase; } -h3 { +h2 { font-weight: 100; color: #555 } .ticket-info { - font-size: 20px + font-size: 26px +} + +#phytosanitary { + padding-right: 10px +} + +#phytosanitary .flag img { + width: 100% +} + +#phytosanitary .flag .flag-text { + padding-left: 10px; + box-sizing: border-box; +} + +.phytosanitary-info { + margin-top: 10px } \ No newline at end of file diff --git a/print/templates/reports/delivery-note/assets/images/europe.png b/print/templates/reports/delivery-note/assets/images/europe.png new file mode 100644 index 000000000..673be92ae Binary files /dev/null and b/print/templates/reports/delivery-note/assets/images/europe.png differ diff --git a/print/templates/reports/delivery-note/delivery-note.html b/print/templates/reports/delivery-note/delivery-note.html index 22ce0eaa8..5d3a8ca9d 100644 --- a/print/templates/reports/delivery-note/delivery-note.html +++ b/print/templates/reports/delivery-note/delivery-note.html @@ -14,7 +14,7 @@
-
+

{{$t('title')}}

@@ -66,59 +66,46 @@ -

{{$t('saleLines')}}

+

{{$t('saleLines')}}

- - - - - - - + + + + + + + - - - + + + - + - - - - - - + - @@ -130,52 +117,89 @@
-

{{$t('services')}}

+

{{$t('services')}}

{{$t('reference')}}{{$t('quantity')}}{{$t('concept')}}{{$t('price')}}{{$t('discount')}}{{$t('vat')}}{{$t('amount')}}{{$t('reference')}}{{$t('quantity')}}{{$t('concept')}}{{$t('price')}}{{$t('discount')}}{{$t('vat')}}{{$t('amount')}}
{{sale.itemFk}}
{{sale.itemFk | zerofill('000000')}} {{sale.quantity}} {{sale.concept}} {{sale.price | currency('EUR', $i18n.locale)}}{{(sale.discount / 100) | percentage}}{{(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}} -
-
- {{sale.ediBotanic}} {{sale.denomination}} {{sale.countryCode}}-{{sale.passportNumber}} - ZP + + {{sale.tag5}} {{sale.value5}} + + + {{sale.tag6}} {{sale.value6}} + + + {{sale.tag7}} {{sale.value7}} +
+ {{$t('subtotal')}} {{getSubTotal() | currency('EUR', $i18n.locale)}}
- - - - + + + + + + + - + - + + + + - - + +
{{$t('concept')}}{{$t('quantity')}}{{$t('vatType')}}{{$t('amount')}}{{$t('quantity')}}{{$t('concept')}}{{$t('price')}}{{$t('vat')}}{{$t('amount')}}
{{service.description}} {{service.quantity}}{{service.taxDescription}}{{service.description}}{{service.price | currency('EUR', $i18n.locale)}}{{service.taxDescription}} {{service.price | currency('EUR', $i18n.locale)}}
{{$t('total')}} {{serviceTotal | currency('EUR', $i18n.locale)}} + {{$t('subtotal')}} + {{serviceTotal | currency('EUR', $i18n.locale)}}
- - -
-

{{$t('taxBreakdown')}}

+
+
+ +
+

{{$t('packagings')}}

- - + + + + + + + + + + + +
{{$t('type')}} + {{$t('reference')}}{{$t('quantity')}}{{$t('concept')}}
{{packaging.itemFk | zerofill('000000')}}{{packaging.quantity}}{{packaging.name}}
+
+ +
+
+ +
+ + + + + + + + + + + - + + + - @@ -199,29 +223,46 @@
{{$t('taxBreakdown')}}
{{$t('type')}} {{$t('taxBase')}} - - {{$t('tax')}}{{$t('fee')}}{{$t('tax')}}{{$t('fee')}}
{{tax.name}} + {{tax.Base | currency('EUR', $i18n.locale)}} {{tax.vatPercent | percentage}}
- - -
-

{{$t('packagings')}}

- - - - - - - - - - - - - - - -
Id{{$t('concept')}}{{$t('quantity')}}
{{packaging.itemFk}}{{packaging.name}}{{packaging.quantity}}
+ + +
+
+
+
+
+
+ +
+
+ Pasaporte fitosanitario
+ Plant passport +
+
+
+
+
+ A + {{getBotanical()}} +
+
+ B + ES17462130 +
+
+ C + {{ticket.id}} +
+
+ D + ES +
+
+
+
- - + +
+
diff --git a/print/templates/reports/delivery-note/delivery-note.js b/print/templates/reports/delivery-note/delivery-note.js index 5bf9824f6..5e5752e36 100755 --- a/print/templates/reports/delivery-note/delivery-note.js +++ b/print/templates/reports/delivery-note/delivery-note.js @@ -95,6 +95,22 @@ module.exports = { }, getTotal() { return this.getTotalBase() + this.getTotalTax(); + }, + getBotanical() { + let phytosanitary = []; + this.sales.forEach(sale => { + let itemPhytosanitary; + if (sale.latinGenusName || sale.latinSpeciesName) + itemPhytosanitary = [sale.latinGenusName, sale.latinSpeciesName].filter(Boolean).join(' '); + else if (sale.botanical) + itemPhytosanitary = sale.botanical; + + phytosanitary.push(itemPhytosanitary); + }); + + return phytosanitary.filter((item, index) => + phytosanitary.indexOf(item) == index + ).join(', '); } }, components: { diff --git a/print/templates/reports/delivery-note/sql/sales.sql b/print/templates/reports/delivery-note/sql/sales.sql index a563c19f0..08c349f5a 100644 --- a/print/templates/reports/delivery-note/sql/sales.sql +++ b/print/templates/reports/delivery-note/sql/sales.sql @@ -14,10 +14,9 @@ SELECT i.inkFk, s.ticketFk, tcl.code vatType, - ibwg.ediBotanic, - ppa.denomination, - pp.number passportNumber, - be.isProtectedZone, c.code AS countryCode, + ib.botanical, + eg.latinGenusName, + es.latinSpeciesName, i.tag5, i.value5, i.tag6, @@ -34,20 +33,14 @@ FROM vn.sale s 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 itemCategory ic ON ic.id = it.categoryFk 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 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), ''), - '%') + LEFT JOIN itemBotanical ib ON ib.itemFk = i.id + AND ic.code = 'plant' + LEFT JOIN ediGenus eg ON eg.id = ib.genusFk + LEFT JOIN ediSpecie es ON es.id = ib.specieFk WHERE s.ticketFk = ? GROUP BY s.id ORDER BY (it.isPackaging), s.concept, s.itemFk \ No newline at end of file diff --git a/print/templates/reports/delivery-note/sql/services.sql b/print/templates/reports/delivery-note/sql/services.sql index fbb4a53c4..d64e8dc26 100644 --- a/print/templates/reports/delivery-note/sql/services.sql +++ b/print/templates/reports/delivery-note/sql/services.sql @@ -1,5 +1,5 @@ SELECT - tc.description taxDescription, + tc.code taxDescription, ts.description, ts.quantity, ts.price