Topic: Fiscal year error on every transaction

Hi,

I recently installed FA 2.4.4

I deleted the fiscal years and set the year to 01/07/2018 to 30/06/2019.

Now when I add a direct invoice with the date as 04/11/2018 (4th Nov 2018) it gives an error:

"The entered date is out of fiscal year or is closed for further data entry."

I went into the code and commented the following code in the function is_date_in_fiscalyear($date, $date):

if (is_date_closed($date2))
        return 0;

The error stopped and I could enter the invoice.

This is the is_date_closed function:

function is_date_closed($date)
{
    return !date1_greater_date2($date, sql2date(get_company_pref('gl_closing_date')));
}

My gl_closing_date is 30/6/2019
The date entered in the invoice is 04/11/2018

So the function date1_greater_date2 returns false as my date1 is not greater than date2. The ! before the function means it will return true, which means the function is_date_in_fiscalyear will return false, which of course is not the right result.

Also the code further in the is_date_in_fiscalyear is:

        $myrow = get_current_fiscalyear();
    $begin = sql2date($myrow['begin']);
    $end = sql2date($myrow['end']);
    if (date1_greater_date2($begin, $date2) || date1_greater_date2($date2, $end))
    {
        return 0;
    }
    return 1;

This code checks if the transaction being entered is in the fiscal year, so I don't understand why we need is_date_closed function.

Now finally my question is that if I keep that code commented will it give me any problems?

It's 5:30 am here i'm running on caffine, I might be totally wrong here, I apologize if I am.

Re: Fiscal year error on every transaction

Set your active fiscal year in company setup. Do not change the code.

Re: Fiscal year error on every transaction

That's the first thing I checked. It's set correctly 1/7/2018 to 30/6/2019.

Re: Fiscal year error on every transaction

List the contents of the fiscal year table. The sequence of the ids must match the sort order of the fiscal year start field.

Re: Fiscal year error on every transaction

id      begin          end       closed
10 2019-07-01 2020-06-30   0
11 2018-07-01 2019-06-30   0

How do I fix this? To change the year from the default Jan-Dec, I had to close n delete the old ones and then create them again in the Jul-Jun format.

Can I just use an update query to switch the dates?

6 (edited by poncho1234 11/04/2018 05:47:11 pm)

Re: Fiscal year error on every transaction

This is documented in the wiki

But where you are now, maybe a fresh install and follow the instructions in the wiki is the easiest way to go.

Or as apmuthu states in post 4 above

apmuthu wrote:

The sequence of the ids must match the sort order of the fiscal year start field.

Your 2019 - 2020 comes before your 2018 - 2019
so delete 2019 - 2020 and then enter it again

The FrontAccounting Wiki(Manual, examples, tips, setup info, links to accounting sites, etc) https://frontaccounting.com/fawiki/

Re: Fiscal year error on every transaction

I made the fiscal years by creating a makeshift one and then deleting old ones and creating them again, like stated in the wiki.

That's exactly how I ended up with the ID of the later year larger than the current one.

Re: Fiscal year error on every transaction

I changed the dates in the fiscal year. The id 10 is now 18-19 and 11 is 19-20.

made the current fiscal year 18-19.

Still getting the error. I guess the variable gl_closing_date in the sys_prefs table is 2019-06-30 and that's where the issue lies.

Re: Fiscal year error on every transaction

Have you checked/re-check the basics:-

What is the active fiscal year in company setup?

Is the fiscal year selected closed?

Did you make code changes? Change them back.

Clear cache - logout login - go to Preferences click the 'Update' button.

Did you create backup before you started changes? (Always a good idea then you can revert if you made a mistake)

If you still having issues try on clean install as suggested earlier

The FrontAccounting Wiki(Manual, examples, tips, setup info, links to accounting sites, etc) https://frontaccounting.com/fawiki/

Re: Fiscal year error on every transaction

Changing the fiscal id will need to be reflected in some other tables as well.

Re: Fiscal year error on every transaction

So I deleted and reinstalled the whole system. Followed this (https://frontaccounting.com/fawiki/index.php?n=Help.FiscalYears) step by step.

The problem here is that when I installed the system the default fiscal year is 1-1-2018 to 31-12-2018. I then create a small year 1-1-2019 to 30-6-2019 and another full year 1-7-2019 to 30-6-2020.

Now I close and delete 1-1-2018 to 31-12-2018 and also the small year 1-1-2019 to 30-6-2019. This is where the problem lies. Once these years are closed the sys_prefs.gl_closing_date is set to '2019-06-30'.

Now when I create 1-7-2018 to 30-6-2019 (which is the current year right now) and set it as the current year, the fiscal year closed error pops up as the gl_closing_date is set to '2019-06-30'.

So here's how I fixed this issue for myself:

1. I reinstalled the whole system again
2. Went in to the fiscal_year table and changed the years from (1-1-2018 to 31-12-2018) to (1-1-2017 to 31-12-2017)

Then followed the wiki link provided above and now everything is working properly.

12 (edited by spider 01/23/2019 10:34:44 am)

Re: Fiscal year error on every transaction

this worked for me as well, but I didn't reinstall - thanks