This commit is contained in:
parent
e5b7ebd8b4
commit
87bef62e35
|
@ -51,7 +51,6 @@ BEGIN
|
|||
(INDEX (id))
|
||||
SELECT s.ticketFk futureId,
|
||||
t2.ticketFk id,
|
||||
sum((s.quantity <= IFNULL(st.amount,0))) hasStock,
|
||||
count(DISTINCT s.id) saleCount,
|
||||
t2.state,
|
||||
t2.isNotValidated,
|
||||
|
@ -65,32 +64,34 @@ BEGIN
|
|||
t2.shipped,
|
||||
t.shipped futureShipped,
|
||||
t2.totalWithVat,
|
||||
t.totalWithVat futureTotalWithVat
|
||||
t.totalWithVat futureTotalWithVat,
|
||||
t2.hasStock
|
||||
FROM vn.ticket t
|
||||
JOIN vn.ticketState ts ON ts.ticketFk = t.id
|
||||
JOIN vn.state st ON st.id = ts.stateFk
|
||||
JOIN vn.saleVolume sv ON t.id = sv.ticketFk
|
||||
JOIN (SELECT
|
||||
t2.id ticketFk,
|
||||
t2.addressFk,
|
||||
st.isNotValidated,
|
||||
st.name state,
|
||||
GROUP_CONCAT(DISTINCT ipt.code ORDER BY ipt.code) ipt,
|
||||
t2.shipped,
|
||||
t2.totalWithVat
|
||||
t2.id ticketFk,
|
||||
t2.addressFk,
|
||||
st.isNotValidated,
|
||||
st.name state,
|
||||
GROUP_CONCAT(DISTINCT ipt.code ORDER BY ipt.code) ipt,
|
||||
t2.shipped,
|
||||
t2.totalWithVat,
|
||||
sum((s.quantity <= IFNULL(st.amount,0))) hasStock
|
||||
FROM vn.ticket t2
|
||||
JOIN vn.sale s ON s.ticketFk = t2.id
|
||||
JOIN vn.item i ON i.id = s.itemFk
|
||||
JOIN vn.ticketState ts ON ts.ticketFk = t2.id
|
||||
JOIN vn.state st ON st.id = ts.stateFk
|
||||
LEFT JOIN vn.itemPackingType ipt ON ipt.code = i.itemPackingTypeFk
|
||||
LEFT JOIN tmp.stock st ON st.itemFk = s.itemFk
|
||||
WHERE t2.shipped BETWEEN vDateToAdvance AND util.dayend(vDateToAdvance)
|
||||
AND t2.warehouseFk = vWarehouseFk
|
||||
GROUP BY t2.id) t2 ON t2.addressFk = t.addressFk
|
||||
JOIN vn.sale s ON s.ticketFk = t.id
|
||||
JOIN vn.item i ON i.id = s.itemFk
|
||||
LEFT JOIN vn.itemPackingType ipt ON ipt.code = i.itemPackingTypeFk
|
||||
LEFT JOIN tmp.stock st ON st.itemFk = s.itemFk
|
||||
WHERE t.shipped BETWEEN vDateFuture AND util.dayend(vDateFuture)
|
||||
AND t.warehouseFk = vWarehouseFk
|
||||
GROUP BY t.id;
|
||||
|
|
|
@ -55,6 +55,9 @@
|
|||
<th field="futureState">
|
||||
<span translate>State</span>
|
||||
</th>
|
||||
<th field="hasStock">
|
||||
<span>Stock</span>
|
||||
</th>
|
||||
<th field="totalWithVat">
|
||||
<span translate>Import</span>
|
||||
</th>
|
||||
|
@ -73,9 +76,6 @@
|
|||
<th field="liters">
|
||||
<span translate>Liters</span>
|
||||
</th>
|
||||
<th field="hasStock">
|
||||
<span>Stock</span>
|
||||
</th>
|
||||
<th field="lines">
|
||||
<span translate>Lines</span>
|
||||
</th>
|
||||
|
@ -111,6 +111,7 @@
|
|||
{{::ticket.futureState | dashIfEmpty}}
|
||||
</span>
|
||||
</td>
|
||||
<td>{{::ticket.hasStock | dashIfEmpty}}</td>
|
||||
<td>
|
||||
<span class="chip {{$ctrl.totalPriceColor(ticket.futureTotalWithVat)}}">
|
||||
{{::(ticket.futureTotalWithVat ? ticket.futureTotalWithVat : 0) | currency: 'EUR': 2}}
|
||||
|
@ -136,7 +137,6 @@
|
|||
</span>
|
||||
</td>
|
||||
<td>{{::ticket.liters | dashIfEmpty}}</td>
|
||||
<td>{{::ticket.hasStock | dashIfEmpty}}</td>
|
||||
<td>{{::ticket.lines | dashIfEmpty}}</td>
|
||||
<td>
|
||||
<span class="chip {{$ctrl.totalPriceColor(ticket.totalWithVat)}}">
|
||||
|
|
Loading…
Reference in New Issue