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

38 lines
1.1 KiB
JavaScript

const vnReport = require('../../../core/mixins/vn-report.js');
const app = require('vn-loopback/server/server');
module.exports = {
name: 'balance-compensation',
mixins: [vnReport],
async serverPrefetch() {
this.receipt = await app.models.Receipt.findOne({
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);
},
props: {
id: {
type: Number,
required: true,
description: 'The receipt id'
}
}
};