Creating payroll dates

General support questions.
Posts: 1
Joined: Thu Jul 19, 2007 11:39 am
Location: Richmond, VA
PostPosted: Thu Jul 19, 2007 11:53 am
I need to create a set of records for each client based on their payroll frequency. I need a payroll date for one client that has a weekly check date of Friday; another that has a b-weekly check date of Friday; another that has semi-monthly check dates on the 15th and last day of the month; etc. I need to create a check date schedule for the whole year for each client. I am told the best way is through a Loop expression, but I have limited experience in doing that. Any help is greatly appreciated
SeedCode Staff
SeedCode Staff
Posts: 2764
Joined: Thu Nov 20, 2003 11:01 am
PostPosted: Fri Jul 20, 2007 12:13 pm
Basically you'll use two loops: one to move through the clients you need to create schedules for, and a second loop that makes all the schedule records for each client. Probably something like this (runs from the client's table):

Loop
Set Variable $Date: Get ( CurrentDate )
Loop
Set Variable $Date: $Date + 7
< Make schedule record for $Date >
Exit loop if $Date > Date ( 12 ; 31 ; year ( Get ( CurrentDate ) ) )
End Loop
Go to Record Request [ Next ; Exit After Last ]
End Loop

I'm not sure how you're making your schedule records, but that is the gist of it. The example above sets $Date to every 7 days for the rest of the current year; you'd need to come up with some other calcs to do things like "first monday of the month", "every two weeks on Monday", etc.

Our Pro Calendar has a repeating events script that does a lot of this and which might be a good place to look for examples on how to get the date math right.

Hope that helps.
John Sindelar
SeedCode

Return to General Support

Who is online

Users browsing this forum: No registered users and 2 guests

(855) SEEDCODE
[email protected]
Follow us: