project QadFinancials > class BCInvoice > business logic query CInvoiceByAllocationInfoNew

Description

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


Parameters


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


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 AND
CInvoice.CInvoicePostingYear = iiPeriodYear AND
CInvoice.Creditor_ID = iiCreditorID

      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 (inner-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 resultset tqCInvoiceByAllocationInfoNew


field namedata typedb fielddescription
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.
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.
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.
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.
tdCInvoiceBalanceCreditTCdecimalCInvoice.CInvoiceBalanceCreditTCTC Balance Amount CR. This field displays the sum of the credit amounts of all posting lines in transaction currency.
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.
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.
tcCInvoiceCITextcharacterCInvoice.CInvoiceCITextCIDescription. A brief description for the SI posting.
api annotation:This field defaults from the CInvoiceDescription.
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.
tcCInvoiceDescriptioncharacterCInvoice.CInvoiceDescriptionDescription. A brief description of the invoice. The system generates a default description based on the Reference and Supplier Code.
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.
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
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).
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.
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.
tiCompany_IDintegerCInvoice.Company_IDLink to Company
tcCompanyCodecharacterCompany.CompanyCodeEntity Code
tlCompanyPropertyIsCompenslogicalCompanyProperty.CompanyPropertyIsCompensCustomer/Supplier Compensation allowed
tlCompanyPropertyIsWHTlogicalCompanyProperty.CompanyPropertyIsWHTUse Withholding Tax
tcCompanyPropertyOINetRestrcharacterCompanyProperty.CompanyPropertyOINetRestrOpen Item Netting Restriction
tiControlGL_IDintegerCInvoice.ControlGL_IDAccount
tcCorporateGroupCodecharacterCorporateGroup.CorporateGroupCodeGroup Name
tiCreditor_IDintegerCInvoice.Creditor_IDLink to Creditor
tcCreditorCodecharacterCreditor.CreditorCodeSupplier Code
tlCreditorIsWHTlogicalCreditor.CreditorIsWHTWithholding Tax
tcCurrencyCodecharacterCurrency.CurrencyCodeCurrency Code
tcDivisionCodecharacterDivision.DivisionCodeSub-Account
tcGLCodecharacterGL.GLCodeA code identifying the GL account.
tcJournalCodecharacterJournal.JournalCodeA daybook code (maximum eight characters).
tcPaymentConditionPaymentTypcharacterPaymentCondition.PaymentConditionPaymentTypPayment Type
tdPaymentConditionPercentagedecimalPaymentCondition.PaymentConditionPercentageDiscount Percentage
tiPeriodPeriodintegerPeriod.PeriodPeriodGL Period
tiPeriodYearintegerPeriod.PeriodYearGL Calendar Year
tiPosting_IDintegerPostingLine.Posting_IDLink to Posting
tiReason_IDintegerReason.Reason_IDRecord ID
tcReasonCodecharacterReason.ReasonCodeInvoice Status Code
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 BOpenItemAdjustment.OIAdjApplyFilterCreditor