From 7864a24801c77007481a279de7e31916eb5bd010 Mon Sep 17 00:00:00 2001 From: Muhammad Sulaiman Yusuf Date: Sun, 10 Jul 2022 22:09:30 +0700 Subject: [PATCH] clean codes --- app/Http/Controllers/Controller.php | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index 842dd77..cefe1a4 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -10,7 +10,7 @@ class Controller extends BaseController protected $pathImage = "assets/image/"; protected $pathDocument = "assets/file/project/"; protected $pathActivityDocument = "assets/file/activity/"; - protected $listJoinAll = ['first', 'second', 'third', 'fourth', 'fifth', + protected $listJoinAll = ['first', 'second', 'third', 'fourth', 'fifth', 'sixth', 'seventh', 'eighth', 'ninth', 'tenth']; protected $currentDate; protected $currentName; @@ -35,14 +35,14 @@ class Controller extends BaseController if($condition){ if(isset($condition['joins'])){ $selectColumn = []; - $no = 0; + $no = 0; foreach($condition['joins'] as $join){ $tableJoin = isset($join['name1']) ? $join['name1'] : $alias; $tableName = $join['name']; $columnJoin = $join['column_join']; // foreign key table sini $columnSelf = isset($join['column_self']) ? $join['column_self'] : "id"; // primary key table lawan $columnResult = $join['column_results']; - + foreach($columnResult as $sColumn){ $builder = $builder->addSelect($tableName.".".$sColumn." as join_".$this->listJoinAll[$no]."_".$sColumn); } @@ -50,7 +50,7 @@ class Controller extends BaseController $no++; } } - + if(isset($condition['columns'])){ $listWhere = $condition['columns']; @@ -71,7 +71,7 @@ class Controller extends BaseController if(isset($condition['group_column'])){ $builder = $this->groupWhere($builder, $condition['group_column'], $alias); } - + $data['count'] = clone $builder; if(isset($condition['paging'])){ @@ -225,7 +225,7 @@ class Controller extends BaseController ->where("assign_hr_to_activity.activity_id", $activity_id)->where("assign_hr_to_activity.proyek_id", $proyek_id) ->where("ahp.proyek_id", $proyek_id) ->get(); - + $totalCost = 0; foreach ($dataHuman as $human) { $uom = $human->uom_standart_rate; @@ -242,7 +242,7 @@ class Controller extends BaseController $standarRate = $human->standart_rate; $maxUsed = $human->max_used/100; $totalCost = ($standarRate*$duration)*$maxUsed; - return $totalCost; + return $totalCost; } private function calculateMaterialCost($activity_id, $proyek_id) @@ -251,11 +251,6 @@ class Controller extends BaseController return $totalCost; } - private function calculateToolsCost($activity_id, $proyek_id) - { - - } - protected function updatedCostPlanning($id) { $sumBiaya = Activity::select(DB::raw('sum(cast(rencana_biaya as double precision))'))->where("parent_id", $id)->first(); @@ -272,4 +267,4 @@ class Controller extends BaseController } } } -} \ No newline at end of file +}