Compare commits
No commits in common. "787cc9452ff7a92f20da583b4b12aaa9c302c000" and "60ace348b867a76aa38a169fe96c79491164c8a5" have entirely different histories.
787cc9452f
...
60ace348b8
@ -50,5 +50,4 @@ Walk Issues
|
|||||||
Things to Demo
|
Things to Demo
|
||||||
* product swap out
|
* product swap out
|
||||||
* pivot re-org
|
* pivot re-org
|
||||||
* don't use filters
|
* don't use filters
|
||||||
* assumes all changes target USD
|
|
@ -17,8 +17,7 @@ target AS (select $$replace_request$$::json def)
|
|||||||
,to_char(N1ED01,'yymm') CAPR
|
,to_char(N1ED01,'yymm') CAPR
|
||||||
,N1ED01 - N1SD01 +1 NDAYS
|
,N1ED01 - N1SD01 +1 NDAYS
|
||||||
,CASE WHEN EXTRACT(MONTH FROM N1ED01) >= 6 THEN EXTRACT(YEAR FROM N1ED01) + 1 ELSE EXTRACT(YEAR FROM N1ED01) END SSYR
|
,CASE WHEN EXTRACT(MONTH FROM N1ED01) >= 6 THEN EXTRACT(YEAR FROM N1ED01) + 1 ELSE EXTRACT(YEAR FROM N1ED01) END SSYR
|
||||||
,to_char(CASE WHEN EXTRACT(MONTH FROM N1ED01) >= 6 THEN EXTRACT(MONTH FROM N1ED01) -5 ELSE EXTRACT(MONTH FROM N1ED01) +7 END,'FM00') SSPR
|
,to_char(CASE WHEN EXTRACT(MONTH FROM N1ED01) >= 6 THEN EXTRACT(MONTH FROM N1ED01) -5 ELSE EXTRACT(MONTH FROM N1ED01) +7 END,'00') SSPR
|
||||||
,to_char(CASE WHEN EXTRACT(MONTH FROM N1ED01) >= 6 THEN EXTRACT(MONTH FROM N1ED01) -5 ELSE EXTRACT(MONTH FROM N1ED01) +7 END,'FM00') || ' - '|| TO_CHAR(n1ed01,'FMMon') SORTMO
|
|
||||||
FROM
|
FROM
|
||||||
LGDAT.GLDATREF
|
LGDAT.GLDATREF
|
||||||
INNER JOIN LGDAT.GLDATE ON
|
INNER JOIN LGDAT.GLDATE ON
|
||||||
@ -236,15 +235,15 @@ SELECT
|
|||||||
,jr.part_descr
|
,jr.part_descr
|
||||||
,substring(jr.part_descr,1,8) part_group
|
,substring(jr.part_descr,1,8) part_group
|
||||||
,mxm.qty*mxm.momix*jr.mix units
|
,mxm.qty*mxm.momix*jr.mix units
|
||||||
,mxm.amount*mxm.momix*jr.mix value_usd --assume that target dollars are USD
|
,mxm.amount*mxm.momix*jr.mix value_loc
|
||||||
,make_date(mxm.yr + 2021,mxm.cal,mxm.odom) order_date
|
,make_date(mxm.yr + 2021,mxm.cal,mxm.odom) order_date
|
||||||
,od.sortmo order_month
|
,to_char(make_date(mxm.yr + 2021,mxm.cal,mxm.odom),'Mon') order_month
|
||||||
,od.ssyr order_season
|
,od.ssyr order_season
|
||||||
,make_date(mxm.yr + 2021,mxm.cal,mxm.odom) + rlag request_date
|
,make_date(mxm.yr + 2021,mxm.cal,mxm.odom) + rlag request_date
|
||||||
,rd.sortmo request_month
|
,to_char(make_date(mxm.yr + 2021,mxm.cal,mxm.odom) + rlag,'Mon') request_month
|
||||||
,rd.ssyr request_season
|
,rd.ssyr request_season
|
||||||
,make_date(mxm.yr + 2021,mxm.cal,mxm.odom) + rlag + slag ship_date
|
,make_date(mxm.yr + 2021,mxm.cal,mxm.odom) + rlag + slag ship_date
|
||||||
,sd.sortmo ship_month
|
,to_char(make_date(mxm.yr + 2021,mxm.cal,mxm.odom) + rlag + slag,'Mon') ship_month
|
||||||
,sd.ssyr ship_season
|
,sd.ssyr ship_season
|
||||||
,jr.mix
|
,jr.mix
|
||||||
FROM
|
FROM
|
||||||
@ -316,10 +315,10 @@ SELECT
|
|||||||
,copr.curr c_currency --master data
|
,copr.curr c_currency --master data
|
||||||
,cx.rate c_rate --master data
|
,cx.rate c_rate --master data
|
||||||
,b.units
|
,b.units
|
||||||
,b.value_usd / rx.rate --b.value is denominated in USD, need to apply currency to get to local
|
,b.value_loc
|
||||||
,b.value_usd value_usd --b.value is already denominated in usd
|
,b.value_loc * rx.rate value_usd
|
||||||
,COALESCE(im.cgstcs,ip.chstcs, ir.y0stcs)*b.units cost_loc
|
,COALESCE(im.cgstcs,ip.chstcs, ir.y0stcs)*b.units cost_loc
|
||||||
,COALESCE(im.cgstcs,ip.chstcs, ir.y0stcs)*b.units*cx.rate cost_usd
|
,COALESCE(im.cgstcs,ip.chstcs, ir.y0stcs)*b.units*cx.rate cost_loc
|
||||||
,'CLOSED' calc_status
|
,'CLOSED' calc_status
|
||||||
,'SHIPMENT' flag
|
,'SHIPMENT' flag
|
||||||
,b.order_date
|
,b.order_date
|
||||||
|
Loading…
Reference in New Issue
Block a user