salix/print/templates/reports/balance-compensation/balance-compensation.js

37 lines
1.0 KiB
JavaScript
Raw Normal View History

2022-10-28 12:49:22 +00:00
const Component = require(`vn-print/core/component`);
const reportHeader = new Component('report-header');
const reportFooter = new Component('report-footer');
module.exports = {
2022-11-02 14:54:23 +00:00
name: 'balance-compensation',
2022-10-28 12:49:22 +00:00
async serverPrefetch() {
this.client = await this.fetchClient(this.id);
2022-11-02 14:54:23 +00:00
this.company = await this.fetchCompany();
2022-10-28 12:49:22 +00:00
},
methods: {
fetchClient(id) {
return this.findOneFromDef('client', [id]);
},
2022-11-02 14:54:23 +00:00
fetchCompany() {
return this.findOneFromDef('company');
},
2022-10-28 12:49:22 +00:00
currentDate() {
const current = new Date();
const date = `${current.getDate()}/${current.getMonth()+1}/${current.getFullYear()}`;
return date;
}
},
components: {
'report-header': reportHeader.build(),
'report-footer': reportFooter.build()
},
props: {
id: {
2022-11-02 14:54:23 +00:00
type: Number,
2022-10-28 12:49:22 +00:00
required: true,
description: 'The receipt id'
}
}
};