project QadFinancials > class BAPMatching > method GetPendingVouchersNoLogChargesTaxFiscalWHT

Description

Submethod of GetPendingVouchersNoLogChargesTax


Parameters


ilAutoSelectinputlogicalAuto-select
ilCallGTMinputlogicalShoudl we call GTM
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BAPMatching.GetPendingVouchersNoLogChargesTaxFiscal


program code (program7/bapmatching.p)

create tPendingVoucherWHTAPM. 
assign tPendingVoucherWHTAPM.tcDomainCode               = tLgddDetMatForAPMBAPM.tclgd_domain
       tPendingVoucherWHTAPM.tcVatCode                  = tLgddDetTaxForAPMBAPM.tctx2d_tax_code
       tPendingVoucherWHTAPM.tcVatInOut                 = {&VATINOUT-INPUT}
       tPendingVoucherWHTAPM.APMatchingLnWHTTaxType     = tLgddDetTaxForAPMBAPM.tctx2d_tax_type
       tPendingVoucherWHTAPM.APMatchingLnWHTTaxTrType   = tLgddDetTaxForAPMBAPM.tctx2d_tr_type
       tPendingVoucherWHTAPM.APMatchingLnWHTTxFeeDebTC  = if ilAutoSelect = true
                                                          then if tAPMatching.tcCInvoiceType = {&INVOICETYPE-INVOICE} or tAPMatching.tcCInvoiceType = {&INVOICETYPE-INVOICECORRECTION}
                                                               then 0
                                                               else tLgddDetTaxForAPMBAPM.tdtx2d_tottax 
                                                          else 0
       tPendingVoucherWHTAPM.APMatchingLnWHTTxFeeCredTC = if ilAutoSelect = true
                                                          then if tAPMatching.tcCInvoiceType = {&INVOICETYPE-INVOICE} or tAPMatching.tcCInvoiceType = {&INVOICETYPE-INVOICECORRECTION}
                                                               then tLgddDetTaxForAPMBAPM.tdtx2d_tottax 
                                                               else 0
                                                          else 0
       tPendingVoucherWHTAPM.APMatchingLnWHTTxFeeDebLC  = if ilAutoSelect = true
                                                          then if tAPMatching.tcCInvoiceType = {&INVOICETYPE-INVOICE} or tAPMatching.tcCInvoiceType = {&INVOICETYPE-INVOICECORRECTION}
                                                               then 0
                                                               else tLgddDetTaxForAPMBAPM.tdtx2d_taxable_amt 
                                                          else 0
       tPendingVoucherWHTAPM.APMatchingLnWHTTxFeeCredLC = if ilAutoSelect = true
                                                          then if tAPMatching.tcCInvoiceType = {&INVOICETYPE-INVOICE} or tAPMatching.tcCInvoiceType = {&INVOICETYPE-INVOICECORRECTION}
                                                               then tLgddDetTaxForAPMBAPM.tdtx2d_taxable_amt 
                                                               else 0
                                                          else 0                                                                                       
       tPendingVoucherWHTAPM.APMatchingLnWHTFeeDebTC    = if ilAutoSelect = true
                                                          then if tAPMatching.tcCInvoiceType = {&INVOICETYPE-INVOICE} or tAPMatching.tcCInvoiceType = {&INVOICETYPE-INVOICECORRECTION}
                                                               then 0
                                                               else tLgddDetTaxForAPMBAPM.tdtx2d_totamt 
                                                          else 0
       tPendingVoucherWHTAPM.APMatchingLnWHTFeeCredTC   = if ilAutoSelect = true
                                                          then if tAPMatching.tcCInvoiceType = {&INVOICETYPE-INVOICE} or tAPMatching.tcCInvoiceType = {&INVOICETYPE-INVOICECORRECTION}
                                                               then tLgddDetTaxForAPMBAPM.tdtx2d_totamt
                                                               else 0
                                                          else 0
       tPendingVoucherWHTAPM.APMatchingLnWHTExpDebTC    = 0
       tPendingVoucherWHTAPM.APMatchingLnWHTExpCredTC   = 0
       tPendingVoucherWHTAPM.APMatchingLnWHTAmtDebTC    = if ilAutoSelect = true
                                                          then if tAPMatching.tcCInvoiceType = {&INVOICETYPE-INVOICE} or tAPMatching.tcCInvoiceType = {&INVOICETYPE-INVOICECORRECTION}
                                                               then 0
                                                               else tLgddDetTaxForAPMBAPM.tdtx2d_cur_tax_amt 
                                                          else 0
       tPendingVoucherWHTAPM.APMatchingLnWHTAmtCredTC   = if ilAutoSelect = true
                                                          then if tAPMatching.tcCInvoiceType = {&INVOICETYPE-INVOICE} or tAPMatching.tcCInvoiceType = {&INVOICETYPE-INVOICECORRECTION}
                                                               then tLgddDetTaxForAPMBAPM.tdtx2d_cur_tax_amt 
                                                               else 0
                                                          else 0          
       tPendingVoucherWHTAPM.APMatchingLnWHTAmtDebLC    = if ilAutoSelect = true
                                                          then if tAPMatching.tcCInvoiceType = {&INVOICETYPE-INVOICE} or tAPMatching.tcCInvoiceType = {&INVOICETYPE-INVOICECORRECTION}
                                                               then 0
                                                               else tLgddDetTaxForAPMBAPM.tdtx2d_tax_amt 
                                                          else 0
       tPendingVoucherWHTAPM.APMatchingLnWHTAmtCredLC   = if ilAutoSelect = true
                                                          then if tAPMatching.tcCInvoiceType = {&INVOICETYPE-INVOICE} or tAPMatching.tcCInvoiceType = {&INVOICETYPE-INVOICECORRECTION}
                                                               then tLgddDetTaxForAPMBAPM.tdtx2d_tax_amt 
                                                               else 0
                                                          else 0          
       tPendingVoucherWHTAPM.APMatchingLnWHTIsUpdAllow  = tLgddDetTaxForAPMBAPM.tltx2_update_tax
       tPendingVoucherWHTAPM.APMatchingLnWHTTaxPct      = tLgddDetTaxForAPMBAPM.tdtx2_tax_pct
       tPendingVoucherWHTAPM.APMatchingLnWHTRecovTaxPct = tLgddDetTaxForAPMBAPM.tdtx2_pct_recv
       tPendingVoucherWHTAPM.tcGLCode                   = if tAPMatching.tcCInvoiceType = {&INVOICETYPE-INVOICE} or tAPMatching.tcCInvoiceType = {&INVOICETYPE-INVOICECORRECTION}
                                                          then tLgddDetTaxForAPMBAPM.tctx2_ap_acct
                                                          else tLgddDetTaxForAPMBAPM.tctx2_ap_cn_acct
       tPendingVoucherWHTAPM.tcDivisionCode             = if tAPMatching.tcCInvoiceType = {&INVOICETYPE-INVOICE} or tAPMatching.tcCInvoiceType = {&INVOICETYPE-INVOICECORRECTION}
                                                          then tLgddDetTaxForAPMBAPM.tctx2_ap_sub
                                                          else tLgddDetTaxForAPMBAPM.tctx2_ap_cn_sub
       tPendingVoucherWHTAPM.APMatchingLnTax_ID         = ? /* not linked to any tax record here */
       tPendingVoucherWHTAPM.tc_ParentRowid             = tPendingVoucherAPM.tc_Rowid
       tPendingVoucherWHTAPM.tc_Rowid                   = string(viRowidPendingVoucherWHTAPM)
       tPendingVoucherWHTAPM.tc_Status                  = "N":U
       viRowidPendingVoucherWHTAPM                      = viRowidPendingVoucherWHTAPM + 1.      
<Q-20 run VATPrim (all) (Read) (NoCache)
   (input ?, (VatId)
    input tPendingVoucherWHTAPM.tcVatCode, (VatCode)
    input ?, (DomainId)
    input tPendingVoucherWHTAPM.tcDomainCode, (DomainCode)
    input tPendingVoucherWHTAPM.tcVatInOut, (VatInOut)
    output dataset tqVATPrim) in BVAT >
find first tqVatPrim where
           tqVATPrim.tcVatCode = tPendingVoucherWHTAPM.tcVatCode
           no-lock no-error.
assign tPendingVoucherWHTAPM.tcVatDescription = if available tqVATPrim
                                                then tqVATPrim.tcVatDescription
                                                else "":U.                
                                                
/* ================================================================= */                                                          
/* Retrieve tax base for the tax code to get the tax base percentage */
/* ================================================================= */                 
assign tPendingVoucherWHTAPM.APMatchingLnWHTBaseTaxPct = 100.
if tLgddDetTaxForAPMBAPM.tctx2_base <> "" and
   tLgddDetTaxForAPMBAPM.tctx2_base <> ?
then do:
    <Q-86 run GeneralizedCodeForSecurity (all) (Read) (Cache)
       (input tPendingVoucherWHTAPM.tcDomainCode, (DomainCode)
        input 'txb_base', (CodeFldName)
        input tqPendingVoucherForMatchingNoLC.tctx2_base, (CodeValue)
        output dataset tqGeneralizedCodeForSecurity) in BMfgGeneralizedCode>
    find first tqGeneralizedCodeForSecurity where
               tqGeneralizedCodeForSecurity.tccode_domain  = tPendingVoucherWHTAPM.tcDomainCode and
               tqGeneralizedCodeForSecurity.tccode_fldname = 'txb_base'   and
               tqGeneralizedCodeForSecurity.tccode_value   = tLgddDetTaxForAPMBAPM.tctx2_base
               no-lock no-error.
    if available tqGeneralizedCodeForSecurity
    then do:
        assign vcWHTBasePercentage = substring(tqGeneralizedCodeForSecurity.tccode_cmmt, 1, 9, "CHARACTER").
        if vcWHTBasePercentage <> "" and
           vcWHTBasePercentage <> ?
        then assign tPendingVoucherWHTAPM.APMatchingLnWHTBaseTaxPct = decimal(vcWHTBasePercentage) no-error.
        if error-status:error
        then assign tPendingVoucherWHTAPM.APMatchingLnWHTBaseTaxPct = 100.
    end. /* if available tqGeneralizedCodeForSecurity */
end. /* if tqPendingVoucherForMatchingNoLC.tctx2_base <> "" and */