コード例 #1
0
 protected function getData($from, $to)
 {
     $cmd = $this->db->createCommand("SELECT * FROM hr_non_working_day WHERE `from`>='{$from}' AND `until`<='{$to}'  ORDER BY `from`");
     $data = $cmd->query();
     $data = $data->readAll();
     $event = array();
     foreach ($data as $row) {
         $time = '';
         if ($row['period'] == 'morning') {
             $time = 'T08:00:00';
         }
         if ($row['period'] == 'afternoon') {
             $time = 'T13:00:00';
         }
         if ($this->isAccess('nonWorkingDay.mod')) {
             $url = "index.php?page=nonWorkingDay.mod&id=" . $row['id'] . "&back=components.timuxuser.calendar.calendar";
         } else {
             $url = "#";
         }
         $event[] = array('id' => $row['id'], 'title' => $row['name'], 'start' => $row['from'] . $time, 'end' => $row['until'], 'url' => $url, 'className' => 'nonworking_' . substr($row['color'], 1, 6), 'description' => $row['comment'], 'allDay' => $row['period'] == 'allday' ? true : false, 'color' => $row['color'], 'nwd' => true);
     }
     while (strtotime($from) <= strtotime($to)) {
         $cmd = $this->db->createCommand("SELECT * FROM hr_timux_request AS tr LEFT JOIN hr_timux_request_leave AS trl ON trl.request_id=tr.id LEFT JOIN hr_timux_timecode AS tt ON tr.timecodeId=tt.id WHERE trl.datefrom<='{$from}' AND trl.dateto>='{$from}'  AND ( tr.state='validate' OR  tr.state='closed') ORDER BY trl.datefrom");
         $data = $cmd->query();
         $data = $data->readAll();
         foreach ($data as $row) {
             $employee = new employee($row['userId']);
             $time = '';
             if ($row['period'] == 'morning') {
                 $time = 'T08:00:00';
             }
             if ($row['period'] == 'afternoon') {
                 $time = 'T13:00:00';
             }
             if ($this->isAccess('components.timuxuser.leave.mod')) {
                 $url = 'index.php?page=components.timuxuser.leave.mod&id=' . $row['request_id'] . '&back=components.timuxuser.calendar.calendar';
             } else {
                 $url = "#";
             }
             $event[$row['request_id']] = array('id' => $row['request_id'], 'title' => $row['name'] . " (" . $employee->getFullName() . ")", 'start' => $row['datefrom'] . $time, 'end' => $row['dateto'], 'url' => $url, 'description' => $row['remark'], 'className' => 'leave_' . substr($row['color'], 1, 6), 'allDay' => $row['period'] == 'allday' ? true : false, 'color' => $row['color'], 'nwd' => false);
         }
         $from = date("Y-m-d", strtotime(date("Y-m-d", strtotime($from)) . " +1 day"));
     }
     function compare($a, $b)
     {
         return strcasecmp($a["start"], $b["start"]);
     }
     usort($event, "compare");
     return $event;
 }
コード例 #2
0
ファイル: report.php プロジェクト: BackupTheBerlios/horux-svn
 protected function printMonthBalance($month, $year)
 {
     $cmd = $this->db->createCommand("SELECT id FROM hr_user WHERE name!='??' ORDER BY name, firstname");
     $data = $cmd->query();
     $data = $data->readAll();
     $app = $this->getApplication()->getGlobalization();
     foreach ($data as $v) {
         $this->pdf->AddPage();
         $employee = new employee($v['id']);
         $this->pdf->SetFont('Arial', '', 9);
         $this->pdf->Cell(0, 10, utf8_decode(Prado::localize('Sign in/out')), 0, 0, 'L');
         $this->pdf->Ln(10);
         $this->pdf->Cell(30, 5, utf8_decode(Prado::localize('Employee')) . " :", 0, 0, 'L');
         $this->pdf->Cell(0, 5, utf8_decode($employee->getFullName()), 0, 1, 'L');
         $this->pdf->Cell(30, 5, utf8_decode(Prado::localize('Department')) . " :", 0, 0, 'L');
         $this->pdf->Cell(0, 5, utf8_decode($employee->getDepartment()), 0, 1, 'L');
         $date = new DateFormat($app->getCulture());
         $date = $date->format('1-' . $month . "-" . $year, "P");
         $date = explode(" ", $date);
         $date = $date[2] . " " . $date[3];
         $this->pdf->Cell(30, 5, utf8_decode(Prado::localize('Month')) . " :", 0, 0, 'L');
         $this->pdf->Cell(0, 5, utf8_decode($date), 0, 1, 'L');
         $this->pdf->Ln(10);
         $header = array(utf8_decode(Prado::localize("Date")), utf8_decode(Prado::localize("Signing")), utf8_decode(Prado::localize("To do")), utf8_decode(Prado::localize("Done")), utf8_decode(Prado::localize("Overtime")), utf8_decode(Prado::localize("Remark")));
         $this->pdf->SetFillColor(124, 124, 124);
         $this->pdf->SetTextColor(255);
         $this->pdf->SetDrawColor(255);
         $this->pdf->SetLineWidth(0.3);
         $this->pdf->SetFont('', 'B');
         $w = array(20, 65, 15, 15, 15, 65);
         for ($i = 0; $i < count($header); $i++) {
             $this->pdf->CellExt($w[$i], 7, $header[$i], 1, 0, 'C', 1);
         }
         $this->pdf->Ln();
         $this->pdf->SetFillColor(215, 215, 215);
         $this->pdf->SetTextColor(0);
         $this->pdf->SetFont('');
         $fill = false;
         $this->pdf->SetFont('courier', '', 7);
         $data = $this->getMonthBalanceData($month, $year, $employee);
         foreach ($data as $d) {
             $date = new DateFormat($app->getCulture());
             $date = $date->format($d['date'], "P");
             $date = explode(" ", $date);
             $date[0] = strtoupper(substr($date[0], 0, 2));
             $date = implode(" ", $date);
             $date = utf8_decode($date);
             $nBr2 = $this->findall("<br/>", $d['sign']);
             $sign = str_replace("&nbsp;", " ", str_replace("<br/>", "\n", $d['sign']));
             $todo = utf8_decode($d['todo']);
             $done = utf8_decode($d['done']);
             $overtime = utf8_decode($d['overtime']);
             $remark = utf8_decode($d['remark']);
             $remark = str_replace("&rarr;", "->", $remark);
             $remark = str_replace("&larr;", "<-", $remark);
             $nBr = $this->findall("<br>", $remark);
             $remark = str_replace("<br>", "\n", $remark);
             $remark = str_replace("<span style=\"color:red\">", "", $remark);
             $remark = str_replace("</span>", "", $remark);
             if ($nBr2 !== false && $nBr2 > $nBr) {
                 $nBr = $nBr2;
             }
             $height = 5;
             if ($nBr !== false) {
                 $height = 5.5 * count($nBr);
             }
             $this->pdf->CellExt($w[0], $height, $date, 'LR', 0, 'L', $fill);
             $this->pdf->CellExt($w[1], $height, $sign, 'LR', 0, 'L', $fill);
             $this->pdf->CellExt($w[2], $height, $todo, 'LR', 0, 'L', $fill);
             $this->pdf->CellExt($w[3], $height, $done, 'LR', 0, 'L', $fill);
             $this->pdf->CellExt($w[4], $height, $overtime, 'LR', 0, 'L', $fill);
             $this->pdf->CellExt($w[5], $height, $remark, 'LR', 0, 'L', $fill);
             $this->pdf->Ln();
             $fill = !$fill;
         }
         $this->pdf->SetFont('Arial', '', 9);
         $this->pdf->SetDrawColor(0);
         $this->pdf->SetLineWidth(0.1);
         $this->pdf->Ln(7);
         // ligne 1
         $this->pdf->Cell(30, 3, utf8_decode(Prado::localize('Hours due')) . " :", 0, 0, 'L');
         $this->pdf->Cell(20, 3, $this->hoursDue, 0, 0, 'R');
         $this->pdf->Cell(10, 3, "", 0, 0, 'R');
         $this->pdf->Cell(55, 3, utf8_decode(Prado::localize('Holidays (days)')) . "", 0, 0, 'L');
         $this->pdf->Cell(20, 3, "", 0, 1, 'R');
         //Ligne 2
         $this->pdf->Cell(30, 3, utf8_decode(Prado::localize('Signed')) . " :", 0, 0, 'L');
         $this->pdf->Cell(20, 3, $this->signed, 0, 0, 'R');
         $this->pdf->Cell(10, 3, "", 0, 0, 'R');
         $this->pdf->Cell(55, 3, utf8_decode(Prado::localize('Holidays balance last year')) . " :", 0, 0, 'L');
         $this->pdf->Cell(20, 3, $this->balanceHolidaysLastYear, 0, 1, 'R');
         //Ligne 3
         if ($this->overTimeMonth > 0) {
             $this->pdf->Cell(30, 3, utf8_decode(str_replace("<br/>", " ", Prado::localize('Balance for the month'))) . " :", 0, 0, 'L');
             $this->pdf->Cell(20, 3, sprintf("+%.02f", $this->overTimeMonth), 0, 0, 'R');
         } elseif ($this->overTimeMonth < 0 || $this->overTimeMonth == 0) {
             $this->pdf->Cell(30, 3, utf8_decode(str_replace("<br/>", " ", Prado::localize('Balance for the month'))) . " :", 0, 0, 'L');
             $this->pdf->Cell(20, 3, sprintf(" %.02f", $this->overTimeMonth), 0, 0, 'R');
         }
         $this->pdf->Cell(10, 3, "", 0, 0, 'R');
         $this->pdf->Cell(55, 3, utf8_decode(Prado::localize('Holidays for the year')) . " :", 0, 0, 'L');
         $this->pdf->Cell(20, 3, sprintf(" %.02f", $this->holidayForTheYear), 0, 1, 'R');
         //Ligne 4
         if ($this->overTimeLastMonth > 0) {
             $this->pdf->Cell(30, 3, utf8_decode(str_replace("<br/>", " ", Prado::localize('Last month'))) . " :", 0, 0, 'L');
             $this->pdf->Cell(20, 3, sprintf("+%.02f", $this->overTimeLastMonth), 0, 0, 'R');
         } elseif ($this->overTimeLastMonth < 0 || $this->overTimeLastMonth == 0) {
             $this->pdf->Cell(30, 3, utf8_decode(str_replace("<br/>", " ", Prado::localize('Last month'))) . " :", 0, 0, 'L');
             $this->pdf->Cell(20, 3, sprintf(" %.02f", $this->overTimeLastMonth), 0, 0, 'R');
         }
         $this->pdf->Cell(10, 3, "", 0, 0, 'R');
         $this->pdf->Cell(55, 3, utf8_decode(Prado::localize('Holidays last month')) . " :", 0, 0, 'L');
         $this->pdf->Cell(20, 3, $this->holidaysLastMonth, 0, 1, 'R');
         // ligne 5
         $balances = bcadd($this->overTimeMonth, $this->overTimeLastMonth, 4);
         $overtTimeActivityCounter = $employee->getActivityCounter($year, $month, $employee->getDefaultOvertimeCounter());
         if ($overtTimeActivityCounter != 0) {
             $balances = bcadd($balances, $overtTimeActivityCounter, 4);
         }
         if ($balances > 0) {
             $this->pdf->Cell(30, 3, utf8_decode(Prado::localize('Balances')) . " :", 0, 0, 'L');
             if ($overtTimeActivityCounter) {
                 $this->pdf->Cell(20, 3, sprintf("* +%.02f", $balances), 0, 0, 'R');
             } else {
                 $this->pdf->Cell(20, 3, sprintf("+%.02f", $balances), 0, 0, 'R');
             }
         } elseif ($balances < 0 || $balances == 0) {
             $this->pdf->Cell(30, 3, utf8_decode(Prado::localize('Balances')) . " :", 0, 0, 'L');
             if ($overtTimeActivityCounter) {
                 $this->pdf->Cell(20, 3, sprintf("* %.02f", $balances), 0, 0, 'R');
             } else {
                 $this->pdf->Cell(20, 3, sprintf(" %.02f", $balances), 0, 0, 'R');
             }
         }
         $this->pdf->Cell(10, 3, "", 0, 0, 'R');
         $defaultHolidayTimeCode = $employee->getDefaultHolidaysCounter();
         $holidays = $employee->getRequest($year, $month, $defaultHolidayTimeCode);
         if ($holidays['nbre'] > 0) {
             $this->pdf->Cell(55, 3, utf8_decode(Prado::localize('Holidays for this month')) . " :", 0, 0, 'L');
             $this->pdf->Cell(20, 3, sprintf("-%.02f", $holidays['nbre']), 0, 1, 'R');
         } elseif ($holidays['nbre'] == 0) {
             $this->pdf->Cell(55, 3, utf8_decode(Prado::localize('Holidays for this month')) . " :", 0, 0, 'L');
             $this->pdf->Cell(20, 3, sprintf("%.02f", $holidays['nbre']), 0, 1, 'R');
         }
         // ligne 6
         $this->pdf->Cell(30, 3, "", 0, 0, 'L');
         $this->pdf->Cell(20, 3, "", 0, 0, 'R');
         $this->pdf->Cell(10, 3, "", 0, 0, 'R');
         $holidayActivityCounter = $employee->getActivityCounter($year, $month, $employee->getDefaultHolidaysCounter());
         $holidaysTotal = bcsub($this->holidaysLastMonth, $holidays['nbre'], 4);
         if ($holidaysTotal > 0) {
             $this->pdf->Cell(55, 3, utf8_decode(Prado::localize('Total')) . " :", 0, 0, 'L');
             if ($holidayActivityCounter) {
                 $this->pdf->Cell(20, 3, sprintf("* +%.02f", $holidaysTotal), 0, 1, 'R');
             } else {
                 $this->pdf->Cell(20, 3, sprintf("+%.02f", $holidaysTotal), 0, 1, 'R');
             }
         } elseif ($holidaysTotal < 0 || $holidaysTotal == 0) {
             $this->pdf->Cell(55, 3, utf8_decode(Prado::localize('Total')) . " :", 0, 0, 'L');
             if ($holidayActivityCounter) {
                 $this->pdf->Cell(20, 3, sprintf("* %.02f", $holidaysTotal), 0, 1, 'R');
             } else {
                 $this->pdf->Cell(20, 3, sprintf("%.02f", $holidaysTotal), 0, 1, 'R');
             }
         }
         // ligne 7
         $this->pdf->ln(3);
         // ligne 8
         $this->pdf->Cell(30, 3, "", 0, 0, 'L');
         $this->pdf->Cell(20, 3, "", 0, 0, 'R');
         $this->pdf->Cell(10, 3, "", 0, 0, 'R');
         $this->pdf->Cell(55, 3, utf8_decode(Prado::localize('Non working days similar to a Sunday')) . " :", 0, 0, 'L');
         $this->pdf->Cell(20, 3, $this->nonworkingday, 0, 1, 'R');
         // ligne 9
         $this->pdf->Cell(30, 3, "", 0, 0, 'L');
         $this->pdf->Cell(20, 3, "", 0, 0, 'R');
         $this->pdf->Cell(10, 3, "", 0, 0, 'R');
         $this->pdf->Cell(55, 3, utf8_decode(Prado::localize('Non working days a the end of the year')) . " :", 0, 0, 'L');
         $this->pdf->Cell(20, 3, sprintf(" %.02f", $this->nonworkingdayendofyear), 0, 1, 'R');
         $this->pdf->ln(7);
         foreach ($this->TimeCode as $v) {
             $this->pdf->Cell(50, 3, utf8_decode($v['name']) . " :", 0, 0, 'L');
             $this->pdf->Cell(80, 3, utf8_decode($v['value']), 0, 1, 'R');
         }
     }
     $this->pdf->Output(Prado::localize('Balance') . '_' . $month . '_' . $year . '.pdf', 'D');
 }
コード例 #3
0
 public function getData()
 {
     $department = $this->FilterDepartment->getSelectedValue();
     if ($department > 0) {
         $department = " AND u.department=" . $department;
     } else {
         $department = "";
     }
     $year = $this->FilterYear->getSelectedValue();
     $month = $this->FilterMonth->getSelectedValue();
     $date = $year . "-" . $month . "-" . date('t', mktime(0, 0, 0, $month, 1, $year));
     $cmd = $this->db->createCommand("SELECT w.user_id FROM hr_timux_workingtime AS w LEFT JOIN hr_user AS u ON u.id=w.user_id WHERE w.endOfActivity=0 AND w.startDate<='{$date}' {$department} GROUP BY w.user_id ORDER BY u.name,u.firstname");
     $data = $cmd->query();
     $data = $data->readAll();
     $result = array();
     foreach ($data as $d) {
         $employee = new employee($d['user_id']);
         $count = 0;
         if ($this->FilterYear->getSelectedValue() >= date('Y') && $this->FilterMonth->getSelectedValue() >= date('n')) {
             $count = -1;
         } else {
             $cmd = $this->db->createCommand("SELECT* FROM hr_timux_activity_counter WHERE user_id=" . $d['user_id'] . " AND year={$year} AND month={$month} AND isClosedMonth=1");
             $data = $cmd->query();
             $data = $data->readAll();
             // if we have data, this means that the month is already closed
             if (count($data) > 0) {
                 $count = -2;
             } else {
                 //check if the last month is closed
                 $m = $month;
                 $y = $year;
                 // check if the last month is closed
                 if ($m == 1) {
                     $m = 12;
                     $y--;
                 } else {
                     $m--;
                 }
                 $cmd = $this->db->createCommand("SELECT* FROM hr_timux_activity_counter WHERE user_id=" . $d['user_id'] . " AND year={$y} AND month={$m} AND isClosedMonth=1");
                 $data = $cmd->query();
                 $data = $data->readAll();
                 if (count($data) > 0) {
                     $isError = $employee->getError($this->FilterYear->getSelectedValue(), $this->FilterMonth->getSelectedValue());
                     $count = count($isError);
                 } else {
                     $count = -3;
                 }
             }
         }
         if ($count != -4) {
             $result[] = array('user_id' => $d['user_id'], 'employee' => $employee->getFullName(), 'canBeClosed' => $count);
         }
     }
     return $result;
 }
コード例 #4
0
ファイル: load.php プロジェクト: BackupTheBerlios/horux-svn
 public function getData($isPrint = false)
 {
     $param = Prado::getApplication()->getParameters();
     $computation2 = $param['computation2'];
     if ($computation2 != '') {
         Prado::using('horux.pages.components.timuxuser.' . $computation2);
     }
     $userList = $this->getEmployeeList();
     $filterEmployee = $this->FilterEmployee->getSelectedValue();
     $filterLoad = $this->FilterLoad->getSelectedValue();
     if ($filterEmployee > 0) {
         $employee = new employee($filterEmployee);
         $userList = array();
         $userList[] = array("Value" => $filterEmployee, "Text" => $employee->getFullName());
     }
     $year = $this->FilterYear->getSelectedValue();
     $month = $this->FilterMonth->getSelectedValue();
     $from = $year . '-' . $month . '-1';
     $until = $year . '-' . $month . '-' . date("t", mktime(0, 0, 0, $month, 1, $year));
     $date = " t.date>='{$from}' AND t.date<='{$until}' AND ";
     $timeCodeList = array();
     $hourMonthTodo = array();
     $hourly = array();
     $hoursByDay = array();
     foreach ($userList as $user) {
         if ($user['Value'] > 0) {
             $employee = new employee($user['Value']);
             $hourMonthTodo[$user['Value']] = $employee->getHoursMonthTodo($month, $year);
             $hourly[$user['Value']] = $employee->getHourly($month, $year);
             $hoursByDay[$user['Value']] = $employee->getHoursByDay($month, $year);
             $cmd = $this->db->createCommand("SELECT t.id_user, t.id, t.date, tb.roundBooking AS time, tb.action, tb.actionReason, tb.internet, tbb.BDE1\r\n                                               FROM hr_tracking AS t\r\n                                               LEFT JOIN hr_timux_booking AS tb ON tb.tracking_id=t.id\r\n                                               LEFT JOIN hr_timux_booking_bde AS tbb ON tbb.tracking_id=t.id\r\n                                               WHERE {$date} t.id_user={$user['Value']} AND tb.action!='NULL'  GROUP BY t.id  ORDER BY  t.date ASC , t.time ASC, tb.action ASC");
             $data = $cmd->query();
             $data = $data->readAll();
             $nextBookingType = 'IN';
             $type = '';
             $timeCode = '';
             foreach ($data as $d) {
                 $type = $this->isBookingIn($d) ? 'IN' : 'OUT';
                 if ($type == $nextBookingType) {
                     if ($type == 'IN') {
                         $bookinIN = $d['time'];
                         $timeCode = $d['BDE1'];
                     } else {
                         if ($d['action'] == '100') {
                             $dateTodo = explode("-", $d['date']);
                             $ddone = $employee->getDayDone($dateTodo[2], $dateTodo[1], $dateTodo[0]);
                             $timeCodeList[$ddone['timecodeId']]['total'] = bcadd($timeCodeList[$ddone['timecodeId']]['total'], $ddone['compensation'], 4);
                             $timeCodeList[$ddone['timecodeId']][$user['Text']]['total'] = bcadd($timeCodeList[$ddone['timecodeId']][$user['Text']]['total'], $ddone['compensation'], 4);
                             $timeCodeList[$ddone['timecodeId']][$user['Text']]['hourDayTodo'] = $hoursByDay[$user['Value']];
                             $timeCodeList[$ddone['timecodeId']][$user['Text']]['hourly'] = $hourly[$user['Value']];
                             $timeCodeList[$ddone['timecodeId']][$user['Text']]['id'] = $user['Value'];
                             $timeCodeList[$ddone['timecodeId']][$user['Text']]['hourMonthTodo'] = $hourMonthTodo[$user['Value']];
                         }
                         $t = bcdiv(strtotime($d['time']) - strtotime($bookinIN), 3600, 4);
                         $timeCodeList[$timeCode][$user['Text']]['total'] = bcadd($timeCodeList[$timeCode][$user['Text']]['total'], $t, 4);
                         $timeCodeList[$timeCode][$user['Text']]['hourDayTodo'] = $hoursByDay[$user['Value']];
                         $timeCodeList[$timeCode][$user['Text']]['hourly'] = $hourly[$user['Value']];
                         $timeCodeList[$timeCode][$user['Text']]['id'] = $user['Value'];
                         $timeCodeList[$timeCode][$user['Text']]['hourMonthTodo'] = $hourMonthTodo[$user['Value']];
                         $timeCodeList[$timeCode]['total'] = bcadd($timeCodeList[$timeCode]['total'], $t, 4);
                         $bookinIN = 0;
                         $timeCode = '';
                     }
                     $nextBookingType = $nextBookingType == 'IN' ? 'OUT' : 'IN';
                 } else {
                     $bookinIN = 0;
                     $timeCode = '';
                     $nextBookingType = 'IN';
                 }
             }
         }
     }
     foreach ($userList as $user) {
         if ($user['Value'] > 0) {
             $employee = new employee($user['Value']);
             $dtcH = $employee->getDefaultHolidaysCounter();
             $dtcO = $employee->getDefaultOvertimeCounter();
             $h = $employee->getRequest($year, $month, $dtcH);
             if ($h['nbre'] > 0) {
                 if ($h['disp'] == 'day') {
                     $timeCodeList[$dtcH]['total'] = bcadd($timeCodeList[$dtcH]['total'], bcmul($h['nbre'], $hoursByDay[$user['Value']], 4), 4);
                     $timeCodeList[$dtcH][$user['Text']]['total'] = bcadd($timeCodeList[$dtcH][$user['Text']]['total'], bcmul($h['nbre'], $hoursByDay[$user['Value']], 4), 4);
                     $timeCodeList[$dtcH][$user['Text']]['hourDayTodo'] = $hoursByDay[$user['Value']];
                     $timeCodeList[$dtcH][$user['Text']]['hourly'] = $hourly[$user['Value']];
                     $timeCodeList[$dtcH][$user['Text']]['id'] = $user['Value'];
                     $timeCodeList[$dtcH][$user['Text']]['hourMonthTodo'] = $hourMonthTodo[$user['Value']];
                 } else {
                     $timeCodeList[$dtcH]['total'] += bcadd($timeCodeList[$dtcH]['total'], $h['nbre'], 4);
                     $timeCodeList[$dtcH][$user['Text']]['total'] = bcadd($timeCodeList[$dtcH][$user['Text']]['total'], $h['nbre'], 4);
                     $timeCodeList[$dtcH][$user['Text']]['hourDayTodo'] = $hoursByDay[$user['Value']];
                     $timeCodeList[$dtcH][$user['Text']]['hourly'] = $hourly[$user['Value']];
                     $timeCodeList[$dtcH][$user['Text']]['id'] = $user['Value'];
                     $timeCodeList[$dtcH][$user['Text']]['hourMonthTodo'] = $hourMonthTodo[$user['Value']];
                 }
             }
             $cmd = $this->db->createCommand("SELECT * FROM hr_timux_timecode WHERE id NOT IN ({$dtcH},{$dtcO}) AND type!='load'");
             $data = $cmd->query();
             $data = $data->readAll();
             foreach ($data as $d) {
                 $h = $employee->getRequest($year, $month, $d['id']);
                 if ($h['nbre'] > 0) {
                     if ($h['disp'] == 'day') {
                         $timeCodeList[$d['id']]['total'] = bcadd($timeCodeList[$d['id']]['total'], bcmul($h['nbre'], $hoursByDay[$user['Value']], 4), 4);
                         $timeCodeList[$d['id']][$user['Text']]['total'] = bcadd($timeCodeList[$d['id']][$user['Text']]['total'], bcmul($h['nbre'], $hoursByDay[$user['Value']], 4), 4);
                         $timeCodeList[$d['id']][$user['Text']]['hourDayTodo'] = $hoursByDay[$user['Value']];
                         $timeCodeList[$d['id']][$user['Text']]['hourly'] = $hourly[$user['Value']];
                         $timeCodeList[$d['id']][$user['Text']]['id'] = $user['Value'];
                         $timeCodeList[$d['id']][$user['Text']]['hourMonthTodo'] = $hourMonthTodo[$user['Value']];
                     } else {
                         $timeCodeList[$d['id']]['total'] = bcadd($timeCodeList[$d['id']]['total'], $h['nbre'], 4);
                         $timeCodeList[$d['id']][$user['Text']]['total'] = bcadd($timeCodeList[$d['id']][$user['Text']]['total'], $h['nbre'], 4);
                         $timeCodeList[$d['id']][$user['Text']]['hourDayTodo'] = $hoursByDay[$user['Value']];
                         $timeCodeList[$d['id']][$user['Text']]['hourly'] = $hourly[$user['Value']];
                         $timeCodeList[$d['id']][$user['Text']]['id'] = $user['Value'];
                         $timeCodeList[$d['id']][$user['Text']]['hourMonthTodo'] = $hourMonthTodo[$user['Value']];
                     }
                 }
             }
             for ($i = 1; $i < date('t', mktime(0, 0, 0, $month, 1, $year)); $i++) {
                 $nwd = $employee->getNonWorkingDay($year, $month, $i);
                 if ($nwd > 0 && $employee->isWorking($year, $month, $i)) {
                     $timeCodeList[Prado::localize('Non working day')]['total'] = bcadd($timeCodeList[Prado::localize('Non working day')]['total'], bcmul($nwd, $hoursByDay[$user['Value']], 4), 4);
                     $timeCodeList[Prado::localize('Non working day')][$user['Text']]['total'] = bcadd($timeCodeList[Prado::localize('Non working day')][$user['Text']]['total'], bcmul($nwd, $hoursByDay[$user['Value']], 4), 4);
                     $timeCodeList[Prado::localize('Non working day')][$user['Text']]['hourDayTodo'] = $hoursByDay[$user['Value']];
                     $timeCodeList[Prado::localize('Non working day')][$user['Text']]['hourly'] = $hourly[$user['Value']];
                     $timeCodeList[Prado::localize('Non working day')][$user['Text']]['id'] = $user['Value'];
                     $timeCodeList[Prado::localize('Non working day')][$user['Text']]['hourMonthTodo'] = $hourMonthTodo[$user['Value']];
                 }
             }
             $employee = new employee($user['Value']);
             for ($i = 1; $i <= date("t", mktime(0, 0, 0, $month, 1, $year)); $i++) {
                 $b = $employee->getDayDone($i, $month, $year);
                 $todo = $employee->getDayTodo($i, $month, $year);
                 $overtime = bcsub($b['done'], $todo, 4);
                 $overtime = bcmul($overtime, -1, 4);
                 if ($overtime != 0) {
                     $timeCodeList[Prado::localize('Overtime2')][$user['Text']]['total'] = bcadd($timeCodeList[Prado::localize('Overtime2')][$user['Text']]['total'], $overtime, 4);
                     $timeCodeList[Prado::localize('Overtime2')][$user['Text']]['hourDayTodo'] = $hoursByDay[$user['Value']];
                     $timeCodeList[Prado::localize('Overtime2')]['total'] = bcadd($timeCodeList[Prado::localize('Overtime2')]['total'], $overtime, 4);
                     $timeCodeList[Prado::localize('Overtime2')][$user['Text']]['hourly'] = $hourly[$user['Value']];
                     $timeCodeList[Prado::localize('Overtime2')][$user['Text']]['id'] = $user['Value'];
                     $timeCodeList[Prado::localize('Overtime2')][$user['Text']]['hourMonthTodo'] = $hourMonthTodo[$user['Value']];
                 }
             }
         }
     }
     $cmd = $this->db->createCommand("SELECT * FROM hr_timux_config");
     $query = $cmd->query();
     $data = $query->read();
     $hoursByDay = bcdiv($data['hoursByWeek'], $data['daysByWeek'], 4);
     $cmd = $this->db->createCommand("SELECT * FROM hr_site");
     $query = $cmd->query();
     $data = $query->read();
     $devise = " " . $data['devise'];
     $res = array();
     $extendHourly = false;
     if (class_exists($computation2)) {
         $extendHourly = new $computation2();
     }
     foreach ($timeCodeList as $k => $v) {
         $totalCost = 0;
         if (is_array($v)) {
             foreach ($v as $k2 => $u) {
                 if (is_array($u)) {
                     if ($extendHourly) {
                         $u['hourly'] = $extendHourly->getHourly($month, $year, $u);
                     }
                     $totalCost = bcadd($totalCost, bcmul($u['hourly'], round($u['total'], 2), 2), 2);
                 }
             }
         }
         if ($k != '') {
             $cmd = $this->db->createCommand("SELECT * FROM hr_timux_timecode WHERE abbreviation=:abb || id=:abb");
             $cmd->bindValue(":abb", $k);
             $data = $cmd->query();
             $data = $data->read();
             if ($filterLoad != 0 && $data['id'] != $filterLoad) {
                 continue;
             }
             if ($data) {
                 $r['timecode'] = '<b>' . $data['name'] . '</b>';
                 //how the time code is computed
                 $r['hoursdone'] = '<b>' . round($v['total'], 2) . '</b>';
                 $r['cost'] = sprintf("<b>%.02f {$devise}</b>", $totalCost);
                 $r['hourly'] = '';
                 $r['id'] = '';
                 $res[] = $r;
                 if ($this->showUser->getChecked()) {
                     foreach ($v as $k => $u) {
                         if ($u['hourDayTodo'] > 0) {
                             $hoursByDay2 = $u['hourDayTodo'];
                         } else {
                             $hoursByDay2 = $hoursByDay;
                         }
                         if ($k != 'total') {
                             if ($extendHourly) {
                                 $u['hourly'] = $extendHourly->getHourly($month, $year, $u);
                             }
                             $r['timecode'] = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" . $k;
                             $r['hoursdone'] = round($u['total'], 2);
                             $r['cost'] = sprintf("%.02f {$devise}", bcmul($u['hourly'], round($u['total'], 2), 2));
                             $r['hourly'] = sprintf("%.02f {$devise}", $u['hourly']);
                             $r['id'] = $u['id'];
                             $res[] = $r;
                         }
                     }
                 }
             } else {
                 $r['timecode'] = '<b>' . $k . '</b>';
                 $r['hoursdone'] = '<b>' . round($v['total'], 2) . '</b>';
                 $r['cost'] = sprintf("<b>%.02f {$devise}</b>", $totalCost);
                 $r['hourly'] = '';
                 $r['id'] = '';
                 $res[] = $r;
                 if ($this->showUser->getChecked()) {
                     foreach ($v as $k => $u) {
                         if ($u['hourDayTodo'] > 0) {
                             $hoursByDay2 = $u['hourDayTodo'];
                         } else {
                             $hoursByDay2 = $hoursByDay;
                         }
                         if ($k != 'total') {
                             if ($extendHourly) {
                                 $u['hourly'] = $extendHourly->getHourly($month, $year, $u);
                             }
                             $r['timecode'] = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" . $k;
                             $r['hoursdone'] = round($u['total'], 2);
                             $r['cost'] = sprintf("%.02f {$devise}", bcmul($u['hourly'], round($u['total'], 2), 2));
                             $r['hourly'] = sprintf("%.02f {$devise}", $u['hourly']);
                             $r['id'] = $u['id'];
                             $res[] = $r;
                         }
                     }
                 }
             }
         } else {
             $r['timecode'] = '<b>' . Prado::localize('Unkown time code') . '</b>';
             $r['hoursdone'] = '<b>' . round($v['total'], 2) . '</b>';
             $r['cost'] = sprintf("<b>%.02f {$devise}</b>", $totalCost);
             $r['hourly'] = '';
             $r['id'] = '';
             $res[] = $r;
             if ($this->showUser->getChecked()) {
                 foreach ($v as $k => $u) {
                     if ($u['hourDayTodo'] > 0) {
                         $hoursByDay2 = $u['hourDayTodo'];
                     } else {
                         $hoursByDay2 = $hoursByDay;
                     }
                     if ($k != 'total') {
                         if ($extendHourly) {
                             $u['hourly'] = $extendHourly->getHourly($month, $year, $u);
                         }
                         $r['timecode'] = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" . $k;
                         $r['hoursdone'] = round($u['total'], 2);
                         $r['cost'] = sprintf("%.02f {$devise}", bcmul($u['hourly'], round($u['total'], 2), 2));
                         $r['hourly'] = sprintf("%.02f {$devise}", $u['hourly']);
                         $r['id'] = $u['id'];
                         $res[] = $r;
                     }
                 }
             }
         }
     }
     return $res;
 }