sin item cost
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
javi 2022-12-09 09:24:19 +01:00
parent ac447d4981
commit 43f04e3b42
1 changed files with 4 additions and 3 deletions

View File

@ -2,13 +2,14 @@
ir.id code, ir.id code,
ir.description description, ir.description description,
CAST(SUM(IFNULL(i.stems, 1) * s.quantity) AS DECIMAL(10,2)) stems, CAST(SUM(IFNULL(i.stems, 1) * s.quantity) AS DECIMAL(10,2)) stems,
CAST(SUM(CAST(IFNULL(i.stems, 1) * s.quantity * IF(ic.grams, ic.grams, i.density * ic.cm3delivery / 1000) / 1000 AS DECIMAL(10,2)) * CAST(SUM(CAST(IFNULL(i.stems, 1)
IF(sub.weight, sub.weight / vn.invoiceOut_getWeight(?), 1)) AS DECIMAL(10,2)) netKg, * s.quantity
* i.weightByPiece / 1000 AS DECIMAL(10,2))
* IF(sub.weight, sub.weight / vn.invoiceOut_getWeight(?), 1)) AS DECIMAL(10,2)) netKg,
CAST(SUM((s.quantity * s.price * (100 - s.discount) / 100 )) AS DECIMAL(10,2)) subtotal CAST(SUM((s.quantity * s.price * (100 - s.discount) / 100 )) AS DECIMAL(10,2)) subtotal
FROM vn.ticket t FROM vn.ticket t
JOIN vn.sale s ON s.ticketFk = t.id JOIN vn.sale s ON s.ticketFk = t.id
JOIN vn.item i ON i.id = s.itemFk JOIN vn.item i ON i.id = s.itemFk
JOIN vn.itemCost ic ON ic.itemFk = i.id AND ic.warehouseFk = t.warehouseFk
JOIN vn.intrastat ir ON ir.id = i.intrastatFk JOIN vn.intrastat ir ON ir.id = i.intrastatFk
LEFT JOIN ( LEFT JOIN (
SELECT t2.weight SELECT t2.weight