Uploaded image for project: 'OFBiz'
  1. OFBiz
  2. OFBIZ-12755

Ending balance of closed period not summed with transaction entries from open period on balance sheet

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 22.01.01
    • 22.01.01
    • accounting
    • None

    Description

      When closing a Custom Time Period, a GlAccountHistory value is created for each of the organization's GL Accounts, containing the opening balance, total debits, total credits and closing balance for the account.

      If a GL Account doesn't have any transaction entries for the time period being closed, a GlAccountHistory value will be created with equal OpeningBalance and ClosingBalance attributes, and with zero PostedDebits and PostedCredits attributes.

      When calculating balances, BalanceSheet.groovy will use an account's most recent GlAccountHistory value, combining it with relevant account entries that have occurred after the closed time period. However, rather than using ClosingBalance from GlAccountHistory, the script calculates a new balance from PostedDebits and PostedCredits.

      PostedDebits and PostedCredits in GlAccountHistory only reflect the debits or credits for the closed time period, not an accumulation of debits and credits for consecutive time periods. Relying on the PostedDebit and PostedCredit attributes to calculate balances gives an incorrect result.

       

      To observe this bug using demo data, create the following Fiscal Month custom time periods (time values should be 00:00:00):

      • 2009-01-01 to 2009-02-01
      • 2009-02-01 to 2009-03-01
      • 2009-03-01 to 2009-04-01

      Close these time periods in chronological order.

      Visit screen https://localhost:8443/webtools/control/entity/find/GlAccountAndHistory and search for values with Account Code 111100. You should see a table containing results similar to:

       

      Search Results

      Account Name Gl Account ID Posted Credits Posted Debits Ending Balance Custom Time Period ID Opening Balance
      GENERAL CHECKING ACCOUNT 111100 148,619.93 200,000 51,380.07 10000 0
      GENERAL CHECKING ACCOUNT 111100 0 0 51,380.07 10001 51,380.07
      GENERAL CHECKING ACCOUNT 111100 0 0 51,380.07 10010 51,380.07

      (Note: the first 4 values created by demo data can be ignored and have been removed from the above table. Some columns have also been removed.)
       
      Notice that the posted credits and debits attributes for the GlAccountHistory values for February and March are zero.
       
      Access screen https://localhost:8443/accounting/control/BalanceSheet for the company and generate a balance sheet with Thru Date 2009-07-11 00:00:00. 
       
      Observe that the balance for the GENERAL CHECKING ACOUNT is $51,380.07.
       
      Now generate a balance sheet with Thru Date 2009-07-12 00:00:00 (i.e. one day later).
       
      Observe that the balance for the GENERAL CHECKING ACCOUNT is now -$116.85. 
       
      This value is wrong as it now only summarises the two transactions (IDs 8006 and 8009) dated 2009-07-11 that affected the GENERAL CHECKING ACCOUNT. The previous balance of $51,380.07 has not been included in the sum.
       
      Fix the method used to calculate balances to ensure that the closing balance from GlAccountHistory values are included.

      Attachments

        Issue Links

          Activity

            People

              danwatford Daniel Watford
              danwatford Daniel Watford
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: