project QadFinancials > class BCInvoice > API query CInvoiceByID

Description

This query lists all CInvoice records based on creditor invoice id.


query filter (table tFilter)


tcBusinessFieldNametcDataTypetcOperator
iiCompanyIdi
iiCInvoiceIDi=
tCInvoice.CInvoiceBalanceCreditTCd=,>=,>,<>,<=,<
tCInvoice.CInvoiceBalanceDebitTCd=,>=,>,<>,<=,<
tCInvoice.CInvoiceCCRated=,>=,>,<>,<=,<
tCInvoice.CInvoiceCCScaled=,>=,>,<>,<=,<
tCInvoice.CInvoiceDatet=,>=,>,<>,<=,<
tCInvoice.CInvoiceExchangeRated=,>=,>,<>,<=,<
tCInvoice.CInvoiceIsInitialStatusl=,<>
tCInvoice.CInvoiceIsOpenl=,<>
tCInvoice.CInvoiceOriginalCreditCCd=,>=,>,<>,<=,<
tCInvoice.CInvoiceOriginalCreditLCd=,>=,>,<>,<=,<
tCInvoice.CInvoiceOriginalCreditTCd=,>=,>,<>,<=,<
tCInvoice.CInvoiceOriginalDebitCCd=,>=,>,<>,<=,<
tCInvoice.CInvoiceOriginalDebitLCd=,>=,>,<>,<=,<
tCInvoice.CInvoiceOriginalDebitTCd=,>=,>,<>,<=,<
tCInvoice.CInvoicePostingYeari=,>=,>,<>,<=,<
tCInvoice.CInvoiceRateScaled=,>=,>,<>,<=,<
tCInvoice.CInvoiceTypec=,>=,>,<>,<=,<,begins,can-do,matches
tCInvoice.CInvoiceVatBaseCreditTCd=,>=,>,<>,<=,<
tCInvoice.CInvoiceVatBaseDebitTCd=,>=,>,<>,<=,<
tCInvoice.CInvoiceVatCreditTCd=,>=,>,<>,<=,<
tCInvoice.CInvoiceVatDebitTCd=,>=,>,<>,<=,<
tCInvoice.CInvoiceVoucheri=,>=,>,<>,<=,<
tCInvoice.CInvoiceWHTTotAmtCreditTCd=,>=,>,<>,<=,<
tCInvoice.CInvoiceWHTTotAmtDebitTCd=,>=,>,<>,<=,<
tCostCentre.CostCentreCodec=,>=,>,<>,<=,<,begins,can-do,matches
tCurrency.CurrencyCodec=,>=,>,<>,<=,<,begins,can-do,matches
tDivision.DivisionCodec=,>=,>,<>,<=,<,begins,can-do,matches
tJournal.JournalCodec=,>=,>,<>,<=,<,begins,can-do,matches
tPeriod.PeriodPeriodi=,>=,>,<>,<=,<
tPeriod.PeriodYeari=,>=,>,<>,<=,<
tProject.ProjectCodec=,>=,>,<>,<=,<,begins,can-do,matches


Parameters (internal)


iiCompanyIdintegerCompany id
iiCInvoiceIDintegerCinvoice ID


query condition


  each CInvoice where
CInvoice.Company_Id = iiCompanyId AND
CInvoice.CInvoice_ID = iiCInvoiceID

      first CostCentre (conditional-join) where
CostCentre.SharedSet_Id = vi_COSTCENTRE_sharedset(iiCompanyId) AND
CostCentre.CostCentre_ID = CInvoice.CostCentre_ID AND

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

      first Division (outer-join) where
Division.SharedSet_Id = vi_DIVISION_sharedset(iiCompanyId) AND
Division.Division_ID = CInvoice.Division_ID AND

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

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

      first Project (conditional-join) where
Project.SharedSet_Id = vi_PROJECT_sharedset(iiCompanyId) AND
Project.Project_ID = CInvoice.Project_ID AND


query resultset tqCInvoiceByID


field namedata typedb fielddescription
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.
tdCInvoiceCCRatedecimalCInvoice.CInvoiceCCRateSC Rate. The statutory exchange rate used by the invoice.
The SC Invoice Amount is calculated based on the SC rate.
tdCInvoiceCCScaledecimalCInvoice.CInvoiceCCScaleScale Factor. This field indicates the scale factor applying to the SC rate in use for foreign currency payments.
tiCInvoiceCurrency_IDintegerCInvoice.CInvoiceCurrency_IDCurrency 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.
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.
tlCInvoiceIsInitialStatuslogicalCInvoice.CInvoiceIsInitialStatusInitial Status. This field indicates if the invoice is in initial status.
api annotation:This field defaults from the Initial Status field of the Invoice status code.
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
tdCInvoiceOriginalCreditCCdecimalCInvoice.CInvoiceOriginalCreditCCSC Invoice Amount (CR). This field displays the credit total invoice amount in the statutory currency.
This field is calculated by the system using the TC Invoice Amount(CR) and the SC Rate.
tdCInvoiceOriginalCreditLCdecimalCInvoice.CInvoiceOriginalCreditLCBC Invoice Amount(CR). This field displays the credit total invoice amount in the base currency.
This field is calculated by the system using the TC Invoice Amount(CR) and the Exchange rate.
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.
tdCInvoiceOriginalDebitCCdecimalCInvoice.CInvoiceOriginalDebitCCSC Invoice Amount (DR). This field displays the debit total invoice amount in the statutory currency.
This field is calculated by the system using the TC Invoice Amount(CR) and the SC Rate.
tdCInvoiceOriginalDebitLCdecimalCInvoice.CInvoiceOriginalDebitLCBC Invoice Amount(DR). This field displays the debit total invoice amount in the base currency.
This field is calculated by the system using the TC Invoice Amount(DR) and the Exchange rate.
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.
tiCInvoicePostingYearintegerCInvoice.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.
tdCInvoiceRateScaledecimalCInvoice.CInvoiceRateScaleScale Factor. This field indicates the scale factor applying to the exchange rate in use for foreign currency payments.
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.
tdCInvoiceWHTTotAmtCreditTCdecimalCInvoice.CInvoiceWHTTotAmtCreditTCTC WHT Total Amount (CR)
tdCInvoiceWHTTotAmtDebitTCdecimalCInvoice.CInvoiceWHTTotAmtDebitTCTC WHT Total Amount (DR)
tiCompany_IDintegerCInvoice.Company_IDLink to Company
tcCostCentreCodecharacterCostCentre.CostCentreCodeCost Center: A code that identifies the cost center.
tcCurrencyCodecharacterCurrency.CurrencyCodeCurrency Code
tcDivisionCodecharacterDivision.DivisionCodeSub-Account
tiJournal_IDintegerCInvoice.Journal_IDDaybook Code
tcJournalCodecharacterJournal.JournalCodeA daybook code (maximum eight characters).
tiPeriod_IDintegerCInvoice.Period_IDLink to Period
tiPeriodPeriodintegerPeriod.PeriodPeriodGL Period
tiPeriodYearintegerPeriod.PeriodYearGL Calendar Year
tcProjectCodecharacterProject.ProjectCodeProject
tiTransactionEndCountry_IDintegerCInvoice.TransactionEndCountry_IDCountry Code
tiTransactionStartCountry_IDintegerCInvoice.TransactionStartCountry_IDCountry Code
CInvoiceCustomcharactercalculatedcustom fields
CostCentreCustomcharactercalculatedcustom fields
CurrencyCustomcharactercalculatedcustom fields
DivisionCustomcharactercalculatedcustom fields
JournalCustomcharactercalculatedcustom fields
PeriodCustomcharactercalculatedcustom fields
ProjectCustomcharactercalculatedcustom fields
ti_sequenceintegercalculatedprimary index
tc_rowidcharactercalculated = rowid(CInvoice),rowid(CostCentre),rowid(Currency),rowid(Division),rowid(Journal),rowid(Period),rowid(Project)


Internal usage


QadFinancials
method BAPMatching.PostSave
method BCInvoice.CheckCInvoiceForPayment
method BCInvoice.CreateCInvoiceMovementsCrossCy
method BCInvoice.GetInvoiceNumber
method BCInvoiceAPMatching.CreateCInvoiceAPMatchingAllInOneTran
method BCInvoiceAPMatching.CreateCInvoiceAPMatchingOneInOneTran
method BCInvoiceJournalEntry.ApiStdMaintainTTV01
method BPaymentSelection.AdditionalUpdatesUnconfirm


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 = "CInvoiceByID".
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.cinvoicebyid.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.