This topic is locked

Limit hours per day

12/31/2009 10:57:48 AM
PHPRunner General questions
P
patricktrujillo author

I have two tables, 'claims, and time entry'. When a client adds a new claim, they can then go and add a new time entry for that claim. They could have up to 30 or 40 time entries per claim. On the time entry table, a time entry cannot exceed 8 hours per day. Here is a scenario:
Claim 1 has three time entries:

12/1/09 4 hours

12/2/09 7 hours

12/2/09 2 hours
As you can see, they have exceeded the allowed amount of hours for the date '12/2/09'. How can I enable 'an alert', that will notify them of an error in their time entry table, on that particular claim prior to the time entry being submitted to database?
Secondly, the same client is now setting up claim 2:
Claim 2:

12/5/09 5 hours

12/6/09 5 hours

12/1/09 5 hours
As you can see here, the same client, with two different claims has a time entry on two seperate claims for the same date, and exceeds that alloted eight hour time period. How can I enable 'an alert' to notify that client of the exceeded time entry?, and also let them know what claims are involved with this error in their time entry?
The reason for this is to allow our clients to not have to be put through an auditing procedure due to overage billing.
Any advice would be greatly appreciated.

L
lewisekrantz 1/1/2010

Here is one way to accomplish your objective
In the "Before process" event for what ever the page is

  1. Write an entry to a logfile user/datetime indexed with the key user-datetime
  2. Calculate the total time for the day by subtracting the dateTime beginning the day for that user from the

    current dateTime = total time for the day (it will take some math)
  3. Then based on the total time - pop your message
    It will be a bit more complicated than above because the user may log in and out

    so you will have to deal with multiple entries in the same day, but the basic kind of logic

    still applies.... for example maybe you will write to the file when they log out

    and do the math on each time pair ..... logins and logouts for a given day
    LK

P
patricktrujillo author 1/4/2010

WOW.
Are there any tutorials out there that maybe can show me the details/procedures for setting something like that up? That does seem that like very painstaking scenario.
Any help that you can / or anyone can give, it would be greatly appreciated.
I do appreciate your repsponse and will practice and see what I can do with the advice that you have given me.

P
patricktrujillo author 1/6/2010

I have yet to find anything. Does anyone have the same scenario/setup?

Sergey Kornilov admin 1/6/2010

This is not something you can find. You need to write code in order to make it work.
I don't think it have to be too complicated. Use BeforeAdd event to calculate number of hours for any given date and user. Then you can display a message to user and either add record or require user to fix this.

P
patricktrujillo author 1/6/2010



This is not something you can find. You need to write code in order to make it work.
I don't think it have to be too complicated. Use BeforeAdd event to calculate number of hours for any given date and user. Then you can display a message to user and either add record or require user to fix this.


Would this be wrote in php or javascript code?

Sergey Kornilov admin 1/6/2010

PHP. This code needs to query the database.

P
patricktrujillo author 1/6/2010



PHP. This code needs to query the database.


Can I get a little boost of code to get me going? I have no clue where to begin.

J
Jane 1/7/2010

Patrick,
I recommend you to publish your project on Demo Account and open a ticket at http://support.xlinesoft.com sending a URL to your pages. I'll try to help you with sample code.