From 837d96df5fb06002aa1d18524150c9b350e4ec6c Mon Sep 17 00:00:00 2001 From: wahyu Date: Mon, 4 Dec 2023 17:04:16 +0700 Subject: [PATCH 1/2] check 0 array on calculate scurve --- app/Helpers/MasterFunctionsHelper.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/Helpers/MasterFunctionsHelper.php b/app/Helpers/MasterFunctionsHelper.php index dfc4d89..59c795f 100644 --- a/app/Helpers/MasterFunctionsHelper.php +++ b/app/Helpers/MasterFunctionsHelper.php @@ -1448,6 +1448,9 @@ class MasterFunctionsHelper // if($keyPlanM->duration == 0){ // $duration = 2; // Tanggal awal + if (count($keyPlanM) == 0) { + continue; + } $startDate = new DateTime($keyPlanM[0]->planned_start); // Tanggal akhir $endDate = new DateTime($keyPlanM[0]->planned_end); @@ -1479,6 +1482,9 @@ class MasterFunctionsHelper // hitung progress actual if (count($dataActualM) > 0 && count($dataActualM[0]) > 0) { foreach ($dataActualM as $keyActualM) { + if (count($keyPlanM) == 0) { + continue; + } # hitung untuk persentase progress actual // $progressActualWeek = ((((($keyActualM->qty_actual / $keyActualM->sum_qty_actual) * 100) / $keyActualM->qty_plan)*100)*$keyActualM->bobot_planning)/100; // jika total report > dari planning From 9b24833159c2dbfe1ce4fee2e094dbe568829293 Mon Sep 17 00:00:00 2001 From: wahyu Date: Fri, 15 Dec 2023 13:07:51 +0700 Subject: [PATCH 2/2] update report analysis --- app/Http/Controllers/ActivityController.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) mode change 100644 => 100755 app/Http/Controllers/ActivityController.php diff --git a/app/Http/Controllers/ActivityController.php b/app/Http/Controllers/ActivityController.php old mode 100644 new mode 100755 index cbb425e..af5a636 --- a/app/Http/Controllers/ActivityController.php +++ b/app/Http/Controllers/ActivityController.php @@ -697,7 +697,7 @@ class ActivityController extends Controller 'm_version_gantt.name_version', DB::raw('user_names.user_name as user_name'), DB::raw('SUM(report_activity_material.qty) as qty'), - 'assign_material_to_activity.qty_planning', + DB::raw('SUM(assign_material_to_activity.qty_planning) as qty_planning'), 'assign_material_to_activity.id as join_third_id' ) ->join('m_version_gantt', 'm_version_gantt.id', '=', 'selfTable.version_gantt_id') @@ -710,11 +710,9 @@ class ActivityController extends Controller GROUP BY activity_id) as user_names'), function ($join) { $join->on('user_names.activity_id', '=', 'selfTable.id'); }) + ->where('report_activity_material.assign_material_id', '=', DB::raw('assign_material_to_activity.id')) ->groupBy('selfTable.id') - ->groupBy('selfTable.name') - ->groupBy('selfTable.persentase_progress') ->groupBy('m_version_gantt.name_version') - ->groupBy('assign_material_to_activity.qty_planning') ->groupBy('assign_material_to_activity.id') ->groupBy('user_names.user_name') ->get();