project QadFinancials > class BAPMatching > API query APMatchingLnByPvo

Description

This query retrieves all matching lines and its tax-details that are related to one pending voucher. There are retrieved both matchings in initial and in final status (if needed you can test APMatchingStatus field).
Result-set is indexed on APMatchingLn_ID


query filter (table tFilter)


tcBusinessFieldNametcDataTypetcOperator
iiCompanyIdi
iiPvoIdi=
iiPvoLineIdi=
icDomainCodec=
tAPMatching.APMatchingDatet=,>=,>,<>,<=,<
tAPMatchingLn.APMatchingLnIsPvodFinishedl=,<>
tAPMatchingLn.APMatchingLnMatchQtyd=,>=,>,<>,<=,<
tAPMatchingLn.APMatchingLnMatchUnitPriced=,>=,>,<>,<=,<
tAPMatchingLn.APMatchingLnPvodItemc=,>=,>,<>,<=,<,begins,can-do,matches
tAPMatchingLn.APMatchingLnPvodLgChargec=,>=,>,<>,<=,<,begins,can-do,matches
tAPMatchingLn.APMatchingLnReceiptAmtLCd=,>=,>,<>,<=,<
tAPMatchingLn.APMatchingLnReceiptAmtTCd=,>=,>,<>,<=,<
tAPMatchingLnTax.APMatchingLnTaxAINRecTaxTCd=,>=,>,<>,<=,<
tAPMatchingLnTax.APMatchingLnTaxAIRecTaxTCd=,>=,>,<>,<=,<
tAPMatchingLnTax.APMatchingLnTaxARNRecTaxTCd=,>=,>,<>,<=,<
tAPMatchingLnTax.APMatchingLnTaxARRecTaxTCd=,>=,>,<>,<=,<
tAPMatching.APMatchingStatusc=,>=,>,<>,<=,<,begins,can-do,matches
tCInvoice.CInvoiceBalanceLCd=,>=,>,<>,<=,<
tCInvoice.CInvoiceDatet=,>=,>,<>,<=,<
tCInvoice.CInvoiceIsOpenl=,<>
tCInvoice.CInvoicePostingDatet=,>=,>,<>,<=,<
tCInvoice.CInvoicePostingYeari=,>=,>,<>,<=,<
tCInvoice.CInvoiceReferencec=,>=,>,<>,<=,<,begins,can-do,matches
tCInvoice.CInvoiceVoucheri=,>=,>,<>,<=,<
tCompany.CompanyCodec=,>=,>,<>,<=,<,begins,can-do,matches
tCreditor.CreditorCodec=,>=,>,<>,<=,<,begins,can-do,matches
tCurrency.CurrencyCodec=,>=,>,<>,<=,<,begins,can-do,matches
tJournal.JournalCodec=,>=,>,<>,<=,<,begins,can-do,matches
tAPMatchingLn.PvoDomainc=,>=,>,<>,<=,<,begins,can-do,matches


Parameters (internal)


iiCompanyIdintegerCompany id
iiPvoIdintegerPending voucher Id
iiPvoLineIdintegerPending voucher Line ID
icDomainCodecharacter


query condition


  each APMatchingLn where
APMatchingLn.PvoID = iiPvoId AND
APMatchingLn.PvodLineID = iiPvoLineID AND
APMatchingLn.PvoDomain = icDomainCode

      first APMatching (inner-join) where
APMatching.APMatching_ID = APMatchingLn.APMatching_ID AND
(APMatching.Company_ID = ? or true )

          first CInvoice (inner-join) where
CInvoice.CInvoice_ID = APMatching.CInvoice_ID AND
(CInvoice.Company_Id = ? or true )

              first Creditor (inner-join) where
Creditor.Creditor_ID = CInvoice.Creditor_ID AND
(Creditor.SharedSet_Id = ? or true )

              first Currency (inner-join) where
Currency.Currency_ID = CInvoice.CInvoiceCurrency_ID AND

              first Journal (inner-join) where
Journal.Journal_ID = CInvoice.Journal_ID AND
(Journal.SharedSet_Id = ? or true )

          first Company (inner-join) where
Company.Company_Id = iiCompanyId AND
Company.Company_ID = APMatching.Company_ID AND

      each APMatchingLnTax (outer-join) where
APMatchingLnTax.APMatchingLn_ID = APMatchingLn.APMatchingLn_ID AND


query resultset tqAPMatchingLnByPvo


field namedata typedb fielddescription
ttAPMatchingDatedateAPMatching.APMatchingDateDate
tiAPMatchingLn_IDintegerAPMatchingLn.APMatchingLn_IDRecord ID
tlAPMatchingLnIsPvodFinishedlogicalAPMatchingLn.APMatchingLnIsPvodFinishedFinished
tcAPMatchingLnItemcharacterAPMatchingLn.APMatchingLnPvodItemItem
tcAPMatchingLnLcChargecharacterAPMatchingLn.APMatchingLnPvodLgChargeLogistic Charge
tdAPMatchingLnMatchQtydecimalAPMatchingLn.APMatchingLnMatchQtyMatched Quantity
tdAPMatchingLnMatchUnitPricedecimalAPMatchingLn.APMatchingLnMatchUnitPriceMatched Unit Price
tdAPMatchingLnReceiptAmtLCdecimalAPMatchingLn.APMatchingLnReceiptAmtLCBC Receipt Amt
tdAPMatchingLnReceiptAmtTCdecimalAPMatchingLn.APMatchingLnReceiptAmtTCTC Receipt Amt
tdAPMatchingLnTaxAINRecTaxTCdecimalAPMatchingLnTax.APMatchingLnTaxAINRecTaxTCTC Non Recov Tax Accrued at Invoice
tdAPMatchingLnTaxAIRecTaxTCdecimalAPMatchingLnTax.APMatchingLnTaxAIRecTaxTCTC Recoverable Tax Accrued at Invoice
tdAPMatchingLnTaxARNRecTaxTCdecimalAPMatchingLnTax.APMatchingLnTaxARNRecTaxTCTC Non Recov Tax Accrued at Receipt
tdAPMatchingLnTaxARRecTaxTCdecimalAPMatchingLnTax.APMatchingLnTaxARRecTaxTCTC Recov Tax Accrued at Receipt
tcAPMatchingStatuscharacterAPMatching.APMatchingStatusStatus
tiCInvoice_IDintegerCInvoice.CInvoice_IDRecord ID
tdCInvoiceBalanceLCdecimalCInvoice.CInvoiceBalanceLCBC Balance. This field displays the sum of the debit and credit amounts of all posting lines in base currency.
This field is calculated by the system using the TC Balance and the Exchange rate.
tiCInvoiceCompany_IDintegerCInvoice.Company_IDLink to Company
tcCInvoiceCurrencyCodecharacterCurrency.CurrencyCodeCurrency Code
ttCInvoiceDatedateCInvoice.CInvoiceDateInvoice Date. This field indicates the invoice creation date.
The system uses this field with the credit terms to calculate due date and discount date.
api annotation:This field defaults from the system date.
tlCInvoiceIsOpenlogicalCInvoice.CInvoiceIsOpenOpen.This field indicates if the invoice has been completely paid.
This field is updated automatically when complete payment is confirmed.
This field is read-only.
api annotation:PartialUpdate = yes - defaults to true
tcCInvoiceJournalCodecharacterJournal.JournalCodeA daybook code (maximum eight characters).
ttCInvoicePostingDatedateCInvoice.CInvoicePostingDatePosting Date. This filed indicates the date on which the invoice is to be posted.
api annotation:This field defaults from the invoice creation date.
tcCInvoiceReferencecharacterCInvoice.CInvoiceReferenceReference. An alphanumeric reference to help identify the invoice in the system.
This reference is typically the ID number of the invoice received from the supplier.
tiCInvoiceVoucherintegerCInvoice.CInvoiceVoucherVoucher. This field displays the numeric identifier assigned to the posting.
When the daybook of the journal entry is changed (after transfer), the voucher is cleared.
Voucher must be unique in one GL period.
When the user input is zero, the system automatically assign a value not used yet for this field.
tiCInvoiceYearintegerCInvoice.CInvoicePostingYearYear.This field indicates the accounting year for the invoice.
If you modify these fields, the posting and tax dates are changed correspondingly.
api annotation:This field defaults to the accounting year associated with the posting date.
tiCompany_IDintegerAPMatching.Company_IDLink to Company
tcCompanyCodecharacterCompany.CompanyCodeEntity Code
tcCreditorCodecharacterCreditor.CreditorCodeSupplier Code
tiCreditorSharedSet_IDintegerCreditor.SharedSet_IDLink to SharedSet
tiPvodLineIDintegerAPMatchingLn.PvodLineIDPinv Line ID
tcPvoDomaincharacterAPMatchingLn.PvoDomainDomain
tiPvoIDintegerAPMatchingLn.PvoIDPinv ID
APMatchingLnCustomcharactercalculatedcustom fields
APMatchingCustomcharactercalculatedcustom fields
CInvoiceCustomcharactercalculatedcustom fields
CreditorCustomcharactercalculatedcustom fields
CurrencyCustomcharactercalculatedcustom fields
JournalCustomcharactercalculatedcustom fields
CompanyCustomcharactercalculatedcustom fields
APMatchingLnTaxCustomcharactercalculatedcustom fields
ti_sequenceintegercalculatedprimary index
tc_rowidcharactercalculated = rowid(APMatchingLn),rowid(APMatching),rowid(CInvoice),rowid(Creditor),rowid(Currency),rowid(Journal),rowid(Company),rowid(APMatchingLnTax)


Internal usage


QadFinancials
method BAPMatching.ApiGetAPMatchingLnByPvo
dataset BAPMatching.tAPMatchingLnByPvo


Sample code: how to call this query through RPCRequestService (QXtend Inbound)

define temp-table ttContext no-undo
    field propertyQualifier as character
    field propertyName as character
    field propertyValue as character
    index entityContext is primary unique
        propertyQualifier
        propertyName
    index propertyQualifier
        propertyQualifier.

define dataset dsContext for ttContext.

define variable vhContextDS as handle no-undo.
define variable vhExceptionDS as handle no-undo.
define variable vhServer as handle no-undo.
define variable vhInputDS as handle no-undo.
define variable vhInputOutputDS as handle no-undo.
define variable vhOutputDS as handle no-undo.
define variable vhParameter as handle no-undo.

/* Create context */
create ttContext.
assign ttContext.propertyName = "programName"
       ttContext.propertyValue = "BAPMatching".
create ttContext.
assign ttContext.propertyName = "methodName"
       ttContext.propertyValue = "APMatchingLnByPvo".
create ttContext.
assign ttContext.propertyName = "applicationId"
       ttContext.propertyValue = "fin".
create ttContext.
assign ttContext.propertyName = "entity"
       ttContext.propertyValue = "1000".
create ttContext.
assign ttContext.propertyName = "userName"
       ttContext.propertyValue = "mfg".
create ttContext.
assign ttContext.propertyName = "password"
       ttContext.propertyValue = "".

/* Create input dataset */
create dataset vhInputDS.
vhInputDS:read-xmlschema("file", "xml/bapmatching.apmatchinglnbypvo.i.xsd", ?).
vhParameter = vhInputDS:get-buffer-handle("tParameterI").
vhParameter:buffer-create().

assign vhParameter::icRange = "A"
       vhParameter::icRowid = ""
       vhParameter::iiRownum = 0
       vhParameter::iiNumber = 5 /* Number of records to read */
       vhParameter::icSortColumns = ""
       vhParameter::ilCountOnly = false
       vhParameter::ilForwardRead = true
       vhParameter::iiMaximumBrowseRecordsToCount = 0.

vhParameter = vhInputDS:get-buffer-handle("tFilter").
vhParameter:buffer-create().

assign vhParameter::<field-name-1> = <field-value-1>
       vhParameter::<field-name-2> = <field-value-2>
       ...

/* Connect the AppServer */
create server vhServer.
vhServer:connect("-URL <appserver-url>").

if not vhServer:connected()
then do:
    message "Could not connect AppServer" view-as alert-box error title "Error".
    return.
end.

/* Run */
assign vhContextDS = dataset dsContext:handle.

run program/rpcrequestservice.p on vhServer
    (input-output dataset-handle vhContextDS by-reference,
           output dataset-handle vhExceptionDS,
     input        dataset-handle vhInputDS by-reference,
     input-output dataset-handle vhInputOutputDS by-reference,
           output dataset-handle vhOutputDS).

/* Handle output however you want, in this example, we dump it to xml */
if valid-handle(vhExceptionDS)
then vhExceptionDS:write-xml("file", "Exceptions.xml", true).

if valid-handle(vhOutputDS)
then vhOutputDS:write-xml("file", "Output.xml", true).

/* Cleanup */
vhServer:disconnect().
assign vhServer = ?.

if valid-handle(vhInputDS)
then delete object vhInputDS.

if valid-handle(vhOutputDS)
then delete object vhOutputDS.

if valid-handle(vhExceptionDS)
then delete object vhExceptionDS.