diff --git a/app/Helpers/MasterFunctionsHelper.php b/app/Helpers/MasterFunctionsHelper.php index 04f3076..8fb7284 100644 --- a/app/Helpers/MasterFunctionsHelper.php +++ b/app/Helpers/MasterFunctionsHelper.php @@ -212,6 +212,7 @@ class MasterFunctionsHelper { ->where('activity_id', '=', $keyActualM->activity_id) ->groupBy('activity_id') ->first(); + $reportCount = DB::table('report_activity_material')->where('activity_id', '=', $keyActualM->activity_id)->count(); $dataTempReport [$w]['activity_id'] = $keyActualM->activity_id; $dataTempReport [$w]['qty'] = $keyActualM->qty; $dataTempReport [$w]['report_date'] = $keyActualM->report_date; @@ -231,7 +232,7 @@ class MasterFunctionsHelper { // $sumPercentageActual+=($keyActualM->qty/$sumVolActual->ttl_qty_plan)*$keyActualM->bobot_planning; // if($keyActualM->qty/$sumVolActual->ttl_qty_plan >= 1){ if($checkStatusActivity->status_activity == 'done'){ - $sumPercentageActual+=$keyActualM->bobot_planning; + $sumPercentageActual+=$keyActualM->bobot_planning/$reportCount; // $sumPercentageActual = $sumPercentageActual > $keyGantt['progress'] ? $keyGantt['progress'] : $sumPercentageActual; }else{ if($keyActualM->qty/$sumVolActual->ttl_qty_plan >= 1){ diff --git a/app/Http/Controllers/ActivityController.php b/app/Http/Controllers/ActivityController.php index 8635b25..23ef012 100644 --- a/app/Http/Controllers/ActivityController.php +++ b/app/Http/Controllers/ActivityController.php @@ -488,7 +488,7 @@ class ActivityController extends Controller if (!empty($activity_row['predecessor'])) { $key = array_search($activity_row['predecessor'], array_column($data['activities'], 'no')); - if (!$predecessorActivity = Activity::find($data['activities'][$key]['activity_id'])) + if (!isset($data['activities'][$key]['activity_id']) || !$predecessorActivity = Activity::find($data['activities'][$key]['activity_id'])) continue; $predecessorFinishDate = new \DateTime($predecessorActivity->end_date); diff --git a/app/Http/Controllers/ReportActivityMaterialController.php b/app/Http/Controllers/ReportActivityMaterialController.php index fd61e5f..54be3e0 100644 --- a/app/Http/Controllers/ReportActivityMaterialController.php +++ b/app/Http/Controllers/ReportActivityMaterialController.php @@ -35,7 +35,7 @@ class ReportActivityMaterialController extends Controller /* $data['assign_material_id'] = AssignMaterial::where('activity_id', $request->activity_id)->pluck('id')->first(); */ $data['assign_material_id'] = $request->assign_material_id; $data['qty'] = $this->sanitizeDecimal($data['qty']); - if($reportDate > $startDate){ + if($reportDate >= $startDate){ $created = ReportActivityMaterial::create($data); return response()->json(['status'=>'success','message'=>'Input progress report activity created','code'=>200,'data'=>array('report_id'=>$created->id)]); } else {