refs #5525 mod yml y sql #1491

Merged
carlossa merged 41 commits from 5525-ibanSEPA-CORE into dev 2024-01-16 13:14:39 +00:00
1 changed files with 22 additions and 6 deletions
Showing only changes of commit ea31d3bebb - Show all commits

View File

@ -7,12 +7,28 @@ module.exports = {
name: 'letter-debtor-nd',
async serverPrefetch() {
this.debtor = await db.findOne(`
SELECT sa.iban, be.name bankName
FROM supplierAccount sa
LEFT JOIN bankEntity be ON sa.bankEntityFk = be.id
LEFT JOIN client c ON c.countryFk = sa.countryFk
WHERE c.id = ? OR (c.id IS NULL AND c.countryFk = sa.countryFk)`,
[this.id]);
SELECT sa.iban,
be.name bankName,
sa.countryFk,
c.countryFk
FROM supplierAccount sa
JOIN bankEntity be ON sa.bankEntityFk = be.id
LEFT JOIN company co ON co.supplierAccountFk = sa.id
LEFT JOIN client c ON c.countryFk = sa.countryFk
WHERE c.id = ?
ORDER BY co.id DESC
LIMIT 1;
`, [this.id]);
if (!this.debtor.length) {
this.debtor = await db.findOne(`
SELECT sa.iban,
be.name bankName
FROM supplierAccount sa
JOIN bankEntity be ON sa.bankEntityFk = be.id
JOIN company co ON co.supplierAccountFk = sa.id
WHERE co.code = ?;
`, [this.companyCode]);
}
},
data() {
return {