Results 1 to 2 of 2
May 9, 2001, 09:30 #1
- Join Date
- Jul 2000
- Outside Providence
- 0 Post(s)
- 0 Thread(s)
I have a timesheet form where the user is entering time in and time out and posting time to their time sheet. Those fields (time in, time out, hours worked) are static for each day of the week and easy to work with, so I'm automatically calculating the total hours worked for the week as they change the values. That's the easy part.
Now for the hard part. I have an "Add Leave" button which adds a row into the table (and onto the page) allowing the user to choose the type of leave (personal, sick, vacation). And across the Mon-Fri fields I need to subtotal the leave time (to the right of the row) as well as add it to a leave time subtotal and to the grand total at the bottom of the page.
It wouldn't be such an issue if there wasn't so many different leave types and the ability to add many different leaves each week for the timesheet. For example, the user may have 2 hours vacation time, 2 hours personal time and four hours Leave without pay for one particular day. In this case, the user will continue to add new rows, select the leave type and fill in the hours across the week.
I'm thinking that I need to name the fields in a unique way so that when I'm adding them up, I'll know it's leave time. For example LV_201_Mon, LV_201_Tue, LV_201_Wed, etc. In this case, the id of 201 tells me which leave that they are reporting. How the heck to I add up all these different rows when I have no clue what they're going to be called. Is there a way to loop through a "collection" of fields on a form, and then if it starts with LV, I could just add it to the leave subtotal? I'm stumped.
Thanks in advance for any help you can provide. Sorry about the lengthy message.
AprilTEAMWORK is the fuel that allows common people
to produce uncommon results.