project QadFinancials > class BAPMatching > business logic query APMatchingLnForPvodDetails

Description

APMatchingLnForPvodDetails: query used from the Calculate-method of the APMatching to verify if the pending-voucher data is still the same as one the moment the matching was saved.
This query will return pending-voucher-detail (pvod_det) records with the underlaying tx2d_det records. So the reurn-set will contain multiple records for a single pvod_det in case there were multiple tax-rates applied to the pvod_det.
An index is added on field APMatchingLN_ID


Parameters


iiAPMatchingIDintegerAPMatchingID
iiCompanyIdintegerCompany id


query condition


  each APMatchingLn where
APMatchingLn.APMatching_ID = iiAPMatchingID

      first pvod_det (inner-join) where
pvod_det.pvod_domain = APMatchingLn.PvoDomain AND
pvod_det.pvod_id = APMatchingLn.PvoID AND
pvod_det.pvod_id_line = APMatchingLn.PvodLineID AND

          first pod_det (inner-join) where
pod_det.pod_domain = pvod_det.pvod_domain AND
pod_det.pod_line = pvod_det.pvod_order_line AND
pod_det.pod_nbr = pvod_det.pvod_order AND

              first si_mstr (inner-join) where
si_mstr.si_domain = pod_det.pod_domain AND
si_mstr.si_site = pod_det.pod_site AND

                  first en_mstr (inner-join) where
en_mstr.en_domain = si_mstr.si_domain AND
en_mstr.en_entity = si_mstr.si_entity AND

                      first Company (inner-join) where
Company.Company_Id = iiCompanyId AND
Company.CompanyCode = en_mstr.en_entity AND

          first pvo_mstr (inner-join) where
pvo_mstr.pvo_domain = pvod_det.pvod_domain AND
pvo_mstr.pvo_id = pvod_det.pvod_id AND

              first prh_hist (outer-join) where
prh_hist.prh_domain = pvo_mstr.pvo_domain AND
prh_hist.prh_nbr = pvo_mstr.pvo_order AND
prh_hist.prh_receiver = pvo_mstr.pvo_internal_ref AND
prh_hist.prh_line = pvo_mstr.pvo_line AND

              first pt_mstr (outer-join) where
pt_mstr.pt_domain = pvo_mstr.pvo_domain AND
pt_mstr.pt_part = pvo_mstr.pvo_part AND

          each tx2d_det (outer-join) where
tx2d_det.tx2d_domain = pvod_det.pvod_domain AND
((tx2d_det.tx2d_line = pvod_det.pvod_order_line AND
'01' = pvod_det.pvod_order_type) OR
(0 = pvod_det.pvod_order_line AND
pvod_det1.pvod_id_line = tx2d_det1.tx2d_line AND
'02' = pvod_det.pvod_order_type) OR
(tx2d_det.tx2d_line = 0 AND
'01' = pvod_det.pvod_order_type)) AND
tx2d_det.tx2d_ref = (if pvod_det.pvod_accrued_amt = 0 then pvod_det.pvod_internal_ref else string(pvod_det.pvod_id) ) AND
(tx2d_det.tx2d_tr_type = '45' OR
tx2d_det.tx2d_tr_type = '43' OR
tx2d_det.tx2d_tr_type = '21' OR
tx2d_det.tx2d_tr_type = '27' OR
tx2d_det.tx2d_tr_type = '25' OR
tx2d_det.tx2d_tr_type = '60' OR
tx2d_det.tx2d_tr_type = '30') AND

              first tx2_mstr (outer-join) where
tx2_mstr.tx2_domain = tx2d_det.tx2d_domain AND
tx2_mstr.tx2_tax_code = tx2d_det.tx2d_tax_code AND


query resultset tqAPMatchingLnForPvodDetails


field namedata typedb fielddescription
tiAPMatching_IDintegerAPMatchingLn.APMatching_IDLink to APMatching
tiAPMatchingLn_IDintegerAPMatchingLn.APMatchingLn_IDRecord ID
tiCompany_IDintegerCompany.Company_IDRecord ID
tcCompanyCodecharacterCompany.CompanyCodeEntity Code
tcpod_loccharacterpod_det.pod_locLocation
tlpod_taxablelogicalpod_det.pod_taxableTaxable
tcpod_vpartcharacterpod_det.pod_vpartSupplier Item
tcprh_sitecharacterprh_hist.prh_siteSite
tcprh_typecharacterprh_hist.prh_typePurchase Type
tcprh_umcharacterprh_hist.prh_umUM
tdprh_um_convdecimalprh_hist.prh_um_convUM Conversion
tcpt_desc1characterpt_mstr.pt_desc1Description
tcpt_desc2characterpt_mstr.pt_desc2Description
tcpvo_accrual_acctcharacterpvo_mstr.pvo_accrual_acctAccrual Account
tcpvo_accrual_cccharacterpvo_mstr.pvo_accrual_ccAccrual Cost Ctr
tcpvo_accrual_subcharacterpvo_mstr.pvo_accrual_subAccrual Sub-Account
tdpvo_accrued_amtdecimalpvo_mstr.pvo_accrued_amtAccrued Amount
tcpvo_approvercharacterpvo_mstr.pvo_approverApproved By
tcpvo_buyercharacterpvo_mstr.pvo_buyerBuyer
tcpvo_currcharacterpvo_mstr.pvo_currCurrency
tcpvo_domaincharacterpvo_mstr.pvo_domainDomain
tcpvo_external_refcharacterpvo_mstr.pvo_external_refExternal Reference
tipvo_idintegerpvo_mstr.pvo_idPending Voucher ID
tcpvo_internal_refcharacterpvo_mstr.pvo_internal_refInternal Reference
tcpvo_last_vouchercharacterpvo_mstr.pvo_last_voucherVoucher
tcpvo_lc_chargecharacterpvo_mstr.pvo_lc_chargeLogistics Charge Code
tipvo_lineintegerpvo_mstr.pvo_lineLine
tcpvo_ordercharacterpvo_mstr.pvo_orderOrder
tcpvo_order_typecharacterpvo_mstr.pvo_order_typeOrder Type
tcpvo_partcharacterpvo_mstr.pvo_partItem Number
tcpvo_projectcharacterpvo_mstr.pvo_projectProject
tcpvo_shipfromcharacterpvo_mstr.pvo_shipfromShip-From
tcpvo_shiptocharacterpvo_mstr.pvo_shiptoShip-To
tcpvo_suppliercharacterpvo_mstr.pvo_supplierSupplier
ttpvo_trans_datedatepvo_mstr.pvo_trans_dateTransaction Date
tdpvo_trans_qtydecimalpvo_mstr.pvo_trans_qtyTransaction Qty
tdpvo_vouchered_amtdecimalpvo_mstr.pvo_vouchered_amtVouchered Amt
tdpvo_vouchered_qtydecimalpvo_mstr.pvo_vouchered_qtyVouchered Qty
tcpvod_accrual_acctcharacterpvod_det.pvod_accrual_acctAccrual Account
tcpvod_accrual_cccharacterpvod_det.pvod_accrual_ccAccrual Cost Ctr
tcpvod_accrual_subcharacterpvod_det.pvod_accrual_subAccrual Sub-Account
tdpvod_accrued_amtdecimalpvod_det.pvod_accrued_amtAccrued Amount
tcpvod_domaincharacterpvod_det.pvod_domainDomain
ttpvod_eff_datedatepvod_det.pvod_eff_dateEffective Date
tdpvod_ex_ratedecimalpvod_det.pvod_ex_rateExch Rate
tdpvod_ex_rate2decimalpvod_det.pvod_ex_rate2Exch Rate 2
tipvod_idintegerpvod_det.pvod_idPending Voucher ID
tipvod_id_lineintegerpvod_det.pvod_id_lineLine
tcpvod_last_vouchercharacterpvod_det.pvod_last_voucherSupplier Invoice
tipvod_order_lineintegerpvod_det.pvod_order_lineOrder Line
tcpvod_order_typecharacterpvod_det.pvod_order_typeOrder Type
tdpvod_pur_costdecimalpvod_det.pvod_pur_costPO Cost
ttpvod_trans_datedatepvod_det.pvod_trans_dateTransaction Date
tdpvod_trans_qtydecimalpvod_det.pvod_trans_qtyTransaction Qty
tdpvod_vouchered_qtydecimalpvod_det.pvod_vouchered_qtyVouchered Qty
tcsi_domaincharactersi_mstr.si_domainDomain
tcsi_entitycharactersi_mstr.si_entityEntity
tctx2_ap_acctcharactertx2_mstr.tx2_ap_acctAP Tax Account
tctx2_ap_cn_acctcharactertx2_mstr.tx2_ap_cn_acctAP Tax CN Account
tctx2_ap_cn_subcharactertx2_mstr.tx2_ap_cn_subAP Tax CN Sub-Account
tctx2_ap_subcharactertx2_mstr.tx2_ap_subAP Tax Sub-Account
tctx2_apr_acctcharactertx2_mstr.tx2_apr_acctAP Retained Tax Account
tctx2_apr_cn_acctcharactertx2_mstr.tx2_apr_cn_acctAP Tax Ret CN Account
tctx2_apr_cn_subcharactertx2_mstr.tx2_apr_cn_subAP Tax Ret CN Sub-Account
tctx2_apr_subcharactertx2_mstr.tx2_apr_subAP Retained Tax sub
tctx2_dltx_cn_acctcharactertx2_mstr.tx2_dltx_cn_acctDelayed Tax CN Account
tctx2_dltx_cn_subcharactertx2_mstr.tx2_dltx_cn_subDelayed Tax CN Sub-Account
tctx2_dltx_inv_acctcharactertx2_mstr.tx2_dltx_inv_acctDelayed Tax Invoice Account
tctx2_dltx_inv_subcharactertx2_mstr.tx2_dltx_inv_subDelayed Tax Invoice Sub-Account
tctx2_domaincharactertx2_mstr.tx2_domainDomain
tltx2_inv_disclogicaltx2_mstr.tx2_inv_discDiscount Tax at Invoice
tdtx2_pct_recvdecimaltx2_mstr.tx2_pct_recvPercent Recoverable
tltx2_rcpt_tax_pointlogicaltx2_mstr.tx2_rcpt_tax_pointAccrue Tax at Receipt
tltx2_reverse_chargelogicaltx2_mstr.tx2_reverse_chargeDomestic Reverse Charge
tltx2_stx_dltx_uselogicaltx2_mstr.tx2_stx_dltx_useSuspended/Delayed Taxes
tctx2_tax_codecharactertx2_mstr.tx2_tax_codeTax Code
tdtx2_tax_pctdecimaltx2_mstr.tx2_tax_pctTax Rate
tltx2_update_taxlogicaltx2_mstr.tx2_update_taxUpdate Tax Allowed
tltx2_usage_tax_pointlogicaltx2_mstr.tx2_usage_tax_pointAccrue Tax At Usage
tdtx2d_abs_ret_amtdecimaltx2d_det.tx2d_abs_ret_amtBase Absorbed/Retained
tdtx2d_cur_recov_amtdecimaltx2d_det.tx2d_cur_recov_amtRecoverable
tdtx2d_cur_tax_amtdecimaltx2d_det.tx2d_cur_tax_amtTax
tltx2d_rcpt_tax_pointlogicaltx2d_det.tx2d_rcpt_tax_pointAccrue Tax at Receipt
tctx2d_refcharactertx2d_det.tx2d_refReference
tdtx2d_tax_amtdecimaltx2d_det.tx2d_tax_amtBase Tax
tctx2d_tax_codecharactertx2d_det.tx2d_tax_codeTax Code
tctx2d_tax_envcharactertx2d_det.tx2d_tax_envTax Environment
tctx2d_tax_typecharactertx2d_det.tx2d_tax_typeTax Type
tctx2d_tax_usagecharactertx2d_det.tx2d_tax_usageTax Usage
tdtx2d_taxable_amtdecimaltx2d_det.tx2d_taxable_amtBase Taxable
tctx2d_taxccharactertx2d_det.tx2d_taxcTax Class
tdtx2d_totamtdecimaltx2d_det.tx2d_totamtTotal Amount
tdtx2d_tottaxdecimaltx2d_det.tx2d_tottaxTaxable Sales
tctx2d_tr_typecharactertx2d_det.tx2d_tr_typeTransaction Type
tltx2d_usage_tax_pointlogicaltx2d_det.tx2d_usage_tax_pointAccrue Tax At Usage
tctx2d_zone_fromcharactertx2d_det.tx2d_zone_fromShip-From Tax Zone
tctx2d_zone_tocharactertx2d_det.tx2d_zone_toShip-To Tax Zone


Internal usage


QadFinancials
method BAPMatching.CalculatePostAPMLnQuery