Topic: How Can I Setup Gregorian Calendar w/ Friday off

Hello,


How can I Setup the Calendar w/ Friday off as Bellow :

- Use the Gregorian Calendar as

- Assign the Week End : Friday is Off

- Saturday is 1st work day of the week.

I tried to Track it through the software, but I could not.

Can you help ?


Kalido

Re: How Can I Setup Gregorian Calendar w/ Friday off

This is a tough one, but it is possible. You have to change inside the file /includes/ui/ui_view.inc. There is a function for the DatePicker.
It is written in php but prints javascript code. Normally off days are Saturday and Sunday. The day number starts on Sunday=0, Monday=1 and so on.
Remember to empty the browser cache when testing. The JS code is written to cache.

If you solve it, please share it with us.

/Joe

Re: How Can I Setup Gregorian Calendar w/ Friday off

In config.php you can set the $date_system to a value of 0, 1 or 2, where 0 is gregorian, 1 is jalali and 2 is islamic. If the value is set to either 1 or 2 the Friday is off and the 1st work day is Saturday.
But you will run the Jalali or Islamic date system. If you want to use the gregorian calendar, you will have to mask the code on relevant places to not use the Jalali and Islamic algorithms.

/Joe

4 (edited by Kalido 10/01/2009 10:26:16 pm)

Re: How Can I Setup Gregorian Calendar w/ Friday off

Hello,

I already Solve it.

But Since I am not " WOW " in Java , I hope that you help :

in config.php, I add the follwing lines to define 2 Variables :

$date_system   = 0 ;   // Originally included

// New Variables to use later on in the file : /includes/ui/ui_view.inc

$WeekDay_1_OFF = 0 ; // sun=0 ;mon=1; Tue=2; --> Fri=5;Sat=6
$WeekDay_2_OFF = 6 ; // sun=0 ;mon=1; Tue=2; --> Fri=5;Sat=6

Then in  the file  /includes/ui/ui_view.inc, You go to the lines :

1- Go arround line # 786 and add to the :
    function get_js_date_picker()
    the 2 Varibales already defined in config.php as global :
        global  $WeekDay_1_OFF, $WeekDay_2_OFF;

2 - Go arround line # 1100 and change the line :
          $js .= "}  else if (dayOfWeek == 0 || dayOfWeek == 6) {";

WITH :
$js .= "} else if (dayOfWeek == $WeekDay_1_OFF   || dayOfWeek == $WeekDay_2_OFF   ) {";    // Khaled

BUT at each time you need to change the WeeDay OFF's Variables in config.php, you need to delete the file /company/js_cashe/date_picker.js
And then restart the page to take effect.

---------------------------------------------------------------------------------
Finally, a huge efforts you did with this very interesting Ver 2.2.

it is really interesting and outstanding.



Regards,


Khaled

Re: How Can I Setup Gregorian Calendar w/ Friday off

You are good and almost there.
Replace the line

} else if (dayOfWeek == 0 || dayOfWeek == 6) {

with

} else if (dayOfWeek == $weekday_1_off || dayOfWeek == $weekday_2_off) {

You can use inline php parameters.
And set the variables in config.php

$weekday_1_off = 5 ; // sun=0 ;mon=1; Tue=2; --> Fri=5;Sat=6
$weekday_2_off = 5 ; // sun=0 ;mon=1; Tue=2; --> Fri=5;Sat=6

Khaled, if this is a very common way of doing it in your region, I will consider this to be incorporated in the core code.
Then we would probably also need a global variable for $start_day_of_week, right?

/Joe

Re: How Can I Setup Gregorian Calendar w/ Friday off

OK thanks Joe,

you wanna big_smile.

I spent my time today arround 4 hours or more to discover it.

From other side :

Another strong improvement you may add to your system if you can switch to alphanumeric the A/C classes ; Types ; and movers accounts.

in this case you may impose tree form of all your Chart of Account [COA]

which permit a upward movement so simple w/ the SQL family.

If you check with : MYOB , PEACHTREE, NAVISION etc... all of them adopt this philosophy of preparing and using the COA. The main idea that :

it helps a lot in grouping and quering at all levels.

COA's ex :

101
1011
1012
10121
10122
etc....

Regards,


kalido

Re: How Can I Setup Gregorian Calendar w/ Friday off

There have been a couple of suggestions about that, however we now sort the account lists by account group/type id insted of name.
Unfortunately we cannot do this until release 2.3, should it be necessary. In my opinion it is not needed after our last implementation in 2.1.4 (I guess).

/Joe

Re: How Can I Setup Gregorian Calendar w/ Friday off

If you permit me to suggest, although I am far away of being such a developper like you and your fellows :

using alphanumeric as I suggest , open for you the door for an easy developement of a report generator who can be easely integrated with your system and will be simple to manipulate by the end user like me (finally i am not a programmer, I am a civil engineer who likes the programming and was very impressed by what you done with this software and like it too much).

What i suggest will help a lot for the simple reason that a Function such Get_Value("1012*") will bring you all the down tree levels balance in a simple SQL statement. And in this case you will discard the complication issuing from using Group/Subgroup Loops. You will have a direct access to any level of Groups/Subgroups from the Master_GL easely. Those Groups/Subgroups are the Heart of all kind of reports an Accountant or an Analyst use.


Finally, it is my opinion not more. and for myself already I made a little of changes to the Types & Classes and i use them all as alphanumeric ID's.

Thanks & My Best Regards,


Khaled