diff --git a/print/config/routes.json b/print/config/routes.json index bb3b39aa8..4fa82eea3 100644 --- a/print/config/routes.json +++ b/print/config/routes.json @@ -6,8 +6,8 @@ {"type": "email", "name": "letter-debtor-nd"}, {"type": "email", "name": "claim-pickup-order"}, {"type": "email", "name": "sepa-core"}, - {"type": "report", "name": "delivery-note"}, - {"type": "report", "name": "invoice"}, + {"type": "report", "name": "rpt-delivery-note"}, + {"type": "report", "name": "rpt-invoice"}, {"type": "report", "name": "rpt-claim-pickup-order"}, {"type": "report", "name": "rpt-letter-debtor"}, {"type": "report", "name": "rpt-sepa-core"}, diff --git a/print/report/claim-pickup-order/index.html b/print/report/claim-pickup-order/index.html index d598d3261..4790693f5 100644 --- a/print/report/claim-pickup-order/index.html +++ b/print/report/claim-pickup-order/index.html @@ -26,7 +26,7 @@

{{$t('sections.howToBuy.stock')}}

{{$t('sections.howToBuy.delivery')}}

--> - + \ No newline at end of file diff --git a/print/report/claim-pickup-order/index.js b/print/report/claim-pickup-order/index.js index 95d381d5c..38cb65e78 100755 --- a/print/report/claim-pickup-order/index.js +++ b/print/report/claim-pickup-order/index.js @@ -30,7 +30,8 @@ module.exports = { }); }, created() { - this.$i18n.locale = this.locale; + if (this.locale) + this.$i18n.locale = this.locale; }, methods: { fetchClient(claimFk) { diff --git a/print/report/client-welcome/index.html b/print/report/client-welcome/index.html index fc0295b8f..28c36bd1a 100644 --- a/print/report/client-welcome/index.html +++ b/print/report/client-welcome/index.html @@ -62,7 +62,7 @@

- + \ No newline at end of file diff --git a/print/report/client-welcome/index.js b/print/report/client-welcome/index.js index aeca24a06..1e6b7934c 100755 --- a/print/report/client-welcome/index.js +++ b/print/report/client-welcome/index.js @@ -19,7 +19,8 @@ module.exports = { }); }, created() { - this.$i18n.locale = this.locale; + if (this.locale) + this.$i18n.locale = this.locale; }, methods: { fetchClient(clientFk) { diff --git a/print/report/delivery-note/assets/css/style.css b/print/report/delivery-note/assets/css/style.css deleted file mode 100644 index 918036c36..000000000 --- a/print/report/delivery-note/assets/css/style.css +++ /dev/null @@ -1,3 +0,0 @@ -.blue { - color: blue -} \ No newline at end of file diff --git a/print/report/delivery-note/index.html b/print/report/delivery-note/index.html deleted file mode 100644 index 37d97258a..000000000 --- a/print/report/delivery-note/index.html +++ /dev/null @@ -1,4 +0,0 @@ -
- {{$t('clientId')}}: {{ id1 }} {{ id2 }} - heey -
\ No newline at end of file diff --git a/print/report/delivery-note/index.js b/print/report/delivery-note/index.js deleted file mode 100755 index 34c80b1f8..000000000 --- a/print/report/delivery-note/index.js +++ /dev/null @@ -1,35 +0,0 @@ -const database = require(`${appPath}/lib/database`); -const UserException = require(`${appPath}/lib/exceptions/userException`); - -module.exports = { - name: 'delivery-note', - async asyncData(ctx, params) { - const promises = []; - const dataIndex = promises.push(this.methods.fetchData()) - 1; - const itemsIndex = promises.push(this.methods.fetchItems()) - 1; - - return Promise.all(promises).then(result => { - const [[data]] = result[dataIndex]; - const [[items]] = result[itemsIndex]; - - return { - id1: data.id, - id2: items.id, - }; - }); - }, - data() { - return { - id: null, - }; - }, - methods: { - fetchData() { - return database.pool.query('SELECT 1 AS id'); - }, - - fetchItems() { - return database.pool.query('SELECT 2 AS id'); - }, - }, -}; diff --git a/print/report/delivery-note/locale.js b/print/report/delivery-note/locale.js deleted file mode 100644 index ed35f8b4e..000000000 --- a/print/report/delivery-note/locale.js +++ /dev/null @@ -1,8 +0,0 @@ -module.exports = { - messages: { - es: { - clientId: 'Id cliente', - }, - }, -} -; \ No newline at end of file diff --git a/print/report/email-footer/index.js b/print/report/email-footer/index.js index 6cd80b610..22321dd7d 100755 --- a/print/report/email-footer/index.js +++ b/print/report/email-footer/index.js @@ -6,6 +6,9 @@ module.exports = { }; }, created() { + if (this.locale) + this.$i18n.locale = this.locale; + const embeded = []; this.files.map(file => { const src = this.isPreview ? `/api/${file}` : `cid:${file}`; @@ -27,4 +30,5 @@ module.exports = { ], }; }, + props: ['locale'] }; diff --git a/print/report/email-footer/locale.js b/print/report/email-footer/locale.js index 5782783e8..7e8aa401d 100644 --- a/print/report/email-footer/locale.js +++ b/print/report/email-footer/locale.js @@ -19,5 +19,24 @@ module.exports = { escrito al domicilio social de la entidad. La finalidad del fichero es la gestión administrativa, contabilidad, y facturación.`, }, }, + /* fr: { + buttons: { + webAcccess: 'Visitez notre site web', + info: 'Ayúdanos a mejorar', + }, + privacy: { + fiscalAddress: 'VERDNATURA LEVANTE SL, B97367486 Avda. Espioca, 100, 46460 Silla · www.verdnatura.es · clientes@verdnatura.es', + disclaimer: `- AVISO - Ce message est privé et confidentiel et doit être utilisé. + exclusivamente por la persona destinataria del mismo. Si has recibido este mensaje + por error, te rogamos lo comuniques al remitente y borres dicho mensaje y cualquier documento + adjunto que pudiera contener. Verdnatura Levante SL no renuncia a la confidencialidad ni a + ningún privilegio por causa de transmisión errónea o mal funcionamiento. Igualmente no se hace + responsable de los cambios, alteraciones, errores u omisiones que pudieran hacerse al mensaje una vez enviado.`, + law: `En cumplimiento de lo dispuesto en la Ley Orgánica 15/1999, de Protección de Datos de Carácter Personal, + te comunicamos que los datos personales que facilites 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.`, + }, + }, */ }, }; diff --git a/print/report/letter-debtor-nd/index.html b/print/report/letter-debtor-nd/index.html index 384def01f..f7d4c39b3 100644 --- a/print/report/letter-debtor-nd/index.html +++ b/print/report/letter-debtor-nd/index.html @@ -52,7 +52,7 @@

- + diff --git a/print/report/letter-debtor-nd/index.js b/print/report/letter-debtor-nd/index.js index 49aa46bbf..b68e9cc93 100755 --- a/print/report/letter-debtor-nd/index.js +++ b/print/report/letter-debtor-nd/index.js @@ -30,7 +30,8 @@ module.exports = { }); }, created() { - this.$i18n.locale = this.locale; + if (this.locale) + this.$i18n.locale = this.locale; }, methods: { fetchClient(clientFk, companyFk) { diff --git a/print/report/letter-debtor-st/index.html b/print/report/letter-debtor-st/index.html index 73e220563..e87a2f9f1 100644 --- a/print/report/letter-debtor-st/index.html +++ b/print/report/letter-debtor-st/index.html @@ -35,7 +35,7 @@

- + diff --git a/print/report/letter-debtor-st/index.js b/print/report/letter-debtor-st/index.js index a1a4d8833..8d6ca0362 100755 --- a/print/report/letter-debtor-st/index.js +++ b/print/report/letter-debtor-st/index.js @@ -31,7 +31,8 @@ module.exports = { }); }, created() { - this.$i18n.locale = this.locale; + if (this.locale) + this.$i18n.locale = this.locale; }, methods: { fetchClient(clientFk, companyFk) { diff --git a/print/report/payment-update/index.html b/print/report/payment-update/index.html index f74a51493..2f0f130ed 100644 --- a/print/report/payment-update/index.html +++ b/print/report/payment-update/index.html @@ -38,7 +38,7 @@

{{ $t('notifyAnError') }}

- + diff --git a/print/report/payment-update/index.js b/print/report/payment-update/index.js index 05c0bb64a..23218ec89 100755 --- a/print/report/payment-update/index.js +++ b/print/report/payment-update/index.js @@ -21,7 +21,8 @@ module.exports = { }); }, created() { - this.$i18n.locale = this.locale; + if (this.locale) + this.$i18n.locale = this.locale; }, methods: { fetchClient(clientFk) { diff --git a/print/report/printer-setup/index.html b/print/report/printer-setup/index.html index 1bf622186..52a0535a4 100644 --- a/print/report/printer-setup/index.html +++ b/print/report/printer-setup/index.html @@ -49,7 +49,7 @@

- + diff --git a/print/report/printer-setup/index.js b/print/report/printer-setup/index.js index aaf0a4d5d..eedb83f80 100755 --- a/print/report/printer-setup/index.js +++ b/print/report/printer-setup/index.js @@ -19,7 +19,8 @@ module.exports = { }); }, created() { - this.$i18n.locale = this.locale; + if (this.locale) + this.$i18n.locale = this.locale; }, data() { return { diff --git a/print/report/report-footer/index.js b/print/report/report-footer/index.js index 1ba36b1d7..f2eb42d66 100755 --- a/print/report/report-footer/index.js +++ b/print/report/report-footer/index.js @@ -1,4 +1,8 @@ module.exports = { name: 'report-footer', - props: ['leftText', 'centerText'] + created() { + if (this.locale) + this.$i18n.locale = this.locale; + }, + props: ['leftText', 'centerText', 'locale'] }; diff --git a/print/report/report-header/index.js b/print/report/report-header/index.js index 5928a678e..8eae2e25a 100755 --- a/print/report/report-header/index.js +++ b/print/report/report-header/index.js @@ -1,6 +1,9 @@ module.exports = { name: 'report-header', created() { + if (this.locale) + this.$i18n.locale = this.locale; + const embeded = []; this.files.map(file => { embeded[file] = `file://${__dirname + file}`; @@ -12,4 +15,5 @@ module.exports = { files: ['/assets/images/report-logo.svg'], }; }, + props: ['locale'] }; diff --git a/print/report/rpt-claim-pickup-order/index.html b/print/report/rpt-claim-pickup-order/index.html index c5001c984..568d972d9 100644 --- a/print/report/rpt-claim-pickup-order/index.html +++ b/print/report/rpt-claim-pickup-order/index.html @@ -75,7 +75,8 @@ + :center-text="clientName" + :locale="locale"> diff --git a/print/report/rpt-claim-pickup-order/index.js b/print/report/rpt-claim-pickup-order/index.js index 686a40cd3..8c172aa9c 100755 --- a/print/report/rpt-claim-pickup-order/index.js +++ b/print/report/rpt-claim-pickup-order/index.js @@ -27,7 +27,8 @@ module.exports = { }); }, created() { - this.$i18n.locale = this.locale; + if (this.locale) + this.$i18n.locale = this.locale; }, methods: { dated: () => { diff --git a/print/report/rpt-delivery-note/assets/css/index.js b/print/report/rpt-delivery-note/assets/css/index.js new file mode 100644 index 000000000..d40ab4984 --- /dev/null +++ b/print/report/rpt-delivery-note/assets/css/index.js @@ -0,0 +1,7 @@ +const CssReader = require(`${appPath}/lib/cssReader`); + +module.exports = new CssReader([ + `${appPath}/common/css/layout.css`, + `${appPath}/common/css/misc.css`, + `${__dirname}/style.css`]) + .mergeStyles(); diff --git a/print/report/rpt-delivery-note/assets/css/style.css b/print/report/rpt-delivery-note/assets/css/style.css new file mode 100644 index 000000000..05dbab652 --- /dev/null +++ b/print/report/rpt-delivery-note/assets/css/style.css @@ -0,0 +1,14 @@ +.container { + color: #000 +} + +.title { + font-weight: 100; + margin-top: 0; + margin-bottom: 20px; + font-size: 2em +} + +table.column-oriented { + margin-top: 50px !important +} \ No newline at end of file diff --git a/print/report/rpt-delivery-note/index.html b/print/report/rpt-delivery-note/index.html new file mode 100644 index 000000000..fb59a88e1 --- /dev/null +++ b/print/report/rpt-delivery-note/index.html @@ -0,0 +1,86 @@ + + + +
+ +
+
+
+
+

{{$t('title')}}

+ + + + + + + + + + + + + + + +
{{$t('clientId')}}{{clientId}}
{{$t('ticketId')}}{{ticketId}}
{{$t('date')}}{{dated()}}
+
+
+
+
+
{{$t('clientData')}}
+
+

{{clientName}}

+
+ {{street}} +
+
+ {{postcode}}, {{city}} ({{province}}) +
+
+ {{country}} +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + +
{{$t('date')}}{{$t('concept')}}{{$t('invoiced')}}{{$t('payed')}}{{$t('balance')}}
{{toISOString(sale.issued)}}{{sale.ref}}{{sale.debtOut}}{{sale.debtIn}}{{a}}
+
+ + + +
+ + \ No newline at end of file diff --git a/print/report/rpt-delivery-note/index.js b/print/report/rpt-delivery-note/index.js new file mode 100755 index 000000000..1056fb1d1 --- /dev/null +++ b/print/report/rpt-delivery-note/index.js @@ -0,0 +1,72 @@ +const strftime = require('strftime'); +const database = require(`${appPath}/lib/database`); +const UserException = require(`${appPath}/lib/exceptions/userException`); + +module.exports = { + name: 'rpt-delivery-note', + async asyncData(ctx, params) { + const promises = []; + const data = {}; + + if (!params.ticketFk) + throw new UserException('No ticket id specified'); + + promises.push(this.methods.fetchClient(params.ticketFk)); + // promises.push(this.methods.fetchSales(params.ticketFk)); + + 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); + + return data; + }); + }, + created() { + if (this.locale) + this.$i18n.locale = this.locale; + }, + data() { + return {totalBalance: 0.00}; + }, + methods: { + fetchClient(ticketFk) { + return database.pool.query( + `SELECT + c.id clientId, + u.lang locale, + c.email AS recipient, + c.socialName AS clientName, + c.street, + c.postcode, + c.city, + c.fi, + p.name AS province, + ct.country + 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 + WHERE t.id = ?`, [ticketFk]); + }, + fetchSales(clientFk, companyFk) { + return database.pool.query( + `CALL vn.clientGetDebtDiary(?, ?)`, [clientFk, companyFk]); + }, + dated: () => { + return strftime('%d-%m-%Y', new Date()); + }, + toISOString: date => { + return strftime('%d-%m-%Y', date); + }, + }, + components: { + 'report-header': require('../report-header'), + 'report-footer': require('../report-footer'), + }, +}; diff --git a/print/report/rpt-delivery-note/locale.js b/print/report/rpt-delivery-note/locale.js new file mode 100644 index 000000000..d08c50144 --- /dev/null +++ b/print/report/rpt-delivery-note/locale.js @@ -0,0 +1,16 @@ +module.exports = { + messages: { + es: { + title: 'Albarán', + ticketId: 'Albarán', + clientId: 'Cliente', + clientData: 'Datos del cliente', + date: 'Fecha', + concept: 'Concepto', + invoiced: 'Facturado', + payed: 'Pagado', + balance: 'Saldo', + ticket: 'Albarán {0}' + }, + }, +}; diff --git a/print/report/rpt-letter-debtor/index.html b/print/report/rpt-letter-debtor/index.html index b65bfb97f..6ced7b98a 100644 --- a/print/report/rpt-letter-debtor/index.html +++ b/print/report/rpt-letter-debtor/index.html @@ -74,7 +74,8 @@ + :center-text="clientName" + :locale="locale"> diff --git a/print/report/rpt-letter-debtor/index.js b/print/report/rpt-letter-debtor/index.js index 2b72b6242..7fa049a9e 100755 --- a/print/report/rpt-letter-debtor/index.js +++ b/print/report/rpt-letter-debtor/index.js @@ -30,7 +30,8 @@ module.exports = { }); }, created() { - this.$i18n.locale = this.locale; + if (this.locale) + this.$i18n.locale = this.locale; }, data() { return {totalBalance: 0.00}; diff --git a/print/report/rpt-sepa-core/index.html b/print/report/rpt-sepa-core/index.html index 84b458eea..220346946 100644 --- a/print/report/rpt-sepa-core/index.html +++ b/print/report/rpt-sepa-core/index.html @@ -142,7 +142,8 @@ + :center-text="clientName" + :locale="locale"> diff --git a/print/report/sepa-core/index.js b/print/report/sepa-core/index.js index 3a281ec32..00fe18c3f 100755 --- a/print/report/sepa-core/index.js +++ b/print/report/sepa-core/index.js @@ -27,7 +27,8 @@ module.exports = { }); }, created() { - this.$i18n.locale = this.locale; + if (this.locale) + this.$i18n.locale = this.locale; }, methods: {