2023-01-23 12:15:30 +00:00
|
|
|
const vnReport = require('../../../core/mixins/vn-report.js');
|
2023-02-17 08:11:20 +00:00
|
|
|
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() {
|
2023-02-17 08:11:20 +00:00
|
|
|
this.receipt = await app.models.Receipt.findOne({
|
2023-03-10 06:46:36 +00:00
|
|
|
fields: ['amountPaid', 'payed', 'clientFk', 'companyFk', 'description'],
|
2023-02-17 08:11:20 +00:00
|
|
|
include: [
|
|
|
|
{
|
|
|
|
relation: 'client',
|
|
|
|
scope: {
|
|
|
|
fields: ['name', 'street', 'fi', 'city'],
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
relation: 'supplier',
|
|
|
|
scope: {
|
|
|
|
fields: ['name', 'street', 'nif', 'city'],
|
|
|
|
}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
where: {id: this.id}
|
|
|
|
});
|
|
|
|
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'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|