feat: refs #6500 cambios solicitados
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Robert Ferrús 2024-04-12 12:13:07 +02:00
parent adadf70f1e
commit f30f907d8e
2 changed files with 6 additions and 6 deletions

View File

@ -10,7 +10,7 @@ BEGIN
JOIN ( JOIN (
SELECT * SELECT *
FROM ( FROM (
SELECT id, landed, tt.warehouseInFk, tt.warehouseOutFk SELECT t.id, t.landed, tt.warehouseInFk, tt.warehouseOutFk
FROM travel t FROM travel t
JOIN ( JOIN (
SELECT t.warehouseInFk, t.warehouseOutFk SELECT t.warehouseInFk, t.warehouseOutFk
@ -19,11 +19,11 @@ BEGIN
JOIN travel t ON t.id = e.travelFk JOIN travel t ON t.id = e.travelFk
GROUP BY t.warehouseInFk, t.warehouseOutFk GROUP BY t.warehouseInFk, t.warehouseOutFk
) tt ON t.warehouseInFk = tt.warehouseInFk AND t.warehouseOutFk = tt.warehouseOutFk ) tt ON t.warehouseInFk = tt.warehouseInFk AND t.warehouseOutFk = tt.warehouseOutFk
WHERE shipped > util.VN_CURDATE() AND isDelivered = FALSE WHERE shipped > util.VN_CURDATE() AND NOT isDelivered
ORDER BY t.landed ORDER BY t.landed
LIMIT 10000000000000000000 LIMIT 10000000000000000000
) t ) t
GROUP BY warehouseInFk, warehouseOutFk GROUP BY t.warehouseInFk, t.warehouseOutFk
) tt ON t.warehouseInFk = tt.warehouseInFk AND t.warehouseOutFk = tt.warehouseOutFk ) tt ON t.warehouseInFk = tt.warehouseInFk AND t.warehouseOutFk = tt.warehouseOutFk
SET e.travelFk = t.id; SET e.travelFk = t.id;

View File

@ -18,14 +18,14 @@ BEGIN
( SELECT ( SELECT
t.year, t.year,
t.month, t.month,
CAST(SUM(divisa) AS DECIMAL(10,2)) dollars, CAST(SUM(p.divisa) AS DECIMAL(10,2)) dollars,
CAST(SUM(divisa) / SUM(amount) AS DECIMAL(5,4)) changePractical, CAST(SUM(p.divisa) / SUM(p.amount) AS DECIMAL(5,4)) changePractical,
CAST(rr.value * 0.998 AS DECIMAL(5,4)) changeOfficial CAST(rr.value * 0.998 AS DECIMAL(5,4)) changeOfficial
FROM payment p FROM payment p
JOIN time t ON t.dated = p.received JOIN time t ON t.dated = p.received
JOIN referenceRate rr ON rr.dated = p.received JOIN referenceRate rr ON rr.dated = p.received
JOIN currency c ON c.id = rr.currencyFk JOIN currency c ON c.id = rr.currencyFk
WHERE divisa WHERE p.divisa
AND c.code = 'USD' AND c.code = 'USD'
GROUP BY t.year, t.month GROUP BY t.year, t.month
) pagos ON t.year = pagos.year AND t.month = pagos.MONTH ) pagos ON t.year = pagos.year AND t.month = pagos.MONTH