project QadFinancials > class BAPMatching > method GetPendingVouchersNoLogChargesTaxWHT
Description
Submethod of GetPendingVouchersNoLogChargesTax
Parameters
ilAutoSelect | input | logical | Auto-select |
ilCallGTM | input | logical | Shoudl we call GTM |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program7/bapmatching.p)
/* ========================================================================================================= */
/* Retrieve all WHT taxes that were entered on the Fiscal receiving document */
/* ========================================================================================================= */
/* ALL DATA WE USE IN HERE SHOULD BE AVAILABLE AS THIS METHOD AND ITS CALLING METHOD ARE IN THE SAME SEGMENT */
/* ========================================================================================================= */
/* ====================== */
/* Default return-status */
/* ====================== */
assign oiReturnStatus = -98.
/* =============================================================================== */
/* Create MatchingLnWHT in case GTM does not need to be called */
/* If GTM needs to be called then this is done by the parent-method of this method */
/* The amounts here do depend upon the fact whether a pvo is selected or not */
/* =============================================================================== */
if ilCallGTM = false
then do:
create tPendingVoucherWHTAPM.
assign tPendingVoucherWHTAPM.tcDomainCode = tqPendingVoucherForMatchingNoLC.tctx2_domain
tPendingVoucherWHTAPM.tcVatCode = tqPendingVoucherForMatchingNoLC.tctx2_tax_code
tPendingVoucherWHTAPM.tcVatInOut = {&VATINOUT-INPUT}
tPendingVoucherWHTAPM.APMatchingLnWHTTaxType = tqPendingVoucherForMatchingNoLC.tctx2d_tax_type
tPendingVoucherWHTAPM.APMatchingLnWHTTaxTrType = tqPendingVoucherForMatchingNoLC.tctx2d_tr_type
tPendingVoucherWHTAPM.APMatchingLnWHTTxFeeDebTC = if ilAutoSelect = true
then if tAPMatching.tcCInvoiceType = {&INVOICETYPE-INVOICE} or tAPMatching.tcCInvoiceType = {&INVOICETYPE-INVOICECORRECTION}
then 0
else tqPendingVoucherForMatchingNoLC.tdtx2d_tottax
else 0
tPendingVoucherWHTAPM.APMatchingLnWHTTxFeeCredTC = if ilAutoSelect = true
then if tAPMatching.tcCInvoiceType = {&INVOICETYPE-INVOICE} or tAPMatching.tcCInvoiceType = {&INVOICETYPE-INVOICECORRECTION}
then tqPendingVoucherForMatchingNoLC.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 tqPendingVoucherForMatchingNoLC.tdtx2d_taxable_amt
else 0
tPendingVoucherWHTAPM.APMatchingLnWHTTxFeeCredLC = if ilAutoSelect = true
then if tAPMatching.tcCInvoiceType = {&INVOICETYPE-INVOICE} or tAPMatching.tcCInvoiceType = {&INVOICETYPE-INVOICECORRECTION}
then tqPendingVoucherForMatchingNoLC.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 tqPendingVoucherForMatchingNoLC.tdtx2d_totamt
else 0
tPendingVoucherWHTAPM.APMatchingLnWHTFeeCredTC = if ilAutoSelect = true
then if tAPMatching.tcCInvoiceType = {&INVOICETYPE-INVOICE} or tAPMatching.tcCInvoiceType = {&INVOICETYPE-INVOICECORRECTION}
then tqPendingVoucherForMatchingNoLC.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 tqPendingVoucherForMatchingNoLC.tdtx2d_cur_tax_amt
else 0
tPendingVoucherWHTAPM.APMatchingLnWHTAmtCredTC = if ilAutoSelect = true
then if tAPMatching.tcCInvoiceType = {&INVOICETYPE-INVOICE} or tAPMatching.tcCInvoiceType = {&INVOICETYPE-INVOICECORRECTION}
then tqPendingVoucherForMatchingNoLC.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 tqPendingVoucherForMatchingNoLC.tdtx2d_tax_amt
else 0
tPendingVoucherWHTAPM.APMatchingLnWHTAmtCredLC = if ilAutoSelect = true
then if tAPMatching.tcCInvoiceType = {&INVOICETYPE-INVOICE} or tAPMatching.tcCInvoiceType = {&INVOICETYPE-INVOICECORRECTION}
then tqPendingVoucherForMatchingNoLC.tdtx2d_tax_amt
else 0
else 0
tPendingVoucherWHTAPM.APMatchingLnWHTIsUpdAllow = tqPendingVoucherForMatchingNoLC.tltx2_update_tax
tPendingVoucherWHTAPM.APMatchingLnWHTTaxPct = tqPendingVoucherForMatchingNoLC.tdtx2_tax_pct
tPendingVoucherWHTAPM.APMatchingLnWHTRecovTaxPct = tqPendingVoucherForMatchingNoLC.tdtx2_pct_recv
tPendingVoucherWHTAPM.tcGLCode = if tAPMatching.tcCInvoiceType = {&INVOICETYPE-INVOICE} or tAPMatching.tcCInvoiceType = {&INVOICETYPE-INVOICECORRECTION}
then tqPendingVoucherForMatchingNoLC.tctx2_ap_acct
else tqPendingVoucherForMatchingNoLC.tctx2_ap_cn_acct
tPendingVoucherWHTAPM.tcDivisionCode = if tAPMatching.tcCInvoiceType = {&INVOICETYPE-INVOICE} or tAPMatching.tcCInvoiceType = {&INVOICETYPE-INVOICECORRECTION}
then tqPendingVoucherForMatchingNoLC.tctx2_ap_sub
else tqPendingVoucherForMatchingNoLC.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 tqPendingVoucherForMatchingNoLC.tctx2_base <> "" and
tqPendingVoucherForMatchingNoLC.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 = tqPendingVoucherForMatchingNoLC.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 */
end. /* if ilCallGTM = false and */
/* =================== */
/* Return-status = OK */
/* =================== */
if oiReturnStatus = -98
then assign oiReturnStatus = 0.