project QadFinancials > class BCInvoice > business logic query CInvoiceForAPMSelection

Description

Update Query CInvoiceForAPMSelection: mark the joins to division and to costcentre as conditional ones iso inner-ones.
This query contains jions to the ShipTo-address and to the Creditor its own address; so better not use this query unless you need this information


Parameters


iiCompanyIdintegerCompany id
iiCInvoicePostingYearinteger
icJournalCodecharacter
iiCInvoiceVoucherinteger
iiCInvoiceIdinteger
icCreditorCodecharacter
icCInvoiceReferencecharacter
icAddressTypeCodecharacterProvide the AddressTypeCode to specify which address of the credtor you wantr to retrieve.
If you leave this parameter empty, then the result-set will contain multiple records for a single invoice if the creditor has got multiple addresses linked
iiCInvoiceRegistrationNrintegerCInvoiceRegistrationNr


query condition


  each CInvoice where
CInvoice.Company_Id = iiCompanyId AND
CInvoice.CInvoicePostingYear = iiCInvoicePostingYear AND
CInvoice.CInvoiceVoucher = iiCInvoiceVoucher AND
CInvoice.CInvoice_ID = iiCInvoiceId AND
CInvoice.CInvoiceReference = icCInvoiceReference AND
CInvoice.CInvoiceRegistrationNr = iiCInvoiceRegistrationNr

      first Address1 (inner-join) where
Address1.Address_ID = CInvoice.ShipToAddress_ID AND

          first Country1 (inner-join) where
Country1.Country_ID = Address1.Country_ID AND

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

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

          first BusinessRelation (inner-join) where
BusinessRelation.BusinessRelation_ID = Creditor.BusinessRelation_ID AND

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

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

                  first Country2 (inner-join) where
Country2.Country_ID = Address2.Country_ID AND

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

      first Division (conditional-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
Journal.JournalCode = icJournalCode

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


query resultset tqCInvoiceForAPMSelection


field namedata typedb fielddescription
tcAddressTypeCodecharacterAddressType.AddressTypeCodeAddress Type
tcBusinessRelationICCodecharacterBusinessRelation.BusinessRelationICCodeIntercompany Code. When Intercompany is true, this field is mandatory.
The code entered here must match the intercompany code entered for GL accounts in order to generate intercompany reports.
The intercompany code must be unique for this business relation.
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.
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.
tiCInvoiceRegistrationNrintegerCInvoice.CInvoiceRegistrationNrRegistration number. This field displays the sequential number assigned to each invoice upon initial entry in the system.
tiCreditorAddr_IDintegerAddress2.Address_IDRecord ID
tiNormalPaymentCondition_IDintegerCInvoice.NormalPaymentCondition_IDCredit Terms Code
tiReplacedCInvoice_IDintegerCInvoice.ReplacedCInvoice_IDLink to CInvoice
tiShipToAddress_IDintegerCInvoice.ShipToAddress_IDCity
tlCreditorAddrIsEUCountrylogicalCountry2.CountryIsEUCountryEU Member
tcCreditorAddrCountryCodecharacterCountry2.CountryCodeCountry Code
tlCreditorAddrTaxInCitylogicalAddress2.AddressIsTaxInCityTax in City. This field determines whether the address is in the city limits for taxation purposes. It is used only with the Sales and Use Tax Interface for US and Canadian tax processing.
api annotation:PartialUpdate = yes - defaults to true.
tcCreditorAddrTaxIDFederalcharacterAddress2.AddressTaxIDFederalFederal Tax. The value of this filed is the tax ID assigned to this address by the federal or national government.
If Tax Report is true, the Federal tax ID must be unique; otherwise, related business relations can share an ID.
tcCreditorAddrTaxIDMisc1characterAddress2.AddressTaxIDMisc1Miscellaneous Tax 1.This field is for reference and documentation purposes, its value can be any other tax identification numbers that are useful.
This field can be blank.
tcShipToAddrTaxIDMisc2characterAddress1.AddressTaxIDMisc2Miscellaneous Tax 2.This field is for reference and documentation purposes, its value can be any other tax identification numbers that are useful.
This field can be blank.
tcShipToAddrTaxIDMisc3characterAddress1.AddressTaxIDMisc3Miscellaneous Tax 3.This field is for reference and documentation purposes, its value can be any other tax identification numbers that are useful.
This field can be blank.
tcShipToAddrTaxIDStatecharacterAddress1.AddressTaxIDStateState Tax. This field is for reference and documentation purposes, the value of the field is either a state or provincial tax identification number or a VAT registration number.
tiShipToCountry_IDintegerAddress1.Country_IDCountry Format
tcShipToAddrCountryCodecharacterCountry1.CountryCodeCountry Code
tcCreditorAddrTaxIDMisc2characterAddress2.AddressTaxIDMisc2Miscellaneous Tax 2.This field is for reference and documentation purposes, its value can be any other tax identification numbers that are useful.
This field can be blank.
tcCreditorAddrTaxIDMisc3characterAddress2.AddressTaxIDMisc3Miscellaneous Tax 3.This field is for reference and documentation purposes, its value can be any other tax identification numbers that are useful.
This field can be blank.
tcCreditorAddrTaxIDStatecharacterAddress2.AddressTaxIDStateState Tax. This field is for reference and documentation purposes, the value of the field is either a state or provincial tax identification number or a VAT registration number.
tiCreditorCountry_IDintegerAddress2.Country_IDCountry Format
tlShipToAddrIsTaxInCitylogicalAddress1.AddressIsTaxInCityTax in City. This field determines whether the address is in the city limits for taxation purposes. It is used only with the Sales and Use Tax Interface for US and Canadian tax processing.
api annotation:PartialUpdate = yes - defaults to true.
tiShipToAddrTaxDeclaratintegerAddress1.AddressTaxDeclarationThis field is mandatory.
tcShipToAddrTaxIDFederalcharacterAddress1.AddressTaxIDFederalFederal Tax. The value of this filed is the tax ID assigned to this address by the federal or national government.
If Tax Report is true, the Federal tax ID must be unique; otherwise, related business relations can share an ID.
tcShipToAddrTaxIDMisc1characterAddress1.AddressTaxIDMisc1Miscellaneous Tax 1.This field is for reference and documentation purposes, its value can be any other tax identification numbers that are useful.
This field can be blank.
tlShipToAddrIsEUCountrylogicalCountry1.CountryIsEUCountryEU Member
tiCreditor_IDintegerCreditor.Creditor_IDRecord ID
tcCreditorCodecharacterCreditor.CreditorCodeSupplier Code
tiBusinessRelation_IDintegerBusinessRelation.BusinessRelation_IDRecord ID
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.
tcCurrencyCodecharacterCurrency.CurrencyCodeCurrency Code
tcCInvoiceAllocationStatuscharacterCInvoice.CInvoiceAllocationStatusAllocation Status.This field indicates whether postings occur and if they affect transient or official layers.
User can not delete an invoice which has a non-initial invoice status code.
tlCInvoiceIsInvoiceApprovedlogicalCInvoice.CInvoiceIsInvoiceApprovedInvoice Approved. This field indicates if the invoice is already approved for payment.
api annotation:PartialUpdate = yes - defaults to false
tlCInvoiceIsLogisticMatchinglogicalCInvoice.CInvoiceIsLogisticMatchingReceiver Matching.This field indicates If the Receiver Matching function is enabled.
This field is calculated by the system using the invoice status code.
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.
tiCInvoice_IDintegerCInvoice.CInvoice_IDRecord ID
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.
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.
tiJournal_IDintegerCInvoice.Journal_IDDaybook Code
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.
tdCInvoiceRateScaledecimalCInvoice.CInvoiceRateScaleScale Factor. This field indicates the scale factor applying to the exchange rate in use for foreign currency payments.
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.
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.
tcJournalCodecharacterJournal.JournalCodeA daybook code (maximum eight characters).
tdCInvoiceNonRecTaxAmtTCdecimalCInvoice.CInvoiceNonRecTaxAmtTCNon-Rev Tax Amount. This field displays the percentage of tax that is not recoverable.
Taxes are recoverable whenever your company is eligible to offset a percentage of tax on purchases against tax collected on sales. Recoverable taxes are common in Europe.
tiCompany_IDintegerCInvoice.Company_IDLink to Company
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.
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.
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.
ttCInvoiceTaxPointDatedateCInvoice.CInvoiceTaxPointDateTax Point Date.This field indicates the date to be used in tax calculations.
api annotation:This field defaults from the posting date.
tcDivisionCodecharacterDivision.DivisionCodeSub-Account
tcCostCentreCodecharacterCostCentre.CostCentreCodeCost Center: A code that identifies the cost center.
tdPaymentConditionPercentagedecimalPaymentCondition.PaymentConditionPercentageDiscount Percentage
tcPaymentConditionCodecharacterPaymentCondition.PaymentConditionCodeCredit Terms Code
tiReason_IDintegerCInvoice.Reason_IDInvoice Status Code


Internal usage


QadFinancials
method BAPMatching.DefaultValuesInvoice
method BAPMatching.ValidateComponentPost
method BAPMatching.ValidateComponentPostAPM2
method BAPMatching.ValidateComponentPreAPM
method BCInvoice.ApiGetCreditorInvoiceExchangeRate
method BCInvoice.ApiGetSupplierInvoiceData
read related business field(s) on tAPMatching.CInvoice_ID
ApiGetAlternateKeyValues
validate related business field(s) on tAPMatching.CInvoice_ID