project QadFinancials > class BCInvoice > business logic query CInvoiceForDuplicateReference

Description

CInvoiceForDuplicateReference: query that will read the invoice based upon the CompanyID, the CreditorID, the CInvoiceType and the Reference.
There will also be a condition to allow callers to skip a certain CInvoice based upon its CInvoiceID.


Parameters


iiCompanyIdintegerCompany id
iiCreditorIDintegerID of the Creditor
icCInvoiceTypecharacterType of the invoice
icCInvoiceReferencecharacterCInvoiceReference
iiCInvoiceIDNotEqualintegerIf you pass in a value for this param then the query will only look for CInvoice records with CInvoiceID <> iiCInvoiceID


query condition


  each CInvoice where
CInvoice.Company_Id = iiCompanyId AND
CInvoice.Creditor_ID = iiCreditorID AND
CInvoice.CInvoiceType = icCInvoiceType AND
CInvoice.CInvoiceReference = icCInvoiceReference AND
CInvoice.CInvoice_ID <> iiCInvoiceIDNotEqual

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


query resultset tqCInvoiceForDuplicateReference


field namedata typedb fielddescription
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.
tiCInvoice_IDintegerCInvoice.CInvoice_IDRecord ID
tiCompany_IDintegerCInvoice.Company_IDLink to Company
tiCreditor_IDintegerCInvoice.Creditor_IDLink to Creditor
tiJournal_IDintegerCInvoice.Journal_IDDaybook Code
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.
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.
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.
tcJournalCodecharacterJournal.JournalCodeA daybook code (maximum eight characters).


Internal usage


QadFinancials
method BCInvoice.CheckDuplicateCInvoiceReference