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