Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calculating payroll frequency
Message
 
 
To
08/12/2006 10:46:51
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01176080
Message ID:
01176496
Views:
8
>Has anyone had to figure out how many pay periods, paid bi-weekly, there are in each quarter of the year - for many years to come?

Hi Ken

I put code below together w/o much testing but it seems return correct results. Keep in mind that tdPayDate has to be before beginnig of a quarter or result will be incorrect.
* Calcualte the nuber of bi-weekly payments for specific quarter
LPARAMETERS tnYear, tnQuarter, tdPayDate
* tdPayDate - past bi-weekly pay date
LOCAL ldQstart, ldQend
* Return 0 in case it's used in a query
IF NOT BETWEEN(tnQuarter,1,4)
	RETURN 0
ENDIF
* The first and last date of a quarter
ldQstart 	= DATE(tnYear, (tnQuarter-1)*3 + 1, 01)
ldQend   	= GOMONTH(ldQstart,3) - 1
RETURN INT((ldQend - tdPayDate) / 14) - CEILING((ldQstart - tdPayDate) / 14) + 1
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform