I have a report that calculates employee working hours by retrieving date, punch in and punch out and calculate duration, this data is saved into an array to be displayed based on the payroll period, here is the code that calculates payments based on a weekly period (looping within array)
foreach($punch_sets as $val){
if ($currentmonth==""){
echo "<tr><td>" . date("W",strtotime($val['in_date'])) . "</td>";
}
if ($currentmonth1 == date("F",strtotime($val['in_date'])) || $currentmonth1 ==""){
if ($currentmonth == date("W",strtotime($val['in_date'])) || $currentmonth==""){
$total_time += $minSec + $hours*3600;
$currentmonth = date("W",strtotime($val['in_date']));
}
else
{
echo "<td>" . sec2hm($total_time) . "</td>";
echo "<td>" . (sec2hm($total_time) * $ratepaid) . "</td></tr></tr>";
$currentmonth ="";
$total_time = $minSec + $hours*3600;
}
}
else {
$total_time = $minSec + $hours*3600;
}
$currentmonth1 = date("F",strtotime($val['in_date']));
}
The question here how do I adjust this logic to get bi weekly calculation instead of weekly.