IF vDECAmount <> 0 THEN BEGIN IF vCDFromCurrency <> vCDToCurrency THEN BEGIN IF vCDToCurrency = '' THEN BEGIN IF (vDECCurrFactor = 0) OR (vDECCurrFactor = 1) THEN //Correction For Currency factor vDECCurrFactor := TBCurrExhRate.ExchangeRate(vGMADate,vCDFromCurrency); vDECAmount := TBCurrExhRate.ExchangeAmtFCYToLCY(vGMADate,vCDFromCurrency,vDECAmount,vDECCurrFactor); END ELSE BEGIN IF vCDFromCurrency = '' THEN BEGIN IF (vDECCurrFactor = 0) OR (vDECCurrFactor = 1) THEN //Correction For Currency factor vDECCurrFactor := TBCurrExhRate.ExchangeRate(vGMADate,vCDToCurrency); vDECAmount := TBCurrExhRate.ExchangeAmtLCYToFCY(vGMADate,vCDToCurrency,vDECAmount,vDECCurrFactor); END ELSE BEGIN vDECAmount := TBCurrExhRate.ExchangeAmtFCYToFCY(vGMADate,vCDFromCurrency,vCDToCurrency,vDECAmount); END; END; END; IF vTFUnitAmount THEN BEGIN IF vCDToCurrency = '' THEN BEGIN TBGLSetup.GET; vDECAmount := ROUND(vDECAmount,TBGLSetup."Unit-Amount Rounding Precision"); END ELSE BEGIN lTBCurrency.GET(vCDToCurrency); vDECAmount := ROUND(vDECAmount,lTBCurrency."Unit-Amount Rounding Precision"); END; END ELSE BEGIN IF vCDToCurrency = '' THEN BEGIN TBGLSetup.GET; vDECAmount := ROUND(vDECAmount,TBGLSetup."Amount Rounding Precision"); END ELSE BEGIN lTBCurrency.GET(vCDToCurrency); vDECAmount := ROUND(vDECAmount,lTBCurrency."Amount Rounding Precision"); END; END; END; EXIT(vDECAmount);
Comments
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
P.S.: there's a little bug if the user is on an invoice and changes the currency factor: i already corrected it and i'll post it as soon as possible...i'm a little busy now, sorry
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
As for the bug. I suggest to send it to MS.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
i didn't thought that the user can change the currency factor, and this function does not receive a currency factor as parameter, therefore the currency factor is always recalculated, and there can be some inconsistencies.
I'm now editing my post in order to correct the function
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
here's the old line here's the new line i corrected the code above, too.
this is an important correction in my project, because i am adding lines to an invoice, taking values from other documents: if the invoice is in LCY and someone does a the resulting factor is 1.
if my "other document" is in USD, it must be converted, before adding it to the sales invoice line
@kriki: i posted this to MS connect...were you meaning to post this in that place when you said "send it to MS"?
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
Should i hope for it or MS said this to everyone?
I'd be really proud if will become a standard functionality 8)
P.S.: i forgot a TBGLSetup.GET; in the function :oops: -Just added-
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog