project QadFinancials > class BCreditorReport > business logic query CreditorBalanceCHist

Description

This query gives all the chist records which are needed to calculate the balance at the end of the selected period. Note only balance fields ca n be used, no movements fields.


Parameters


iiCompanyIdintegerCompany id
icCandoBrCodecharacter
icCandoCreditorCodecharacter
icCandoGLCodecharacter
iiEndOfYearPeriodinteger
icFromBRCodecharacter
icFromCreditorCodecharacter
icFromGLCodecharacter
icToBRCodecharacter
icToCreditorCodecharacter
icToGLCodecharacter


query condition


  each Creditor where
Creditor.SharedSet_Id = vi_CREDITOR_sharedset(iiCompanyId) AND
Creditor.CreditorCode >= icFromCreditorCode AND
Creditor.CreditorCode <= icToCreditorCode AND
Creditor.CreditorCode can-do icCandoCreditorCode

      first BusinessRelation (inner-join) where
BusinessRelation.BusinessRelation_ID = Creditor.BusinessRelation_ID AND
BusinessRelation.BusinessRelationCode <= icFromBRCode AND
BusinessRelation.BusinessRelationCode <= icToBRCode AND
BusinessRelation.BusinessRelationCode can-do icCandoBrCode

      each CHist (inner-join) where
CHist.Company_Id = iiCompanyId AND
CHist.Creditor_ID = Creditor.Creditor_ID AND
CHist.CHistYearPeriodFrom <= iiEndOfYearPeriod AND
CHist.CHistYearPeriodTill >= iiEndOfYearPeriod

          first Currency (inner-join) where
Currency.Currency_ID = CHist.Currency_ID AND

          first GL (inner-join) where
GL.SharedSet_Id = vi_GL_sharedset(iiCompanyId) AND
GL.GL_ID = CHist.GL_ID AND
GL.GLCode >= icFromGLCode AND
GL.GLCode <= icToGLCode AND
GL.GLCode can-do icCandoGLCode

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


query resultset tqCreditorBalanceCHist


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.
tdCHistBalanceCCdecimalCHist.CHistBalanceCCSC Balance
tdCHistBalanceLCdecimalCHist.CHistBalanceLCBC Balance
tdCHistBalanceTCdecimalCHist.CHistBalanceTCTC Balance
tiCreditor_IDintegerCreditor.Creditor_IDRecord ID
tcCreditorCodecharacterCreditor.CreditorCodeSupplier Code
tcCurrencyCodecharacterCurrency.CurrencyCodeCurrency Code
tiCurrencyNumberOfDecimalsintegerCurrency.CurrencyNumberOfDecimalsNumber of Decimals
tiGL_IDintegerGL.GL_IDRecord ID
tcGLCodecharacterGL.GLCodeA code identifying the GL account.
tcGLDescriptioncharacterGL.GLDescriptionA description of the GL account.
tcGLTypeCodecharacterGL.GLTypeCodeA code identifying the type of account.
tiJournal_IDintegerJournal.Journal_IDRecord ID
tcJournalCodecharacterJournal.JournalCodeA daybook code (maximum eight characters).
tcJournalDescriptioncharacterJournal.JournalDescriptionA brief description of the daybook.
api annotation:Value for this field defaults to null.
tcJournalTypeCodecharacterJournal.JournalTypeCodeA daybook type code.
api annotation:Value for this field defaults to "Journal Entries".


Internal usage


QadFinancials
method BCreditorReport.CreditorAccountMovements