refs #084200 findOne
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Carlos Satorres 2023-03-27 15:15:15 +02:00
parent aad8fb0a66
commit 14f8f98fe9
1 changed files with 10 additions and 14 deletions

View File

@ -3,20 +3,16 @@ const db = require('../../database');
module.exports = {
name: 'report-footer',
async serverPrefetch() {
this.company = await this.getCompany(this.companyCode);
},
methods: {
getCompany(code) {
return db.findOne(`
SELECT
(SELECT ci.footnotes FROM companyI18n ci WHERE ci.companyFk = c.id) AS footnotes,
c.code
FROM company c
JOIN companyGroup cg ON cg.id = c.companyGroupFk
JOIN supplier s ON s.id = c.id
WHERE c.code = ?`);
}
const company = await db.findOne(`
SELECT
(SELECT ci.footnotes FROM companyI18n ci WHERE ci.companyFk = c.id) AS footnotes,
c.code
FROM company c
JOIN companyGroup cg ON cg.id = c.companyGroupFk
JOIN supplier s ON s.id = c.id
WHERE c.code = ?`, [this.companyCode]);
this.company = company;
},
props: ['leftText', 'companyCode', 'centerText']
};