diff --git a/route_sql/addmonth_vupd.sql b/route_sql/addmonth_vupd.sql index a6acf2f..14110ff 100644 --- a/route_sql/addmonth_vupd.sql +++ b/route_sql/addmonth_vupd.sql @@ -193,6 +193,7 @@ SELECT o.plnt --promo in next step --terms in next step + ,c.bvterm terms ,o.bill_cust_descr ,o.ship_cust_descr ,o.dsm @@ -220,11 +221,14 @@ SELECT ,sum(coalesce(o.units,0)) units ,sum(coalesce(o.value_loc,0)) value_loc ,sum(coalesce(o.value_usd,0)) value_usd - ,sum(coalesce(o.cost_loc,0)) cost_usd + ,sum(coalesce(o.cost_loc,0)) cost_loc + ,sum(coalesce(o.cost_usd,0)) cost_usd ,o.calc_status ,o.flag FROM rlarp.osm_pool o + LEFT OUTER JOIN lgdat.cust c ON + c.bvcust = rtrim(substr(o.bill_cust_descr,1,8)) WHERE -----------------scenario---------------------------- where_clause @@ -239,6 +243,7 @@ SELECT GROUP BY --fspr in next step o.plnt + ,c.bvterm --promo in next step --terms in next step ,o.bill_cust_descr @@ -334,6 +339,7 @@ FROM CROSS JOIN vscale s CROSS JOIN mmixp m CROSS JOIN closest + CROSS JOIN log LEFT OUTER JOIN mseq ON mseq.m = closest.m LEFT OUTER JOIN gld od ON @@ -367,9 +373,9 @@ WHERE ) ,price AS ( SELECT -sd.fspr + b.fspr ,b.plnt - ,m.promo + ,b.promo ,b.terms ,b.bill_cust_descr ,b.ship_cust_descr @@ -419,6 +425,7 @@ sd.fspr FROM volume b CROSS JOIN pscale p + CROSS JOIN log WHERE p.factor <> 0 or p.mod_price <> 0 )