feat: refs #8124 Enrutadores nuevos requerimientos
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
b0b64b2630
commit
26406b6fdb
|
@ -23,14 +23,15 @@ BEGIN
|
||||||
DELETE FROM routeCommission
|
DELETE FROM routeCommission
|
||||||
WHERE routeFk = vSelf;
|
WHERE routeFk = vSelf;
|
||||||
|
|
||||||
SELECT w.isFreelance, v.isKmTruckRate, c.countryFk INTO vIsFreelance, vIsKmTruckRate, vCountryFk
|
SELECT w.isFreelance, v.isKmTruckRate, p.countryFk INTO vIsFreelance, vIsKmTruckRate, vCountryFk
|
||||||
FROM route r
|
FROM route r
|
||||||
JOIN worker w ON w.id = r.workerFk
|
JOIN worker w ON w.id = r.workerFk
|
||||||
JOIN vehicle v ON v.id = r.vehicleFk
|
JOIN vehicle v ON v.id = r.vehicleFk
|
||||||
LEFT JOIN ticket t ON t.routeFk = r.id
|
LEFT JOIN ticket t ON t.routeFk = r.id
|
||||||
LEFT JOIN client c ON c.id = t.clientFk
|
LEFT JOIN address a ON a.id = t.addressFk
|
||||||
|
LEFT JOIN province p ON p.id = a.provinceFk
|
||||||
WHERE r.id = vSelf
|
WHERE r.id = vSelf
|
||||||
GROUP BY c.countryFk
|
GROUP BY p.countryFk
|
||||||
ORDER BY COUNT(*) DESC
|
ORDER BY COUNT(*) DESC
|
||||||
LIMIT 1;
|
LIMIT 1;
|
||||||
|
|
||||||
|
@ -90,7 +91,9 @@ BEGIN
|
||||||
(r.kmEnd - r.kmStart) *
|
(r.kmEnd - r.kmStart) *
|
||||||
IF(v.isKmTruckRate, rc.kmHeavy, rc.kmLight),
|
IF(v.isKmTruckRate, rc.kmHeavy, rc.kmLight),
|
||||||
IFNULL(r.m3, 0) *
|
IFNULL(r.m3, 0) *
|
||||||
IF(v.isKmTruckRate, rc.deliveryM3Cat5, rc.deliveryM3Cat4),
|
IF(v.isKmTruckRate,
|
||||||
|
IFNULL(wc.deliveryM3Cat5, rc.deliveryM3Cat5),
|
||||||
|
IFNULL(wc.deliveryM3Cat4, rc.deliveryM3Cat4)),
|
||||||
(r.kmEnd - r.kmStart) * rc.kmYearly,
|
(r.kmEnd - r.kmStart) * rc.kmYearly,
|
||||||
IFNULL(r.m3, 0) * rc.m3Yearly,
|
IFNULL(r.m3, 0) * rc.m3Yearly,
|
||||||
IFNULL(wc.distributionCat4M3, rc.distributionCat4M3) * IFNULL(r.m3, 0),
|
IFNULL(wc.distributionCat4M3, rc.distributionCat4M3) * IFNULL(r.m3, 0),
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
ALTER TABLE vn.workCenterCommission ADD deliveryM3Cat4 DECIMAL(5,2) DEFAULT NULL NULL;
|
||||||
|
ALTER TABLE vn.workCenterCommission ADD deliveryM3Cat5 DECIMAL(5,2) DEFAULT NULL NULL;
|
||||||
|
|
||||||
|
INSERT INTO vn.workCenterCommission (workCenterFk, deliveryM3Cat4, deliveryM3Cat5)
|
||||||
|
VALUES (5,8.0,8.0);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue