Browse Source

Task #860qh88mh fix uom

pull/3/head
Wahyu Ramadhan 2 years ago
parent
commit
e3c9770ebe
  1. 8
      app/Http/Controllers/Controller.php

8
app/Http/Controllers/Controller.php

@ -227,14 +227,14 @@ class Controller extends BaseController
private function calculateAllHumanCost($activity_id, $proyek_id) 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("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;
$totalCost += $this->calculateHumanCost($human, $activity_id); $totalCost += $this->calculateHumanCost($human, $activity_id);
} }
@ -247,6 +247,10 @@ class Controller extends BaseController
$duration = $activity->duration; $duration = $activity->duration;
$standarRate = $human->standart_rate; $standarRate = $human->standart_rate;
$maxUsed = $human->max_used/100; $maxUsed = $human->max_used/100;
if ($human->uom_standart_rate == "Hour") {
$totalCost = ($standarRate*8*$duration)*$maxUsed;
return $totalCost;
}
$totalCost = ($standarRate*$duration)*$maxUsed; $totalCost = ($standarRate*$duration)*$maxUsed;
return $totalCost; return $totalCost;
} }

Loading…
Cancel
Save