From 344b5d984a3de6fe2484ffa5dc629c1ddaa2e99e Mon Sep 17 00:00:00 2001 From: carlossa Date: Thu, 27 Jul 2023 17:19:44 +0200 Subject: [PATCH] refs #5525 add nif iban --- .../reports/sepa-core/sepa-core.html | 2 +- .../reports/sepa-core/sql/supplier.sql | 31 ++++++++++++------- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/print/templates/reports/sepa-core/sepa-core.html b/print/templates/reports/sepa-core/sepa-core.html index 1b2ad13d9..363ebdfe5 100644 --- a/print/templates/reports/sepa-core/sepa-core.html +++ b/print/templates/reports/sepa-core/sepa-core.html @@ -27,7 +27,7 @@ {{$t('supplier.identifier')}} -
{{$t('supplier.iban')}}
+
{{supplier.iban}}
{{supplier.nif}}
diff --git a/print/templates/reports/sepa-core/sql/supplier.sql b/print/templates/reports/sepa-core/sql/supplier.sql index 55b0e49ca..d93175118 100644 --- a/print/templates/reports/sepa-core/sql/supplier.sql +++ b/print/templates/reports/sepa-core/sql/supplier.sql @@ -1,17 +1,24 @@ SELECT - m.code mandateCode, - s.name, - s.street, - sc.country, - s.postCode, - s.city, - sp.name province -FROM client c - LEFT JOIN mandate m ON m.clientFk = c.id - AND m.companyFk = ? AND m.finished IS NULL + m.code AS mandateCode, + s.name, + s.street, + sc.country, + s.postCode, + s.city, + sp.name AS province, + s.nif, + sa.iban, + be.name AS bankName +FROM + client c + LEFT JOIN mandate m ON m.clientFk = c.id AND m.companyFk = ? AND m.finished IS NULL LEFT JOIN supplier s ON s.id = m.companyFk LEFT JOIN country sc ON sc.id = s.countryFk LEFT JOIN province sp ON sp.id = s.provinceFk LEFT JOIN province p ON p.id = c.provinceFk -WHERE (m.companyFk = ? OR m.companyFk IS NULL) AND c.id = ? -ORDER BY m.created DESC LIMIT 1 \ No newline at end of file + LEFT JOIN bankEntity be ON sa.supplierFk = s.id + LEFT JOIN supplierAccount sa ON sa.bankEntityFk = be.id + WHERE (m.companyFk = ? OR m.companyFk IS NULL) AND c.id = ? OR (c.id IS NULL AND c.countryFk = sa.countryFk) + ORDER BY + m.created DESC + LIMIT 1;