fix: refs#7748 solicitud de domiciliación bancaria #2752

Merged
carlosap merged 7 commits from 7748-Modificar-solicitud-de-domiciliación-bancaria into master 2024-07-19 09:43:16 +00:00
3 changed files with 39 additions and 52 deletions
Showing only changes of commit 9003f2db91 - Show all commits

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 LEFT JOIN province p ON p.id = c.provinceFk
AND m.companyFk = ? AND m.finished IS NULL LEFT JOIN mandate m ON m.clientFk = c.id
LEFT JOIN province p ON p.id = c.provinceFk AND m.companyFk = ?
WHERE (m.companyFk = ? OR m.companyFk IS NULL) AND c.id = ? AND m.finished IS NULL
ORDER BY m.created DESC LIMIT 1 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, ad.value accountDetailValue
s.nif, FROM client c
sa.supplierFk, JOIN mandate m ON m.clientFk = c.id
be.name bankName, JOIN mandateType mt ON mt.id = m.mandateTypeFk
ad.value accountDetailValue JOIN supplier s ON s.id = m.companyFk
FROM LEFT JOIN country sc ON sc.id = s.countryFk
client c LEFT JOIN province sp ON sp.id = s.provinceFk
LEFT JOIN mandate m ON m.clientFk = c.id AND m.companyFk = ? AND m.finished IS NULL JOIN supplierAccount sa ON sa.supplierFk = s.id
LEFT JOIN supplier s ON s.id = m.companyFk JOIN accountDetail ad ON ad.supplierAccountFk = sa.id
LEFT JOIN country sc ON sc.id = s.countryFk JOIN accountDetailType adt ON adt.id = ad.accountDetailTypeFk
LEFT JOIN province sp ON sp.id = s.provinceFk WHERE m.companyFk = ?
LEFT JOIN province p ON p.id = c.provinceFk AND m.finished IS NULL
LEFT JOIN supplierAccount sa ON sa.supplierFk = s.id AND c.id = ?
LEFT JOIN bankEntity be ON sa.bankEntityFk = be.id AND mt.name = 'CORE'
LEFT JOIN accountDetail ad ON ad.supplierAccountFk = sa.id AND adt.description = 'Referencia Remesas'
JOIN accountDetailType adt ON adt.id = ad.accountDetailTypeFk AND adt.id = 3 GROUP BY m.id
WHERE ORDER BY m.created DESC
(m.companyFk = ? OR m.companyFk IS NULL) LIMIT 1;
AND (c.id = ? OR (c.id IS NULL AND c.countryFk = sa.countryFk))
GROUP BY ad.value
ORDER BY
m.created DESC;