Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Calculating payroll frequency
Message
 
 
À
08/12/2006 10:46:51
Ken Zinssar
Newkirk Products Inc
Albany, New York, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
01176080
Message ID:
01176496
Vues:
9
>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--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform