|
|
@ -10,7 +10,7 @@ class Controller extends BaseController |
|
|
|
protected $pathImage = "assets/image/"; |
|
|
|
protected $pathImage = "assets/image/"; |
|
|
|
protected $pathDocument = "assets/file/project/"; |
|
|
|
protected $pathDocument = "assets/file/project/"; |
|
|
|
protected $pathActivityDocument = "assets/file/activity/"; |
|
|
|
protected $pathActivityDocument = "assets/file/activity/"; |
|
|
|
protected $listJoinAll = ['first', 'second', 'third', 'fourth', 'fifth', |
|
|
|
protected $listJoinAll = ['first', 'second', 'third', 'fourth', 'fifth', |
|
|
|
'sixth', 'seventh', 'eighth', 'ninth', 'tenth']; |
|
|
|
'sixth', 'seventh', 'eighth', 'ninth', 'tenth']; |
|
|
|
protected $currentDate; |
|
|
|
protected $currentDate; |
|
|
|
protected $currentName; |
|
|
|
protected $currentName; |
|
|
@ -35,14 +35,14 @@ class Controller extends BaseController |
|
|
|
if($condition){ |
|
|
|
if($condition){ |
|
|
|
if(isset($condition['joins'])){ |
|
|
|
if(isset($condition['joins'])){ |
|
|
|
$selectColumn = []; |
|
|
|
$selectColumn = []; |
|
|
|
$no = 0; |
|
|
|
$no = 0; |
|
|
|
foreach($condition['joins'] as $join){ |
|
|
|
foreach($condition['joins'] as $join){ |
|
|
|
$tableJoin = isset($join['name1']) ? $join['name1'] : $alias; |
|
|
|
$tableJoin = isset($join['name1']) ? $join['name1'] : $alias; |
|
|
|
$tableName = $join['name']; |
|
|
|
$tableName = $join['name']; |
|
|
|
$columnJoin = $join['column_join']; // foreign key table sini |
|
|
|
$columnJoin = $join['column_join']; // foreign key table sini |
|
|
|
$columnSelf = isset($join['column_self']) ? $join['column_self'] : "id"; // primary key table lawan |
|
|
|
$columnSelf = isset($join['column_self']) ? $join['column_self'] : "id"; // primary key table lawan |
|
|
|
$columnResult = $join['column_results']; |
|
|
|
$columnResult = $join['column_results']; |
|
|
|
|
|
|
|
|
|
|
|
foreach($columnResult as $sColumn){ |
|
|
|
foreach($columnResult as $sColumn){ |
|
|
|
$builder = $builder->addSelect($tableName.".".$sColumn." as join_".$this->listJoinAll[$no]."_".$sColumn); |
|
|
|
$builder = $builder->addSelect($tableName.".".$sColumn." as join_".$this->listJoinAll[$no]."_".$sColumn); |
|
|
|
} |
|
|
|
} |
|
|
@ -50,7 +50,7 @@ class Controller extends BaseController |
|
|
|
$no++; |
|
|
|
$no++; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(isset($condition['columns'])){ |
|
|
|
if(isset($condition['columns'])){ |
|
|
|
$listWhere = $condition['columns']; |
|
|
|
$listWhere = $condition['columns']; |
|
|
|
|
|
|
|
|
|
|
@ -71,7 +71,7 @@ class Controller extends BaseController |
|
|
|
if(isset($condition['group_column'])){ |
|
|
|
if(isset($condition['group_column'])){ |
|
|
|
$builder = $this->groupWhere($builder, $condition['group_column'], $alias); |
|
|
|
$builder = $this->groupWhere($builder, $condition['group_column'], $alias); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$data['count'] = clone $builder; |
|
|
|
$data['count'] = clone $builder; |
|
|
|
|
|
|
|
|
|
|
|
if(isset($condition['paging'])){ |
|
|
|
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("assign_hr_to_activity.activity_id", $activity_id)->where("assign_hr_to_activity.proyek_id", $proyek_id) |
|
|
|
->where("ahp.proyek_id", $proyek_id) |
|
|
|
->where("ahp.proyek_id", $proyek_id) |
|
|
|
->get(); |
|
|
|
->get(); |
|
|
|
|
|
|
|
|
|
|
|
$totalCost = 0; |
|
|
|
$totalCost = 0; |
|
|
|
foreach ($dataHuman as $human) { |
|
|
|
foreach ($dataHuman as $human) { |
|
|
|
$uom = $human->uom_standart_rate; |
|
|
|
$uom = $human->uom_standart_rate; |
|
|
@ -242,7 +242,7 @@ class Controller extends BaseController |
|
|
|
$standarRate = $human->standart_rate; |
|
|
|
$standarRate = $human->standart_rate; |
|
|
|
$maxUsed = $human->max_used/100; |
|
|
|
$maxUsed = $human->max_used/100; |
|
|
|
$totalCost = ($standarRate*$duration)*$maxUsed; |
|
|
|
$totalCost = ($standarRate*$duration)*$maxUsed; |
|
|
|
return $totalCost; |
|
|
|
return $totalCost; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private function calculateMaterialCost($activity_id, $proyek_id) |
|
|
|
private function calculateMaterialCost($activity_id, $proyek_id) |
|
|
@ -251,11 +251,6 @@ class Controller extends BaseController |
|
|
|
return $totalCost; |
|
|
|
return $totalCost; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private function calculateToolsCost($activity_id, $proyek_id) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected function updatedCostPlanning($id) |
|
|
|
protected function updatedCostPlanning($id) |
|
|
|
{ |
|
|
|
{ |
|
|
|
$sumBiaya = Activity::select(DB::raw('sum(cast(rencana_biaya as double precision))'))->where("parent_id", $id)->first(); |
|
|
|
$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 |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|