Topic: Problem with supplier invoice transaction date

I upgraded to 2.4.6 having operated frontaccounting for a number of years without problems. I now find that the supplier invoice file isn't picking up an altered transaction date.

So for example - current date : 21/08/2019     which is in my tax year started 01/06/2019 to 31/05/2020

Date of transaction I wish to enter 08/05/2019            in my previous tax year 01/06/2018 to 31/05/2019 - set to active

both tax years open - and SA_MULTIFISCALYEARS set enabled.

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

having added some debug I find that the transaction date being picked up is 21/08/2019 NOT 08/05/2019... which fails the test "correctly" as it isn't in the active year.

I wonder how this problem can be rectified?

Help ??

Thanks in anticipation.

Re: Problem with supplier invoice transaction date

Switch active fiscal to previous fiscal in Setup => Company Setup temporarily for the change to be done.

Re: Problem with supplier invoice transaction date

Hi @Apmuthu.

Thanks.. forgot to mention I had already done that... It still picks up the current date rather than the date in the form as the input for the tests! This must surely be wrong whatever the setting of fiscal year,,

Re: Problem with supplier invoice transaction date

As SA_MULTIFISCALYEARS has been enabled (logged out and logged in again after clearing browser cache), verify the setting is saved in Setup => Access Setup => Role: System Administrator (Role of logged in user).

The function that allows Suppliers, Customers and Items to be entered in older fiscal years is defined in admin/db/fiscalyears_db.inc is is_date_in_fiscalyears() and is used in the function is_date_in_fiscalyear() defined in  includes/date_functions.inc where the first said file is "include"d.

Inspect the variables at that point in Line 204 of the last file stated above. The function user_check_access() is defined in includes/current_user.inc file.

Scope, availability and visibility of the variables and their values will be of use in investigating it. If all is well, then scour the scripts that use these values before "post"ing the updated values to the db.

Post's attachments

AllowEntryOnNonClosedFiscalYears.png 10.7 kb, file has never been downloaded. 

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

Re: Problem with supplier invoice transaction date

Have done some debug.
The problem appears to be with the changing of $_SESSION['supp_trans']->tran_date.
The initial value is todays date (e.g. 30/08/2019) The changed value should be 30/05/2019 - i.e. the previous fiscal year)
The copy_to_trans function changes this date successfully. But when the trans date is picked up and passed to is_date_in_fiscalyear it is the 30/08/2019. This causes the problem - this date isn't in the required previous active fiscal year.

I wonder whether the problem is that the ajax call that submits the purchase invoice is trying to change $_SESSION that was set by the browser making its request. I'm suspecting the two connections don't necessarily share the same session ?? This rest of the check functions check the date format rather than the specific date value for correctness.

Any thoughts?

Re: Problem with supplier invoice transaction date

I have found and fixed the problem..
It's not to do with Ajax & Session...
Rather the gl_closing_date in the sys_prefs table had got miss set (how I have no idea) to the end of an open fiscal year. This thoroughly confused the system. Having edited the database to set this back to the end of the last "closed year" everything worked OK again..
Phew...

Re: Problem with supplier invoice transaction date

The sys_prefs table record for gl_closing_date is set in the function close_transactions() in the file includes/db/audit_train_db.inc.

update_company_prefs(array('gl_closing_date'=> date2sql($todate)));