project QadFinancials > class BPaymentSelection > method CalculatePaySelLineWhtAssign

Description

This method does assignment of the WHT data to the CDocumentInvoiceXref table. These data are taken from the tDefaultWhtCDoc table, filled by previous execution of method BCInvoice.DefaultWhtData


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BPaymentSelection.CalculatePaySelLine


program code (program3/bpaymentselection.p)

/* ====================================================================================== *
 * Method       : This method does assignment of the WHT data to the CDocumentInvXref     *                                                                        *
 * Description  :                                                                         *
 * -------------------------------------------------------------------------------------- *
 * Parameters   :                                                                         *
 * ====================================================================================== */
 
MAIN_BLOCK:
do on error undo, throw:
    /* Default output parameters */
    find first tDefaultWHTDataForPaySel where
               tDefaultWHTDataForPaySel.tiCInvoiceID = tPaySelLine.PaySelLineParentObject_ID
               no-error.
    
    if available tDefaultWHTDataForPaySel
    then assign tPaySelLine.tdCInvoiceTotWHTBaseTC        = tDefaultWHTDataForPaySel.tdCInvoiceTotalWHTTaxFeeTC
                tPaySelLine.tdCInvoiceWHTUnpaidAmtTC      = tDefaultWHTDataForPaySel.tdUnpaidWHTAmountTC
                tPaySelLine.tlUpdateTax                   = tDefaultWHTDataForPaySel.tlUpdateTaxIsAllowed
                tPaySelLine.tdCInvoiceWHTAmtTC            = tDefaultWHTDataForPaySel.tdWHTAmountTC
                tPaySelLine.tdCInvoiceTotWHTTC            = tDefaultWHTDataForPaySel.tdCInvoiceTotalWHTAmountTC
                tPaySelLine.tdTotWHTAmtTC                 = tDefaultWHTDataForPaySel.tdWHTAmountTC
                tPaySelLine.tdInitiallyAllocatedWHTAmntTC = tDefaultWHTDataForPaySel.tdInitiallyAllocatedWHTAmountTC
                tPaySelLine.tdWHTTaxableFeeTC             = tDefaultWHTDataForPaySel.tdCInvoiceTotalWHTTaxFeeTC
                tPaySelLine.tdWHTAmtTC                    = tDefaultWHTDataForPaySel.tdWHTAmountTC
                tPaySelLine.tdWHTAmtLC                    = tDefaultWHTDataForPaySel.tdWHTAmountLC
                tPaySelLine.tdWHTAmtCC                    = tDefaultWHTDataForPaySel.tdWHTAmountCC
                tPaySelLine.tdWHTTCLCExchangeRate         = tDefaultWHTDataForPaySel.tdWHTTCLCExchangeRate
                tPaySelLine.tdWHTTCLCRateScale            = tDefaultWHTDataForPaySel.tdWHTTCLCRateScale
                tPaySelLine.tdWHTTCCCExchangeRate         = tDefaultWHTDataForPaySel.tdWHTTCCCExchangeRate
                tPaySelLine.tdWHTTCCCRateScale            = tDefaultWHTDataForPaySel.tdWHTTCCCRateScale
                tPaySelLine.tdWHTPerc                     = if tDefaultWHTDataForPaySel.tdCInvoiceTotalWHTTaxFeeTC <> 0
                                                            then abs((tDefaultWHTDataForPaySel.tdWHTAmountTC / 
                                                                      tDefaultWHTDataForPaySel.tdCInvoiceTotalWHTTaxFeeTC) * 100)
                                                            else 0
                tPaySelLine.tdOpenInvoiceAmountTC         = tPaySelLine.tdOpenInvoiceAmountTC - tPaySelLine.tdInitiallyAllocatedWHTAmntTC.
end. /* MAIN_BLOCK */