var path = require('path'); var database = require(path.join(__dirname, '../../database.js')); var format = require(path.join(__dirname, '../../util/format.js')); module.exports = class LetterDebtorSt { getData(params, cb) { let query = `SELECT sa.iban, be.name AS bankName, LOWER(ct.code) countryCode, c.email recipient FROM client c JOIN company AS cny JOIN supplierAccount AS sa ON sa.id = cny.supplierAccountFk JOIN bankEntity be ON be.id = sa.bankEntityFk JOIN country ct ON ct.id = c.countryFk WHERE c.id = ? AND cny.id = ?`; this.clientId = params.clientId; this.companyId = params.companyId; this.token = params.token; database.pool.query(query, [params.clientId, params.companyId], (error, result) => { if (error || result.length == 0) return cb(new Error('No template data found')); Object.assign(this, result[0]); cb(); }); } get previewAttachments() { if (this.isPreview) return `` + '
Descargar adjunto
' + 'extracto.pdf
'; } };