refs #6976 entity quantity price

This commit is contained in:
Carlos Satorres 2024-04-22 12:54:48 +02:00
parent b706d1c1c6
commit 0537a3eca3
3 changed files with 6 additions and 21 deletions

View File

@ -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;

View File

@ -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>

View File

@ -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: {