Search found 7 matches

by ahz
Wed Apr 11, 2007 11:29 am
Forum: PHP - Code
Topic: How to calculate the first date of a pay period?
Replies: 13
Views: 1120

The problem with some of those pay period definitions is they cannot align to a work week (i.e. the pay period is not an integer multiple of the work week), which confuses the overtime pay issues (at least here in the USA for non-exempt employees). I will try to get the common ones, and the rest can...
by ahz
Wed Apr 11, 2007 10:48 am
Forum: PHP - Code
Topic: How to calculate the first date of a pay period?
Replies: 13
Views: 1120

OK. My goal was a short, elegant solution that passes the unit tests. I think I have accomplished the goal. Thank you everyone for your help, and per onion2k's suggestion, I will look into implementing pay periods of other definitions (e.g. months). <?php // // Copyright (c) 2007 [url=http://springs...
by ahz
Tue Apr 10, 2007 4:26 pm
Forum: PHP - Code
Topic: How to calculate the first date of a pay period?
Replies: 13
Views: 1120

us2days() turned out bad in practice for calculating the difference of days, so here's tested progress on calculating the difference of days... /** * For any given day in UNIX time, returns the same day at 12:00pm in UNIX time. */ function unixnoon($t0) { $m = intval(date('m', $t0)); $d = intval(dat...
by ahz
Tue Apr 10, 2007 3:52 pm
Forum: PHP - Code
Topic: How to calculate the first date of a pay period?
Replies: 13
Views: 1120

Then you may benefit from the class I linked to already. I looked. Please excuse my oversight, but I don't see how it helps. BTW, I came up with my own serial date system. I'm still working out the rest. :? /** * Calculate UNIX "days" (an ad hoc concept), which is a * serial date like JDN...
by ahz
Tue Apr 10, 2007 10:23 am
Forum: PHP - Code
Topic: How to calculate the first date of a pay period?
Replies: 13
Views: 1120

How are you defining the pay period? All I can see is a single variable. What happens if someone is paid monthly for example? Uh oh. :) Thanks for catching that. I assume 14 days is most typical, so I still need to figure out this question, but after that, I will plan to do monthly, quarterly, etc....
by ahz
Mon Apr 09, 2007 2:03 pm
Forum: PHP - Code
Topic: How to calculate the first date of a pay period?
Replies: 13
Views: 1120

Weirdan wrote:You might want to convert your dates to julian day count using gregoriantojd for simplier calculations.
"Calendar Functions" seems to be an extension not available on all platforms, but I'd like my web app to run anywhere.
by ahz
Mon Apr 09, 2007 1:24 pm
Forum: PHP - Code
Topic: How to calculate the first date of a pay period?
Replies: 13
Views: 1120

How to calculate the first date of a pay period?

Everah | Please use , and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color] Hi, I'm...