project QadFinancials > class BCInvoice > method CreateCIPostingCalculateAmounts

Description

Calculate the amounts for the ci posting


Parameters


ilIsCreditorControlAccountinputlogicalIs this for the creditor control account ?
icCInvoiceTypeinputcharacterInvoice Type
idInvoiceAmountTCinputdecimalInvoice Amount in TC
idInvoiceAmountLCinputdecimalInvoice Amount in LC
idInvoiceAmountCCinputdecimalInvoice Amount in CC
icPostingTypeinputcharacterPosting Type
odDebitTCoutputdecimalDebit TC
odDebitLCoutputdecimalDebit BC
odDebitCCoutputdecimalDebit CC
odCreditTCoutputdecimalCredit TC
odCreditLCoutputdecimalCredit BC
odCreditCCoutputdecimalCredit CC
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BCInvoice.CreateCIPosting2
method BCInvoice.CreateCIPostingControl


program code (program3/bcinvoice.p)

if ilIsCreditorControlAccount
then do:
    case icCInvoiceType:
        when {&INVOICETYPE-INVOICE} or 
        when {&INVOICETYPE-INVOICECORRECTION}
        then assign odDebitTC  = 0
                    odCreditTC = idInvoiceAmountTC
                    odDebitLC  = 0
                    odCreditLC = idInvoiceAmountLC
                    odDebitCC  = 0
                    odCreditCC = idInvoiceAmountCC.
        when {&INVOICETYPE-CREDITNOTE} or 
        when {&INVOICETYPE-CREDITNOTECORRECTION}
        then assign odDebitTC  = idInvoiceAmountTC
                    odCreditTC = 0
                    odDebitLC  = idInvoiceAmountLC
                    odCreditLC = 0
                    odDebitCC  = idInvoiceAmountCC
                    odCreditCC = 0.
        when {&INVOICETYPE-ADJUSTMENT} or 
        when {&INVOICETYPE-PREPAYMENT}
        then assign odDebitTC  = if icPostingType = {&POSTINGTYPE-DEBIT}
                                 then idInvoiceAmountTC
                                 else 0
                    odCreditTC = if icPostingType = {&POSTINGTYPE-CREDIT}
                                 then idInvoiceAmountTC
                                 else 0
                    odDebitLC  = if icPostingType = {&POSTINGTYPE-DEBIT}
                                 then idInvoiceAmountLC
                                 else 0
                    odCreditLC = if icPostingType = {&POSTINGTYPE-CREDIT}
                                 then idInvoiceAmountLC
                                 else 0
                    odDebitCC  = if icPostingType = {&POSTINGTYPE-DEBIT}
                                 then idInvoiceAmountCC
                                 else 0
                    odCreditCC = if icPostingType = {&POSTINGTYPE-CREDIT}
                                 then idInvoiceAmountCC
                                 else 0.
    end case.
end.
else do:
    case icCInvoiceType:
        when {&INVOICETYPE-INVOICE} or 
        when {&INVOICETYPE-INVOICECORRECTION}
        then assign odDebitTC  = idInvoiceAmountTC
                    odCreditTC = 0
                    odDebitLC  = idInvoiceAmountLC
                    odCreditLC = 0
                    odDebitCC  = idInvoiceAmountCC
                    odCreditCC = 0.
        when {&INVOICETYPE-CREDITNOTE} or 
        when {&INVOICETYPE-CREDITNOTECORRECTION}
        then assign odDebitTC  = 0
                    odCreditTC = idInvoiceAmountTC
                    odDebitLC  = 0
                    odCreditLC = idInvoiceAmountLC
                    odDebitCC  = 0
                    odCreditCC = idInvoiceAmountCC.
        when {&INVOICETYPE-ADJUSTMENT} or 
        when {&INVOICETYPE-PREPAYMENT}
        then assign odDebitTC  = if icPostingType = {&POSTINGTYPE-CREDIT}
                                 then idInvoiceAmountTC
                                 else 0
                    odCreditTC = if icPostingType = {&POSTINGTYPE-DEBIT}
                                 then idInvoiceAmountTC
                                 else 0
                    odDebitLC  = if icPostingType = {&POSTINGTYPE-CREDIT}
                                 then idInvoiceAmountLC
                                 else 0
                    odCreditLC = if icPostingType = {&POSTINGTYPE-DEBIT}
                                 then idInvoiceAmountLC
                                 else 0
                    odDebitCC  = if icPostingType = {&POSTINGTYPE-CREDIT}
                                 then idInvoiceAmountCC
                                 else 0
                    odCreditCC = if icPostingType = {&POSTINGTYPE-DEBIT}
                                 then idInvoiceAmountCC
                                 else 0.
    end case.
end.