project QadFinancials > class TSetStatutoryCurrency > method SetStatutoryCurrencyBasedOnTCAPMTax

Description

Assign the Statutory Currency Amounts based on the amounts in TC and the exchange Rate between TC and the newly entered SC.
Split into detail method, because main method would get to big.


Parameters


bcListTackledPostingLinesinput-outputcharacter
ocErrorMessageoutputcharacter
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method TSetStatutoryCurrency.SetStatutoryCurrencyBasedOnTCAPM


program code (program1/tsetstatutorycurrency.p)

assign oiReturnStatus      = -98
       viLocalReturnStatus = 0.
   
STATCURRDETBLOCK:
do:
    
    for each APMatchingLnRevTax of APMatchingLn no-lock Transaction :
        Find PostingLine of Posting where 
             PostingLine.PostingLine_ID = APMatchingLnRevTax.PostingLine_ID
             exclusive-lock no-error.
        if available PostingLine
        then do :
            if PostingLine.PostingLineDebitLC <> 0 and 
               PostingLine.PostingLineDebitLC <> ?
            then assign PostingLine.PostingLineDebitCC  = <M-76 RoundSCAmount  (input  PostingLine.PostingLineDebitLC * APMatchingLn.APMatchingLnPvodCCRate * APMatchingLn.APMatchingLnPvodCCScale (idUnroundedAmount)) in TSetStatutoryCurrency>.
            if PostingLine.PostingLineCreditLC <> 0 and 
               PostingLine.PostingLineCreditLC <> ?
            then assign PostingLine.PostingLineCreditCC  = <M-77 RoundSCAmount  (input  PostingLine.PostingLineCreditLC * APMatchingLn.APMatchingLnPvodCCRate * APMatchingLn.APMatchingLnPvodCCScale (idUnroundedAmount)) in TSetStatutoryCurrency>.
            assign PostingLine.PostingLineCCRate   = APMatchingLn.APMatchingLnPvodExchRate2 / APMatchingLn.APMatchingLnPvodExchRate * APMatchingLn.APMatchingLnPvodCCRate * APMatchingLn.APMatchingLnPvodCCScale
                   PostingLine.PostingLineCCScale  = 1
                   PostingLine.LastModifiedDate    = today
                   bcListTackledPostingLines       = bcListTackledPostingLines + ",":U + string(PostingLine.PostingLine_ID).
        end. /* if available PostingLine */
    end. /* for each APMatchingLnRevTax of APMatchingLn Transaction */
    for each APMatchingLnTax of APMatchingLn no-lock Transaction :
        Find PostingLine of Posting where 
             PostingLine.PostingLine_ID = APMatchingLnTax.APRatePostingLine_ID
             exclusive-lock no-error.
        if available PostingLine
        then do :
            if PostingLine.PostingLineDebitTC <> 0 and 
               PostingLine.PostingLineDebitTC <> ?
            then assign PostingLine.PostingLineDebitCC  = <M-78 RoundSCAmount  (input  PostingLine.PostingLineDebitTC *  CInvoice.CInvoiceCCRate * CInvoice.CInvoiceCCScale (idUnroundedAmount)) in TSetStatutoryCurrency>.
            if PostingLine.PostingLineCreditTC <> 0 and 
               PostingLine.PostingLineCreditTC <> ?
            then assign PostingLine.PostingLineCreditCC  = <M-79 RoundSCAmount  (input  PostingLine.PostingLineCreditTC * CInvoice.CInvoiceCCRate * CInvoice.CInvoiceCCScale (idUnroundedAmount)) in TSetStatutoryCurrency>.
            assign PostingLine.PostingLineCCRate   = CInvoice.CInvoiceCCRate
                   PostingLine.PostingLineCCScale  = CInvoice.CInvoiceCCScale
                   PostingLine.LastModifiedDate    = today
                   bcListTackledPostingLines       = bcListTackledPostingLines + ",":U + string(PostingLine.PostingLine_ID).
        end. /* if available PostingLine */
        Find PostingLine of Posting where 
             PostingLine.PostingLine_ID = APMatchingLnTax.PPVPostingLine_ID
             exclusive-lock no-error.
        if available PostingLine
        then do :
            if PostingLine.PostingLineDebitTC <> 0 and 
               PostingLine.PostingLineDebitTC <> ?
            then assign PostingLine.PostingLineDebitCC  = <M-80 RoundSCAmount  (input  PostingLine.PostingLineDebitTC *  CInvoice.CInvoiceCCRate * CInvoice.CInvoiceCCScale (idUnroundedAmount)) in TSetStatutoryCurrency>.
            if PostingLine.PostingLineCreditTC <> 0 and 
               PostingLine.PostingLineCreditTC <> ?
            then assign PostingLine.PostingLineCreditCC  = <M-81 RoundSCAmount  (input  PostingLine.PostingLineCreditTC * CInvoice.CInvoiceCCRate * CInvoice.CInvoiceCCScale (idUnroundedAmount)) in TSetStatutoryCurrency>.
            assign PostingLine.PostingLineCCRate   = CInvoice.CInvoiceCCRate
                   PostingLine.PostingLineCCScale  = CInvoice.CInvoiceCCScale
                   PostingLine.LastModifiedDate    = today
                   bcListTackledPostingLines       = bcListTackledPostingLines + ",":U + string(PostingLine.PostingLine_ID).
        end. /* if available PostingLine */
        Find PostingLine of Posting where 
             PostingLine.PostingLine_ID = APMatchingLnTax.NormalTaxPostingLine_ID
             exclusive-lock no-error.
        if available PostingLine
        then do :
            if PostingLine.PostingLineDebitTC <> 0 and 
               PostingLine.PostingLineDebitTC <> ?
            then assign PostingLine.PostingLineDebitCC  = <M-96 RoundSCAmount  (input  PostingLine.PostingLineDebitTC *  CInvoice.CInvoiceCCRate * CInvoice.CInvoiceCCScale (idUnroundedAmount)) in TSetStatutoryCurrency>.
            if PostingLine.PostingLineCreditTC <> 0 and 
               PostingLine.PostingLineCreditTC <> ?
            then assign PostingLine.PostingLineCreditCC  = <M-97 RoundSCAmount  (input  PostingLine.PostingLineCreditTC * CInvoice.CInvoiceCCRate * CInvoice.CInvoiceCCScale (idUnroundedAmount)) in TSetStatutoryCurrency>.
            assign PostingLine.PostingLineCCRate   = CInvoice.CInvoiceCCRate
                   PostingLine.PostingLineCCScale  = CInvoice.CInvoiceCCScale
                   PostingLine.LastModifiedDate    = today
                   bcListTackledPostingLines       = bcListTackledPostingLines + ",":U + string(PostingLine.PostingLine_ID).
        end. /* if available PostingLine */
        Find PostingLine of Posting where 
             PostingLine.PostingLine_ID = APMatchingLnTax.AbsRetTaxPostingLine_ID
             exclusive-lock no-error.
        if available PostingLine
        then do :
            if PostingLine.PostingLineDebitTC <> 0 and 
               PostingLine.PostingLineDebitTC <> ?
            then assign PostingLine.PostingLineDebitCC  = <M-98 RoundSCAmount  (input  PostingLine.PostingLineDebitTC *  CInvoice.CInvoiceCCRate * CInvoice.CInvoiceCCScale (idUnroundedAmount)) in TSetStatutoryCurrency>.
            if PostingLine.PostingLineCreditTC <> 0 and 
               PostingLine.PostingLineCreditTC <> ?
            then assign PostingLine.PostingLineCreditCC  = <M-99 RoundSCAmount  (input  PostingLine.PostingLineCreditTC * CInvoice.CInvoiceCCRate * CInvoice.CInvoiceCCScale (idUnroundedAmount)) in TSetStatutoryCurrency>.
            assign PostingLine.PostingLineCCRate   = CInvoice.CInvoiceCCRate
                   PostingLine.PostingLineCCScale  = CInvoice.CInvoiceCCScale
                   PostingLine.LastModifiedDate    = today
                   bcListTackledPostingLines       = bcListTackledPostingLines + ",":U + string(PostingLine.PostingLine_ID).
        end. /* if available PostingLine */
    end. /* for each APMatchingLnRevTax of APMatchingLn Transaction */
    
end. /* STATCURRDETBLOCK */

assign oiReturnStatus = viLocalReturnStatus.