1 回答
TA贡献1998条经验 获得超6个赞
我认为问题是GetApprovedOt函数总是不返回时间值。你应该改变你的函数如下
function GetApprovedOt($connect,$emp_id,$passmonth)
{
$query01 ="SELECT SEC_TO_TIME( SUM( TIME_TO_SEC( `ot_hour` ) ) ) AS timeSum
FROM otresquest
WHERE em_id = $emp_id AND from_month LIKE '$passmonth%' AND overtime_status=6";
$statement = $connect->prepare($query01);
if($statement->execute())
{
$result = $statement->fetchAll();
foreach($result as $row){
if ($row["timeSum"] != NULL) {
$sum =$row["timeSum"];
return $sum;
} else {
return '00:00:00';
}
}
}
}
现在你可以通过formatHours(GetApprovedOt($connect,$row["emp_id"],$_GET["month"]))
- 1 回答
- 0 关注
- 70 浏览
添加回答
举报