|
|
@@ -172,7 +172,8 @@ class LaborReportController extends Controller
|
|
|
$check_in_at=$laborReport->check_in_at;
|
|
|
$laborReport->check_out_at=$check_out_at;
|
|
|
$online_duration=round(Carbon::parse($check_out_at)->diffInSeconds(Carbon::parse($check_in_at))/3600,2);
|
|
|
- $laborReport->working_duration=$this->minusLunchTime($laborReport,$online_duration);
|
|
|
+ $round_time=round(Carbon::parse($laborReport->round_check_out_at)->diffInSeconds(Carbon::parse($laborReport->round_check_in_at))/3600,2);
|
|
|
+ $laborReport->working_duration=$this->minusLunchTime($laborReport,$round_time);
|
|
|
if ($laborReport['enter_at']){
|
|
|
$enter_at=$laborReport['enter_at'];
|
|
|
$laborReport->online_duration=round(Carbon::parse($check_out_at)->diffInSeconds(Carbon::parse($enter_at))/3600,2);
|
|
|
@@ -203,11 +204,12 @@ class LaborReportController extends Controller
|
|
|
$check_in_at=$laborReport->check_in_at;
|
|
|
$laborReport->check_out_at=$check_out_at;
|
|
|
$online_duration=round(Carbon::parse($check_out_at)->diffInSeconds(Carbon::parse($check_in_at))/3600,2);
|
|
|
+ $round_time=round(Carbon::parse($laborReport->round_check_out_at)->diffInSeconds(Carbon::parse($laborReport->round_check_in_at))/3600,2);
|
|
|
if ($relax_time){
|
|
|
$laborReport->relax_time=$relax_time;
|
|
|
- $laborReport->working_duration=$this->minusLunchTime($laborReport,$online_duration)-$relax_time/60;//减去晚饭时间
|
|
|
+ $laborReport->working_duration=$this->minusLunchTime($laborReport,$round_time)-$relax_time/60;//减去晚饭时间
|
|
|
}else{
|
|
|
- $laborReport->working_duration=$this->minusLunchTime($laborReport,$online_duration);
|
|
|
+ $laborReport->working_duration=$this->minusLunchTime($laborReport,$round_time);
|
|
|
}
|
|
|
if ($laborReport->enter_at){
|
|
|
$enter_at=$laborReport['enter_at'];
|
|
|
@@ -224,8 +226,8 @@ class LaborReportController extends Controller
|
|
|
|
|
|
//工作时长减午饭休息时间
|
|
|
public function minusLunchTime($laborReport,$hour){
|
|
|
- $checkInTime=$laborReport->round_check_in_at;
|
|
|
- $checkOutTime=$laborReport->round_check_out_at;
|
|
|
+ $checkInTime=$laborReport->check_in_at;
|
|
|
+ $checkOutTime=$laborReport->check_out_at;
|
|
|
$checkOutTime=Carbon::parse($checkOutTime)->format('H');
|
|
|
$checkInTime=Carbon::parse($checkInTime);
|
|
|
if ($checkInTime->lessThanOrEqualTo($checkInTime->clone()->setHours(11)->setMinutes(30))&&(int)$checkOutTime>=13){
|