6976-supplierConsumption #2365

Merged
carlossa merged 8 commits from 6976-supplierConsumption into dev 2024-04-26 07:04:55 +00:00
3 changed files with 6 additions and 21 deletions
Showing only changes of commit 0537a3eca3 - Show all commits

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