Topic: Debit Credit Error on Trial Balance

Dear all,

I would like to bring this to your attention something I have noticed in FA reporting system.

I have made a mistake unknowingly, I credited an expense account instead of debit, the system accepted my entry.
Now, when I was printing out the trial balance, I got wrong figures because, the balance of the expense account was on credit and not debit.
Is it possible to restrict posting a credit on an expense account vise versa, restrict posting on a credit account?

Thanks in advance

cc:
@joe
@notrinos

Re: Debit Credit Error on Trial Balance

This is so that adjustment entries can be made.
You can void the said entry and make a fresh one.

Re: Debit Credit Error on Trial Balance

@apmuthu  his point is different. He says, is there a way to warn or stop adding those entries wrong.

Subscription service based on FA
HRM CRM POS batch Themes

Re: Debit Credit Error on Trial Balance

I would like to either warn the user when they are about to post entry?
The system should either refuse to accept the post or warn the user that is making post on a wrong account type e.g.

I am not a good programmer, I am more of system administrator. So I am suggesting to the senior programmer:

1. If they can Insert a validation on the credit debit field, in that when a user select an expense account for example, the debit field become disable.
IF it's an asset account, credit field because disable or readonly, to prevent users from posting in the wrong account, which automatically lead to a wrong report if not all reports.

2. Maybe leave the system to accept the entry but warn the user before posting

Kind regards

5 (edited by kvvaradha 05/09/2020 12:17:46 pm)

Re: Debit Credit Error on Trial Balance

Your second option is fine I feel. Because sometimes. People may make reverse entries once they made mistake in another form. So I think the warning would be fine. At the same time even if they post it with warning. It should work and submit the journal entry.

Here is a screenshot for reference what i talked. And code i modified in gl_journal.php

// New function to check it 
function check_account_selection($code, $amount){
    $sql = "SELECT ms.*, cl.class_name, cl.ctype FROM ".TB_PREF."chart_master AS ms LEFT JOIN ".TB_PREF."chart_types AS tp ON ms.account_type= tp.id LEFT JOIN ".TB_PREF."chart_class AS cl ON cl.cid = tp.class_id WHERE account_code= ".db_escape($code);
    $res = db_query($sql, "Cant get the chart class selection");
    if(db_num_rows($res) == 1 ){
        if($row = db_fetch($res)){
            if($row['ctype'] == CL_EXPENSE && $amount > 0)
                display_warning(_("You are entered the Expense under the debit side"));
            if($row['ctype'] == CL_ASSETS  && $amount < 0 )
                display_warning(_("You are entered the Asset in credit side"));
        }
    }

}
function handle_new_item()
{
    if (!check_item_data())
        return;


    if (input_num('AmountDebit') > 0)
        $amount = input_num('AmountDebit');
    else
        $amount = -input_num('AmountCredit');
    
    check_account_selection(get_post('code_id'), $amount);  // This is new line in existing code
    

    $_SESSION['journal_items']->add_gl_item($_POST['code_id'], $_POST['dimension_id'],
        $_POST['dimension2_id'], $amount, $_POST['LineMemo'], '', get_post('person_id'));
      unset($_SESSION['journal_items']->tax_info);
    line_start_focus();
}

abd for updating of exiting entry.

 
function handle_update_item()
{
    if($_POST['UpdateItem'] != "" && check_item_data())
    {
        if (input_num('AmountDebit') > 0)
            $amount = input_num('AmountDebit');
        else
            $amount = -input_num('AmountCredit');


        check_account_selection(get_post('code_id'), $amount); // This is new line in existing code


        $_SESSION['journal_items']->update_gl_item($_POST['Index'], $_POST['code_id'], 
            $_POST['dimension_id'], $_POST['dimension2_id'], $amount, $_POST['LineMemo'], '', get_post('person_id'));
        unset($_SESSION['journal_items']->tax_info);
        line_start_focus();
    }
}
Subscription service based on FA
HRM CRM POS batch Themes

6 (edited by cedricktshiyoyo 05/10/2020 11:29:04 am)

Re: Debit Credit Error on Trial Balance

A thousand times thanks brother @kvvaradha . The code worked perfectly.
This was exactly what I needed. I will modify it little bit with your permission for other accounts too.

Big thanks again!!!

Re: Debit Credit Error on Trial Balance

cedricktshiyoyo wrote:

A thousand times thanks brother @kvvaradha . The code worked perfectly.
This was exactly what I needed. I will modify it little bit with your permission for other accounts too.

Big thanks again!!!

That's good to hear it.

If you modify the code, I feel it's very much usefull to FA  community. So provide it for us to update FA  core.

@Joe,  can you check this to update it to core. May be its useful feature for others.

Subscription service based on FA
HRM CRM POS batch Themes

Re: Debit Credit Error on Trial Balance

In my opinion, Journal Entries are meant to affect selected account on either side of debit or credit. Should any side be pre-assumed as default for certain account types?.
You can use Payments module to post expenses and you wont have to worry about wrong posting.

Re: Debit Credit Error on Trial Balance

@detkenn - not everyone is expert in accounting.  Sometimes a learning accountant,  like new joiny or new person, might make mistake in account selection. And sometimes by mistake. We might choose wrong account and input it by accidently, in this cases the careless mistake can be highlighted. Most of accounting software's  also have this feature to check before make entries.

Hope this feature would be helpful for others.

Subscription service based on FA
HRM CRM POS batch Themes

Re: Debit Credit Error on Trial Balance

In that case, I agree with you.
@Joe should consider integrating it to the core.

Re: Debit Credit Error on Trial Balance

As some of you guys mention, the Gl journal entries are for direct entries without any restrictions. And it should be so in My opinion.
Please use the more easy routines for transactions if you are unsure.

Joe

12 (edited by cedricktshiyoyo 05/11/2020 03:03:55 pm)

Re: Debit Credit Error on Trial Balance

@detkenn I don't think using payment is good idea, I don't know if you have noticed,
when you make an entry using payment, only bank accounts are listed, there is no other accounts.
Maybe our seniors can help also clarify for us, why is that so?
I believe we are all here to contribute with ideas not only coding but also provide our experts like @joe with our insights to make FA the best of the best.

With that in mind, I am bringing this illustration;

Not all payments are done through bank transactions right? Assuming I need to make a payment of $2, am I going to write a check for that amount?
The petty cashier is often given a certain amount of money at hand to pay for small transactions, now when He you process a payment, the petty cash must be credited and the other account debited.

Is there a possibility to allow a cash account (WHICH IS NOT BANK ACCOUNT) (if not all asset accounts) to appear in the list when processing a payment? @joe

Regards to all

Cedrick

Re: Debit Credit Error on Trial Balance

All money is belonging to a bank account. Even small cash accounts. This is to keep it safe. When operating where money is included, you can better use the deposit or payment form.

Joe

14 (edited by cedricktshiyoyo 05/11/2020 04:25:08 pm)

Re: Debit Credit Error on Trial Balance

okay, but how do you record for example a payment of a small amount like 2 dollars? Are you writing a check?

I believe the petty cash is not a bank account right? It's money kept at hand by the petty cashier I believe for quick transactions that do not require writing of a check and making small payments like perdiems, transportation, fuel etc..

Regards

Re: Debit Credit Error on Trial Balance

Petty cash is treated like a bank account in FA. That is why you will find it in the bank_accounts table (check using the standard Chart of Accounts with demo data).

Post's attachments

Cash_as_Bank_Account.png 10 kb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

Re: Debit Credit Error on Trial Balance

Hi,

I think Approval System for GL Transactions should work fine here. Refer Forum Post.

So system administrator/Accountant  can review and approve it.

ANOOP
Experience is the name everyone gives to their mistakes!

Re: Debit Credit Error on Trial Balance

@anoopmb, you are right, its useful module here. But where the company has less people and try that. its double work for them to do it. So the first solution, we applied there is for the small companies or those who handles FA functions totally.

Subscription service based on FA
HRM CRM POS batch Themes

Re: Debit Credit Error on Trial Balance

@joe can this be included into the core with a Company Setup flag in sysprefs table?

Re: Debit Credit Error on Trial Balance

anoopmb wrote:

Hi,

I think Approval System for GL Transactions should work fine here. Refer Forum Post.

So system administrator/Accountant  can review and approve it.

Hi anoobpmb, I just read this thread and I agree. It is possible and often necessary to credit an account with a normal debit balance and vice versa. Your solution is the most ideal, as is the script suggested by kvvaradha and the comments of joe and detkenn.

I look forward to receiving the files for Version 2.4.8 of your Approval System for GL Transactions.

Celito