33 lines
836 B
JavaScript
Executable File
33 lines
836 B
JavaScript
Executable File
const vnReport = require('../../../core/mixins/vn-report.js');
|
|
|
|
module.exports = {
|
|
name: 'entry-order',
|
|
mixins: [vnReport],
|
|
async serverPrefetch() {
|
|
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]);
|
|
},
|
|
data() {
|
|
return {totalBalance: 0.00};
|
|
},
|
|
methods: {
|
|
getTotal() {
|
|
let total = 0.00;
|
|
this.buys.forEach(buy => {
|
|
total += buy.quantity * buy.buyingValue;
|
|
});
|
|
|
|
return total;
|
|
}
|
|
},
|
|
props: {
|
|
id: {
|
|
type: Number,
|
|
required: true,
|
|
description: 'The entry id'
|
|
}
|
|
}
|
|
};
|