update consulte sql
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
c660786e45
commit
894f95cb1f
|
@ -42,20 +42,20 @@ module.exports = Self => {
|
|||
SUM(t.packages) packages,
|
||||
r.m3,
|
||||
r.kmEnd - r.kmStart kmTotal,
|
||||
CAST(IFNULL(ate.routePrice,
|
||||
(ate.kmPrice * (GREATEST(r.kmEnd - r.kmStart , ate.minimumKm))
|
||||
+ GREATEST(r.m3 , ate.minimumM3) * ate.m3Price)
|
||||
+ ate.packagePrice * SUM(t.packages) )
|
||||
CAST(IFNULL(sat.routePrice,
|
||||
(sat.kmPrice * (GREATEST(r.kmEnd - r.kmStart , sat.minimumKm))
|
||||
+ GREATEST(r.m3 , sat.minimumM3) * sat.m3Price)
|
||||
+ sat.packagePrice * SUM(t.packages) )
|
||||
AS DECIMAL(10,2)) price,
|
||||
r.invoiceInFk,
|
||||
a.supplierFk,
|
||||
sat.supplierFk,
|
||||
s.name supplierName
|
||||
FROM vn.route r
|
||||
LEFT JOIN vn.agencyMode am ON r.agencyModeFk = am.id
|
||||
LEFT JOIN vn.agency a ON am.agencyFk = a.id
|
||||
LEFT JOIN vn.ticket t ON t.routeFk = r.id
|
||||
LEFT JOIN vn.agencyTerm ate ON ate.agencyFk = a.id
|
||||
LEFT JOIN vn.supplier s ON s.id = a.supplierFk
|
||||
LEFT JOIN vn.supplierAgencyTerm sat ON sat.agencyFk = a.id
|
||||
LEFT JOIN vn.supplier s ON s.id = sat.supplierFk
|
||||
WHERE r.created > DATE_ADD(CURDATE(), INTERVAL -2 MONTH) AND a.supplierFk IS NOT NULL
|
||||
GROUP BY r.id
|
||||
) a`
|
||||
|
|
Loading…
Reference in New Issue