ilIsCreditorControlAccount | input | logical | Is this for the creditor control account ? |
icCInvoiceType | input | character | Invoice Type |
idInvoiceAmountTC | input | decimal | Invoice Amount in TC |
idInvoiceAmountLC | input | decimal | Invoice Amount in LC |
idInvoiceAmountCC | input | decimal | Invoice Amount in CC |
icPostingType | input | character | Posting Type |
odDebitTC | output | decimal | Debit TC |
odDebitLC | output | decimal | Debit BC |
odDebitCC | output | decimal | Debit CC |
odCreditTC | output | decimal | Credit TC |
odCreditLC | output | decimal | Credit BC |
odCreditCC | output | decimal | Credit CC |
oiReturnStatus | output | integer | Return status of the method. |
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.