Browse Source

Merge pull request 'Dev-Farhan' (#222) from Dev-Farhan into general

Reviewed-on: ordo/adw-backend#222
pull/3/head
farhantock 1 year ago
parent
commit
84f16517a4
  1. 4
      app/Helpers/MasterFunctionsHelper.php
  2. 16
      app/Http/Controllers/PresenceController.php

4
app/Helpers/MasterFunctionsHelper.php

@ -375,7 +375,7 @@ class MasterFunctionsHelper
// } // }
$totalACWP += $keyActualM->biaya_actual / $keyActualM->duration; $totalACWP += $keyActualM->duration > 0 ? $keyActualM->biaya_actual / $keyActualM->duration : 0;
} catch (\DivisionByZeroError $e) { } catch (\DivisionByZeroError $e) {
return response()->json(['message' => $e->getMessage()]); return response()->json(['message' => $e->getMessage()]);
} }
@ -555,6 +555,7 @@ class MasterFunctionsHelper
->join('assign_material_to_activity AS amta', 'amta.activity_id', '=', 'a.id') ->join('assign_material_to_activity AS amta', 'amta.activity_id', '=', 'a.id')
->where('a.type_activity', 'task') ->where('a.type_activity', 'task')
->where('a.bobot_planning', '>', 0) ->where('a.bobot_planning', '>', 0)
->where('a.proyek_id', '=', $projectId)
->whereDate('amta.plan_date', '<=', $dt->format("Y-m-d")) ->whereDate('amta.plan_date', '<=', $dt->format("Y-m-d"))
->whereDate('amta.plan_date', '>', $minSevenDays) ->whereDate('amta.plan_date', '>', $minSevenDays)
->select('a.bobot_planning', 'a.biaya_actual', 'a.duration', 'a.persentase_progress', 'a.id'); ->select('a.bobot_planning', 'a.biaya_actual', 'a.duration', 'a.persentase_progress', 'a.id');
@ -563,6 +564,7 @@ class MasterFunctionsHelper
->join('assign_hr_to_activity AS ahta', 'ahta.activity_id', '=', 'a.id') ->join('assign_hr_to_activity AS ahta', 'ahta.activity_id', '=', 'a.id')
->where('a.type_activity', 'task') ->where('a.type_activity', 'task')
->where('a.bobot_planning', '>', 0) ->where('a.bobot_planning', '>', 0)
->where('a.proyek_id', '=', $projectId)
->whereDate('a.start_date', '<=', $dt->format("Y-m-d")) ->whereDate('a.start_date', '<=', $dt->format("Y-m-d"))
->whereDate('a.start_date', '>', $minSevenDays) ->whereDate('a.start_date', '>', $minSevenDays)
->select('a.bobot_planning', 'a.biaya_actual', 'a.duration', 'a.persentase_progress', 'a.id') ->select('a.bobot_planning', 'a.biaya_actual', 'a.duration', 'a.persentase_progress', 'a.id')

16
app/Http/Controllers/PresenceController.php

@ -135,14 +135,24 @@ class PresenceController extends Controller
$checkLocation = $this->checkLocation($request); $checkLocation = $this->checkLocation($request);
$statusBoundary = false; $statusBoundary = false;
$date = date_create($request->time); $date = date_create($request->time);
$statusRestriction = HumanResource::select('status_boundary')->where('id', $request->user_id)->first();
// assign and in boundary // assign and in boundary
if(count($checkLocation) > 0 && $checkLocation[0]['boundary']){ if (count($checkLocation) > 0 && $statusRestriction->status_boundary == true)
{
if ($checkLocation[0]['boundary'] == true)
{
$statusBoundary = true; $statusBoundary = true;
} else {
$statusBoundary = false;
} }
$statusRestriction = HumanResource::select('status_boundary')->where('id', $request->user_id)->first(); }
if (!$statusRestriction->status_boundary) { // assign and not in boundary or in boundary
else {
if ($checkLocation[0]['boundary'] == true || $checkLocation[0]['boundary'] == false)
{
$statusBoundary = true; $statusBoundary = true;
} }
}
// not assign // not assign
if(!$checkLocation[0]['status_assign'] && $checkLocation[0]['boundary'] == false && $statusBoundary == false){ if(!$checkLocation[0]['status_assign'] && $checkLocation[0]['boundary'] == false && $statusBoundary == false){
$data=array( $data=array(

Loading…
Cancel
Save