diff --git a/route_sql/new_basket.sql b/route_sql/new_basket.sql index f80793d..653d54e 100644 --- a/route_sql/new_basket.sql +++ b/route_sql/new_basket.sql @@ -342,7 +342,7 @@ SELECT ,null::text clss ,null::text brand ,null::text assc - ,null::text fs_line + ,'41010'::text fs_line ,null::text r_currency ,null::numeric r_rate ,null::text c_currency @@ -502,8 +502,8 @@ SELECT ,SUBSTR(COALESCE(m."avcpt#",p."awvpt#"),1,1) brand --master data ,COALESCE(m.avassc,p.awassc) assc --master data ,b.fs_line --master data - ,b.r_currency --history cust mix - ,b.r_rate --master data + ,bc.bvcurr r_currency --history cust mix + ,rx.rate r_rate --master data ,copr.curr c_currency --master data ,cx.rate c_rate --master data ,b.ddqtoi @@ -560,7 +560,7 @@ SELECT ,repc.repp quota_rep_descr ,repc.director director_descr ,b.fb_val_loc value_loc - ,b.fb_val_loc *r_rate value_usd + ,b.fb_val_loc * rx.rate value_usd ,COALESCE(im.cgstcs,ip.chstcs, ir.y0stcs)*b.fb_qty cost_loc ,COALESCE(im.cgstcs,ip.chstcs, ir.y0stcs)*b.fb_qty*cx.rate cost_usd ,b.fb_qty units @@ -661,6 +661,11 @@ FROM AND cx.rtyp = 'MA' AND cx.fcur = copr.curr AND cx.tcur = 'US' + LEFT OUTER JOIN rlarp.ffcret rx ON + rx.perd = '1910' + AND rx.rtyp = 'MA' + AND rx.fcur = bc.bvcurr + AND rx.tcur = 'US' LEFT OUTER JOIN LGDAT.ADRS AD ON AD.QZADR = plnt."yaadr#" )