project QadFinancials > class BDDocument > method AdditionalUpdatesPostingXrefDIDisc3

Description

Extended method of AdditionalUpdatesPostingXrefDIDisc


Parameters


idDiscountRatioinputdecimal
odDiscBaseDebitTCoutputdecimal
odDiscBaseCreditTCoutputdecimal
odDiscBaseDebitCCoutputdecimal
odDiscBaseCreditCCoutputdecimal
odDiscBaseDebitLCoutputdecimal
odDiscBaseCreditLCoutputdecimal
odDiscTaxDebitTCoutputdecimal
odDiscTaxCreditTCoutputdecimal
odDiscTaxDebitCCoutputdecimal
odDiscTaxCreditCCoutputdecimal
odDiscTaxDebitLCoutputdecimal
odDiscTaxCreditLCoutputdecimal
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BDDocument.AdditionalUpdatesPostingXrefDIDisc


program code (program5/bddocument.p)

assign oiReturnStatus = -98.
if can-do({&DOCUMENTSTATUS-INIT} + ",":U + {&DOCUMENTSTATUS-BOUNCED}, tDDocument.DDocumentStatus)
then assign vlReversalPosting = true.
else assign vlReversalPosting = false.
if tqPostingVatByPostingLineId.tltx2_pmt_disc = true
then assign odDiscBaseDebitTC  =  if vlReversalPosting then tqPostingVatByPostingLineId.tdPostingVatBaseDebitTC  * idDiscountRatio 
                                  else tqPostingVatByPostingLineId.tdPostingVatBaseCreditTC * idDiscountRatio
            odDiscBaseCreditTC =  if vlReversalPosting then  tqPostingVatByPostingLineId.tdPostingVatBaseCreditTC * idDiscountRatio
                                  else tqPostingVatByPostingLineId.tdPostingVatBaseDebitTC  * idDiscountRatio
            odDiscTaxDebitTC   =  if vlReversalPosting then tqPostingVatByPostingLineId.tdPostingVatTaxDebitTC   * idDiscountRatio
                                  else tqPostingVatByPostingLineId.tdPostingVatTaxCreditTC  * idDiscountRatio
            odDiscTaxCreditTC  =  if vlReversalPosting then tqPostingVatByPostingLineId.tdPostingVatTaxCreditTC  * idDiscountRatio
                                  else tqPostingVatByPostingLineId.tdPostingVatTaxDebitTC   * idDiscountRatio
            
            odDiscBaseDebitTC  = <M-46 RoundAmount
                                    (input  odDiscBaseDebitTC (idUnroundedAmount), 
                                     input  ? (iiCurrencyID), 
                                     input  tDDocumentInvoiceXref.tcCurrencyCode (icCurrencyCode)) in BDDocument>
            odDiscBaseCreditTC = <M-85 RoundAmount
                                    (input  odDiscBaseCreditTC (idUnroundedAmount), 
                                     input  ? (iiCurrencyID), 
                                     input  tDDocumentInvoiceXref.tcCurrencyCode (icCurrencyCode)) in BDDocument>
            odDiscTaxDebitTC   = <M-39 RoundAmount
                                    (input  odDiscTaxDebitTC (idUnroundedAmount), 
                                     input  ? (iiCurrencyID), 
                                     input  tDDocumentInvoiceXref.tcCurrencyCode (icCurrencyCode)) in BDDocument>
            odDiscTaxCreditTC  = <M-84 RoundAmount
                                    (input  odDiscTaxCreditTC (idUnroundedAmount), 
                                     input  ? (iiCurrencyID), 
                                     input  tDDocumentInvoiceXref.tcCurrencyCode (icCurrencyCode)) in BDDocument>

            odDiscBaseDebitCC  = <M-98 RoundAmount
                                    (input  odDiscBaseDebitTC * tDDocumentInvoiceXref.tdCCExchangeRate * tDDocumentInvoiceXref.tdCCExchangeRateScale (idUnroundedAmount), 
                                     input  viCompanyCCId (iiCurrencyID), 
                                     input  vcCompanyCC (icCurrencyCode)) in BDDocument>
            odDiscBaseCreditCC = <M-81 RoundAmount
                                    (input  odDiscBaseCreditTC * tDDocumentInvoiceXref.tdCCExchangeRate * tDDocumentInvoiceXref.tdCCExchangeRateScale (idUnroundedAmount), 
                                     input  viCompanyCCId (iiCurrencyID), 
                                     input  vcCompanyCC (icCurrencyCode)) in BDDocument>
            odDiscTaxDebitCC   = <M-50 RoundAmount
                                    (input  odDiscTaxDebitTC * tDDocumentInvoiceXref.tdCCExchangeRate * tDDocumentInvoiceXref.tdCCExchangeRateScale (idUnroundedAmount), 
                                     input  viCompanyCCId (iiCurrencyID), 
                                     input  vcCompanyCC (icCurrencyCode)) in BDDocument>
            odDiscTaxCreditCC  = <M-32 RoundAmount
                                    (input  odDiscTaxCreditTC * tDDocumentInvoiceXref.tdCCExchangeRate * tDDocumentInvoiceXref.tdCCExchangeRateScale (idUnroundedAmount), 
                                     input  viCompanyCCId (iiCurrencyID), 
                                     input  vcCompanyCC (icCurrencyCode)) in BDDocument>

            odDiscBaseDebitLC  = <M-74 RoundAmount
                                    (input  odDiscBaseDebitTC * tDDocumentInvoiceXref.tdLCExchangeRate * tDDocumentInvoiceXref.tdLCExchangeRateScale (idUnroundedAmount), 
                                     input  viCompanyLCId (iiCurrencyID), 
                                     input  vcCompanyLC (icCurrencyCode)) in BDDocument>
            odDiscBaseCreditLC = <M-51 RoundAmount
                                    (input  odDiscBaseCreditTC * tDDocumentInvoiceXref.tdLCExchangeRate * tDDocumentInvoiceXref.tdLCExchangeRateScale (idUnroundedAmount), 
                                     input  viCompanyLCId (iiCurrencyID), 
                                     input  vcCompanyLC (icCurrencyCode)) in BDDocument>
            odDiscTaxDebitLC   = <M-16 RoundAmount
                                    (input  odDiscTaxDebitTC * tDDocumentInvoiceXref.tdLCExchangeRate * tDDocumentInvoiceXref.tdLCExchangeRateScale (idUnroundedAmount), 
                                     input  viCompanyLCId (iiCurrencyID), 
                                     input  vcCompanyLC (icCurrencyCode)) in BDDocument>
            odDiscTaxCreditLC  = <M-96 RoundAmount
                                    (input  odDiscTaxCreditTC * tDDocumentInvoiceXref.tdLCExchangeRate * tDDocumentInvoiceXref.tdLCExchangeRateScale (idUnroundedAmount), 
                                     input  viCompanyLCId (iiCurrencyID), 
                                     input  vcCompanyLC (icCurrencyCode)) in BDDocument>.
/* Tax is not discountable at payment */
else assign odDiscBaseDebitTC  = 0
            odDiscBaseCreditTC = 0
            odDiscBaseDebitCC  = 0
            odDiscBaseCreditCC = 0
            odDiscBaseDebitLC  = 0
            odDiscBaseCreditLC = 0
            odDiscTaxDebitTC   = 0
            odDiscTaxCreditTC  = 0
            odDiscTaxDebitCC   = 0
            odDiscTaxCreditCC  = 0
            odDiscTaxDebitLC   = 0
            odDiscTaxCreditLC  = 0.
if oiReturnStatus = -98 then assign oiReturnStatus = 0.