There you go:
WhilePrintingRecords;
CurrencyVar totalgoods;
if ( {?SP_INVCREDNEG} = 0 and {delvitems.dqty} < 0.0 ) and {delv.dcurrency} <> {?SP_LEHOMECURR} then
totalgoods := totalgoods + Ccur(ROUND( ( {delvitems.diforeignprice} * -1 ), {currency.currvaldp} ))
else if ( {?SP_INVCREDNEG} = 0 and {delvitems.dqty} < 0.0 ) and {delv.dcurrency} = {?SP_LEHOMECURR} then
totalgoods := totalgoods + CCur(ROUND( ( {delvitems.dtpr} * -1 ), {currency.currvaldp} ))
else if {delv.dcurrency} <> {?SP_LEHOMECURR} then
totalgoods := totalgoods + CCur(ROUND( ( {delvitems.diforeignprice} ), {currency.currvaldp} ))
else
totalgoods := totalgoods + CCur(ROUND( {delvitems.dtpr}, {currency.currvaldp} ))
-Abhilash