fix: refs #7126 Added addressWaste type
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Guillermo Bonet 2024-07-09 11:40:24 +02:00
parent b9d04e9557
commit 769ee33ab2
1 changed files with 3 additions and 10 deletions

View File

@ -11,22 +11,14 @@ BEGIN
SUM((b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity) value,
SUM (
IF(
a.nickname IN (
'MERMA: FALTAS',
'MERMA: CONTENEDOR',
'MERMA: TRANSPORTE/OTROS'
),
aw.type = 'internal',
(b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity,
0
)
) internalWaste,
SUM (
IF(
a.nickname IN (
'MERMA: RECLAMACION BASURA',
'MERMA: RECLAMACION TALLER',
'MERMA: RECLAMACION FALTAS'
),
aw.type = 'external',
(b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity,
IF(c.code = 'manaClaim',
sc.value * s.quantity,
@ -39,6 +31,7 @@ BEGIN
JOIN vn.itemType it ON it.id = i.typeFk
JOIN vn.ticket t ON t.id = s.ticketFk
STRAIGHT_JOIN vn.address a ON a.id = t.addressFk
LEFT JOIN vn.addressWaste aw ON aw.addressFk = a.id
JOIN vn.warehouse w ON w.id = t.warehouseFk
JOIN cache.last_buy lb ON lb.item_id = i.id
AND lb.warehouse_id = w.id