Exemple #1
0
        $mins = floor(($diff - $hours * 60 * 60) / 60);
        $secs = floor($diff - ($hours * 60 * 60 + $mins * 60));
        if (strlen($hours) < 2) {
            $hours = $hours;
        }
        if (strlen($mins) < 2) {
            $mins = $mins;
        }
        if (strlen($secs) < 2) {
            $secs = "0" . $secs;
        }
        return $hours . ':' . $mins;
    }
    $time1 = date('H:i', strtotime($obtimein));
    $time2 = date('H:i', strtotime($obtimeout));
    $numofhrs = gettimediff($time1, $time2);
    $stmt = "UPDATE `undertime` set \n\t\t\t\tundertimefr = '{$obtimein}', undertimeto = '{$obtimeout}', state = '{$upstate}', edithr = '{$edithr}', datehr = '{$date}', numofhrs = '{$numofhrs}'\n\t\t\twhere account_id = '{$accid}' and state = 'UA' and undertime_id = '{$obid}'";
    if ($conn->query($stmt) === TRUE) {
        echo '<script type="text/javascript">window.location.replace("hr.php?ac=penundr"); </script>';
    } else {
        echo "Error updating record: " . $conn->error;
    }
    $conn->close();
}
if (isset($_POST['disapprovetime'])) {
    $dareason = $_POST['dareason'];
    $overtime = $_POST['overtime'];
    $approve = $_POST['approve'];
    $ac = $_POST['ac'];
    $accid = $_POST['accid'];
    $stmt = "UPDATE `overtime` set \n\t\t\t state = '{$approve}', dareason = '{$dareason}'\n\t\t\twhere account_id = '{$accid}' and state = 'UA' and overtime_id = '{$overtime}'";
Exemple #2
0
     $mins = floor(($diff - $hours * 60 * 60) / 60);
     $secs = floor($diff - ($hours * 60 * 60 + $mins * 60));
     if (strlen($hours) < 2) {
         $hours = $hours;
     }
     if (strlen($mins) < 2) {
         $mins = $mins;
     }
     if (strlen($secs) < 2) {
         $secs = "0" . $secs;
     }
     return $hours . ':' . $mins;
 }
 $time1 = date('H:i', strtotime($_POST['startofot']));
 $time2 = date('H:i', strtotime($_POST['endofot']));
 $approvedothrs = gettimediff($time1, $time2);
 if (substr($approvedothrs, 0, 2) >= 8) {
     $approvedothrs = date("G:i", strtotime("-1 hour", strtotime($approvedothrs)));
 }
 //ot break on ot exec
 if (isset($_POST['otbreak']) && $_POST['otbreak'] != null) {
     if ($_POST['otbreak'] == '30 Mins') {
         $approvedothrs = date("G:i", strtotime("-30 min", strtotime($approvedothrs)));
         $otbreak = '-30 Minutes';
     } elseif ($_POST['otbreak'] == '1 Hour') {
         $approvedothrs = date("G:i", strtotime("-1 Hour", strtotime($approvedothrs)));
         $otbreak = '-1 Hour';
     } else {
         $otbreak = null;
     }
 } else {