public function print_automatic() { global $PH; /*$effort_status = false; if($this->query_options['effort_status_min'] == $this->query_options['effort_status_max']){ $effort_status = true; }*/ $efforts = Effort::getEffortTasks($this->query_options); /*foreach($efforts as $e){ $e->setStatus($effort_status); }*/ $this->render_list($efforts); }
function render_tr(&$obj, $style = "") { if (!isset($obj) || !$obj instanceof Project) { trigger_error("ListBlock->render_tr() called without valid object", E_USER_WARNING); return; } $sum = 0.0; $sum_sal = 0.0; $sum_all = 0.0; $sum_cal = 0.0; $diff_value = false; if ($effort_people = Effort::getEffortPeople(array('project' => $obj->id))) { foreach ($effort_people as $ep) { if ($person = Person::getVisibleById($ep->person)) { /*if($obj->getStatus()){ $sum_sal = Effort::getSumEfforts(array('project'=>$obj->id, 'person'=>$person->id, 'status'=>$obj->status)); } else{*/ $sum_sal = Effort::getSumEfforts(array('project' => $obj->id, 'person' => $person->id)); #} if ($sum_sal) { $sum = round($sum_sal / 60 / 60, 1) * 1.0; if ($pp = $obj->getProjectPeople(array('person_id' => $person->id))) { if ($pp[0]->salary_per_hour) { $sum_all = $sum * $pp[0]->salary_per_hour; } else { $sum_all = $sum * $person->salary_per_hour; } } else { $sum_all = $sum * $person->salary_per_hour; } //$sum_all += ($sum * $person->salary_per_hour); } } } } if ($effort_tasks = Effort::getEffortTasks(array('project' => $obj->id))) { foreach ($effort_tasks as $et) { if ($task = Task::getById($et->task)) { if ($task->calculation) { $sum_cal += $task->calculation; } } } } if ($sum_all && $sum_cal) { $max_length_value = 3; $get_percentage = $sum_all / $sum_cal * 100; if ($get_percentage > 100) { $diff = $get_percentage - 100; $get_percentage = 100; $diff_value = true; } $show_rate = $get_percentage * $max_length_value; echo "<td>"; echo "<nobr>"; echo "<img src='" . getThemeFile("img/pixel.gif") . "' style='width:{$show_rate}px;height:12px;background-color:#f00;'>"; if ($diff_value) { $show_rate = $diff * $max_length_value; echo "<img src='" . getThemeFile("img/pixel.gif") . "' style='width:{$show_rate}px;height:12px;background-color:#ff9900;'>"; echo " " . round($get_percentage, 1) . "% / " . round($diff, 1) . " %"; } else { echo " " . round($get_percentage, 1) . "%"; } echo "</nobr>"; echo "</td>"; } else { echo "<td>-</td>"; } }