|
|
@@ -77,11 +77,16 @@ class LaborReportController extends Controller
|
|
|
->where('checked_at','<=',$date." 14:00:00")->where('type','登出')->first();
|
|
|
$userDutyCheckEnd=UserDutyCheck::where('user_id',$laborReport->user_id)->where('workgroup_id',$laborReport->user_workgroup_id)->where('checked_at','>=',$date." 11:00".":00")
|
|
|
->where('checked_at','<=',$date." 14:00:00")->where('type','登入')->first();
|
|
|
- $laborReport->beginLunch=date('H:i',strtotime($userDutyCheckStart['checked_at']));
|
|
|
- $laborReport->endLunch=date('H:i',strtotime($userDutyCheckEnd['checked_at']));
|
|
|
- $beginTime=Carbon::parse($laborReport->beginLunch);
|
|
|
- $endTime=Carbon::parse($laborReport->endLunch);
|
|
|
- $hour=($endTime->diffInSeconds($beginTime))/3600;
|
|
|
+ if ($userDutyCheckStart['checked_at']==null){
|
|
|
+ $laborReport->beginLunch=null;
|
|
|
+ }else{
|
|
|
+ $laborReport->beginLunch=date('H:i',strtotime($userDutyCheckStart['checked_at']));
|
|
|
+ }
|
|
|
+ if ($userDutyCheckEnd['checked_at']==null){
|
|
|
+ $laborReport->endLunch=null;
|
|
|
+ }else{
|
|
|
+ $laborReport->endLunch=date('H:i',strtotime($userDutyCheckEnd['checked_at']));
|
|
|
+ }
|
|
|
}
|
|
|
$userWorkGroups=UserWorkgroup::select('id','name')->get();
|
|
|
return view('personnel/laborReport/index',['laborReports'=>$laborReports,'userWorkGroups'=>$userWorkGroups,]);
|