use basline fx and new budget period fx rates

This commit is contained in:
pt 2020-02-26 23:55:20 -05:00
parent 8838fdbcbc
commit 10d20e050e

View File

@ -281,7 +281,7 @@ SELECT
b.fspr
,i.dplt plnt
,b.promo
,b.terms
,COALESCE(b.terms,bc.bvterm) terms
,b.bill_cust_descr
,b.ship_cust_descr
,(SELECT max(rcode) FROM repc WHERE rname = log.doc->'scenario'->>'quota_rep_descr') dsm
@ -324,7 +324,7 @@ SELECT
,seg.segm
,CASE WHEN i.majg = '610' THEN 'Fiber' ELSE 'Plastic' END substance
,'41010' fs_line --master data
,mxm.r_currency --history cust mix
,b.r_currency --history cust mix
,rx.rate r_rate --master data
,copr.curr c_currency --master data
,cx.rate c_rate --master data
@ -422,14 +422,14 @@ FROM
LEFT OUTER JOIN copr ON
copr.comp = yacomp::text
LEFT OUTER JOIN rlarp.ffcret cx ON
cx.perd = '2008'
AND cx.rtyp = 'MA'
cx.perd = '2101'
AND cx.rtyp = 'BG'
AND cx.fcur = copr.curr
AND cx.tcur = 'US'
LEFT OUTER JOIN rlarp.ffcret rx ON
rx.perd = '2008'
AND rx.rtyp = 'MA'
AND rx.fcur = COALESCE(bc.bvcurr,mxm.r_currency)
rx.perd = '2101'
AND rx.rtyp = 'BG'
AND rx.fcur = COALESCE(bc.bvcurr,b.r_currency)
AND rx.tcur = 'US'
)
, ins AS (