project QadFinancials > class BCInvoice > business logic query CInvoiceMovementForHistRebuild

Description

CInvoiceMovementForHistoryRebuild: query that returns all required information for rebuilding the balnce of the creditors.
Please do only use this query for the balance-rebuild to limit the dependancies


Parameters


iiCompanyIdintegerCompany id
iiCreditorIDinteger
iiFromPeriodYearPeriodinteger
iiCurrencyIDinteger
icCompanyCodecharacter
icCreditorCodecharacter
icCurrencyCodecharacter


query condition


  each CInvoice where
CInvoice.Company_Id = iiCompanyId AND
CInvoice.Creditor_ID = iiCreditorID AND
CInvoice.CInvoiceCurrency_ID = iiCurrencyID

      each CInvoiceMovement (inner-join) where
CInvoiceMovement.Company_Id = iiCompanyId AND
CInvoiceMovement.CInvoice_ID = CInvoice.CInvoice_ID AND
CInvoiceMovement.CInvoiceMovementYearPeriod >= iiFromPeriodYearPeriod

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

              first Posting (inner-join) where
Posting.Company_Id = iiCompanyId AND
Posting.Posting_ID = PostingLine.Posting_ID AND

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

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

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

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


query resultset tqCInvoiceMovementForHistRebuild


field namedata typedb fielddescription
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.
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).
tiCInvoiceMovementYearPeriodintegerCInvoiceMovement.CInvoiceMovementYearPeriodYear/GL Period. This field indicates the accounting year and period for the invoice's movement.
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.
ttCInvoiceTaxPointDatedateCInvoice.CInvoiceTaxPointDateTax Point Date.This field indicates the date to be used in tax calculations.
api annotation:This field defaults from 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.
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.
tiCompany_IDintegerCInvoice.Company_IDLink to Company
tcCompanyCodecharacterCompany.CompanyCodeEntity Code
tiCostCentre_IDintegerPostingLine.CostCentre_IDCost Center Code
tiCreditor_IDintegerCInvoice.Creditor_IDLink to Creditor
tcCreditorCodecharacterCreditor.CreditorCodeSupplier Code
tcCurrencyCodecharacterCurrency.CurrencyCodeCurrency Code
tiDivision_IDintegerPostingLine.Division_IDSub-Account Code
tiGL_IDintegerPostingLine.GL_IDGL Description
tiJournal_ID1integerPosting.Journal_IDDaybook Code
tcJournalCodecharacterJournal.JournalCodeA daybook code (maximum eight characters).
tiPeriod_IDintegerCInvoiceMovement.Period_IDLink to Period
tiPosting_IDintegerPostingLine.Posting_IDLink to Posting
tiPostingLine_IDintegerCInvoiceMovement.PostingLine_IDLink to PostingLine
tdPostingLineCreditCCdecimalPostingLine.PostingLineCreditCCSC Credit
api annotation:Partial Update = yes - it will get a default value depending on the value of PostingLinCreditTC, PostingLineCCRate & PostingLineCCScale.
SC Amount = TC Amount * Exchange rate (TC/SC) * Scale Factor (TC/SC). If Partial Update is false, you should enter the correct value for this field
tdPostingLineCreditLCdecimalPostingLine.PostingLineCreditLCBC Credit
api annotation:Partial Update = yes - it will get a default value depends on the value of PostingLineCreditTC, PostingLineExchangeRate & PostingLineRateScale.
BC Amount = TC Amount * Exchange rate (TC/BC) * Scale Factor (TC/BC). If Partial Update is false, enter a value for this field.
tdPostingLineCreditTCdecimalPostingLine.PostingLineCreditTCTC Credit
tdPostingLineDebitCCdecimalPostingLine.PostingLineDebitCCSC Debit
api annotation:Partial Update = yes - it will get a default value depending on the value of PostingLineDebitTC, PostingLineCCRate & PostingLineCCScale.
SC Amount = TC Amount * Exchange rate (TC/SC) * Scale Factor (TC/SC). If Partial Update is false, enter the correct value for this field.
tdPostingLineDebitLCdecimalPostingLine.PostingLineDebitLCBC Debit
api annotation:Partial Update = yes - it will get a default value depending on the value of PostingLineDebitTC, PostingLineExchangeRate and PostingLineRateScale.
BC Amount = TC Amount * Exchange rate (TC/BC) * Scale Factor (TC/BC). If Partial Update = false, enter the correct value into this field.
tdPostingLineDebitTCdecimalPostingLine.PostingLineDebitTCTC Debit
tiPostingVoucherintegerPosting.PostingVoucherVoucher is a sequential number that uniquely identifies the journal entry (within the combination of an entity and a daybook code).
api annotation:In create mode,enter 0 in this field - the voucher number is generated by the system. In Modify/Delete, the correct voucher number must be entered because this identifies the record.
tiProject_IDintegerPostingLine.Project_IDDescription


Internal usage


QadFinancials
method BCreditorBalance.RebuildHistory