project QadFinancials > class BDInvoice > business logic query DInvoiceMovementForHistRebuild

Description

DInvoiceMovementForHistoryRebuild: 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
iiFromPeriodYearPeriodinteger
icCompanyCodecharacter
iiDebtorIDinteger
icDebtorCodecharacter
iiCurrencyIDinteger
icCurrencyCodecharacter


query condition


  each DInvoice where
DInvoice.Company_Id = iiCompanyId AND
DInvoice.Debtor_ID = iiDebtorID AND
DInvoice.DInvoiceCurrency_ID = iiCurrencyID

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

      first Currency (inner-join) where
Currency.Currency_ID = DInvoice.DInvoiceCurrency_ID AND
Currency.CurrencyCode = icCurrencyCode

      first Debtor (inner-join) where
Debtor.SharedSet_Id = vi_DEBTOR_sharedset(iiCompanyId) AND
Debtor.Debtor_ID = DInvoice.Debtor_ID AND
Debtor.DebtorCode = icDebtorCode

      each DInvoiceMovement (inner-join) where
DInvoiceMovement.Company_Id = iiCompanyId AND
DInvoiceMovement.DInvoice_ID = DInvoice.DInvoice_ID AND
DInvoiceMovement.DInvoiceMovementYearPeriod >= iiFromPeriodYearPeriod

          first PostingLine (inner-join) where
PostingLine.Company_Id = iiCompanyId AND
PostingLine.PostingLine_ID = DInvoiceMovement.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


query resultset tqDInvoiceMovementForHistRebuild


field namedata typedb fielddescription
tiCompany_IDintegerDInvoice.Company_IDLink to Company
tcCompanyCodecharacterCompany.CompanyCodeEntity Code
tiCostCentre_IDintegerPostingLine.CostCentre_IDCost Center Code
tcCurrencyCodecharacterCurrency.CurrencyCodeCurrency Code
tiDebtor_IDintegerDInvoice.Debtor_IDLink to Debtor
tcDebtorCodecharacterDebtor.DebtorCodeA code (maximum eight characters) that identifies a customer. If the code you specify matches an existing supplier code, a warning message displays. You can choose to ignore the warning, and create the record. However, when a supplier and customer share the same code, they must reference the same business relation.
api annotation:If you leave the Customer Code field blank, the system automatically generates a number for the record based on the sequence defined in Customer Autonumber Create.
tiDInvoice_IDintegerDInvoice.DInvoice_IDRecord ID
tiDInvoiceCurrency_IDintegerDInvoice.DInvoiceCurrency_IDCurrency Code
tcDInvoiceDescriptioncharacterDInvoice.DInvoiceDescriptionDescription. A brief description of the invoice. This field is mandatory.
tdDInvoiceExchangeRatedecimalDInvoice.DInvoiceExchangeRateExchange Rate. The accounting 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.
tcDInvoiceMovementTypecharacterDInvoiceMovement.DInvoiceMovementTypeCInvoiceMovementType. "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).
tiDInvoiceMovementYearPeriodintegerDInvoiceMovement.DInvoiceMovementYearPeriodYear/GL Period. This field indicates the accounting year and period for the invoice's movement.
tdDInvoiceRateScaledecimalDInvoice.DInvoiceRateScaleScale Factor.This field indicates the scale factor applying to the exchange rate in use for foreign currency payments.
The exchange rate is multiplied by the scale factor to determine the actual exchange rate.
api annotation:The value for the scale factor defaults from the exchange rate definition, but it can be modified.
ttDInvoiceTaxPointDatedateDInvoice.DInvoiceTaxPointDateTax Point Date. The date to be used in tax calculations. For sales-related invoices, this field displays the tax calculation date on the associated order.
api annotation:This field defaults to DInvoicePostingDate.
tcDInvoiceTypecharacterDInvoice.DInvoiceTypeInvoice Type. This field displays the invoice type.
Invoice Correction and Credit Note Correction display as choices only when the appropriate daybook types have already been defined.
api annotation:PartialUpdate = yes - defaults to Invoice
tdDInvoiceVatCreditTCdecimalDInvoice.DInvoiceVatCreditTCTC 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.
tdDInvoiceVatDebitTCdecimalDInvoice.DInvoiceVatDebitTCTC 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.
tiDivision_IDintegerPostingLine.Division_IDSub-Account Code
tiGL_IDintegerPostingLine.GL_IDGL Description
tiJournal_ID1integerPosting.Journal_IDDaybook Code
tcJournalCode1characterJournal.JournalCodeA daybook code (maximum eight characters).
tiPeriod_IDintegerDInvoiceMovement.Period_IDLink to Period
tiPosting_IDintegerPostingLine.Posting_IDLink to Posting
tiPostingLine_IDintegerDInvoiceMovement.PostingLine_IDLink to PostingLine
tiPostingLine_ID2integerPostingLine.PostingLine_IDRecord ID
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 BDebtorBalance.RebuildHistory