diff --git a/print/common/css/misc.css b/print/common/css/misc.css index 91af817b1..4a1cee352 100644 --- a/print/common/css/misc.css +++ b/print/common/css/misc.css @@ -2,6 +2,10 @@ text-transform: uppercase } +.justified { + text-align: justify +} + .centered { text-align: center } diff --git a/print/lib/reportEngine.js b/print/lib/reportEngine.js index 0bdef6aa9..b6e5de906 100644 --- a/print/lib/reportEngine.js +++ b/print/lib/reportEngine.js @@ -106,6 +106,9 @@ module.exports = { const options = { format: 'A4', border: '1.5cm', + header: { + height: '80px', + }, footer: { height: '60px', } diff --git a/print/lib/router.js b/print/lib/router.js index 21aeabe6f..69b02b702 100644 --- a/print/lib/router.js +++ b/print/lib/router.js @@ -16,8 +16,8 @@ module.exports = app => { app.get(`/api/report/${name}`, (request, response, next) => { reportEngine.toPdf(name, request).then(stream => { - // response.setHeader('Content-Disposition', `attachment; filename="${name}.pdf"`); - // response.setHeader('Content-type', 'application/pdf'); + response.setHeader('Content-Disposition', `attachment; filename="${name}.pdf"`); + response.setHeader('Content-type', 'application/pdf'); stream.pipe(response); }).catch(e => { next(e); diff --git a/print/report/report-header/assets/css/style.css b/print/report/report-header/assets/css/style.css index 39525c1b5..1f3c13501 100644 --- a/print/report/report-header/assets/css/style.css +++ b/print/report/report-header/assets/css/style.css @@ -1,13 +1,14 @@ header { + font-family: "Roboto", "Helvetica", "Arial", sans-serif; border-bottom: 1px solid #DDD; padding-bottom: 10px; - margin-bottom: 40px; text-align: center; - font-size: 0.65em; - color: #555 + font-size: 0.60em; + color: #555; + zoom: 0.65 } header img { margin-bottom: 10px; width: 350px -} +} \ No newline at end of file diff --git a/print/report/rpt-claim-pickup-order/index.html b/print/report/rpt-claim-pickup-order/index.html index 42a8f9096..9a0a529eb 100644 --- a/print/report/rpt-claim-pickup-order/index.html +++ b/print/report/rpt-claim-pickup-order/index.html @@ -3,7 +3,9 @@
- + +
diff --git a/print/report/rpt-delivery-note/index.html b/print/report/rpt-delivery-note/index.html index 36a2f1e11..4d2b986e8 100644 --- a/print/report/rpt-delivery-note/index.html +++ b/print/report/rpt-delivery-note/index.html @@ -3,7 +3,9 @@
- + +
@@ -50,19 +52,24 @@ - + + - - - + + + + + + + - - - - + + + + diff --git a/print/report/rpt-delivery-note/index.js b/print/report/rpt-delivery-note/index.js index 52b3d90d7..2ed01a8c3 100755 --- a/print/report/rpt-delivery-note/index.js +++ b/print/report/rpt-delivery-note/index.js @@ -12,16 +12,16 @@ module.exports = { throw new UserException('No ticket id specified'); promises.push(this.methods.fetchClient(params.ticketFk)); - // promises.push(this.methods.fetchSales(params.ticketFk)); + promises.push(this.methods.fetchSales(params.ticketFk)); return Promise.all(promises).then(result => { const [[client]] = result[0]; - // const [[sales]] = result[1]; + const [sales] = result[1]; if (!client) throw new UserException('No client data found'); - Object.assign(data, client); + Object.assign(data, client, {sales}); return data; }); @@ -64,16 +64,60 @@ module.exports = { LEFT JOIN dms d ON d.id = dt.dmsFk WHERE t.id = ?`, [ticketFk]); }, - fetchSales(clientFk, companyFk) { + fetchSales(ticketFk) { return database.pool.query( - `CALL vn.clientGetDebtDiary(?, ?)`, [clientFk, companyFk]); + `SELECT + s.id, + s.itemFk, + s.concept, + s.quantity, + s.price, + s.price - SUM(IF(ctr.id = 6, + sc.value, + 0)) netPrice, + s.discount, + i.size, + i.stems, + ic.type taxType, + i.category, + it.id itemTypeId, + o.code AS origin, + i.inkFk, + s.ticketFk, + ita.tag1, + ita.val1, + ita.tag2, + ita.val2, + ita.tag3, + ita.val3 + FROM 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 + WHERE s.ticketFk = ? + GROUP BY s.id + ORDER BY (it.isPackaging), s.concept, s.itemFk`, [ticketFk]); }, dated: () => { return strftime('%d-%m-%Y', new Date()); }, - toISOString: date => { - return strftime('%d-%m-%Y', date); - }, }, components: { 'report-header': require('../report-header'), diff --git a/print/report/rpt-informe/assets/css/style.css b/print/report/rpt-informe/assets/css/style.css index e621f3e23..9dd6ff5b8 100644 --- a/print/report/rpt-informe/assets/css/style.css +++ b/print/report/rpt-informe/assets/css/style.css @@ -1,3 +1,25 @@ -table.column-oriented { - margin-top: 50px !important +p { + font-size: 1.2em; + margin: 0 +} + +.main { + position: relative; + height: 100% +} + +.content { + position: absolute; + margin-top: -200px; + height: 400px; + top: 50% +} + +.signature { + text-align: center; + margin-top: 150px +} + +.signature img { + width: 400px } \ No newline at end of file diff --git a/print/report/rpt-informe/assets/images/signature.png b/print/report/rpt-informe/assets/images/signature.png new file mode 100644 index 000000000..c69cc4798 Binary files /dev/null and b/print/report/rpt-informe/assets/images/signature.png differ diff --git a/print/report/rpt-informe/index.html b/print/report/rpt-informe/index.html index 9a60114fd..633f23783 100644 --- a/print/report/rpt-informe/index.html +++ b/print/report/rpt-informe/index.html @@ -3,28 +3,24 @@
- + +
-

{{$t('title')}}

-

{{$t('date')}} {{dated()}}

-
{{$t('date')}}{{$t('reference')}}{{$t('quantity')}} {{$t('concept')}}{{$t('invoiced')}}{{$t('payed')}}{{$t('balance')}}{{$t('size')}}{{$t('cat')}}{{$t('col')}}{{$t('VAT')}}{{$t('price')}}{{$t('%')}}{{$t('amount')}}
{{toISOString(sale.issued)}}{{sale.ref}}{{sale.debtOut}}{{sale.debtIn}}{{sale.ref{{sale}}{{sale}}{{sale}} {{a}}
- - - - - - - - - - - - - - -
Id{{$t('concept')}}{{$t('quantity')}}
{{sale.id}}{{sale.concept}}{{sale.quantity}}
+
+

{{$t('title')}}

+

+ Recibo de LEON LLORENS LUIS ENRIQUE, + la cantidad de 259,96 € en concepto de 'entrega a cuenta', quedando pendiente en la cuenta del cliente + un saldo de 0,00 €. +

+
+ +

{{$t('dated', ['Silla', '20', 'enero', '2019'])}}

+
+
diff --git a/print/report/rpt-informe/index.js b/print/report/rpt-informe/index.js index 8338e2df7..b5204e8c7 100755 --- a/print/report/rpt-informe/index.js +++ b/print/report/rpt-informe/index.js @@ -5,25 +5,26 @@ module.exports = { created() { if (this.locale) this.$i18n.locale = this.locale; + + const embeded = []; + this.files.map(file => { + embeded[file] = `file://${__dirname + file}`; + }); + this.embeded = embeded; }, data() { return { client: { - id: 10252, - name: 'Batman', + id: 101, + name: 'Batman' }, - sales: [ - {id: 1, concept: 'My item 1', quantity: 25}, - {id: 2, concept: 'My item 2', quantity: 50}, - {id: 3, concept: 'My item 3', quantity: 150} - ], - locale: 'es' + files: ['/assets/images/signature.png'], }; }, methods: { - dated: () => { + /* dated: () => { return strftime('%d-%m-%Y', new Date()); - }, + }, */ }, components: { 'report-header': require('../report-header'), diff --git a/print/report/rpt-informe/locale.js b/print/report/rpt-informe/locale.js index d231e10ff..69f63bce6 100644 --- a/print/report/rpt-informe/locale.js +++ b/print/report/rpt-informe/locale.js @@ -1,10 +1,9 @@ module.exports = { messages: { es: { - title: 'Sample report', + title: 'Recibo', date: 'Fecha', - quantity: 'Cantidad', - concept: 'Concepto', + dated: 'En {0}, a {1} de {2} de {3}', client: 'Cliente {0}', }, }, diff --git a/print/report/rpt-letter-debtor/index.html b/print/report/rpt-letter-debtor/index.html index 6e8b681ba..8d984dadf 100644 --- a/print/report/rpt-letter-debtor/index.html +++ b/print/report/rpt-letter-debtor/index.html @@ -3,7 +3,9 @@
- + +
diff --git a/print/report/rpt-sepa-core/index.html b/print/report/rpt-sepa-core/index.html index ec82a61d2..0330573e6 100644 --- a/print/report/rpt-sepa-core/index.html +++ b/print/report/rpt-sepa-core/index.html @@ -3,7 +3,9 @@
- + +

{{$t('title')}}

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