From 4ed31f51727c776cb1d018e970290a7d7e0f3dcd Mon Sep 17 00:00:00 2001 From: carlosjr Date: Mon, 19 Jul 2021 10:42:12 +0200 Subject: [PATCH] added footerr to report --- .../reports/credit-request/credit-request.html | 7 +++++++ .../reports/credit-request/credit-request.js | 15 ++++++++++++++- .../reports/credit-request/sql/client.sql | 13 +++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 print/templates/reports/credit-request/sql/client.sql diff --git a/print/templates/reports/credit-request/credit-request.html b/print/templates/reports/credit-request/credit-request.html index c377ad81ab..6f9441c449 100644 --- a/print/templates/reports/credit-request/credit-request.html +++ b/print/templates/reports/credit-request/credit-request.html @@ -176,6 +176,13 @@ + + + diff --git a/print/templates/reports/credit-request/credit-request.js b/print/templates/reports/credit-request/credit-request.js index 09a170bd65..d6a40b37c4 100755 --- a/print/templates/reports/credit-request/credit-request.js +++ b/print/templates/reports/credit-request/credit-request.js @@ -1,10 +1,23 @@ const Component = require(`${appPath}/core/component`); const reportHeader = new Component('report-header'); +const reportFooter = new Component('report-footer'); const rptCreditRequest = { name: 'credit-request', + async serverPrefetch() { + this.client = await this.fetchClient(this.recipientId); + + if (!this.client) + throw new Error('Something went wrong'); + }, + methods: { + fetchClient(clientId) { + return this.findOneFromDef('client', [clientId]); + } + }, components: { - 'report-header': reportHeader.build() + 'report-header': reportHeader.build(), + 'report-footer': reportFooter.build() } }; diff --git a/print/templates/reports/credit-request/sql/client.sql b/print/templates/reports/credit-request/sql/client.sql new file mode 100644 index 0000000000..d675cf168d --- /dev/null +++ b/print/templates/reports/credit-request/sql/client.sql @@ -0,0 +1,13 @@ +SELECT + c.id, + c.socialName, + c.street, + c.postcode, + c.city, + c.fi, + p.name AS province, + ct.country +FROM client c + JOIN country ct ON ct.id = c.countryFk + LEFT JOIN province p ON p.id = c.provinceFk +WHERE c.id = ? \ No newline at end of file