refs #5525 mod yml y sql #1491
|
@ -1,3 +1,7 @@
|
|||
ALTER TABLE `vn`.`supplierAccount` ADD COLUMN `countryFk` mediumint(8) unsigned NULL;
|
||||
|
||||
|
||||
|
||||
ALTER TABLE `vn`.`supplierAccount` ADD CONSTRAINT `supplierAccount_fk_country` FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`);
|
||||
ALTER TABLE `vn`.`company` MODIFY COLUMN `supplierAccountFk` mediumint(8) unsigned DEFAULT NULL NULL COMMENT 'Cuenta por defecto para ingresos desde este pais';
|
||||
d
|
||||
|
|
|
@ -7,10 +7,11 @@ module.exports = {
|
|||
name: 'letter-debtor-st',
|
||||
async serverPrefetch() {
|
||||
this.debtor = await db.findOne(`
|
||||
SELECT sa.iban FROM client c
|
||||
LEFT JOIN supplierAccount sa ON c.countryFk = sa.countryFk
|
||||
WHERE c.id = ?
|
||||
OR (c.id IS NULL AND c.countryFk = sa.countryFk)`,
|
||||
SELECT sa.iban, be.name bankName
|
||||
FROM supplierAccount sa
|
||||
JOIN bankEntity be ON sa.bankEntityFk = be.id
|
||||
JOIN client c ON c.countryFk = sa.countryFk
|
||||
WHERE c.id = ? OR (c.id IS NULL AND c.countryFk = sa.countryFk);`,
|
||||
[this.id]);
|
||||
},
|
||||
data() {
|
||||
|
|
Loading…
Reference in New Issue