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