fix: refs #7748 solicitud de domiciliación bancaria
gitea/salix/pipeline/pr-master This commit looks good Details

This commit is contained in:
Carlos Andrés 2024-07-18 19:37:03 +02:00
parent 29e7d97878
commit 9003f2db91
3 changed files with 39 additions and 52 deletions

View File

@ -23,16 +23,5 @@ module.exports = {
type: Number, type: Number,
required: true required: true
} }
},
methods: {
getSupplierCif() {
return db.findOne(`
SELECT DISTINCT ad.value
FROM supplierAccount sa
JOIN accountDetail ad ON ad.supplierAccountFk = sa.id
JOIN accountDetailType adt ON adt.id = ad.accountDetailTypeFk AND adt.id = 3
WHERE sa.supplierFk = ?`) [this.companyId];
} }
}
}; };

View File

@ -1,19 +1,21 @@
SELECT SELECT c.id,
c.id,
m.code mandateCode, m.code mandateCode,
c.socialName, c.socialName,
c.street, c.street,
c.postcode, c.postcode,
c.city, c.city,
c.fi, c.fi,
p.name AS province, p.name province,
ct.name country, ct.name country,
ct.code AS countryCode, ct.code countryCode,
ct.ibanLength AS ibanLength ct.ibanLength ibanLength
FROM client c FROM client c
JOIN country ct ON ct.id = c.countryFk JOIN country ct ON ct.id = c.countryFk
LEFT JOIN mandate m ON m.clientFk = c.id
AND m.companyFk = ? AND m.finished IS NULL
LEFT JOIN province p ON p.id = c.provinceFk LEFT JOIN province p ON p.id = c.provinceFk
WHERE (m.companyFk = ? OR m.companyFk IS NULL) AND c.id = ? LEFT JOIN mandate m ON m.clientFk = c.id
ORDER BY m.created DESC LIMIT 1 AND m.companyFk = ?
AND m.finished IS NULL
WHERE (m.companyFk = ? OR m.companyFk IS NULL)
AND c.id = ?
ORDER BY m.created DESC
LIMIT 1

View File

@ -1,29 +1,25 @@
SELECT SELECT m.code mandateCode,
m.code mandateCode,
s.name, s.name,
s.street, s.street,
sc.name country, sc.name country,
s.postCode, s.postCode,
s.city, s.city,
sp.name province, sp.name province,
s.nif,
sa.supplierFk,
be.name bankName,
ad.value accountDetailValue ad.value accountDetailValue
FROM FROM client c
client c JOIN mandate m ON m.clientFk = c.id
LEFT JOIN mandate m ON m.clientFk = c.id AND m.companyFk = ? AND m.finished IS NULL JOIN mandateType mt ON mt.id = m.mandateTypeFk
LEFT JOIN supplier s ON s.id = m.companyFk JOIN supplier s ON s.id = m.companyFk
LEFT JOIN country sc ON sc.id = s.countryFk LEFT JOIN country sc ON sc.id = s.countryFk
LEFT JOIN province sp ON sp.id = s.provinceFk LEFT JOIN province sp ON sp.id = s.provinceFk
LEFT JOIN province p ON p.id = c.provinceFk JOIN supplierAccount sa ON sa.supplierFk = s.id
LEFT JOIN supplierAccount sa ON sa.supplierFk = s.id JOIN accountDetail ad ON ad.supplierAccountFk = sa.id
LEFT JOIN bankEntity be ON sa.bankEntityFk = be.id JOIN accountDetailType adt ON adt.id = ad.accountDetailTypeFk
LEFT JOIN accountDetail ad ON ad.supplierAccountFk = sa.id WHERE m.companyFk = ?
JOIN accountDetailType adt ON adt.id = ad.accountDetailTypeFk AND adt.id = 3 AND m.finished IS NULL
WHERE AND c.id = ?
(m.companyFk = ? OR m.companyFk IS NULL) AND mt.name = 'CORE'
AND (c.id = ? OR (c.id IS NULL AND c.countryFk = sa.countryFk)) AND adt.description = 'Referencia Remesas'
GROUP BY ad.value GROUP BY m.id
ORDER BY ORDER BY m.created DESC
m.created DESC; LIMIT 1;