Compare commits

..

No commits in common. "c92f945a71661996c7865531f551c72ff9dcdf6e" and "e3722193c5c8bc59938c90e681ae4b43db0d64ec" have entirely different histories.

7 changed files with 35 additions and 35 deletions

View File

@ -39,7 +39,7 @@ SELECT DISTINCT
,CASE WHEN i.majg = '610' THEN 'Fiber' ELSE 'Plastic' END substance
FROM
rlarp.osm_pool o
LEFT OUTER JOIN rlarp.itemmv i ON
LEFT OUTER JOIN rlarp.itemm i ON
i.item = o.part
LEFT OUTER JOIN seg ON
seg.glec = i.glec

View File

@ -316,11 +316,11 @@ SELECT
,b.r_rate
,b.c_currency
,b.c_rate
,round(b.units*s.factor*m.momix ,2) units
,round(b.value_loc*s.factor*m.momix,2) value_loc
,round(b.value_usd*s.factor*m.momix,2) value_usd
,round(b.cost_loc*s.factor*m.momix ,2) cost_loc
,round(b.cost_usd*s.factor*m.momix ,2) cost_usd
,b.units*s.factor*m.momix units
,b.value_loc*s.factor*m.momix value_loc
,b.value_usd*s.factor*m.momix value_usd
,b.cost_loc*s.factor*m.momix cost_loc
,b.cost_usd*s.factor*m.momix cost_usd
,b.calc_status
,b.flag
,make_date(mseq.yr + 2022,mseq.cal,m.odom) order_date
@ -407,8 +407,8 @@ SELECT
,b.c_currency
,b.c_rate
,0::numeric units
,round((CASE WHEN p.factor = 0 THEN b.units * p.mod_price/b.r_rate ELSE b.value_loc*p.factor END)::numeric,2) value_loc
,round((CASE WHEN p.factor = 0 THEN b.units * p.mod_price ELSE b.value_usd*p.factor END)::numeric ,2) value_usd
,(CASE WHEN p.factor = 0 THEN b.units * p.mod_price/b.r_rate ELSE b.value_loc*p.factor END)::numeric value_loc
,(CASE WHEN p.factor = 0 THEN b.units * p.mod_price ELSE b.value_usd*p.factor END)::numeric value_usd
,0::numeric cost_loc
,0::numeric cost_usd
,b.calc_status

View File

@ -329,11 +329,11 @@ SELECT
,rx.rate r_rate --master data
,copr.curr c_currency --master data
,cx.rate c_rate --master data
,round(b.units ,2) units
,round(b.value_usd / COALESCE(rx.rate,1) ,2) value_loc --b.value is denominated in USD, need to apply currency to get to local, assume 1 if using a fake customer
,round(b.value_usd ,2) value_usd --b.value is already denominated in usd
,round(COALESCE(im.cgstcs,ip.chstcs, ir.y0stcs)*b.units ,2) cost_loc
,round(COALESCE(im.cgstcs,ip.chstcs, ir.y0stcs)*b.units*cx.rate,2) cost_usd
,b.units
,b.value_usd / COALESCE(rx.rate,1) --b.value is denominated in USD, need to apply currency to get to local, assume 1 if using a fake customer
,b.value_usd value_usd --b.value is already denominated in usd
,COALESCE(im.cgstcs,ip.chstcs, ir.y0stcs)*b.units cost_loc
,COALESCE(im.cgstcs,ip.chstcs, ir.y0stcs)*b.units*cx.rate cost_usd
,'CLOSED' calc_status
,'SHIPMENT' flag
,b.order_date

View File

@ -152,8 +152,8 @@ target AS (select target_increment incr)
,c_currency --master data
,c_rate --master data
,0::numeric units
,round((CASE WHEN s.factor = 0 THEN b.units * s.mod_price/b.r_rate ELSE b.value_loc*s.factor END)::numeric,2) value_loc
,round((CASE WHEN s.factor = 0 THEN b.units * s.mod_price ELSE b.value_usd*s.factor END)::numeric ,2) value_usd
,(CASE WHEN s.factor = 0 THEN b.units * s.mod_price/b.r_rate ELSE b.value_loc*s.factor END)::numeric value_loc
,(CASE WHEN s.factor = 0 THEN b.units * s.mod_price ELSE b.value_usd*s.factor END)::numeric value_usd
,0::numeric cost_loc
,0::numeric cost_usd
,calc_status --0

View File

@ -180,11 +180,11 @@ target AS (select incr_qty qincr)
,r_rate --master data
,c_currency --master data
,c_rate --master data
,round(units*s.factor ,2) units
,round(value_loc*s.factor,2) value_loc
,round(value_usd*s.factor,2) value_usd
,round(cost_loc*s.factor ,2) cost_loc
,round(cost_usd*s.factor ,2) cost_usd
,units*s.factor
,value_loc*s.factor value_loc
,value_usd*s.factor value_usd
,cost_loc*s.factor cost_loc
,cost_usd*s.factor cost_usd
,calc_status --0
,flag --0
,order_date --history date mix

View File

@ -179,11 +179,11 @@ target AS (select target_vol vincr, target_prc pincr)
,r_rate --master data
,c_currency --master data
,c_rate --master data
,round(units*s.factor ,2) units
,round(value_loc*s.factor,2) value_loc
,round(value_usd*s.factor,2) value_usd
,round(cost_loc*s.factor ,2) cost_loc
,round(cost_usd*s.factor ,2) cost_usd
,units*s.factor units
,value_loc*s.factor value_loc
,value_usd*s.factor value_usd
,cost_loc*s.factor cost_loc
,cost_usd*s.factor cost_usd
,calc_status --0
,flag --0
,order_date --history date mix
@ -261,8 +261,8 @@ FROM
,c_currency --master data
,c_rate --master data
,0::numeric units
,round((CASE WHEN s.factor = 0 THEN b.units * s.mod_price/b.r_rate ELSE b.value_loc*s.factor END)::numeric,2) value_loc
,round((CASE WHEN s.factor = 0 THEN b.units * s.mod_price ELSE b.value_usd*s.factor END)::numeric ,2) value_usd
,(CASE WHEN s.factor = 0 THEN b.units * s.mod_price/b.r_rate ELSE b.value_loc*s.factor END)::numeric value_loc
,(CASE WHEN s.factor = 0 THEN b.units * s.mod_price ELSE b.value_usd*s.factor END)::numeric value_usd
,0::numeric cost_loc
,0::numeric cost_usd
,calc_status --0

View File

@ -180,11 +180,11 @@ target AS (select target_vol vincr, target_prc pincr)
,r_rate --master data
,c_currency --master data
,c_rate --master data
,round(units*s.factor ,2) units
,round(value_loc*s.factor,2) value_loc
,round(value_usd*s.factor,2) value_usd
,round(cost_loc*s.factor ,2) cost_loc
,round(cost_usd*s.factor ,2) cost_usd
,units*s.factor units
,value_loc*s.factor value_loc
,value_usd*s.factor value_usd
,cost_loc*s.factor cost_loc
,cost_usd*s.factor cost_usd
,calc_status --0
,flag --0
,order_date --history date mix
@ -262,8 +262,8 @@ FROM
,c_currency --master data
,c_rate --master data
,0::numeric units
,round((CASE WHEN s.factor = 0 THEN b.units * s.mod_price/b.r_rate ELSE b.value_loc*s.factor END)::numeric,2) value_loc
,round((CASE WHEN s.factor = 0 THEN b.units * s.mod_price ELSE b.value_usd*s.factor END)::numeric ,2) value_usd
,(CASE WHEN s.factor = 0 THEN b.units * s.mod_price/b.r_rate ELSE b.value_loc*s.factor END)::numeric value_loc
,(CASE WHEN s.factor = 0 THEN b.units * s.mod_price ELSE b.value_usd*s.factor END)::numeric value_usd
,0::numeric cost_loc
,0::numeric cost_usd
,calc_status --0