This commit is contained in:
parent
c453935ddd
commit
5b5191a6a5
|
@ -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-st',
|
name: 'letter-debtor-st',
|
||||||
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