Jump to content

biweekly payroll


flemingmike

Recommended Posts

here is what i was talking about:

 

<?php


$payrollstart="2010-10-16";
$payrollend="2010-10-29";
$payrollnum="0";

echo date('Y-m-d', strtotime($payrollstart) ), "<br />";
echo date('Y-m-d', strtotime($payrollend) ), "<br />";
echo $payrollnum;

echo "<br /><br /><br />";


function round_nearest($no,$near) 
{ 
    return ceil($no/$near)*$near; 
} 

$date=date('Y-m-d');

$startdatestring = strtotime($payrollend);
$nowstring = strtotime($date);
$diffsecs=($nowstring - $startdatestring);
$days = round($diffsecs / 86400);

echo $days;
echo "<br />";
$days1 = round_nearest($days, 14);
echo $days1;
echo "<br />";
$weeks=($days1 / 7);
echo $weeks;


echo "<br /><br /><br />";


$payrollweek=$weeks;
echo date('Y-m-d', strtotime("+$payrollweek week $payrollstart") ), "<br />";
echo date('Y-m-d', strtotime("+$payrollweek week $payrollend") ), "<br />";
echo $payrollweek;


?> 

 

now i just need to figure out how to make a drop down list that shows

date('Y-m-d', strtotime("+$payrollweek week $payrollend") )

as the first date and an array of the last 5 pay periods(the friday date)

Link to comment
Share on other sites

here is what i came up with:

 

<?php


$payrollstart="2010-10-02";
$payrollend="2010-10-15";
$payrollnum="0";

echo date('Y-m-d', strtotime($payrollstart) ), "<br />";
echo date('Y-m-d', strtotime($payrollend) ), "<br />";
echo $payrollnum;

echo "<br /><br /><br />";


function round_nearest($no,$near) 
{ 
    return ceil($no/$near)*$near; 
} 

$date=date('Y-m-d');

$startdatestring = strtotime($payrollend);
$nowstring = strtotime($date);
$diffsecs=($nowstring - $startdatestring);
$days = round($diffsecs / 86400);

echo $days;
echo "<br />";
$days1 = round_nearest($days, 14);
echo $days1;
echo "<br />";
$weeks=($days1 / 7);
echo $weeks;


echo "<br /><br /><br />";


$payrollweek=$weeks;
$payrollweekstart = date('Y-m-d', strtotime("+$payrollweek week $payrollstart") );
$payrollweekstart1 = date('l F j, Y', strtotime("$payrollweekstart") );
$payrollweekend = date('Y-m-d', strtotime("+$payrollweek week $payrollend") );
$payrollweekend2 = date('l F j, Y', strtotime("$payrollweekend") );
echo $payrollweek, "<br />";
echo $payrollweekstart1, "<br />";
echo $payrollweekend2, "<br />";

echo "<br /><br /><br />";

$payrollweek2=($payrollweek - 2);
$payrollweek3=($payrollweek - 4);
$payrollweek4=($payrollweek - 6);
$payrollweek5=($payrollweek - ;


$payperiod =  date('Y-m-d', strtotime("+$payrollweek week $payrollend") );
$payperiod2 = date('Y-m-d', strtotime("+$payrollweek2 week $payrollend") );
$payperiod3 = date('Y-m-d', strtotime("+$payrollweek3 week $payrollend") );
$payperiod4 = date('Y-m-d', strtotime("+$payrollweek4 week $payrollend") );
$payperiod5 = date('Y-m-d', strtotime("+$payrollweek5 week $payrollend") );



?> 



<form method="POST">
Pay Period Ending: 
<select size="1" name="payperiod">
<option selected value="<?php echo $payperiod; ?>"><?php echo date('F j, Y', strtotime("$payperiod") ); ?></option>
<option value="<?php echo $payperiod2; ?>"><?php echo date('F j, Y', strtotime("$payperiod2") ); ?></option>
<option value="<?php echo $payperiod3; ?>"><?php echo date('F j, Y', strtotime("$payperiod3") ); ?></option>
<option value="<?php echo $payperiod4; ?>"><?php echo date('F j, Y', strtotime("$payperiod4") ); ?></option>
<option value="<?php echo $payperiod5; ?>"><?php echo date('F j, Y', strtotime("$payperiod5") ); ?></option>
</select> <input type="submit" value="View" name="view">
</form>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.