From e3c9770ebe35835a920785a5a10189fb37c92db5 Mon Sep 17 00:00:00 2001 From: Wahyu Ramadhan Date: Tue, 18 Apr 2023 13:41:33 +0700 Subject: [PATCH] Task #860qh88mh fix uom --- app/Http/Controllers/Controller.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index a02d0d1..c431f28 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -227,14 +227,14 @@ class Controller extends BaseController private function calculateAllHumanCost($activity_id, $proyek_id) { - $dataHuman = UserToActivity::select("ahp.standart_rate as standart_rate","ahp.max_used as max_used", "ahp.cost_per_used as cost_per_used", "ahp.uom_standart_rate as uom_standart_rate")->leftJoin("assign_hr_to_proyek as ahp", "assign_hr_to_activity.user_id", "=", "ahp.user_id") + $dataHuman = UserToActivity::select("ahp.standart_rate as standart_rate","ahp.max_used as max_used", "ahp.cost_per_used as cost_per_used", "ahp.uom_standart_rate as uom_standart_rate") + ->leftJoin("assign_hr_to_proyek as ahp", "assign_hr_to_activity.user_id", "=", "ahp.user_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) ->get(); $totalCost = 0; foreach ($dataHuman as $human) { - $uom = $human->uom_standart_rate; $totalCost += $this->calculateHumanCost($human, $activity_id); } @@ -247,6 +247,10 @@ class Controller extends BaseController $duration = $activity->duration; $standarRate = $human->standart_rate; $maxUsed = $human->max_used/100; + if ($human->uom_standart_rate == "Hour") { + $totalCost = ($standarRate*8*$duration)*$maxUsed; + return $totalCost; + } $totalCost = ($standarRate*$duration)*$maxUsed; return $totalCost; }