123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- <?
- if (!$logged_me_in_successfully234)
- return;
- echo ' <input type="submit" class="subtaskCheck" onclick="getXml()" name="subtask" value="Скачать XML">';
- if ($new != "2" && $new != "3")
- $taskarr = GrabTasktypes("subs");
- echo "<form id='form1' name='form1' method='post'>";
- echo "<h3>Среднее время выполнения задач компании $companyname:</h3>";
- EchoTaskTypes($taskarr);
- echo "</form>
- ";
- function EchoTaskTypes($arr, $chooseSubtasks = false)
- {
- global $link, $companyID;
- foreach ($arr as $res1) {
- $tasktype_id = $res1->id;
- $taskname = $res1->name;
- $description = $res1->description;
- $main = $res1->main_task;
- $completeTime = intval($res1->time_to_complete_minutes);
- // $tasktype_id = $res1['id'];
- // $taskname = $res1['name'];
- // $description = $res1['description'];
- // $main = $res1['main_task'];
- // $completeTime = intval($res1['time_to_complete_minutes']);
- $global = '';
- $styletab = ' style="margin-left: 40px"';
- $nam = '<b><span'.$styletab.'>Задача '.$tasktype_id.$global.': '.$taskname.'</span></b>';
- echo "<div style='border: solid; border-width: 1px; border-color: #9cb2c4; border-radius: 15px; margin:5px; padding: 15px'>";
- echo $nam;
- if ($description != '')
- echo " [$description]";
- if ($main != '1')
- echo " <span style='color:#1f6377'>Норматив выполнения: <b>".$completeTime." минут</b></span>";
- if ($chooseSubtasks)
- echo ' <input type="checkbox" class="subtaskCheck" onclick="SubtaskTaskOn()" name="subtask'.$tasktype_id.'"/>';
- else{
- ShowSubTasks($tasktype_id);
- }
- echo '<p><br>';
- $query1 = mysqli_query($link, "select * from accounts where company=$companyID");
- while ($res1 = mysqli_fetch_array($query1))
- {
- $staff_id = $res1['id'];
- $staff_name = $res1['name'];
- echo '<b>'.$staff_name.':</b>';
- // $eff = EfficiencyReport($staff_id);
- $tasks = GrabReadyTasksForAccount($staff_id, $tasktype_id);
- // $data = $eff[$tasktype_id];
- if (sizeof($tasks) == 0)
- echo ' не выполнял';
- else {
- $data = round(GetAverageTime($tasks)/60.0, 0, PHP_ROUND_HALF_UP);
- $minutes = 'минут';
- switch (intval($data)) {
- case 0:
- $data = 'меньше минуты';
- $minutes = '';
- break;
- case 1:
- $minutes = 'минуту';
- break;
- case 2:
- case 3:
- case 4:
- $minutes = 'минуты';
- break;
- }
- echo "<span style='color:green'> в среднем затрачивает $data $minutes </span>";
- echo "<input type='button' onclick='ShowAnalytics($staff_id, $tasktype_id)' value='Подробно' style='margin: 2'>";
- }
- echo "<br><div id='$staff_id"."_"."$tasktype_id' style='display: none; margin-left:20px'>";
- foreach ($tasks as $task)
- {
- $start = $task['accepted_time'];
- $finish = $task['finished_time'];
- $startdate = date('d.m.Y', strtotime($start));
- $starttime = date('H:i', strtotime($start));
- $endtime = date('H:i', strtotime($finish));
- $time = TimeSpentForTaskFromArray($task);
- $minutes = intval(date('i', $time));
- $seconds = date('s', $time);
- echo "<b>$startdate</b> начал в $starttime, закончил в $endtime, время выполнения: $minutes минут $seconds секунд<br>";
- }
- echo "<br></div>";
- }
- echo "</p></div>";
- }
- }
- function ShowSubTasks($id)
- {
- global $link, $Subtaskarr;
- $str = "select subtasks from tasktypes where id=$id";
- $query1 = mysqli_query($link, $str);
- if ($res1 = mysqli_fetch_row($query1)) {
- $arr = explode(",", $res1[0]);
- if (sizeof($arr) > 0 && $arr[0] != '') {
- echo ' <select name="subtasks">';
- $i = 1;
- foreach ($arr as $sub) {
- if ($sub != '') {
- echo '<option value="' . $Subtaskarr[$sub] . '">' . $i . '. [' . $sub . '] ' . $Subtaskarr[$sub]['name'] . '</option>';
- $i++;
- }
- }
- echo '</select>';
- }
- }
- }
- ?>
|