Wrox Programmer Forums
ASP Pro Code Clinic As of Oct 5, 2005, this forum is now locked. No posts have been deleted. Please use "Classic ASP Professional" at: http://p2p.wrox.com/forum.asp?FORUM_ID=56 for discussions similar to the old ASP Pro Code Clinic or one of the other many remaining ASP and ASP.NET forums here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Pro Code Clinic section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old August 13th, 2004, 08:29 AM
Authorized User
Join Date: Jun 2003
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Default Time attendance database and coding

Hi all,

I am really stuck today and can use all your help on this subject.

I am making kinda like a punch-in card for work which will register your time of arrive and departure. I have a small system working in that the employee has an ID number and then when they log in with the EmployeeID and Password the database records the date and the time of arrival, then when they log out it records the exit time and then works out the amount of hours and minutes worked today.

However the problem arises when I want to call up a complete week or month. Our company doesn't work on a Sunday. For example if I call up the weeks information and it happens to be wednesday. I want it display the next 3 days (Thurs, Fri and Saturday) which will be empty cos they are in the future and the first 4 days (Sun, Mon, tue and wed). What I want to know is how can I extract this data. My TABLE consists of the following fields: EmployeeID, Date, TimeIn, TimeOut, HoursWorked, MinutesWorked.

I have been thinking about using the day indentifier which gives you a numeric for that day(eg. sun=0, mon=1 etc) but what happens when tuesday falls on the first of the month.

Are there any simpler ways to resolve this problem. Any ideas or feedback will be greatly recieved.

With many thanks for all your assistance and time,

Old August 14th, 2004, 08:04 PM
Friend of Wrox
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41

An observation if I may:

You have the fields EmployeeID, Date, TimeIn, TimeOut, HoursWorked, MinutesWorked in your table

Personaly, I wouldnt store HoursWorked/MinutesWorked. You have the timeIn and timeOut, calculate this at run time when needed - Any how thats personal preference, my theory - store only whats neccessary.

;;;;However the problem arises when I want to call up a complete week or month
What exactly is the problem?
;;;;how can I extract this data
Specificly what data? time worked for all employees over the given date range?

Am I on the right track?
If you are calling up time worked and three days of the week are in the future, wont it give you results based on all days of the week where there is data? Days that have no time clocked against them shouldnt effect your recordset.

Wind is your friend
Old August 16th, 2004, 07:37 AM
Registered User
Join Date: Aug 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts

I would use SQL date functions to dismantle and rebuild the day dateparts of your dates, creating a generic algorithm to solve your problem for any specified day...

any help?

Old August 16th, 2004, 07:40 AM
Registered User
Join Date: Aug 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts

In particular you could use the DATEADD function to build this algorithm.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Store Procedure For Attendance prasanta2expert SQL Server 2000 4 July 5th, 2012 03:10 AM
Time attendance database and coding neo_jakey Classic ASP Professional 6 August 17th, 2007 02:24 AM
create database in mysql through php coding vivekananth PHP Databases 2 January 31st, 2007 01:48 AM
Time attendance database and coding neo_jakey Classic ASP Basics 1 August 14th, 2004 02:20 AM
attendance scanning system rajanikrishna Classic ASP Databases 2 June 8th, 2004 04:30 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.