7253-devToTest_2418 #2350
|
@ -10,7 +10,7 @@ BEGIN
|
|||
JOIN (
|
||||
SELECT *
|
||||
FROM (
|
||||
SELECT id, landed, tt.warehouseInFk, tt.warehouseOutFk
|
||||
SELECT t.id, t.landed, tt.warehouseInFk, tt.warehouseOutFk
|
||||
FROM travel t
|
||||
JOIN (
|
||||
SELECT t.warehouseInFk, t.warehouseOutFk
|
||||
|
@ -19,11 +19,11 @@ BEGIN
|
|||
JOIN travel t ON t.id = e.travelFk
|
||||
GROUP BY t.warehouseInFk, t.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
|
||||
LIMIT 10000000000000000000
|
||||
) t
|
||||
GROUP BY warehouseInFk, warehouseOutFk
|
||||
GROUP BY t.warehouseInFk, t.warehouseOutFk
|
||||
) tt ON t.warehouseInFk = tt.warehouseInFk AND t.warehouseOutFk = tt.warehouseOutFk
|
||||
SET e.travelFk = t.id;
|
||||
|
||||
|
|
|
@ -18,14 +18,14 @@ BEGIN
|
|||
( SELECT
|
||||
t.year,
|
||||
t.month,
|
||||
CAST(SUM(divisa) AS DECIMAL(10,2)) dollars,
|
||||
CAST(SUM(divisa) / SUM(amount) AS DECIMAL(5,4)) changePractical,
|
||||
CAST(SUM(p.divisa) AS DECIMAL(10,2)) dollars,
|
||||
CAST(SUM(p.divisa) / SUM(p.amount) AS DECIMAL(5,4)) changePractical,
|
||||
CAST(rr.value * 0.998 AS DECIMAL(5,4)) changeOfficial
|
||||
FROM payment p
|
||||
JOIN time t ON t.dated = p.received
|
||||
JOIN referenceRate rr ON rr.dated = p.received
|
||||
JOIN currency c ON c.id = rr.currencyFk
|
||||
WHERE divisa
|
||||
WHERE p.divisa
|
||||
AND c.code = 'USD'
|
||||
GROUP BY t.year, t.month
|
||||
) pagos ON t.year = pagos.year AND t.month = pagos.MONTH
|
||||
|
|
Loading…
Reference in New Issue