project QadFinancials > class BCInvoice > API query CInvoiceBankForPayment

Description

This query lists all CInvoiceBank records based on payment information


query filter (table tFilter)


tcBusinessFieldNametcDataTypetcOperator
iiCompanyIdi
iiBankPayFormat_IDi=
ilIsInvoiceApprovedl=
iiCInvoice_IDi=
icCInvoiceTypeccan-do
ilIsLockPaymentl=
ilIsOpenl=
ilIsSelectedl=
icCurrencyCodec=
icDivisionCodecmatches
icPaymentGroupCodec=
icAddressTypeCodec=
icBusinessRelationCodec=
icCountryCodec=
ilIsWithBankl=
ilBusinessRelationIsIntercol=
icCorporateGroupCodec=
icFromBusinessRelationCodec>=
icToBusinessRelationCodec<=
icPaymentReferencec=
tAddressType.AddressTypeCodec=,>=,>,<>,<=,<,begins,can-do,matches
tBankNumber.BankNumberc=,>=,>,<>,<=,<,begins,can-do,matches
tBankNumber.BankNumberExtensionc=,>=,>,<>,<=,<,begins,can-do,matches
tBankNumber.BankNumberFormattedc=,>=,>,<>,<=,<,begins,can-do,matches
tBankNumber.BankNumberValidationc=,>=,>,<>,<=,<,begins,can-do,matches
tBusinessRelation.BusinessRelationCodec=,>=,>,<>,<=,<,begins,can-do,matches
tBusinessRelation.BusinessRelationIsInCompl=,<>
tBusinessRelation.BusinessRelationIsIntercol=,<>
tBusinessRelation.BusinessRelationName1c=,>=,>,<>,<=,<,begins,can-do,matches
tCInvoice.CInvoiceBalanceCreditTCd=,>=,>,<>,<=,<
tCInvoice.CInvoiceBalanceDebitTCd=,>=,>,<>,<=,<
tCInvoice.CInvoiceBalanceTCd=,>=,>,<>,<=,<
tCInvoiceBank.CInvoiceBankToPayTCd=,>=,>,<>,<=,<
tCInvoice.CInvoiceDatet=,>=,>,<>,<=,<
tCInvoice.CInvoiceDiscountDueDatet=,>=,>,<>,<=,<
tCInvoice.CInvoiceDueDatet=,>=,>,<>,<=,<
tCInvoice.CInvoiceExchangeRated=,>=,>,<>,<=,<
tCInvoice.CInvoiceHoldAmountTCd=,>=,>,<>,<=,<
tCInvoice.CInvoiceIsDiscTaxAtPayml=,<>
tCInvoice.CInvoiceIsInvoiceApprovedl=,<>
tCInvoice.CInvoiceIsLockPaymentl=,<>
tCInvoice.CInvoiceIsOpenl=,<>
tCInvoice.CInvoiceIsSelectedl=,<>
tCInvoice.CInvoiceIsWHTl=,<>
tCInvoice.CInvoiceIsWithBankl=,<>
tCInvoice.CInvoiceNonDiscAmtTCd=,>=,>,<>,<=,<
tCInvoice.CInvoiceOriginalCreditTCd=,>=,>,<>,<=,<
tCInvoice.CInvoiceOriginalDebitTCd=,>=,>,<>,<=,<
tCInvoice.CInvoicePostingDatet=,>=,>,<>,<=,<
tCInvoice.CInvoiceRateScaled=,>=,>,<>,<=,<
tCInvoice.CInvoiceReferencec=,>=,>,<>,<=,<,begins,can-do,matches
tCInvoice.CInvoiceTSMNumberc=,>=,>,<>,<=,<,begins,can-do,matches
tCInvoice.CInvoiceTypec=,>=,>,<>,<=,<,begins,can-do,matches
tCInvoice.CInvoiceVatBaseCreditTCd=,>=,>,<>,<=,<
tCInvoice.CInvoiceVatBaseDebitTCd=,>=,>,<>,<=,<
tCInvoice.CInvoiceVatCreditTCd=,>=,>,<>,<=,<
tCInvoice.CInvoiceVatDebitTCd=,>=,>,<>,<=,<
tCInvoice.CInvoiceVoucheri=,>=,>,<>,<=,<
tCInvoice.CInvoiceWHTBaseAmtCreditCCd=,>=,>,<>,<=,<
tCInvoice.CInvoiceWHTBaseAmtCreditLCd=,>=,>,<>,<=,<
tCInvoice.CInvoiceWHTBaseAmtCreditTCd=,>=,>,<>,<=,<
tCInvoice.CInvoiceWHTBaseAmtDebitCCd=,>=,>,<>,<=,<
tCInvoice.CInvoiceWHTBaseAmtDebitLCd=,>=,>,<>,<=,<
tCInvoice.CInvoiceWHTBaseAmtDebitTCd=,>=,>,<>,<=,<
tCInvoice.CInvoiceWHTTotAmtCreditCCd=,>=,>,<>,<=,<
tCInvoice.CInvoiceWHTTotAmtCreditLCd=,>=,>,<>,<=,<
tCInvoice.CInvoiceWHTTotAmtCreditTCd=,>=,>,<>,<=,<
tCInvoice.CInvoiceWHTTotAmtDebitCCd=,>=,>,<>,<=,<
tCInvoice.CInvoiceWHTTotAmtDebitLCd=,>=,>,<>,<=,<
tCInvoice.CInvoiceWHTTotAmtDebitTCd=,>=,>,<>,<=,<
tCompany.CompanyCodec=,>=,>,<>,<=,<,begins,can-do,matches
tCompanyProperty.CompanyPropertyIsWHTl=,<>
tCorporateGroup.CorporateGroupCodec=,>=,>,<>,<=,<,begins,can-do,matches
tCountry.CountryCodec=,>=,>,<>,<=,<,begins,can-do,matches
tCreditor.CreditorCodec=,>=,>,<>,<=,<,begins,can-do,matches
tCreditor.CreditorIsIndividualPaymntl=,<>
tCreditor.CreditorIsWHTl=,<>
tCurrency.CurrencyCodec=,>=,>,<>,<=,<,begins,can-do,matches
tDivision.DivisionCodec=,>=,>,<>,<=,<,begins,can-do,matches
tJournal.JournalCodec=,>=,>,<>,<=,<,begins,can-do,matches
tPaymentCondition.PaymentConditionPaymentTypc=,>=,>,<>,<=,<,begins,can-do,matches
tPaymentCondition.PaymentConditionPercentaged=,>=,>,<>,<=,<
tPaymentGroup.PaymentGroupCodec=,>=,>,<>,<=,<,begins,can-do,matches
tPeriod.PeriodPeriodi=,>=,>,<>,<=,<
tPeriod.PeriodYeari=,>=,>,<>,<=,<


Parameters (internal)


iiCompanyIdintegerCompany id
iiBankPayFormat_IDintegerBank Payment Format ID
ilIsInvoiceApprovedlogicalIs invoice approved flag
iiCInvoice_IDintegerCreditor Invoice ID
icCInvoiceTypecharacterInvoice Type
ilIsLockPaymentlogicalis lock payment flag
ilIsOpenlogicalis open flag
ilIsSelectedlogicalis selected flag
icCurrencyCodecharacterCurrency Code
icDivisionCodecharacterDivision Code
icPaymentGroupCodecharacterPayment Format Group
icAddressTypeCodecharacterAddress Type Code
icBusinessRelationCodecharacterBusiness Relation Code
icCountryCodecharacterCountry code
ilIsWithBanklogicalIs with bank
ilBusinessRelationIsIntercologicalBusiness Relation is Intercompany flag
icCorporateGroupCodecharacterCorporate Group Code
icFromBusinessRelationCodecharacterFrom BusinessRelationCode
icToBusinessRelationCodecharacterTo BusinessRelationCode
icPaymentReferencecharacterPayment Reference


query condition


  each CInvoice where
CInvoice.Company_Id = iiCompanyId AND
CInvoice.CInvoiceIsOpen = ilIsOpen AND
CInvoice.CInvoiceIsSelected = ilIsSelected AND
CInvoice.CInvoiceType can-do icCInvoiceType AND
CInvoice.CInvoiceIsWithBank = ilIsWithBank AND
CInvoice.CInvoice_ID = iiCInvoice_ID AND
CInvoice.CInvoiceIsInvoiceApproved = ilIsInvoiceApproved AND
CInvoice.CInvoiceIsLockPayment = ilIsLockPayment AND
CInvoice.CInvoiceTSMNumber = icPaymentReference

      each CInvoiceBank (conditional-join) where
CInvoiceBank.CInvoice_ID = CInvoice.CInvoice_ID AND

          first BankNumber (conditional-join) where
BankNumber.BankNumber_ID = CInvoiceBank.BankNumber_ID AND
BankNumber.BankPayFormat_ID = iiBankPayFormat_ID

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

          each CompanyProperty (inner-join) where
CompanyProperty.Company_Id = iiCompanyId AND
CompanyProperty.Company_ID = Company.Company_ID AND

      first Creditor (inner-join) where
Creditor.SharedSet_Id = vi_CREDITOR_sharedset(iiCompanyId) AND
Creditor.Creditor_ID = CInvoice.Creditor_ID AND

          first BusinessRelation (inner-join) where
BusinessRelation.BusinessRelation_ID = Creditor.BusinessRelation_ID AND
BusinessRelation.BusinessRelationCode = icBusinessRelationCode AND
BusinessRelation.BusinessRelationIsInterco = ilBusinessRelationIsInterco AND
BusinessRelation.BusinessRelationCode >= icFromBusinessRelationCode AND
BusinessRelation.BusinessRelationCode <= icToBusinessRelationCode

              each Address (inner-join) where
Address.BusinessRelation_ID = BusinessRelation.BusinessRelation_ID AND

                  first AddressType (inner-join) where
AddressType.AddressType_ID = Address.AddressType_ID AND
AddressType.AddressTypeCode = icAddressTypeCode

                  first Country (inner-join) where
Country.Country_ID = Address.Country_ID AND
Country.CountryCode = icCountryCode

              first CorporateGroup (conditional-join) where
CorporateGroup.CorporateGroup_ID = BusinessRelation.CorporateGroup_ID AND
CorporateGroup.CorporateGroupCode = icCorporateGroupCode

          first PaymentGroup (conditional-join) where
PaymentGroup.PaymentGroup_ID = Creditor.PaymentGroup_ID AND
PaymentGroup.PaymentGroupCode = icPaymentGroupCode

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

      first Division (conditional-join) where
Division.SharedSet_Id = vi_DIVISION_sharedset(iiCompanyId) AND
Division.Division_ID = CInvoice.Division_ID AND
Division.DivisionCode matches icDivisionCode

      first Journal (inner-join) where
Journal.SharedSet_Id = vi_JOURNAL_sharedset(iiCompanyId) AND
Journal.Journal_ID = CInvoice.Journal_ID AND

      first PaymentCondition (inner-join) where
PaymentCondition.PaymentCondition_ID = CInvoice.NormalPaymentCondition_ID AND

      first Period (inner-join) where
Period.Company_Id = iiCompanyId AND
Period.Period_ID = CInvoice.Period_ID AND


query resultset tqCInvoiceBankForPayment


field namedata typedb fielddescription
tcAddressTypeCodecharacterAddressType.AddressTypeCodeAddress Type
tcBankNumbercharacterBankNumber.BankNumberBank Number
tiBankNumber_IDintegerCInvoiceBank.BankNumber_IDBank Number
tcBankNumberExtensioncharacterBankNumber.BankNumberExtensionBank Extension
tcBankNumberFormattedcharacterBankNumber.BankNumberFormattedFormatted Bank Account No
tcBankNumberValidationcharacterBankNumber.BankNumberValidationValidation
tiBankPayFormat_IDintegerBankNumber.BankPayFormat_IDLink to BankPayFormat
tcBusinessRelationCodecharacterBusinessRelation.BusinessRelationCodeBusiness Relation. A code to identify the business relation.
If this field does not have a input from the user, the system automatically generates a number for the record based on the sequence defined in Business Relation Autonumber Create.
tlBusinessRelationIsInComplogicalBusinessRelation.BusinessRelationIsInCompInternal Entity. This filed indicates if the business relation identifies one of your entities within this database.
If this is an internal entity, you can also update the Tax Report, Name Control, and Last Filing fields, which are used for filing 1099-MISC reports in the US.
api annotation:PartialUpdate = yes - defaults to false.
For internal entities, this field defaults to yes and cannot be changed.
tlBusinessRelationIsIntercologicalBusinessRelation.BusinessRelationIsIntercoIntercompany. This field Indicates if the business relation identifies an entity that is a member of a group of entities that trade with each other.
If the business relation is identified as an internal entity,this field is true and cannot be changed.
api annotation:PartialUpdate = yes - defaults to false.
tcBusinessRelationName1characterBusinessRelation.BusinessRelationName1Name: The full name of the business relation.
This field sets the default name for linked addresses such as customers and suppliers.
api annotation:PartialUpdate = yes - defaults to the BusinessRelationCode.
tiCInvoice_IDintegerCInvoice.CInvoice_IDRecord ID
tdCInvoiceBalanceCreditTCdecimalCInvoice.CInvoiceBalanceCreditTCTC Balance Amount CR. This field displays the sum of the credit amounts of all posting lines in transaction currency.
tdCInvoiceBalanceDebitTCdecimalCInvoice.CInvoiceBalanceDebitTCTC Balance Amount DR. This field displays the sum of the debit amounts of all posting lines in transaction currency.
tdCInvoiceBalanceTCdecimalCInvoice.CInvoiceBalanceTCBalance. This field displays the sum of the debit and credit amounts of all posting lines in transaction currency.
tiCInvoiceBank_IDintegerCInvoiceBank.CInvoiceBank_IDRecord ID
tdCInvoiceBankToPayTCdecimalCInvoiceBank.CInvoiceBankToPayTCTC Payment Amount. This field displays the payment amount in the transaction currency.
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.
ttCInvoiceDiscountDueDatedateCInvoice.CInvoiceDiscountDueDateDiscount Due Date.This field indicates the last date a discount applies, calculated by the system based on the credit terms and the invoice date.
User can modify this field without affecting the credit terms.
ttCInvoiceDueDatedateCInvoice.CInvoiceDueDateDue Date.This field indicates the date when payment become due.
This field can be modified without affecting the credit terms.
This field is calculated by the system based on the credit terms and the invoice date.
tdCInvoiceExchangeRatedecimalCInvoice.CInvoiceExchangeRateExchange Rate. The exchange rate used by the invoice.
The BC Invoice Amount is calculated based on the exchange rate.
If user modify the TC Invoice Amount, the BC invoice amount is automatically adjusted.
tdCInvoiceHoldAmountTCdecimalCInvoice.CInvoiceHoldAmountTCTC Hold Amount. This field displays the amount of the invoice total that is not to be paid.
If this field is not blank, the hold amount is taken into account during payment processing.
Hold amounts must be:
For invoices or correction invoices: Less than the invoice total and greater than zero.
For credit notes or correction credit notes: Greater than the document total and less than zero.
The hold amount for a negative payment must always be set to zero.
tlCInvoiceIsDiscTaxAtPaymlogicalCInvoice.CInvoiceIsDiscTaxAtPaymDiscount Tax at Payment. This field indicates if the invoice has a discount for tax at the time of payment.
The discount amount at the time of payment only applies to the tax base amount.
api annotation:PartialUpdate = yes - defaults to false
tlCInvoiceIsInvoiceApprovedlogicalCInvoice.CInvoiceIsInvoiceApprovedInvoice Approved. This field indicates if the invoice is already approved for payment.
api annotation:PartialUpdate = yes - defaults to false
tlCInvoiceIsLockPaymentlogicalCInvoice.CInvoiceIsLockPaymentLock Payment. This field indicates if the invoice is locked for payment. The invoice cannot be included in any automatic payment selections if this field is true.
api annotation:PartialUpdate = yes - defaults to false
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
tlCInvoiceIsSelectedlogicalCInvoice.CInvoiceIsSelectedSelected. This field indicates whether the invoice is included in a payment selection.
This field is read-only.
tlCInvoiceIsWHTlogicalCInvoice.CInvoiceIsWHTWithholding Tax
tlCInvoiceIsWithBanklogicalCInvoice.CInvoiceIsWithBankWith Bank. This field indicates if the invoice has a supplier bank number specified for it.
api annotation:PartialUpdate = yes - defaults to true
tdCInvoiceNonDiscAmtTCdecimalCInvoice.CInvoiceNonDiscAmtTCTC Non-discount Amount. This field display the invoice amount without discount in base currency.
tdCInvoiceOriginalCreditTCdecimalCInvoice.CInvoiceOriginalCreditTCTC Invoice Amount CR. This field displays the credit total invoice amount in the transaction currency.
If you modify this field, the system automatically recalculates the exchange rate to ensure that the BC Invoice Amount remains the same.
tdCInvoiceOriginalDebitTCdecimalCInvoice.CInvoiceOriginalDebitTCTC AP Amount. This field displays the debit total invoice amount in the transaction currency.
If you modify this field, the system automatically recalculates the exchange rate to ensure that the TC Invoice Amount remains the same.
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.
tdCInvoiceRateScaledecimalCInvoice.CInvoiceRateScaleScale Factor. This field indicates the scale factor applying to the exchange rate in use for foreign currency payments.
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.
tcCInvoiceTSMNumbercharacterCInvoice.CInvoiceTSMNumberPayment Reference. This field displays a unique reference number to be included in the supplier payment file.
This reference can consist of a Transfer with Structured Message (TSM) number.
This field can be blank.
tcCInvoiceTypecharacterCInvoice.CInvoiceTypeInvoice Type. This field identifies the invoice type.
The value can be Invoice Correction and Credit Note Correction type only when the appropriate daybook types have already been defined.
tdCInvoiceVatBaseCreditTCdecimalCInvoice.CInvoiceVatBaseCreditTCTC Base Amount CR. This field displays the credit base amount in the transaction currency.
This field is calculated by the system using the total invoice amount (TC) and the applicable tax rate code.
tdCInvoiceVatBaseDebitTCdecimalCInvoice.CInvoiceVatBaseDebitTCTC Base Amount DR. This field displays the debit base amount in the transaction currency.
This field is calculated by the system using the total invoice amount (TC) and the applicable tax rate code.
tdCInvoiceVatCreditTCdecimalCInvoice.CInvoiceVatCreditTCTC Tax Amount CR. This field displays the credit tax amount (TC) calculated by the system using the total invoice amount (TC) and the applicable tax rate code.
tdCInvoiceVatDebitTCdecimalCInvoice.CInvoiceVatDebitTCTC Tax Amount DR. This field displays the debit tax amount (TC) calculated by the system using the total invoice amount (TC) and the applicable tax rate code.
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.
tdCInvoiceWHTBaseAmtCreditCCdecimalCInvoice.CInvoiceWHTBaseAmtCreditCCSC WHT Base Amount (CR)
tdCInvoiceWHTBaseAmtCreditLCdecimalCInvoice.CInvoiceWHTBaseAmtCreditLCBC WHT Base Amount (CR)
tdCInvoiceWHTBaseAmtCreditTCdecimalCInvoice.CInvoiceWHTBaseAmtCreditTCTC WHT Base Amount (CR)
tdCInvoiceWHTBaseAmtDebitCCdecimalCInvoice.CInvoiceWHTBaseAmtDebitCCSC WHT Base Amount (DR)
tdCInvoiceWHTBaseAmtDebitLCdecimalCInvoice.CInvoiceWHTBaseAmtDebitLCBC WHT Base Amount (DR)
tdCInvoiceWHTBaseAmtDebitTCdecimalCInvoice.CInvoiceWHTBaseAmtDebitTCTC WHT Base Amount (DR)
tdCInvoiceWHTTotAmtCreditCCdecimalCInvoice.CInvoiceWHTTotAmtCreditCCSC WHT Total Amount (CR)
tdCInvoiceWHTTotAmtCreditLCdecimalCInvoice.CInvoiceWHTTotAmtCreditLCBC WHT Total Amount (CR)
tdCInvoiceWHTTotAmtCreditTCdecimalCInvoice.CInvoiceWHTTotAmtCreditTCTC WHT Total Amount (CR)
tdCInvoiceWHTTotAmtDebitCCdecimalCInvoice.CInvoiceWHTTotAmtDebitCCSC WHT Total Amount (DR)
tdCInvoiceWHTTotAmtDebitLCdecimalCInvoice.CInvoiceWHTTotAmtDebitLCBC WHT Total Amount (DR)
tdCInvoiceWHTTotAmtDebitTCdecimalCInvoice.CInvoiceWHTTotAmtDebitTCTC WHT Total Amount (DR)
tiCompany_IDintegerCInvoice.Company_IDLink to Company
tcCompanyCodecharacterCompany.CompanyCodeEntity Code
tlCompanyPropertyIsWHTlogicalCompanyProperty.CompanyPropertyIsWHTUse Withholding Tax
tcCorporateGroupCodecharacterCorporateGroup.CorporateGroupCodeGroup Name
tcCountryCodecharacterCountry.CountryCodeCountry Code
tiCreditor_IDintegerCInvoice.Creditor_IDLink to Creditor
tcCreditorCodecharacterCreditor.CreditorCodeSupplier Code
tlCreditorIsIndividualPaymntlogicalCreditor.CreditorIsIndividualPaymntIndividual Payments
tlCreditorIsWHTlogicalCreditor.CreditorIsWHTWithholding Tax
tcCurrencyCodecharacterCurrency.CurrencyCodeCurrency Code
tcDivisionCodecharacterDivision.DivisionCodeSub-Account
tcJournalCodecharacterJournal.JournalCodeA daybook code (maximum eight characters).
tcPaymentConditionPaymentTypcharacterPaymentCondition.PaymentConditionPaymentTypPayment Type
tdPaymentConditionPercentagedecimalPaymentCondition.PaymentConditionPercentageDiscount Percentage
tcPaymentGroupCodecharacterPaymentGroup.PaymentGroupCodePayment Group
tiPeriodPeriodintegerPeriod.PeriodPeriodGL Period
tiPeriodYearintegerPeriod.PeriodYearGL Calendar Year
CInvoiceCustomcharactercalculatedcustom fields
CInvoiceBankCustomcharactercalculatedcustom fields
BankNumberCustomcharactercalculatedcustom fields
CompanyCustomcharactercalculatedcustom fields
CompanyPropertyCustomcharactercalculatedcustom fields
CreditorCustomcharactercalculatedcustom fields
BusinessRelationCustomcharactercalculatedcustom fields
AddressTypeCustomcharactercalculatedcustom fields
CountryCustomcharactercalculatedcustom fields
CurrencyCustomcharactercalculatedcustom fields
JournalCustomcharactercalculatedcustom fields
PaymentConditionCustomcharactercalculatedcustom fields
PeriodCustomcharactercalculatedcustom fields
CorporateGroupCustomcharactercalculatedcustom fields
PaymentGroupCustomcharactercalculatedcustom fields
DivisionCustomcharactercalculatedcustom fields
ti_sequenceintegercalculatedprimary index
tc_rowidcharactercalculated = rowid(CInvoice),rowid(CInvoiceBank),rowid(BankNumber),rowid(Company),rowid(CompanyProperty),rowid(Creditor),rowid(BusinessRelation),rowid(Address),rowid(AddressType),rowid(Country),rowid(CorporateGroup),rowid(PaymentGroup),rowid(Currency),rowid(Division),rowid(Journal),rowid(PaymentCondition),rowid(Period)


Internal usage


unused


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 = "BCInvoice".
create ttContext.
assign ttContext.propertyName = "methodName"
       ttContext.propertyValue = "CInvoiceBankForPayment".
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/bcinvoice.cinvoicebankforpayment.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.