This commit is contained in:
parent
56bbdd66ef
commit
cc6ffff018
|
@ -1,25 +0,0 @@
|
||||||
CREATE TABLE `supplierAccount` (
|
|
||||||
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
|
|
||||||
`supplierFk` int(11) DEFAULT NULL,
|
|
||||||
`iban` varchar(30) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
|
|
||||||
`office` varchar(4) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
|
|
||||||
`DC` varchar(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
|
|
||||||
`number` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
|
|
||||||
`description__` varchar(45) DEFAULT NULL COMMENT '@deprecated 2023-03-23',
|
|
||||||
`bankEntityFk` int(10) unsigned DEFAULT NULL,
|
|
||||||
`accountingFk` int(11) DEFAULT NULL,
|
|
||||||
`beneficiary` varchar(50) DEFAULT NULL,
|
|
||||||
`editorFk` int(10) unsigned DEFAULT NULL,
|
|
||||||
`countryFk` int(10) unsigned UNIQUE KEY COMMENT 'Cuenta por defecto para ingresos desde esta empresa',
|
|
||||||
`companyFk` int(10) unsigned UNIQUE KEY,
|
|
||||||
PRIMARY KEY (`id`),
|
|
||||||
KEY `fk_proveedores_proveedores_account_idx` (`supplierFk`),
|
|
||||||
KEY `fk_Proveedores_account_entity1_idx` (`bankEntityFk`),
|
|
||||||
KEY `fk_banco_prov_account_idx` (`accountingFk`),
|
|
||||||
KEY `supplierAccount_fk_editor` (`editorFk`),
|
|
||||||
CONSTRAINT `supplierAccount_FK` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE,
|
|
||||||
CONSTRAINT `supplierAccount_FK_1` FOREIGN KEY (`bankEntityFk`) REFERENCES `bankEntity` (`id`) ON UPDATE CASCADE,
|
|
||||||
CONSTRAINT `supplierAccount_fk_editor` FOREIGN KEY (`editorFk`) REFERENCES `account`.`user` (`id`),
|
|
||||||
CONSTRAINT `supplierAccount_FK_country` FOREIGN KEY (`countryFk`) REFERENCES `vn`.`country` (`id`),
|
|
||||||
CONSTRAINT `supplierAccount_FK_company` FOREIGN KEY (`companyFk`) REFERENCES `vn`.`company` (`id`)
|
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=242 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
|
|
|
@ -1,14 +1,18 @@
|
||||||
const Component = require(`vn-print/core/component`);
|
const Component = require(`vn-print/core/component`);
|
||||||
const emailBody = new Component('email-body');
|
const emailBody = new Component('email-body');
|
||||||
const attachment = new Component('attachment');
|
const attachment = new Component('attachment');
|
||||||
|
const db = require('../../../core/database');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'letter-debtor-nd',
|
name: 'letter-debtor-nd',
|
||||||
async serverPrefetch() {
|
async serverPrefetch() {
|
||||||
this.debtor = await this.fetchDebtor(this.id, this.companyId);
|
this.debtor = await db.findOne(`
|
||||||
|
SELECT sa.iban, be.name bankName
|
||||||
if (!this.debtor)
|
FROM supplierAccount sa
|
||||||
throw new Error('Something went wrong');
|
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]);
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Reference in New Issue