Register    Login    Forum    Search    FAQ

Board index » General Usage » Payables




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Trial Balance error
 Post Posted: Wed Mar 26, 2008 2:45 pm 
Offline

Joined: Sun Nov 18, 2007 5:53 pm
Posts: 109
Hi All,

I've been making vendor payments but now I can't make anymore as I get an error "Trial balance is out of balance. Debits: 16462.45 and credits: 16462.46 in period 28".

How do I fix that as I can't make any more payments.

Cheers


Top 
 Profile  
 
 Post subject:
 Post Posted: Wed Mar 26, 2008 5:19 pm 
Offline

Joined: Fri Oct 26, 2007 3:55 pm
Posts: 3498
Location: Colorado, US
You have hit the balance rounding error issue. I didn't expect this so early since I keep double precision floating point numbers in the trial balance.

I have this on my to do list but since you hit the problem, I will need to fix it right away. I'll get right on it and have a function for you very soon.

I'm trying to get the initial stable release out, but I will provide the function to you sooner so you can continue.

Sorry for the problem...

Dave


Top 
 Profile  
 
 Post subject:
 Post Posted: Thu Mar 27, 2008 7:19 am 
Offline

Joined: Sun Nov 18, 2007 5:53 pm
Posts: 109
Thanks Dave. We're at month and year end so looking forward to the fix :-)[/u]


Top 
 Profile  
 
 Post subject:
 Post Posted: Thu Mar 27, 2008 9:01 am 
Offline

Joined: Fri Oct 26, 2007 3:55 pm
Posts: 3498
Location: Colorado, US
Richard,

Here is a fix for the error you are receiving. PLEASE BACKUP BEFORE YOU RUN THIS. It is vey hard to test since generating this error is difficult.

Place the code snippet below replacing lines 319-321 in file /modules/gen_ledger/classes/gen_ledger.php

was:
Code:
      if ($debit_total <> $credit_total) { // Trouble in paradise, need fraction cents adjustment function
         return $this->fail_message(GL_ERROR_OUT_OF_BALANCE_A . $result->fields['debit'] . GL_ERROR_OUT_OF_BALANCE_B . $result->fields['credit'] . GL_ERROR_OUT_OF_BALANCE_C . $period);
      }


To:

Code:
      if ($debit_total <> $credit_total) { // Trouble in paradise, fraction of cents adjustment next
         $tolerance = 2 * (1 / pow(10, $currencies->currencies[DEFAULT_CURRENCY]['decimal_places'])); // i.e. 2 cents in USD
         $adjustment = $result->fields['credit'] - $result->fields['debit'];
         if (abs($adjustment) > $tolerance) {
            return $this->fail_message(GL_ERROR_OUT_OF_BALANCE_A . $result->fields['debit'] . GL_ERROR_OUT_OF_BALANCE_B . $result->fields['credit'] . GL_ERROR_OUT_OF_BALANCE_C . $period);
         }
         // find the adjustment account
         if (!defined('ROUNDING_GL_ACCOUNT') || ROUNDING_GL_ACCOUNT == '') {
            $result = $db->Execute("select id from " . TABLE_CHART_OF_ACCOUNTS . " where account_type = 44 limit 1");
            if ($result->RecordCount() == 0) {
               return $this->fail_message('Failed trying to locate retained earnings account to make rounding adjustment. There must be one and only one Retained Earnings account in the chart of accounts!');
            }
            $adj_gl_account = $result->fields['id'];
         } else {
            $adj_gl_account = ROUNDING_GL_ACCOUNT;
         }
         if (DEBUG) $messageStack->debug("\n      Adjusting balance, adjustment = " . $adjustment . " and gl account = " . $adj_gl_account);
         $sql = "update " . TABLE_CHART_OF_ACCOUNTS_HISTORY . "
            set debit_amount = debit_amount + " . $adjustment . "
            where period = " . $period . " and account_id = '" . $adj_gl_account . "'";
         $result = $db->Execute($sql);
      }


Dave


Top 
 Profile  
 
 Post subject:
 Post Posted: Thu Mar 27, 2008 10:22 am 
Offline

Joined: Sun Nov 18, 2007 5:53 pm
Posts: 109
Hi Dave,

Applied the fix but I now get:

Failed trying to locate retained earnings account to make rounding adjustment. There must be one and only one Retained Earnings account in the chart of accounts!

Is it something I've done?

Cheers

Richard


Top 
 Profile  
 
 Post subject:
 Post Posted: Thu Mar 27, 2008 11:44 am 
Offline

Joined: Fri Oct 26, 2007 3:55 pm
Posts: 3498
Location: Colorado, US
You need at least one chart of account of type 'Retained Earnings'. This is the account where the end of year accounts get closed into. You need one and only one of these. I look for this account and error if not found. This is where the rounding errors go by default. I plan on adding a constant later that you can put rounding amounts into but for now it's best to use the retained earnings account.

Also, you won't be able properly roll your year end numbers into next fiscal year without a retained earnings account.

Go to General Ledger -> Chart of Accounts and add an account called Retained Earnings and make it type 'Retained Earnings'.

Dave


Top 
 Profile  
 
 Post subject:
 Post Posted: Thu Mar 27, 2008 1:35 pm 
Offline

Joined: Sun Nov 18, 2007 5:53 pm
Posts: 109
Thanks Dave, that's fixed it.


Top 
 Profile  
 
Display posts from previous:  Sort by  
 
Post new topic Reply to topic  [ 7 posts ] 

Board index » General Usage » Payables


Who is online

Users browsing this forum: No registered users and 2 guests

 
 

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron