project QadFinancials > class BCInvoice > business logic query CInvoiceByAllocationInfo

Description

CInvoiceByAllocationInfo; query that returns all creditor-invoices that match the input parameters (= Allocation information)


Parameters


iiCompanyIdintegerCompany id
icBusinessRelationCodecharacter
icCreditorCodecharacterCreditorCode
icCInvoiceRefererencecharacterCInvoiceRefererence
icCurrencyCodecharacter
iiCInvoiceIDintegerCInvoiceID
ilCInvoiceIsOpenlogicalCInvoiceIsOpen
idCInvoiceAmountTCMinimumdecimalCInvoiceAmountTCMinimum (checked against the DebitBalanceTC or the CreditBalanceTC)
idCInvoiceAmountTCMaximumdecimalCInvoiceAmountTCMaximum (checked against the DebitBalanceTC or the CreditBalanceTC)
iiPeriodYearMinimumintegerPeriodYearMinimum; when filled, only invoices with a >= year will be returned.
iiPeriodYearinteger
icJournalCodecharacterDaybook Code
iiVoucherintegerVoucher
icCInvoiceMovementTypecharacterCInvoiceMovementType
ilCInvoiceIsSelectedlogicalIs the CI already selected into a payment selection ?
icCInvoiceTSMNumbercharacterCInvoiceTSMNumber
icCorporateGroupCodecharacterGroup Code
ilReasonIsLockPaymentlogical
ilCompIsOICrossCylogicalOpen Item Cross Entity Allowed or not ?


query condition


  each CInvoice where
CInvoice.Company_Id = iiCompanyId AND
CInvoice.CInvoiceReference matches icCInvoiceRefererence AND
((CInvoice.CInvoiceBalanceCreditTC >= idCInvoiceAmountTCMinimum AND
CInvoice.CInvoiceBalanceCreditTC <= idCInvoiceAmountTCMaximum ) OR
(CInvoice.CInvoiceBalanceDebitTC >= idCInvoiceAmountTCMinimum AND
CInvoice.CInvoiceBalanceDebitTC <= idCInvoiceAmountTCMaximum )) AND
CInvoice.CInvoice_ID = iiCInvoiceID AND
CInvoice.CInvoiceIsOpen = ilCInvoiceIsOpen AND
CInvoice.CInvoiceVoucher = iiVoucher AND
CInvoice.CInvoiceIsSelected = ilCInvoiceIsSelected AND
CInvoice.CInvoiceTSMNumber matches icCInvoiceTSMNumber

      each CInvoiceMovement (inner-join) where
CInvoiceMovement.Company_Id = iiCompanyId AND
CInvoiceMovement.CInvoice_ID = CInvoice.CInvoice_ID AND
CInvoiceMovement.CInvoiceMovementType = icCInvoiceMovementType

          first PostingLine (inner-join) where
PostingLine.Company_Id = iiCompanyId AND
PostingLine.PostingLine_ID = CInvoiceMovement.PostingLine_ID AND

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

          each CompanyProperty (conditional-join) where
CompanyProperty.Company_Id = iiCompanyId AND
CompanyProperty.Company_ID = Company.Company_ID AND
CompanyProperty.CompanyPropertyIsOICrossCy = ilCompIsOICrossCy

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

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

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

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

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

      first GL (inner-join) where
GL.SharedSet_Id = vi_GL_sharedset(iiCompanyId) AND
GL.GL_ID = CInvoice.ControlGL_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

      first Period (inner-join) where
Period.Company_Id = iiCompanyId AND
Period.Period_ID = CInvoice.Period_ID AND
Period.PeriodYear >= iiPeriodYearMinimum AND
Period.PeriodYear = iiPeriodYear

      first Reason (inner-join) where
Reason.Reason_ID = CInvoice.Reason_ID AND
Reason.ReasonIsLockPayment = ilReasonIsLockPayment


query sort order


Period.PeriodYear (ascending)
Journal.JournalCode (ascending)
CInvoice.CInvoiceVoucher (ascending)


query resultset tqCInvoiceByAllocationInfo


field namedata typedb fielddescription
tlBusinessRelationIsCompenslogicalBusinessRelation.BusinessRelationIsCompensCustomer/Supplier Compensation Allowed. This filed indicates how open items should be managed during payment processing when a customer and supplier are both associated with this business relation.
api annotation:PartialUpdate = yes - defaults to false.
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.
tcCInvoiceCITextcharacterCInvoice.CInvoiceCITextCIDescription. A brief description for the SI posting.
api annotation:This field defaults from the CInvoiceDescription.
tcCInvoiceDescriptioncharacterCInvoice.CInvoiceDescriptionDescription. A brief description of the invoice. The system generates a default description based on the Reference and Supplier Code.
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
tlCInvoiceIsWHTlogicalCInvoice.CInvoiceIsWHTWithholding Tax
tdCInvoiceNonDiscAmtTCdecimalCInvoice.CInvoiceNonDiscAmtTCTC Non-discount Amount. This field display the invoice amount without discount in base currency.
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.
tdCInvoiceWHTBaseAmtCreditTCdecimalCInvoice.CInvoiceWHTBaseAmtCreditTCTC WHT Base Amount (CR)
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)
tlCompanyPropertyIsCompenslogicalCompanyProperty.CompanyPropertyIsCompensCustomer/Supplier Compensation allowed
tlCompanyPropertyIsOICrossCylogicalCompanyProperty.CompanyPropertyIsOICrossCyOpen Item Cross Entity Allowed
tlCompanyPropertyIsWHTlogicalCompanyProperty.CompanyPropertyIsWHTUse Withholding Tax
tcCompanyPropertyOINetRestrcharacterCompanyProperty.CompanyPropertyOINetRestrOpen Item Netting Restriction
tlCreditorIsWHTlogicalCreditor.CreditorIsWHTWithholding Tax
tiReason_IDintegerReason.Reason_IDRecord ID
tcReasonCodecharacterReason.ReasonCodeInvoice Status Code
tlReasonIsLockPaymentlogicalReason.ReasonIsLockPaymentLock Payment
tiCompany_IDintegerCInvoice.Company_IDLink to Company
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.
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.
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.
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.
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.
tiPosting_IDintegerPostingLine.Posting_IDLink to Posting
tcCInvoiceMovementTypecharacterCInvoiceMovement.CInvoiceMovementTypeCInvoiceMovementType. "Initial" indicates that the movement represents the initial creation of the invoice, "movement" stands for all subsequent modifications of the invoice balance (payments, adjustments etc).
tcJournalCodecharacterJournal.JournalCodeA daybook code (maximum eight characters).
tiPeriodYearintegerPeriod.PeriodYearGL Calendar Year
tiPeriodPeriodintegerPeriod.PeriodPeriodGL Period
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.
tcCreditorCodecharacterCreditor.CreditorCodeSupplier Code
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.
tdCInvoiceBalanceCreditLCdecimalCInvoice.CInvoiceBalanceCreditLCBC Balance Amount CR. This field displays the sum of the credit amounts of all posting lines in transaction currency.
This field is calculated by the system using the TC Base Amount CR and the Exchange rate.
tdCInvoiceBalanceDebitLCdecimalCInvoice.CInvoiceBalanceDebitLCBC Balance Amount DR. This field displays the sum of the debit amounts of all posting lines in transaction currency.
This field is calculated by the system using the TC Base Amount DR and the Exchange rate.
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.
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.
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.
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.
tcCorporateGroupCodecharacterCorporateGroup.CorporateGroupCodeGroup Name
tcCurrencyCodecharacterCurrency.CurrencyCodeCurrency Code
tcPaymentConditionPaymentTypcharacterPaymentCondition.PaymentConditionPaymentTypPayment Type
tdPaymentConditionPercentagedecimalPaymentCondition.PaymentConditionPercentageDiscount Percentage
tcDivisionCodecharacterDivision.DivisionCodeSub-Account
tcCompanyCodecharacterCompany.CompanyCodeEntity Code
tcGLCodecharacterGL.GLCodeA code identifying the GL account.
tiCInvoice_IDintegerCInvoice.CInvoice_IDRecord ID
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.
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.
tiCreditor_IDintegerCInvoice.Creditor_IDLink to Creditor
tiCInvoiceCurrency_IDintegerCInvoice.CInvoiceCurrency_IDCurrency Code
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.
tiControlGL_IDintegerCInvoice.ControlGL_IDAccount
ti_sequenceintegercalculatedprimary index
tc_rowidcharactercalculated = rowid(CInvoice),rowid(CInvoiceMovement),rowid(PostingLine),rowid(Company),rowid(CompanyProperty),rowid(Creditor),rowid(BusinessRelation),rowid(CorporateGroup),rowid(Currency),rowid(Division),rowid(GL),rowid(Journal),rowid(PaymentCondition),rowid(Period),rowid(Reason)


Internal usage


QadFinancials
method BBankEntry.CalculateBankStateAlloc
method BBankEntry.GetPossibleAllocationsCInvoice
method BCDocument.CalculateAll