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

38 lines
1.1 KiB
JavaScript
Raw Permalink Normal View History

2023-01-23 12:15:30 +00:00
const vnReport = require('../../../core/mixins/vn-report.js');
const app = require('vn-loopback/server/server');
2022-10-28 12:49:22 +00:00
module.exports = {
2022-11-02 14:54:23 +00:00
name: 'balance-compensation',
2023-01-23 12:15:30 +00:00
mixins: [vnReport],
2022-10-28 12:49:22 +00:00
async serverPrefetch() {
this.receipt = await app.models.Receipt.findOne({
2023-03-10 06:46:36 +00:00
fields: ['amountPaid', 'payed', 'clientFk', 'companyFk', 'description'],
include: [
{
relation: 'client',
scope: {
fields: ['name', 'street', 'fi', 'city'],
}
}, {
relation: 'supplier',
scope: {
fields: ['name', 'street', 'nif', 'city'],
}
}
],
where: {id: this.id}
});
this.client = this.receipt.client();
this.company = this.receipt.supplier();
this.checkMainEntity(this.receipt);
2022-10-28 12:49:22 +00:00
},
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'
}
}
};