protected function onPrint() { parent::onPrint(); $cellHeaderWidth = 6; $cellHeaderHeight = 20; $this->pdf->AddPage(); $this->pdf->SetFont('Arial', '', 11); $this->pdf->Cell(0, 10, utf8_decode(Prado::localize('List of the users groups')), 0, 0, 'L'); $this->pdf->Ln(10); $this->pdf->setDefaultFont(); $groups = $this->getData(); foreach ($groups as $ot) { $this->pdf->SetTextColor(0); $this->pdf->SetDrawColor(0); $this->pdf->SetFont('Arial', 'B', 11); $this->pdf->SetLineWidth(0.4); $this->pdf->Cell(0, 6, utf8_decode($ot['name']), 'B', 1, 'L'); $this->pdf->setDefaultFont(); $this->pdf->SetLineWidth(0.1); $this->pdf->SetDrawColor(127); $this->pdf->Cell(60, 6, utf8_decode(Prado::localize('Access plugin')), 'B', 0, 'L'); $this->pdf->Cell(0, 6, utf8_decode($ot['accessPlugin']), 'B', 1, 'L'); $this->pdf->Cell(60, 6, utf8_decode(Prado::localize('Description')), 'B', 0, 'L'); $this->pdf->Cell(0, 6, utf8_decode($ot['comment']), 'B', 1, 'L'); $command = $this->db->createCommand("SELECT * FROM hr_device WHERE accessPoint>0"); $dataReader = $command->query(); $this->pdf->Ln(5); $this->pdf->setDefaultFont(); //! put a marge $this->pdf->Cell(30); $this->pdf->SetFillColor(124, 124, 124); $this->pdf->SetTextColor(255); $this->pdf->SetDrawColor(255); $this->pdf->SetLineWidth(0.3); $nEntry = array(); foreach ($dataReader as $device) { $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode($device['name']), 1, 0, 'D', true); $nEntry[] = $device['id']; } $this->pdf->Ln($cellHeaderHeight); $command = $this->db->createCommand("SELECT * FROM hr_access_level"); $dataAccess = $command->query(); foreach ($dataAccess as $access) { $this->pdf->Cell(30, $cellHeaderWidth, utf8_decode($access['name']), 1, 0, 'L', true); for ($i = 0; $i < count($nEntry); $i++) { $cmd = $this->db->createCommand("SELECT * FROM hr_user_group_access WHERE id_access_level=" . $access['id'] . " AND id_device=" . $nEntry[$i] . " AND id_group=" . $ot['id']); $data = $cmd->query(); $data = $data->readAll(); if ($data) { $this->pdf->Image("./fpdf/ok.png", $this->pdf->GetX() + $i * 6 + 1.5, $this->pdf->GetY() + 1.5, 3, 3); } else { $this->pdf->Image("./fpdf/ko.png", $this->pdf->GetX() + $i * 6 + 1.5, $this->pdf->GetY() + 1.5, 3, 3); } } $this->pdf->Ln(6); } $this->pdf->Ln(10); } $this->pdf->render(); }
protected function onPrint() { parent::onPrint(); $this->pdf->AddPage(); $param = $this->Application->getParameters(); $groupId = $this->Application->getUser()->getGroupID(); if ($param['appMode'] == 'saas' && $groupId == 1 || $param['appMode'] != 'saas') { $cmd = $this->db->createCommand(SQL::SQL_GET_ALL_USER_2); } else { $cmd = $this->db->createCommand(SQL::SQL_GET_ALL_USER_2_SAAS); } $data = $cmd->query(); $data = $data->readAll(); $this->pdf->SetFont('Arial', '', 11); $this->pdf->Cell(0, 10, utf8_decode(Prado::localize('List of the super users')), 0, 0, 'L'); $this->pdf->Ln(10); $this->pdf->setDefaultFont(); $header = array(utf8_decode(Prado::localize("Name")), utf8_decode(Prado::localize("Firstname")), utf8_decode(Prado::localize("Username")), utf8_decode(Prado::localize("Email")), utf8_decode(Prado::localize("Phone")), utf8_decode(Prado::localize("Group"))); //Couleurs, �paisseur du trait et police grasse $this->pdf->SetFillColor(124, 124, 124); $this->pdf->SetTextColor(255); $this->pdf->SetDrawColor(255); $this->pdf->SetLineWidth(0.3); $this->pdf->SetFont('', 'B'); //En-t�te $w = array(30, 30, 35, 35, 30, 30); for ($i = 0; $i < count($header); $i++) { $this->pdf->Cell($w[$i], 7, $header[$i], 1, 0, 'C', 1); } $this->pdf->Ln(); //Restauration des couleurs et de la police $this->pdf->SetFillColor(215, 215, 215); $this->pdf->SetTextColor(0); $this->pdf->SetFont(''); //Donn�es $fill = false; foreach ($data as $d) { $name = utf8_decode($d['name']); $firstname = utf8_decode($d['firstname']); $email = utf8_decode($d['email2']); $phone = utf8_decode($d['phone2']); $username = utf8_decode($d['username']); $group = utf8_decode($d['groupName']); $this->pdf->Cell($w[0], 6, $name, 'LR', 0, 'L', $fill); $this->pdf->Cell($w[1], 6, $firstname, 'LR', 0, 'L', $fill); $this->pdf->Cell($w[2], 6, $username, 'LR', 0, 'C', $fill); $this->pdf->Cell($w[3], 6, $email, 'LR', 0, 'C', $fill); $this->pdf->Cell($w[4], 6, $phone, 'LR', 0, 'C', $fill); $this->pdf->Cell($w[5], 6, $group, 'LR', 0, 'C', $fill); $this->pdf->Ln(); $fill = !$fill; } $this->pdf->Cell(array_sum($w), 0, '', 'T'); $this->pdf->render(); }
protected function onPrint() { parent::onPrint(); $this->pdf->AddPage(); $command = $this->db->createCommand(SQL::SQL_GET_HARDWARE_ALL); $dataReader = $command->query(); $this->pdf->SetFont('Arial', '', 11); $this->pdf->Cell(0, 10, utf8_decode(Prado::localize('List of the hardware')), 0, 0, 'L'); $this->pdf->Ln(10); $this->pdf->setDefaultFont(); $header = array(utf8_decode(Prado::localize("Name")), utf8_decode(Prado::localize("Access Point")), utf8_decode(Prado::localize("Debug")), utf8_decode(Prado::localize("Type")), utf8_decode(Prado::localize("Access plugin")), utf8_decode(Prado::localize("Open time"))); //Couleurs, �paisseur du trait et police grasse $this->pdf->SetFillColor(124, 124, 124); $this->pdf->SetTextColor(255); $this->pdf->SetDrawColor(255); $this->pdf->SetLineWidth(0.3); $this->pdf->SetFont('', 'B'); //En-t�te $w = array(30, 28, 25, 48, 30, 30); for ($i = 0; $i < count($header); $i++) { $this->pdf->Cell($w[$i], 7, $header[$i], 1, 0, 'C', 1); } $this->pdf->Ln(); //Restauration des couleurs et de la police $this->pdf->SetFillColor(215, 215, 215); $this->pdf->SetTextColor(0); $this->pdf->SetFont(''); //Donn�es $fill = false; $this->pdf->SetFont('Arial', '', 9); foreach ($dataReader as $d) { $name = utf8_decode($d['name']); $accessPoint = utf8_decode($d['accessPoint'] == 1 ? Prado::Localize("Yes") : Prado::Localize("No")); $debug = utf8_decode($d['isLog'] == 1 ? Prado::Localize("Yes") : Prado::Localize("No")); $type = utf8_decode($d['type']); $accessPlugin = utf8_decode($d['accessPlugin']); $command = $this->db->createCommand("SELECT * FROM hr_openTime AS o LEFT JOIN hr_openTime_attribution AS oa ON oa.id_openTime=o.id WHERE oa.id_device=" . $d['id']); $dataOpentime = $command->query(); $openTime = array(); foreach ($dataOpentime as $ot) { $openTime[] = $ot['name']; } $openTime = join(", ", $openTime); $this->pdf->Cell($w[0], 6, $name, 'LR', 0, 'L', $fill); $this->pdf->Cell($w[1], 6, $accessPoint, 'LR', 0, 'L', $fill); $this->pdf->Cell($w[2], 6, $debug, 'LR', 0, 'C', $fill); $this->pdf->Cell($w[3], 6, $type, 'LR', 0, 'C', $fill); $this->pdf->Cell($w[4], 6, $accessPlugin, 'LR', 0, 'C', $fill); $this->pdf->Cell($w[5], 6, $openTime, 'LR', 0, 'C', $fill); $this->pdf->Ln(); $fill = !$fill; } $this->pdf->Cell(array_sum($w), 0, '', 'T'); $this->pdf->render(); }
protected function onPrint() { $param = Prado::getApplication()->getParameters(); $nbreOfColumn = $param['barcodeprintcolumn']; $orderOfColumn = $param['orderprintcolumn']; parent::onPrint(); $this->pdf->AddPage(); $type = $this->Request['f1']; //type $typeText = ''; switch ($type) { case '0': break; case 'leave': $typeText = " - " . Prado::localize("Leave"); break; case 'absence': $typeText = " - " . Prado::localize("Absence"); break; case 'overtime': $typeText = " - " . Prado::localize("Overtime"); break; case 'load': $typeText = " - " . Prado::localize("Load"); break; } $this->pdf->SetFont('Arial', '', 11); $this->pdf->Cell(0, 10, utf8_decode(Prado::localize('List of time code') . $typeText), 0, 0, 'L'); $this->pdf->Ln(10); $this->pdf->setDefaultFont(); if ($type == '0') { $cmd = $this->db->createCommand("SELECT * FROM hr_timux_timecode ORDER BY {$orderOfColumn}"); } else { $cmd = $this->db->createCommand("SELECT * FROM hr_timux_timecode WHERE type=:type ORDER BY {$orderOfColumn}"); $cmd->bindValue(":type", $type); } $data = $cmd->query(); $timeCode = $data->readAll(); while (count($timeCode) % $nbreOfColumn > 0) { $timeCode[] = array('name' => '', 'abbreviation' => ''); } $i = 0; $j = 0; $x = 10; $y = 38; $width = 190 / $nbreOfColumn; foreach ($timeCode as $tc) { $this->pdf->Cell($width, 6, utf8_decode($tc['name']), 'LTR'); $objCode = new pi_barcode(); $objCode->setSize(20); $objCode->hideCodeType(); $objCode->setColors('#000000'); $objCode->setSize(30); $param = Prado::getApplication()->getParameters(); if ($tc['abbreviation'] != '') { $objCode->setType($param['barcodetype']); $objCode->setCode($tc['abbreviation']); $objCode->setFiletype('PNG'); $objCode->writeBarcodeFile('./tmp/bctc' . $i . '.png'); $this->pdf->Image('./tmp/bctc' . $i . '.png', $x, $y); $x += 93; } $i++; if ($i % $nbreOfColumn == 0) { $this->pdf->Ln(); for ($c = 0; $c < $nbreOfColumn; $c++) { $this->pdf->Cell($width, 20, '', 'LRB'); } $j++; if ($j % 9 == 0) { $this->pdf->AddPage(); $x = 15; $y = 38; $this->pdf->SetFont('Arial', '', 11); $this->pdf->Cell(0, 10, utf8_decode(Prado::localize('List of time code')), 0, 0, 'L'); $this->pdf->Ln(10); $this->pdf->setDefaultFont(); } else { $this->pdf->Ln(); $y += 26; $x = 10; } } } $this->pdf->render(); $i = 0; }
protected function onPrint() { parent::onPrint(); $this->pdf->AddPage(); $this->pdf->SetFont('Arial', '', 11); $this->pdf->Cell(0, 10, utf8_decode(Prado::localize('List of the open time')), 0, 0, 'L'); $this->pdf->Ln(10); $this->pdf->setDefaultFont(); $openTime = $this->getData(); $i = 0; foreach ($openTime as $ot) { $this->pdf->SetDrawColor(0); $this->pdf->SetFont('Arial', 'B', 11); $this->pdf->SetLineWidth(0.4); $this->pdf->Cell(0, 6, utf8_decode($ot['name']), 'B', 1, 'L'); $this->pdf->setDefaultFont(); $this->pdf->SetLineWidth(0.1); $this->pdf->SetDrawColor(127); $this->pdf->Cell(60, 6, utf8_decode(Prado::localize('Apply to the week-end')), 'B', 0, 'L'); $this->pdf->Cell(0, 6, utf8_decode($ot['week_end'] == "1" ? Prado::localize('Yes') : Prado::localize('No')), 'B', 1, 'L'); $this->pdf->Cell(60, 6, utf8_decode(Prado::localize('Apply to the non working day')), 'B', 0, 'L'); $this->pdf->Cell(0, 6, utf8_decode($ot['non_working_day'] == "1" ? Prado::localize('Yes') : Prado::localize('No')), 'B', 1, 'L'); $this->pdf->Cell(60, 6, utf8_decode(Prado::localize('Valid from')), 'B', 0, 'L'); $this->pdf->Cell(0, 6, utf8_decode($ot['validity_date'] == "0000-00-00" ? "-" : $this->dateFromSql($ot['validity_date'])), 'B', 1, 'L'); $this->pdf->Cell(60, 6, utf8_decode(Prado::localize('Valid until')), 'B', 0, 'L'); $this->pdf->Cell(0, 6, utf8_decode($ot['validity_date_to'] == "0000-00-00" ? "-" : $this->dateFromSql($ot['validity_date_to'])), 'B', 1, 'L'); $this->pdf->Cell(60, 6, utf8_decode(Prado::localize('Apply on the devices')), 'B', 0, 'L'); $cmd = $this->db->createCommand("SELECT * FROM hr_device AS d LEFT JOIN hr_openTime_attribution AS oa ON oa.id_device=d.id WHERE oa.id_openTime=" . $ot['id']); $devices = $cmd->query(); $deviceList = array(); foreach ($devices as $device) { $deviceList[] = $device['name']; } $deviceList = join(",", $deviceList); $this->pdf->Cell(0, 6, $deviceList, 'B', 1, 'L'); $this->pdf->SetLineWidth(0.2); $this->pdf->Cell(60, 6, utf8_decode(Prado::localize('Description')), 'B', 0, 'L'); $this->pdf->Cell(0, 6, utf8_decode($ot['comment']), 'B', 1, 'L'); $this->pdf->SetLineWidth(0.1); $this->pdf->Cell(60, 6, utf8_decode(Prado::localize('Monday')), 'B', 0, 'L'); $cmd = $this->db->createCommand("SELECT * FROM hr_openTime_time WHERE day='lundi' AND id_openTime=" . $ot['id']); $times = $cmd->query(); foreach ($times as $time) { $from = $time['from']; $until = $time['until']; $timeStart = str_pad((int) ($from / 60), 2, "0", STR_PAD_LEFT) . ":" . str_pad($from % 60, 2, "0", STR_PAD_LEFT); $timeEnd = str_pad((int) ($until / 60), 2, "0", STR_PAD_LEFT) . ":" . str_pad($until % 60, 2, "0", STR_PAD_LEFT); $this->pdf->Cell(25, 6, $timeStart . "-" . $timeEnd, 'B', 0, 'L'); } $this->pdf->Cell(0, 6, "", 'B', 1, 'L'); $this->pdf->Cell(60, 6, utf8_decode(Prado::localize('Tuesday')), 'B', 0, 'L'); if ($ot['monday_default'] == 1) { $cmd = $this->db->createCommand("SELECT * FROM hr_openTime_time WHERE day='lundi' AND id_openTime=" . $ot['id']); } else { $cmd = $this->db->createCommand("SELECT * FROM hr_openTime_time WHERE day='mardi' AND id_openTime=" . $ot['id']); } $times = $cmd->query(); foreach ($times as $time) { $from = $time['from']; $until = $time['until']; $timeStart = str_pad((int) ($from / 60), 2, "0", STR_PAD_LEFT) . ":" . str_pad($from % 60, 2, "0", STR_PAD_LEFT); $timeEnd = str_pad((int) ($until / 60), 2, "0", STR_PAD_LEFT) . ":" . str_pad($until % 60, 2, "0", STR_PAD_LEFT); $this->pdf->Cell(25, 6, $timeStart . "-" . $timeEnd, 'B', 0, 'L'); } $this->pdf->Cell(0, 6, "", 'B', 1, 'L'); $this->pdf->Cell(60, 6, utf8_decode(Prado::localize('Wednesday')), 'B', 0, 'L'); if ($ot['monday_default'] == 1) { $cmd = $this->db->createCommand("SELECT * FROM hr_openTime_time WHERE day='lundi' AND id_openTime=" . $ot['id']); } else { $cmd = $this->db->createCommand("SELECT * FROM hr_openTime_time WHERE day='mercredi' AND id_openTime=" . $ot['id']); } $times = $cmd->query(); foreach ($times as $time) { $from = $time['from']; $until = $time['until']; $timeStart = str_pad((int) ($from / 60), 2, "0", STR_PAD_LEFT) . ":" . str_pad($from % 60, 2, "0", STR_PAD_LEFT); $timeEnd = str_pad((int) ($until / 60), 2, "0", STR_PAD_LEFT) . ":" . str_pad($until % 60, 2, "0", STR_PAD_LEFT); $this->pdf->Cell(25, 6, $timeStart . "-" . $timeEnd, 'B', 0, 'L'); } $this->pdf->Cell(0, 6, "", 'B', 1, 'L'); $this->pdf->Cell(60, 6, utf8_decode(Prado::localize('Thursday')), 'B', 0, 'L'); if ($ot['monday_default'] == 1) { $cmd = $this->db->createCommand("SELECT * FROM hr_openTime_time WHERE day='lundi' AND id_openTime=" . $ot['id']); } else { $cmd = $this->db->createCommand("SELECT * FROM hr_openTime_time WHERE day='jeudi' AND id_openTime=" . $ot['id']); } $times = $cmd->query(); foreach ($times as $time) { $from = $time['from']; $until = $time['until']; $timeStart = str_pad((int) ($from / 60), 2, "0", STR_PAD_LEFT) . ":" . str_pad($from % 60, 2, "0", STR_PAD_LEFT); $timeEnd = str_pad((int) ($until / 60), 2, "0", STR_PAD_LEFT) . ":" . str_pad($until % 60, 2, "0", STR_PAD_LEFT); $this->pdf->Cell(25, 6, $timeStart . "-" . $timeEnd, 'B', 0, 'L'); } $this->pdf->Cell(0, 6, "", 'B', 1, 'L'); $this->pdf->Cell(60, 6, utf8_decode(Prado::localize('Friday')), 'B', 0, 'L'); if ($ot['monday_default'] == 1) { $cmd = $this->db->createCommand("SELECT * FROM hr_openTime_time WHERE day='lundi' AND id_openTime=" . $ot['id']); } else { $cmd = $this->db->createCommand("SELECT * FROM hr_openTime_time WHERE day='vendredi' AND id_openTime=" . $ot['id']); } $times = $cmd->query(); foreach ($times as $time) { $from = $time['from']; $until = $time['until']; $timeStart = str_pad((int) ($from / 60), 2, "0", STR_PAD_LEFT) . ":" . str_pad($from % 60, 2, "0", STR_PAD_LEFT); $timeEnd = str_pad((int) ($until / 60), 2, "0", STR_PAD_LEFT) . ":" . str_pad($until % 60, 2, "0", STR_PAD_LEFT); $this->pdf->Cell(25, 6, $timeStart . "-" . $timeEnd, 'B', 0, 'L'); } $this->pdf->Cell(0, 6, "", 'B', 1, 'L'); $this->pdf->Cell(60, 6, utf8_decode(Prado::localize('Saturday')), 'B', 0, 'L'); if ($ot['monday_default'] == 1) { $cmd = $this->db->createCommand("SELECT * FROM hr_openTime_time WHERE day='lundi' AND id_openTime=" . $ot['id']); } else { $cmd = $this->db->createCommand("SELECT * FROM hr_openTime_time WHERE day='samedi' AND id_openTime=" . $ot['id']); } $times = $cmd->query(); foreach ($times as $time) { $from = $time['from']; $until = $time['until']; $timeStart = str_pad((int) ($from / 60), 2, "0", STR_PAD_LEFT) . ":" . str_pad($from % 60, 2, "0", STR_PAD_LEFT); $timeEnd = str_pad((int) ($until / 60), 2, "0", STR_PAD_LEFT) . ":" . str_pad($until % 60, 2, "0", STR_PAD_LEFT); $this->pdf->Cell(25, 6, $timeStart . "-" . $timeEnd, 'B', 0, 'L'); } $this->pdf->Cell(0, 6, "", 'B', 1, 'L'); $this->pdf->Cell(60, 6, utf8_decode(Prado::localize('Sunday')), 'B', 0, 'L'); if ($ot['monday_default'] == 1) { $cmd = $this->db->createCommand("SELECT * FROM hr_openTime_time WHERE day='lundi' AND id_openTime=" . $ot['id']); } else { $cmd = $this->db->createCommand("SELECT * FROM hr_openTime_time WHERE day='dimanche' AND id_openTime=" . $ot['id']); } $times = $cmd->query(); foreach ($times as $time) { $from = $time['from']; $until = $time['until']; $timeStart = str_pad((int) ($from / 60), 2, "0", STR_PAD_LEFT) . ":" . str_pad($from % 60, 2, "0", STR_PAD_LEFT); $timeEnd = str_pad((int) ($until / 60), 2, "0", STR_PAD_LEFT) . ":" . str_pad($until % 60, 2, "0", STR_PAD_LEFT); $this->pdf->Cell(25, 6, $timeStart . "-" . $timeEnd, 'B', 0, 'L'); } $this->pdf->Cell(0, 6, "", 'B', 1, 'L'); $this->pdf->Ln(10); if ($i % 2) { $this->pdf->AddPage(); } $i++; } $this->pdf->render(); }
protected function onPrint() { parent::onPrint(); $app = $this->getApplication()->getGlobalization(); $this->pdf->AddPage('L'); $data = $this->getData(); $this->pdf->SetFont('Arial', '', 9); $this->pdf->Ln(5); $this->pdf->Cell(80, 5, utf8_decode(Prado::localize('Employee')) . " :", 0, 0, 'L'); $this->pdf->Cell(0, 5, utf8_decode($this->employee->getFullName()), 0, 1, 'L'); $this->pdf->Cell(80, 5, utf8_decode(Prado::localize('Department')) . " :", 0, 0, 'L'); $this->pdf->Cell(0, 5, utf8_decode($this->employee->getDepartment()), 0, 1, 'L'); $this->pdf->Cell(80, 5, utf8_decode(Prado::localize('Year')) . " :", 0, 0, 'L'); $this->pdf->Cell(0, 5, $this->Request['f3'], 0, 1, 'L'); $this->pdf->Cell(80, 5, utf8_decode(Prado::localize('Number of holidays')) . " :", 0, 0, 'L'); $this->pdf->Cell(0, 5, $this->daysVacation->Text, 0, 1, 'L'); $this->pdf->Cell(80, 5, utf8_decode(Prado::localize('Number of days of holidays for the last year')) . " :", 0, 0, 'L'); $this->pdf->Cell(0, 5, $this->daysVacationLastYear->Text, 0, 1, 'L'); $this->pdf->Cell(80, 5, utf8_decode(str_replace("<br/>", " ", Prado::localize('Total of holidays (days)'))) . " :", 0, 0, 'L'); $this->pdf->Cell(0, 5, $this->totalVacation->Text, 0, 1, 'L'); $this->pdf->Cell(80, 5, utf8_decode(Prado::localize('Hours balance of the last year')) . " :", 0, 0, 'L'); $this->pdf->Cell(0, 5, $this->hoursBalance->Text, 0, 1, 'L'); $date = new DateFormat($app->getCulture()); $date = $date->format('1-' . $this->Request['f4'] . "-" . $this->Request['f3'], "P"); $date = explode(" ", $date); $date = $date[2] . " " . $date[3]; $this->pdf->Ln(10); $header = array(utf8_decode(Prado::localize("Month")), utf8_decode($this->br2nl(Prado::localize("Occupancy rate in %"))), utf8_decode($this->br2nl(Prado::localize("Hours at 100%"))), utf8_decode($this->br2nl(Prado::localize("Hours at X%"))), utf8_decode($this->br2nl(Prado::localize("Hours worked"))), utf8_decode($this->br2nl(Prado::localize("Nbre of holidays (day)"))), utf8_decode($this->br2nl(Prado::localize("Nbre of holidays (hours)"))), utf8_decode($this->br2nl(Prado::localize("Nbre of leave (day)"))), utf8_decode($this->br2nl(Prado::localize("Nbre of leave (hours)"))), utf8_decode($this->br2nl(Prado::localize("Holidays balance"))), utf8_decode($this->br2nl(Prado::localize("Nbre of absence (day)"))), utf8_decode($this->br2nl(Prado::localize("Nbre of absence (hours)"))), utf8_decode($this->br2nl(Prado::localize("Total of hours"))), utf8_decode($this->br2nl(Prado::localize("Balance for the month"))), utf8_decode($this->br2nl(Prado::localize("Hours due for the year"))), utf8_decode($this->br2nl(Prado::localize("Hours due for the year / without holidays"))), utf8_decode($this->br2nl(Prado::localize("Average per month / end of year")))); $this->pdf->SetFillColor(124, 124, 124); $this->pdf->SetTextColor(255); $this->pdf->SetDrawColor(255); $this->pdf->SetLineWidth(0.3); $this->pdf->SetFont('', 'B'); $this->pdf->SetFont('Arial', '', 6); $w = array(16.5, 16.5, 16.5, 16.5, 16.5, 16.5, 16.5, 16.5, 16.5, 16.5, 16.5, 16.5, 16.5, 16.5, 16.5, 16.5, 16.5); for ($i = 0; $i < count($header); $i++) { $this->pdf->CellExt($w[$i], 10, $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', '', 8); foreach ($data as $d) { $height = 5; $this->pdf->CellExt($w[0], $height, utf8_decode($d['month']), 'LR', 0, 'L', $fill); $this->pdf->CellExt($w[1], $height, $d['occupancy'], 'LR', 0, 'L', $fill); $this->pdf->CellExt($w[2], $height, $d['hours100'], 'LR', 0, 'L', $fill); $this->pdf->CellExt($w[3], $height, $d['hoursX'], 'LR', 0, 'L', $fill); $this->pdf->CellExt($w[4], $height, $d['hoursWorked'], 'LR', 0, 'L', $fill); $this->pdf->CellExt($w[5], $height, $d['nbreHolidaysDay'], 'LR', 0, 'L', $fill); $this->pdf->CellExt($w[6], $height, $d['nbreHolidaysHour'], 'LR', 0, 'L', $fill); $this->pdf->CellExt($w[7], $height, $d['nbreLeaveDay'], 'LR', 0, 'L', $fill); $this->pdf->CellExt($w[8], $height, $d['nbreLeaveHour'], 'LR', 0, 'L', $fill); $this->pdf->CellExt($w[9], $height, $d['holidayBalance'], 'LR', 0, 'L', $fill); $this->pdf->CellExt($w[10], $height, $d['nbreAbsenceDay'], 'LR', 0, 'L', $fill); $this->pdf->CellExt($w[11], $height, $d['nbreAbsenceHour'], 'LR', 0, 'L', $fill); $this->pdf->CellExt($w[12], $height, $d['totalHours'], 'LR', 0, 'L', $fill); $this->pdf->CellExt($w[13], $height, $d['monthBalance'], 'LR', 0, 'L', $fill); $this->pdf->CellExt($w[14], $height, $d['hoursDueYear'], 'LR', 0, 'L', $fill); $this->pdf->CellExt($w[15], $height, $d['hoursDueYearSubHolidays'], 'LR', 0, 'L', $fill); $this->pdf->CellExt($w[16], $height, $d['average'], 'LR', 0, 'L', $fill); $this->pdf->Ln(); $fill = !$fill; } $this->pdf->render(); }
protected function printPDF() { parent::onPrint('L'); $cmd = $this->db->createCommand(SQL::SQL_GET_EXPORT); $cmd->bindValue(":id", $this->Request['id']); $data = $cmd->query(); $data = $data->read(); $this->pdf->AddPage(); $this->pdf->SetFont('Arial', '', 11); $this->pdf->Cell(0, 10, utf8_decode($data['name'] . ":" . $data['description']), 0, 0, 'L'); $this->pdf->Ln(10); $this->pdf->setDefaultFont(); $data = $this->getData(); $header = array(); if (count($data) > 0) { foreach ($data[0] as $k => $v) { $header[] = utf8_decode($k); } } //Couleurs,épaisseur du trait et police grasse $this->pdf->SetFillColor(124, 124, 124); $this->pdf->SetTextColor(255); $this->pdf->SetDrawColor(255); $this->pdf->SetLineWidth(0.3); $this->pdf->SetFont('', 'B'); //En-tête foreach ($header as $h) { $this->pdf->Cell(280 / count($header), 7, $h, 1, 0, 'C', 1); } $this->pdf->Ln(); //Restauration des couleurs et de la police $this->pdf->SetFillColor(215, 215, 215); $this->pdf->SetTextColor(0); $this->pdf->SetFont(''); //Données $fill = false; foreach ($data as $d) { foreach ($d as $field) { $this->pdf->Cell(280 / count($header), 6, utf8_decode($field), 'LR', 0, 'L', $fill); } $this->pdf->Ln(); $fill = !$fill; } $this->pdf->Cell(count($header), 0, '', 'T'); $this->pdf->render(); }
protected function onPrint() { parent::onPrint(); $param = $this->Application->getParameters(); $groupId = $this->Application->getUser()->getGroupID(); $nCell = 0; $accessRight = array(); $cellHeaderWidth = 6; $cellHeaderHeight = 40; $this->pdf->AddPage('L'); $this->pdf->SetFont('Arial', '', 11); $this->pdf->Cell(0, 10, utf8_decode(Prado::localize('List of the super users groups')), 0, 0, 'L'); $this->pdf->Ln(10); $this->pdf->setDefaultFont(); //! put a marge $this->pdf->Cell(30); $this->pdf->SetFillColor(124, 124, 124); $this->pdf->SetTextColor(255); $this->pdf->SetDrawColor(255); $this->pdf->SetLineWidth(0.3); $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode(Prado::localize('Control Panel')), 1, 0, 'D', true); $accessRight[] = "controlPanel.ControlPanel"; $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode(Prado::localize('Super User')), 1, 0, 'D', true); $accessRight[] = "superuser.userList"; $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode(Prado::localize('Super User Group')), 1, 0, 'D', true); $accessRight[] = "superuser.userGroupList"; if ($param['appMode'] == 'saas' && $groupId == 1 || $param['appMode'] != 'saas') { $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode(Prado::localize('Configuration')), 1, 0, 'D', true); $accessRight[] = "configuration.config"; } else { $nCell--; } $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode(Prado::localize('Site')), 1, 0, 'D', true); $accessRight[] = "site.Site"; $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode(Prado::localize('Hardware')), 1, 0, 'D', true); $accessRight[] = "hardware.HardwareList"; $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode(Prado::localize('Opent time')), 1, 0, 'D', true); $accessRight[] = "openTime.openTimeList"; $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode(Prado::localize('Alarms')), 1, 0, 'D', true); $accessRight[] = "system.Alarms"; if ($param['appMode'] == 'saas' && $groupId == 1 || $param['appMode'] != 'saas') { $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode(Prado::localize('Horux Service')), 1, 0, 'D', true); $accessRight[] = "system.Service"; } else { $nCell--; } $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode(Prado::localize('Horux Status')), 1, 0, 'D', true); $accessRight[] = "system.Status"; $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode(Prado::localize('User')), 1, 0, 'D', true); $accessRight[] = "user.UserList"; $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode(Prado::localize('User Group')), 1, 0, 'D', true); $accessRight[] = "userGroup.UserGroupList"; $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode(Prado::localize('User Wizard')), 1, 0, 'D', true); $accessRight[] = "user.UserWizzard"; $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode(Prado::localize('Key')), 1, 0, 'D', true); $accessRight[] = "key.KeyList"; $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode(Prado::localize('Access Level')), 1, 0, 'D', true); $accessRight[] = "accessLevel.accessLevelList"; $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode(Prado::localize('Non Working Day')), 1, 0, 'D', true); $accessRight[] = "nonWorkingDay.nonWorkingDay"; $cmd = $this->db->createCommand("SELECT * FROM hr_install WHERE type='component'"); $data = $cmd->query(); $data = $data->readAll(); $this->pdf->SetFillColor(176, 176, 176); foreach ($data as $d) { $nCell++; $doc = new TXmlDocument(); $doc->loadFromFile('./protected/pages/components/' . $d['name'] . '/install.xml'); $name = $doc->getElementByTagName('name'); $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode(Prado::localize($name->getValue())), 1, 0, 'D', true); $accessRight[] = "components." . $d['name']; } $this->pdf->SetFillColor(124, 124, 124); if ($param['appMode'] == 'saas' && $groupId == 1 || $param['appMode'] != 'saas') { $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode(Prado::localize('Install/Uninstall')), 1, 0, 'D', true); $accessRight[] = "installation.extensions"; $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode(Prado::localize('Devices Manager')), 1, 0, 'D', true); $accessRight[] = "installation.devices"; $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode(Prado::localize('Component Manager')), 1, 0, 'D', true); $accessRight[] = "installation.components"; $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode(Prado::localize('Template Manager')), 1, 0, 'D', true); $accessRight[] = "installation.template"; } else { $nCell -= 4; } $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode(Prado::localize('Language Manager')), 1, 0, 'D', true); $accessRight[] = "installation.language"; $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode(Prado::localize('Global Checkin')), 1, 0, 'D', true); $accessRight[] = "tool.GlobalCheckin"; $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode(Prado::localize('Horux Gui log')), 1, 0, 'D', true); $accessRight[] = "tool.GuiLog"; $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode(Prado::localize('System Info')), 1, 0, 'D', true); $accessRight[] = "help.SystemInfo"; $this->pdf->VCell($cellHeaderWidth, $cellHeaderHeight, utf8_decode(Prado::localize('About')), 1, 1, 'D', true); $accessRight[] = "help.About"; $nCell += 25; $groups = $this->getData(); foreach ($groups as $g) { if ($g['superAdmin'] == 1) { $this->pdf->SetFillColor(255, 76, 76); } else { $this->pdf->SetFillColor(124, 124, 124); } $this->pdf->Cell(30, $cellHeaderWidth, utf8_decode($g['name']), 1, 0, 'L', true); for ($i = 0; $i < $nCell; $i++) { $cmd = $this->db->createCommand("SELECT * FROM hr_gui_permissions WHERE page LIKE '" . $accessRight[$i] . "%' AND value=" . $g['id']); $data = $cmd->query(); $data = $data->readAll(); if ($data || $accessRight[$i] == "controlPanel.ControlPanel" || $accessRight[$i] == "help.About") { $this->pdf->Image("./fpdf/ok.png", $this->pdf->GetX() + $i * 6 + 1.5, $this->pdf->GetY() + 1.5, 3, 3); } else { $this->pdf->Image("./fpdf/ko.png", $this->pdf->GetX() + $i * 6 + 1.5, $this->pdf->GetY() + 1.5, 3, 3); } } $this->pdf->Ln(6); } $this->pdf->Ln(10); $this->pdf->SetTextColor(0); $this->pdf->SetDrawColor(0); $groups = $this->getData(); foreach ($groups as $g) { $this->pdf->Cell(80, $cellHeaderWidth, utf8_decode(Prado::Localize('Super users in "{g}" group', array("g" => $g['name']))), 'B', 1); $cmd = $this->db->createCommand("SELECT su.name AS username, u.name, u.firstname FROM hr_superusers AS su LEFT JOIN hr_user AS u ON u.id=su.user_id WHERE su.group_id=" . $g['id']); $data = $cmd->query(); $users = $data->readAll(); $userList = array(); foreach ($users as $user) { $u = $user['username']; if (strlen($user['name']) > 0 || strlen($user['firstname']) > 0) { $u .= " (" . $user['name'] . " " . $user['firstname'] . ")"; } $userList[] = utf8_decode($u); } $userList = join(', ', $userList); $this->pdf->MultiCell(0, 6, $userList, 0, 1); } $this->pdf->render(); }
protected function onPrint() { parent::onPrint(); $this->pdf->AddPage(); $data = $this->getData(); $this->pdf->SetFont('Arial', '', 11); $this->pdf->Cell(0, 10, utf8_decode(Prado::localize('List of the users')), 0, 0, 'L'); $this->pdf->Ln(10); $this->pdf->setDefaultFont(); $name = $this->Request['f1']; if ($name == "%") { $name = "*"; } else { $name = $name . "*"; } $firstname = $this->Request['f2']; if ($firstname == "%") { $firstname = "*"; } else { $firstname = $firstname . "*"; } $status = $this->Request['f3']; switch ($status) { case "all": $status = utf8_decode(Prado::localize('All')); break; case "block": $status = utf8_decode(Prado::localize('Blocked')); break; case "unblock": $status = utf8_decode(Prado::localize('Unblocked')); break; } $group = $this->Request['f4']; if ($group != 0) { $cmd = $this->db->createCommand("SELECT * FROM hr_user_group WHERE id=" . $group); $data = $cmd->query(); $data = $data->read(); $group = utf8_decode($data['name']); } else { $group = utf8_decode(Prado::localize('All')); } $accessPoint = $this->Request['f5']; if ($accessPoint != 0) { $cmd = $this->db->createCommand("SELECT * FROM hr_device WHERE id=" . $accessPoint); $data = $cmd->query(); $data = $data->read(); $accessPoint = utf8_decode($data['name']); } else { $accessPoint = utf8_decode(Prado::localize('All')); } $this->pdf->Cell(10, 5, utf8_decode(Prado::localize('Filter')), 'B', 1, 'L'); $this->pdf->Ln(1); $this->pdf->Cell(30, 5, utf8_decode(Prado::localize('Name')) . " :", 0, 0, 'L'); $this->pdf->Cell(0, 5, $name, 0, 1, 'L'); $this->pdf->Cell(30, 5, utf8_decode(Prado::localize('Firstname')) . " :", 0, 0, 'L'); $this->pdf->Cell(0, 5, $firstname, 0, 1, 'L'); $this->pdf->Cell(30, 5, utf8_decode(Prado::localize('Status')) . " :", 0, 0, 'L'); $this->pdf->Cell(0, 5, $status, 0, 1, 'L'); $this->pdf->Cell(30, 5, utf8_decode(Prado::localize('Group')) . " :", 0, 0, 'L'); $this->pdf->Cell(0, 5, $group, 0, 1, 'L'); $this->pdf->Cell(30, 5, utf8_decode(Prado::localize('Access')) . " :", 0, 0, 'L'); $this->pdf->Cell(0, 5, $accessPoint, 0, 1, 'L'); $this->pdf->Ln(10); $header = array(utf8_decode(Prado::localize("Name")), utf8_decode(Prado::localize("Firstname")), utf8_decode(Prado::localize("Email")), utf8_decode(Prado::localize("Phone")), utf8_decode(Prado::localize("Group")), utf8_decode(Prado::localize("Is Blocked"))); //Couleurs, �paisseur du trait et police grasse $this->pdf->SetFillColor(124, 124, 124); $this->pdf->SetTextColor(255); $this->pdf->SetDrawColor(255); $this->pdf->SetLineWidth(0.3); $this->pdf->SetFont('', 'B'); //En-t�te $w = array(30, 30, 30, 30, 45, 30); for ($i = 0; $i < count($header); $i++) { $this->pdf->Cell($w[$i], 7, $header[$i], 1, 0, 'C', 1); } $this->pdf->Ln(); //Restauration des couleurs et de la police $this->pdf->SetFillColor(215, 215, 215); $this->pdf->SetTextColor(0); $this->pdf->SetFont(''); //Donn�es $fill = false; $data = $this->getData(); foreach ($data as $d) { $name = utf8_decode($d['name']); $firstname = utf8_decode($d['firstname']); $email = utf8_decode($d['email2']); $phone = utf8_decode($d['phone2']); $isBlocked = utf8_decode($d['isBlocked'] == 1 ? Prado::Localize("Yes") : Prado::Localize("No")); $cmd = $this->db->createCommand("SELECT * FROM hr_user_group AS ug LEFT JOIN hr_user_group_attribution AS uga ON ug.id = uga.id_group WHERE uga.id_user="******", ", $groupList); $group = utf8_decode($groupList); $this->pdf->Cell($w[0], 6, $name, 'LR', 0, 'L', $fill); $this->pdf->Cell($w[1], 6, $firstname, 'LR', 0, 'L', $fill); $this->pdf->Cell($w[2], 6, $email, 'LR', 0, 'L', $fill); $this->pdf->Cell($w[3], 6, $phone, 'LR', 0, 'L', $fill); $this->pdf->Cell($w[4], 6, $group, 'LR', 0, 'L', $fill); $this->pdf->Cell($w[5], 6, $isBlocked, 'LR', 0, 'L', $fill); $this->pdf->Ln(); $fill = !$fill; } $this->pdf->Cell(array_sum($w), 0, '', 'T'); $this->pdf->render(); }
protected function onPrint() { parent::onPrint(); $this->pdf->AddPage(); $this->pdf->SetFont('Arial', '', 11); $this->pdf->Cell(0, 10, utf8_decode(Prado::localize('List of the access level')), 0, 0, 'L'); $this->pdf->Ln(10); $this->pdf->setDefaultFont(); $accessLevel = $this->getData(); $i = 0; foreach ($accessLevel as $ot) { $this->pdf->SetDrawColor(0); $this->pdf->SetFont('Arial', 'B', 11); $this->pdf->SetLineWidth(0.4); $this->pdf->Cell(0, 6, utf8_decode($ot['name']), 'B', 1, 'L'); $this->pdf->setDefaultFont(); $this->pdf->SetLineWidth(0.1); $this->pdf->SetDrawColor(127); $this->pdf->Cell(60, 6, utf8_decode(Prado::localize('Full access')), 'B', 0, 'L'); $this->pdf->Cell(0, 6, utf8_decode($ot['full_access'] == "1" ? Prado::localize('Yes') : Prado::localize('No')), 'B', 1, 'L'); $this->pdf->Cell(60, 6, utf8_decode(Prado::localize('Apply to the week-end')), 'B', 0, 'L'); $this->pdf->Cell(0, 6, utf8_decode($ot['week_end'] == "1" ? Prado::localize('Yes') : Prado::localize('No')), 'B', 1, 'L'); $this->pdf->Cell(60, 6, utf8_decode(Prado::localize('Apply to the non working day')), 'B', 0, 'L'); $this->pdf->Cell(0, 6, utf8_decode($ot['non_working_day'] == "1" ? Prado::localize('Yes') : Prado::localize('No')), 'B', 1, 'L'); $this->pdf->SetLineWidth(0.2); $this->pdf->Cell(60, 6, utf8_decode(Prado::localize('Description')), 'B', 0, 'L'); $this->pdf->Cell(0, 6, utf8_decode($ot['comment']), 'B', 1, 'L'); $this->pdf->SetLineWidth(0.1); $this->pdf->Cell(60, 6, utf8_decode(Prado::localize('Monday')), 'B', 0, 'L'); $cmd = $this->db->createCommand("SELECT * FROM hr_access_time WHERE day='lundi' AND id_access_level=" . $ot['id']); $times = $cmd->query(); foreach ($times as $time) { $from = $time['from']; $until = $time['until']; $timeStart = str_pad((int) ($from / 60), 2, "0", STR_PAD_LEFT) . ":" . str_pad($from % 60, 2, "0", STR_PAD_LEFT); $timeEnd = str_pad((int) ($until / 60), 2, "0", STR_PAD_LEFT) . ":" . str_pad($until % 60, 2, "0", STR_PAD_LEFT); $this->pdf->Cell(25, 6, $timeStart . "-" . $timeEnd, 'B', 0, 'L'); } $this->pdf->Cell(0, 6, "", 'B', 1, 'L'); $this->pdf->Cell(60, 6, utf8_decode(Prado::localize('Tuesday')), 'B', 0, 'L'); if ($ot['monday_default'] == 1) { $cmd = $this->db->createCommand("SELECT * FROM hr_access_time WHERE day='lundi' AND id_access_level=" . $ot['id']); } else { $cmd = $this->db->createCommand("SELECT * FROM hr_access_time WHERE day='mardi' AND id_access_level=" . $ot['id']); } $times = $cmd->query(); foreach ($times as $time) { $from = $time['from']; $until = $time['until']; $timeStart = str_pad((int) ($from / 60), 2, "0", STR_PAD_LEFT) . ":" . str_pad($from % 60, 2, "0", STR_PAD_LEFT); $timeEnd = str_pad((int) ($until / 60), 2, "0", STR_PAD_LEFT) . ":" . str_pad($until % 60, 2, "0", STR_PAD_LEFT); $this->pdf->Cell(25, 6, $timeStart . "-" . $timeEnd, 'B', 0, 'L'); } $this->pdf->Cell(0, 6, "", 'B', 1, 'L'); $this->pdf->Cell(60, 6, utf8_decode(Prado::localize('Wednesday')), 'B', 0, 'L'); if ($ot['monday_default'] == 1) { $cmd = $this->db->createCommand("SELECT * FROM hr_access_time WHERE day='lundi' AND id_access_level=" . $ot['id']); } else { $cmd = $this->db->createCommand("SELECT * FROM hr_access_time WHERE day='mercredi' AND id_access_level=" . $ot['id']); } $times = $cmd->query(); foreach ($times as $time) { $from = $time['from']; $until = $time['until']; $timeStart = str_pad((int) ($from / 60), 2, "0", STR_PAD_LEFT) . ":" . str_pad($from % 60, 2, "0", STR_PAD_LEFT); $timeEnd = str_pad((int) ($until / 60), 2, "0", STR_PAD_LEFT) . ":" . str_pad($until % 60, 2, "0", STR_PAD_LEFT); $this->pdf->Cell(25, 6, $timeStart . "-" . $timeEnd, 'B', 0, 'L'); } $this->pdf->Cell(0, 6, "", 'B', 1, 'L'); $this->pdf->Cell(60, 6, utf8_decode(Prado::localize('Thursday')), 'B', 0, 'L'); if ($ot['monday_default'] == 1) { $cmd = $this->db->createCommand("SELECT * FROM hr_access_time WHERE day='lundi' AND id_access_level=" . $ot['id']); } else { $cmd = $this->db->createCommand("SELECT * FROM hr_access_time WHERE day='jeudi' AND id_access_level=" . $ot['id']); } $times = $cmd->query(); foreach ($times as $time) { $from = $time['from']; $until = $time['until']; $timeStart = str_pad((int) ($from / 60), 2, "0", STR_PAD_LEFT) . ":" . str_pad($from % 60, 2, "0", STR_PAD_LEFT); $timeEnd = str_pad((int) ($until / 60), 2, "0", STR_PAD_LEFT) . ":" . str_pad($until % 60, 2, "0", STR_PAD_LEFT); $this->pdf->Cell(25, 6, $timeStart . "-" . $timeEnd, 'B', 0, 'L'); } $this->pdf->Cell(0, 6, "", 'B', 1, 'L'); $this->pdf->Cell(60, 6, utf8_decode(Prado::localize('Friday')), 'B', 0, 'L'); if ($ot['monday_default'] == 1) { $cmd = $this->db->createCommand("SELECT * FROM hr_access_time WHERE day='lundi' AND id_access_level=" . $ot['id']); } else { $cmd = $this->db->createCommand("SELECT * FROM hr_access_time WHERE day='vendredi' AND id_access_level=" . $ot['id']); } $times = $cmd->query(); foreach ($times as $time) { $from = $time['from']; $until = $time['until']; $timeStart = str_pad((int) ($from / 60), 2, "0", STR_PAD_LEFT) . ":" . str_pad($from % 60, 2, "0", STR_PAD_LEFT); $timeEnd = str_pad((int) ($until / 60), 2, "0", STR_PAD_LEFT) . ":" . str_pad($until % 60, 2, "0", STR_PAD_LEFT); $this->pdf->Cell(25, 6, $timeStart . "-" . $timeEnd, 'B', 0, 'L'); } $this->pdf->Cell(0, 6, "", 'B', 1, 'L'); $this->pdf->Cell(60, 6, utf8_decode(Prado::localize('Saturday')), 'B', 0, 'L'); if ($ot['monday_default'] == 1) { $cmd = $this->db->createCommand("SELECT * FROM hr_access_time WHERE day='lundi' AND id_access_level=" . $ot['id']); } else { $cmd = $this->db->createCommand("SELECT * FROM hr_access_time WHERE day='samedi' AND id_access_level=" . $ot['id']); } $times = $cmd->query(); foreach ($times as $time) { $from = $time['from']; $until = $time['until']; $timeStart = str_pad((int) ($from / 60), 2, "0", STR_PAD_LEFT) . ":" . str_pad($from % 60, 2, "0", STR_PAD_LEFT); $timeEnd = str_pad((int) ($until / 60), 2, "0", STR_PAD_LEFT) . ":" . str_pad($until % 60, 2, "0", STR_PAD_LEFT); $this->pdf->Cell(25, 6, $timeStart . "-" . $timeEnd, 'B', 0, 'L'); } $this->pdf->Cell(0, 6, "", 'B', 1, 'L'); $this->pdf->Cell(60, 6, utf8_decode(Prado::localize('Sunday')), 'B', 0, 'L'); if ($ot['monday_default'] == 1) { $cmd = $this->db->createCommand("SELECT * FROM hr_access_time WHERE day='lundi' AND id_access_level=" . $ot['id']); } else { $cmd = $this->db->createCommand("SELECT * FROM hr_access_time WHERE day='dimanche' AND id_access_level=" . $ot['id']); } $times = $cmd->query(); foreach ($times as $time) { $from = $time['from']; $until = $time['until']; $timeStart = str_pad((int) ($from / 60), 2, "0", STR_PAD_LEFT) . ":" . str_pad($from % 60, 2, "0", STR_PAD_LEFT); $timeEnd = str_pad((int) ($until / 60), 2, "0", STR_PAD_LEFT) . ":" . str_pad($until % 60, 2, "0", STR_PAD_LEFT); $this->pdf->Cell(25, 6, $timeStart . "-" . $timeEnd, 'B', 0, 'L'); } $this->pdf->Cell(0, 6, "", 'B', 1, 'L'); $this->pdf->Ln(10); if ($i % 2) { $this->pdf->AddPage(); } $i++; } $this->pdf->render(); }
protected function onPrint() { parent::onPrint(); $app = $this->getApplication()->getGlobalization(); $year = $this->Request['f3']; $this->pdf->AddPage(); $data = $this->getData(true); $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($this->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($this->employee->getDepartment()), 0, 1, 'L'); $date = new DateFormat($app->getCulture()); $date = $date->format('1-' . $this->Request['f4'] . "-" . $this->Request['f3'], "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); 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(" ", " ", 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("→", "->", $remark); $remark = str_replace("←", "<-", $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->Text, 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->Text, 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->Text, 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->Text), 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->Text, 0, 1, 'R'); // ligne 5 $balances = bcadd($this->overTimeMonth, $this->overTimeLastMonth, 4); $overtTimeActivityCounter = $this->employee->getActivityCounter($year, $this->Request['f4'], $this->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 = $this->employee->getDefaultHolidaysCounter(); $holidays = $this->employee->getRequest($this->Request['f3'], $this->Request['f4'], $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 = $this->employee->getActivityCounter($year, $this->Request['f4'], $this->employee->getDefaultHolidaysCounter()); $holidaysTotal = bcsub($this->holidaysLastMonth->Text, $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->Text, 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->Text), 0, 1, 'R'); $this->pdf->ln(7); foreach ($this->TimeCode->DataSource 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->render(); }
protected function onPrint() { parent::onPrint(); $this->pdf->AddPage(); $data = $this->getData(); $this->pdf->SetFont('Arial', '', 11); $this->pdf->Cell(0, 10, utf8_decode(Prado::localize('List of the keys')), 0, 0, 'L'); $this->pdf->Ln(10); $this->pdf->setDefaultFont(); $identificator = $this->Request['f1']; if ($identificator == "%") { $identificator = "*"; } else { $identificator = $identificator . "*"; } $attributed = $this->Request['f2']; switch ($attributed) { case "all": $attributed = utf8_decode(Prado::localize('All')); break; case "used": $attributed = utf8_decode(Prado::localize('Attributed')); break; case "unsued": $attributed = utf8_decode(Prado::localize('Unattributed')); break; } $status = $this->Request['f3']; switch ($status) { case "all": $status = utf8_decode(Prado::localize('All')); break; case "block": $status = utf8_decode(Prado::localize('Blocked')); break; case "unblock": $status = utf8_decode(Prado::localize('Unblocked')); break; } $this->pdf->Cell(10, 5, utf8_decode(Prado::localize('Filter')), 'B', 1, 'L'); $this->pdf->Ln(1); $this->pdf->Cell(30, 5, utf8_decode(Prado::localize('Identificator')) . " :", 0, 0, 'L'); $this->pdf->Cell(0, 5, $identificator, 0, 1, 'L'); $this->pdf->Cell(30, 5, utf8_decode(Prado::localize('Attribution')) . " :", 0, 0, 'L'); $this->pdf->Cell(0, 5, $attributed, 0, 1, 'L'); $this->pdf->Cell(30, 5, utf8_decode(Prado::localize('Status')) . " :", 0, 0, 'L'); $this->pdf->Cell(0, 5, $status, 0, 1, 'L'); $this->pdf->Ln(10); $header = array(utf8_decode(Prado::localize("Identificator")), utf8_decode(Prado::localize("Key Number")), utf8_decode(Prado::localize("Blocked")), utf8_decode(Prado::localize("Attribution"))); //Couleurs, �paisseur du trait et police grasse $this->pdf->SetFillColor(124, 124, 124); $this->pdf->SetTextColor(255); $this->pdf->SetDrawColor(255); $this->pdf->SetLineWidth(0.3); $this->pdf->SetFont('', 'B'); //En-t�te $w = array(45, 60, 25, 50); for ($i = 0; $i < count($header); $i++) { $this->pdf->Cell($w[$i], 7, $header[$i], 1, 0, 'C', 1); } $this->pdf->Ln(); //Restauration des couleurs et de la police $this->pdf->SetFillColor(215, 215, 215); $this->pdf->SetTextColor(0); $this->pdf->SetFont(''); //Donn�es $fill = false; foreach ($data as $d) { $identificator = utf8_decode($d['identificator']); $number = utf8_decode($d['serialNumber']); $isBlocked = utf8_decode($d['isBlocked'] == 1 ? Prado::Localize("Yes") : Prado::Localize("No")); $attribution = utf8_decode($d['person']); $this->pdf->Cell($w[0], 6, $identificator, 'LR', 0, 'L', $fill); $this->pdf->Cell($w[1], 6, $number, 'LR', 0, 'L', $fill); $this->pdf->Cell($w[2], 6, $isBlocked, 'LR', 0, 'L', $fill); $this->pdf->Cell($w[3], 6, $attribution, 'LR', 0, 'L', $fill); $this->pdf->Ln(); $fill = !$fill; } $this->pdf->Cell(array_sum($w), 0, '', 'T'); $this->pdf->render(); }
protected function onPrint() { parent::onPrint(); $this->pdf->AddPage(); $this->pdf->SetFont('Arial', '', 11); $this->pdf->Cell(0, 10, utf8_decode(Prado::localize('List of tracking')), 0, 0, 'L'); $this->pdf->Ln(10); $this->pdf->setDefaultFont(); $name = $this->Request['f1']; if ($name == "all") { $name = "*"; } else { if ($this->db->DriverName == 'sqlite') { $cmd = $this->db->createCommand("SELECT name || ' ' || firstname AS Text, id AS Value FROM hr_user WHERE id=" . $name); } else { $cmd = $this->db->createCommand("SELECT CONCAT(name,' ', firstname) AS Text, id AS Value FROM hr_user WHERE id=" . $name); } $data = $cmd->query(); $data = $data->read(); $name = $data['Text']; } $status = $this->Request['f3']; switch ($status) { case "all": $status = utf8_decode(Prado::localize('All')); break; case "ok": $status = utf8_decode(Prado::localize('Access ok')); break; case "ko": $status = utf8_decode(Prado::localize('Access ko')); break; } $accessPoint = $this->Request['f4']; if ($accessPoint != "all") { $cmd = $this->db->createCommand("SELECT * FROM hr_device WHERE id=" . $accessPoint); $data = $cmd->query(); $data = $data->read(); $accessPoint = utf8_decode($data['name']); } else { $accessPoint = utf8_decode(Prado::localize('All')); } $from = $this->Request['f5']; $until = $this->Request['f6']; $this->pdf->Cell(10, 5, utf8_decode(Prado::localize('Filter')), 'B', 1, 'L'); $this->pdf->Ln(1); $this->pdf->Cell(30, 5, utf8_decode(Prado::localize('Name')) . " :", 0, 0, 'L'); $this->pdf->Cell(0, 5, $name, 0, 1, 'L'); $this->pdf->Cell(30, 5, utf8_decode(Prado::localize('Status')) . " :", 0, 0, 'L'); $this->pdf->Cell(0, 5, $status, 0, 1, 'L'); $this->pdf->Cell(30, 5, utf8_decode(Prado::localize('From')) . " :", 0, 0, 'L'); $this->pdf->Cell(0, 5, $from, 0, 1, 'L'); $this->pdf->Cell(30, 5, utf8_decode(Prado::localize('Until')) . " :", 0, 0, 'L'); $this->pdf->Cell(0, 5, $until, 0, 1, 'L'); $this->pdf->Cell(30, 5, utf8_decode(Prado::localize('Access point')) . " :", 0, 0, 'L'); $this->pdf->Cell(0, 5, $accessPoint, 0, 1, 'L'); $this->pdf->Ln(10); $header = array(utf8_decode(Prado::localize("Name")), utf8_decode(Prado::localize("Date")), utf8_decode(Prado::localize("Time")), utf8_decode(Prado::localize("Access point")), utf8_decode(Prado::localize("Key")), utf8_decode(Prado::localize("Is Access"))); //Couleurs, �paisseur du trait et police grasse $this->pdf->SetFillColor(124, 124, 124); $this->pdf->SetTextColor(255); $this->pdf->SetDrawColor(255); $this->pdf->SetLineWidth(0.3); $this->pdf->SetFont('', 'B'); //En-t�te $w = array(40, 30, 30, 30, 30, 25); for ($i = 0; $i < count($header); $i++) { $this->pdf->Cell($w[$i], 7, $header[$i], 1, 0, 'C', 1); } $this->pdf->Ln(); //Restauration des couleurs et de la police $this->pdf->SetFillColor(215, 215, 215); $this->pdf->SetTextColor(0); $this->pdf->SetFont(''); //Donn�es $fill = false; $data = $this->getData(); foreach ($data as $d) { $user = utf8_decode($d['name'] . " " . $d['firstName']); $date = utf8_decode($this->dateFromSql($d['date'])); $time = utf8_decode($d['time']); $device = utf8_decode($d['device']); $identificator = utf8_decode($d['identificator']); $is_access = utf8_decode($d['is_access'] == 1 ? Prado::Localize("Yes") : Prado::Localize("No")); $this->pdf->Cell($w[0], 6, $user, 'LR', 0, 'L', $fill); $this->pdf->Cell($w[1], 6, $date, 'LR', 0, 'L', $fill); $this->pdf->Cell($w[2], 6, $time, 'LR', 0, 'L', $fill); $this->pdf->Cell($w[3], 6, $device, 'LR', 0, 'L', $fill); $this->pdf->Cell($w[4], 6, $identificator, 'LR', 0, 'L', $fill); $this->pdf->Cell($w[5], 6, $is_access, 'LR', 0, 'L', $fill); $this->pdf->Ln(); $fill = !$fill; } $this->pdf->Cell(array_sum($w), 0, '', 'T'); $this->pdf->render(); }