Merge pull request '6976-supplierConsumption' (!2365) from 6976-supplierConsumption into dev
gitea/salix/pipeline/head This commit looks good Details

Reviewed-on: #2365
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
This commit is contained in:
Carlos Satorres 2024-04-26 07:04:53 +00:00
commit dab69cc9a3
4 changed files with 21 additions and 4 deletions

View File

@ -18,3 +18,8 @@ h2 {
.description strong {
text-transform: uppercase;
}
.black {
color: black;
}

View File

@ -6,3 +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;

View File

@ -37,7 +37,10 @@
</div>
<div v-for="entry in entries" v-if="entry.buys">
<h2>
<span>{{$t('entry')}} {{entry.id}}</span>
<span>
<span>{{$t('entry')}}</span>
<span class="black"> {{entry.id}}</span>
</span>
<span>{{$t('dated')}} {{formatDate(entry.shipped, '%d-%m-%Y')}}</span>
<span class="pull-right">{{$t('reference')}} {{entry.reference}}</span>
</h2>
@ -67,6 +70,13 @@
</tbody>
</table>
</div>
<table>
<tr class="font bold no-page-break">
<td>{{$t('total')}}</td>
<td class="number">{{total.price | currency('EUR', $i18n.locale)}}</td>
<td></td>
</tr>
</table>
</div>
</div>
<template v-slot:footer>

View File

@ -7,7 +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]);
this.total = {quantity: 0, price: 0};
const entriesId = [];
for (let entry of entries)
@ -23,7 +23,8 @@ 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);
}
}