Gossamer Forum
Home : Products : DBMan : Customization :

Timecard DB - Calculating Time

Quote Reply
Timecard DB - Calculating Time
Pardon my if this question has already been answered, but I've search the forum and didn't find any results that fit my needs. If it has, please point me in the right direction.

I'm trying to build a timecard DB. Users would enter in the time they came and went and the script would calculate the total hours.

I'm using calculations for other items, but I can't seem to figure out how to calculate time. By using 24hr time, and using in db.cgi, it will calculate, but only in full hours:

Code:
$in{'Date1Reg'} = $in{'Date1Out1'} - $in{'Date1In1'};

If I come in at 0800 and leave at 1200, it calculates 400, but if it's 0815 and 1200, I get 385, which isn't accurate.

This also gets a bit complicated since I need 2 in and out times each day for 2 weeks.

I thought of having separate records for each day, but I don't know how to pull the 2 weeks I need for each pay period.

If anyone has suggestions on this, it would be greatly appreciated. Smile
Quote Reply
Re: [shalom777] Timecard DB - Calculating Time In reply to
Did you by any chance see this thread:

http://www.gossamer-threads.com/perl/gforum/gforum.cgi?post=254959

I did a search using "calculate time". There may be others but I didn't read each one.

Unoffical DBMan FAQ
http://redundantcartridge.com/dbman/
Quote Reply
Re: [LoisC] Timecard DB - Calculating Time In reply to
Where would I place the code for the index.pl file? Would it be in the sub add_form?
Quote Reply
Re: [shalom777] Timecard DB - Calculating Time In reply to
In your db.cgi they apparently renamed the db.cgi to index.cgi for their application.

Unoffical DBMan FAQ
http://redundantcartridge.com/dbman/