This commit is contained in:
parent
c453935ddd
commit
5b5191a6a5
|
@ -1,14 +1,18 @@
|
|||
const Component = require(`vn-print/core/component`);
|
||||
const emailBody = new Component('email-body');
|
||||
const attachment = new Component('attachment');
|
||||
const db = require('../../../core/database');
|
||||
|
||||
module.exports = {
|
||||
name: 'letter-debtor-st',
|
||||
async serverPrefetch() {
|
||||
this.debtor = await this.fetchDebtor(this.id, this.companyId);
|
||||
|
||||
if (!this.debtor)
|
||||
throw new Error('Something went wrong');
|
||||
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]);
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
|
Loading…
Reference in New Issue