salix/print/templates/reports/entry-order/entry-order.js

33 lines
836 B
JavaScript
Raw Normal View History

2023-01-23 12:15:30 +00:00
const vnReport = require('../../../core/mixins/vn-report.js');
2020-02-20 08:31:09 +00:00
module.exports = {
name: 'entry-order',
2023-01-23 12:15:30 +00:00
mixins: [vnReport],
2020-02-20 08:31:09 +00:00
async serverPrefetch() {
2023-01-23 12:15:30 +00:00
this.entry = await this.findOneFromDef('entry', [this.id]);
this.checkMainEntity(this.entry);
this.supplier = await this.findOneFromDef('supplier', [this.id]);
this.buys = await this.rawSqlFromDef('buys', [this.id]);
2020-02-20 08:31:09 +00:00
},
data() {
return {totalBalance: 0.00};
},
methods: {
getTotal() {
let total = 0.00;
this.buys.forEach(buy => {
total += buy.quantity * buy.buyingValue;
});
return total;
}
},
props: {
2022-09-26 11:33:27 +00:00
id: {
2022-10-28 13:53:57 +00:00
type: Number,
2022-09-26 11:33:27 +00:00
required: true,
description: 'The entry id'
2020-02-20 08:31:09 +00:00
}
}
};