6976-supplierConsumption #2365
|
@ -6,5 +6,4 @@ SELECT
|
|||
FROM vn.entry e
|
||||
JOIN vn.travel t ON t.id = e.travelFk
|
||||
WHERE e.supplierFk = ? AND DATE(t.shipped) BETWEEN ? AND ?
|
||||
ORDER BY
|
||||
t.shipped DESC;
|
||||
ORDER BY t.shipped DESC;
|
||||
|
|
|
@ -65,6 +65,8 @@
|
|||
<span v-if="buy.value5"> <strong>{{buy.tag5}}</strong> {{buy.value5}} </span>
|
||||
<span v-if="buy.value6"> <strong>{{buy.tag6}}</strong> {{buy.value6}} </span>
|
||||
<span v-if="buy.value7"> <strong>{{buy.tag7}}</strong> {{buy.value7}} </span>
|
||||
<div>{{total.quantity}}</div>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
|
|
@ -7,9 +7,7 @@ module.exports = {
|
|||
this.supplier = await this.findOneFromDef('supplier', [this.id]);
|
||||
this.checkMainEntity(this.supplier);
|
||||
let entries = await this.rawSqlFromDef('entries', [this.id, this.from, this.to]);
|
||||
let totalEntry;
|
||||
let total;
|
||||
|
||||
this.total = {quantity: 0, price: 0};
|
||||
const entriesId = [];
|
||||
|
||||
for (let entry of entries)
|
||||
|
@ -25,26 +23,13 @@ module.exports = {
|
|||
const entry = entriesMap.get(buy.entryFk);
|
||||
if (entry) {
|
||||
if (!entry.buys) entry.buys = [];
|
||||
|
||||
this.total.quantity = this.total.quantity + buy.quantity;
|
||||
this.total.price = this.total.price + (buy.price * buy.quantity);
|
||||
entry.buys.push(buy);
|
||||
}
|
||||
}
|
||||
|
||||
this.entries = entries;
|
||||
|
||||
// for (let buy of entry.buys)
|
||||
// total += buy.total;
|
||||
|
||||
// getTotal(entry) {
|
||||
// if (entry.buys) {
|
||||
// let total = 0;
|
||||
// for (let buy of entry.buys)
|
||||
// total += buy.total;
|
||||
|
||||
// return total;
|
||||
// }
|
||||
// console.log('total', total);
|
||||
// };
|
||||
},
|
||||
getTotal(entry) {
|
||||
if (entry.buys) {
|
||||
|
@ -54,7 +39,6 @@ module.exports = {
|
|||
|
||||
return total;
|
||||
}
|
||||
console.log('total', total);
|
||||
},
|
||||
props: {
|
||||
id: {
|
||||
|
|
Loading…
Reference in New Issue