project QadFinancials > class BPosting > method ValidateComponentPostRounding
Description
Check rounding on all amounts
Parameters
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program4/bposting.p)
/* ================== */
/* Exception handling */
/* ================== */
assign oiReturnStatus = -98
viLocalReturnStatus = 0.
if t_sPosting.tc_Status <> "D":U and
(t_sPostingLine.tc_Status = "N":U or
t_sPostingLine.tc_Status = "C":U) and
t_sPostingLine.Currency_ID <> 0 and
t_sPostingLine.Currency_ID <> ?
then do:
/* ================================= */
/* Check the rounding for TC Amounts */
/* ================================= */
assign vdRounded = t_sPostingLine.PostingLineDebitTC
t_sPostingLine.PostingLineDebitTC = vdRounded
vdRounded = t_sPostingLine.PostingLineCreditTC
t_sPostingLine.PostingLineCreditTC = vdRounded.
if t_sPostingLine.PostingLineDebitTC = 0
then assign vdRounded = 0.
else assign vdRounded = <M-8 RoundAmount
(input t_sPostingLine.PostingLineDebitTC (idUnroundedAmount),
input 0 (iiCurrencyID),
input t_sPostingLine.tcCurrencyCode (icCurrencyCode)) in business>.
if vdRounded <> t_sPostingLine.PostingLineDebitTC
then do:
assign vcMsgExplanation = <M-22 GetErrorExplanation
(input t_sPosting.tc_Rowid (icPostingRowId),
input t_sPostingLine.tc_Rowid (icPostingLineRowId),
output viFcReturnSuper (oiReturnStatus)) in BPosting>.
assign vcMessage = trim(subst(#T-12'The debit amount in TC is not correctly rounded. Check the rounding method linked to the currency.':150(49115)t-12#, t_sPostingLine.tcCurrencyCode))
viLocalReturnStatus = -1.
<M-10 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input 'tPostingLine.PostingLineDebitTC':U (icFieldName),
input string(t_sPostingLine.PostingLineDebitTC) (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sPostingLine.tc_Rowid (icRowid),
input 'QadFin-7389':U (icFcMsgNumber),
input vcMsgExplanation (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPosting>
end.
if t_sPostingLine.PostingLineCreditTC = 0
then assign vdRounded = 0.
else assign vdRounded = <M-9 RoundAmount
(input t_sPostingLine.PostingLineCreditTC (idUnroundedAmount),
input 0 (iiCurrencyID),
input t_sPostingLine.tcCurrencyCode (icCurrencyCode)) in business>.
if vdRounded <> t_sPostingLine.PostingLineCreditTC
then do:
assign vcMsgExplanation = <M-60 GetErrorExplanation
(input t_sPosting.tc_Rowid (icPostingRowId),
input t_sPostingLine.tc_Rowid (icPostingLineRowId),
output viFcReturnSuper (oiReturnStatus)) in BPosting>.
assign vcMessage = trim(subst(#T-13'The credit amount in TC is not correctly rounded. Check the rounding method that is linked to the currency.':150(49116)t-13#, t_sPostingLine.tcCurrencyCode))
viLocalReturnStatus = -1.
<M-11 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input 'tPostingLine.PostingLineCreditTC':U (icFieldName),
input string(t_sPostingLine.PostingLineCreditTC) (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sPostingLine.tc_Rowid (icRowid),
input 'QadFin-7390':U (icFcMsgNumber),
input vcMsgExplanation (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BPosting>
end.
end.
/* ================== */
/* Exception handling */
/* ================== */
assign oiReturnStatus = viLocalReturnStatus.