handle costs and major groups
This commit is contained in:
parent
77fe829ece
commit
87d5dbceaf
@ -99,7 +99,7 @@ target AS (SELECT $$swap_doc$$::jsonb swap)
|
|||||||
,repl AS (
|
,repl AS (
|
||||||
SELECT
|
SELECT
|
||||||
fspr
|
fspr
|
||||||
,plnt ---master data
|
,m.dplt plnt ---master data
|
||||||
,promo --history date mix
|
,promo --history date mix
|
||||||
,terms
|
,terms
|
||||||
,bill_cust_descr --history cust mix
|
,bill_cust_descr --history cust mix
|
||||||
@ -116,22 +116,22 @@ target AS (SELECT $$swap_doc$$::jsonb swap)
|
|||||||
,m.item || ' - ' || m.descr partd
|
,m.item || ' - ' || m.descr partd
|
||||||
,substring(pl.replace,1,8) part_group
|
,substring(pl.replace,1,8) part_group
|
||||||
,m.branding branding
|
,m.branding branding
|
||||||
,m.majgd majg_descr
|
,m.majg||' - '||m.majgd majg_descr
|
||||||
,m.mingd ming_descr
|
,m.ming||' - '||m.mingd ming_descr
|
||||||
,m.majsd majs_descr
|
,m.majs||' - '||m.majsd majs_descr
|
||||||
,m.minsd mins_descr
|
,m.mins||' - '||m.minsd mins_descr
|
||||||
,seg.segm
|
,seg.segm
|
||||||
,substance
|
,substance
|
||||||
,fs_line --master data
|
,fs_line --master data
|
||||||
,r_currency --history cust mix
|
,r_currency --history cust mix
|
||||||
,r_rate --master data
|
,r_rate --master data
|
||||||
,c_currency --master data
|
,r.curr c_currency --master data
|
||||||
,c_rate --master data
|
,x.rate c_rate --master data
|
||||||
,-units units
|
,-units units
|
||||||
,-value_loc value_loc
|
,-value_loc value_loc
|
||||||
,-value_usd value_usd
|
,-value_usd value_usd
|
||||||
,-cost_loc cost_loc
|
,-units * c.std cost_loc
|
||||||
,-cost_usd cost_usd
|
,-units * c.std * x.rate cost_usd
|
||||||
,calc_status --0
|
,calc_status --0
|
||||||
,flag --0
|
,flag --0
|
||||||
,order_date --history date mix
|
,order_date --history date mix
|
||||||
@ -154,7 +154,17 @@ target AS (SELECT $$swap_doc$$::jsonb swap)
|
|||||||
INNER JOIN pl ON
|
INNER JOIN pl ON
|
||||||
pl.original = o.part
|
pl.original = o.part
|
||||||
INNER JOIN rlarp.itemmv m ON
|
INNER JOIN rlarp.itemmv m ON
|
||||||
m.item = o.part
|
m.item = pl.replace
|
||||||
|
LEFT OUTER JOIN rlarp.icstx c ON
|
||||||
|
c.part = pl.replace
|
||||||
|
AND c.plnt = m.dplt
|
||||||
|
LEFT OUTER JOIN rlarp.plpr r ON
|
||||||
|
yaplnt = m.dplt
|
||||||
|
LEFT OUTER JOIN rlarp.ffcret x ON
|
||||||
|
x.fcur = r.curr
|
||||||
|
AND x.tcur = 'US'
|
||||||
|
AND x.rtyp = 'BG'
|
||||||
|
AND x.perd = '2101'
|
||||||
LEFT OUTER JOIN seg ON
|
LEFT OUTER JOIN seg ON
|
||||||
seg.glec = m.glec
|
seg.glec = m.glec
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user