function up() { // Do only if Province of Laguna $lgu_code = Setting::getField('lgu_code'); if ($lgu_code == 'laguna_province') { $o = new Office_m(); $offices = $o->get(); foreach ($offices as $office) { // Select all employees by office $e = new Employee_m(); $employees = $e->get_by_office_id($office->office_id); $office_id = sprintf("%03d", $office->office_id); // Add leading zeros $i = 1; foreach ($employees as $employee) { // Lets update the employee id $employee_id = sprintf("%03d", $i); // Add leading zeros $update_employee = new Employee_m(); $update_employee->get_by_id($employee->id); $update_employee->employee_id = $office_id . $employee_id; $update_employee->save(); $i++; } } } }
function training_preview($employee_id = '', $report_name = '') { $employee = new Employee_m(); $employee->get_by_id($employee_id); $office = new Office_m(); $office->get_by_office_id($employee->office_id); $type_employment = $this->options->type_employment(); $a = Setting::getField('republic'); $b = Setting::getField('lgu_name'); $c = Setting::getField('lgu_office'); $d = Setting::getField('lgu_address'); // this is for heading republic $lgu_code = Setting::getField('lgu_code'); // Laguna Province if ($lgu_code == 'laguna_province') { $logo = 'dtr/template/laguna_province/logo.jpg'; } $html = ' <table width="100%" border="0" cellpadding="5"> <tr> <td colspan="4" align="center" style="font-family:\'Times New Roman\', Times, serif"><b><em>' . $a . '</em></b></td> </tr> <tr> <td colspan="4" align="center" style="font-family:\'Times New Roman\', Times, serif"><b><em>' . $b . '</em></b></td> </tr> <tr> <td colspan="4" align="center" style="font-family:\'Times New Roman\', Times, serif"><b><em>' . $c . '</em></b></td> </tr> <tr> <td colspan="4" align="center" style="font-family:\'Times New Roman\', Times, serif"><b><em>' . $d . '</em></b></td> </tr> <tr> <td colspan="4" align="center" style="font-family:\'Times New Roman\', Times, serif"> </td> </tr> <tr> <td colspan="4" align="center" style="font-family:\'Times New Roman\', Times, serif"> </td> </tr> <tr> <td colspan="4" align="center" style="font-size:18px;">Employee Training Record</td> </tr> <tr> <td width="16%"> </td> <td width="35%"> </td> <td width="27%"> </td> <td width="22%"> </td> </tr> <tr> <td align="left"><strong>Name:</strong></td> <td>' . $employee->lname . ', ' . $employee->fname . ' ' . $employee->mname . '</td> <td> </td> <td> </td> </tr> <tr> <td align="left"><strong>Department:</strong></td> <td>' . $office->office_name . '</td> <td align="left"><strong>Sex:</strong></td> <td>' . $employee->sex . '</td> </tr> <tr> <td align="left"><strong>Position:</strong></td> <td>' . $employee->position . '</td> <td align="left"><strong>Employment Status:</strong></td> <td>' . $type_employment[$employee->permanent] . '</td> </tr> </table> <table width="100%" border="0"> <tr> <td colspan="3" align="center">' . $report_name . '</td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> </table> <table width="100%" border="1"> <tbody><tr> <td width="10%"><strong>Date From</strong></td> <td width="9%"><strong>Date to</strong></td> <td width="4%"><strong>Course Title</strong></td> <td width="10%"><strong>Duration</strong></td> <td width="13%"><strong>Conducted By</strong></td> </tr>'; $params = array('format' => 'Letter'); $this->load->library('mpdf', $params); // LOAD a stylesheet $stylesheet = file_get_contents(base_url() . 'css/mpdf/mpdfstyletables.css'); $this->mpdf->WriteHTML($stylesheet, 1); // The parameter 1 tells that this is css/style only and no body/html/text $this->mpdf->WriteHTML($html); // Training=========================================================== $t = new Training(); $t->order_by('date_from', 'DESC'); $rows = $t->get_by_employee_id($employee_id); foreach ($rows as $row) { $entry = ' <tr> <td>' . $row->date_from . '</td> <td>' . $row->date_to . '</td> <td>' . $row->name . '</td> <td>' . $row->number_hours . '</td> <td>' . $row->conducted_by . '</td> </tr>'; $this->mpdf->WriteHTML($entry); } $signatories = ' <tr> <td></td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> </tbody></table> '; // Signatories $training_prepared = Setting::getField('training_prepared'); $training_prepared_position = Setting::getField('training_prepared_position'); $training_certified = Setting::getField('training_certified'); $training_certified_position = Setting::getField('training_certified_position'); $signatories .= ' <table width="100%" border="0"> <tr> <td width="38%"> </td> <td width="23%"> </td> <td width="39%"> </td> </tr> <tr> <td align="center">PREPARED BY:</td> <td> </td> <td align="center">CERTIFIED CORRECT:</td> </tr> <tr> <td align="center"> </td> <td> </td> <td align="center"> </td> </tr> <tr> <td align="center"> </td> <td> </td> <td align="center"> </td> </tr> <tr> <td align="center">' . $training_prepared . '</td> <td> </td> <td align="center">' . $training_certified . '</td> </tr> <tr> <td align="center">' . $training_prepared_position . '</td> <td> </td> <td align="center">' . $training_certified_position . '</td> </tr> </table> '; $this->mpdf->WriteHTML($signatories); $this->mpdf->Output('dtr/template/pds/archives/pds_' . date('Y_m_d') . '.pdf', 'I'); }
<table width="100%" border="0" class="type-one"> <tr> <th width="6%">Emp ID</th> <th width="11%">Name</th> <th width="4%">Sex</th> <th width="14%">Position/Designation</th> <th width="13%">Office</th> <th width="10%">Employment Status</th> <th width="6%">SG</th> <th width="7%">Eligibility</th> <th width="13%">Education</th> <th width="8%">Birthday</th> <th width="8%">Address</th> </tr> <?php $office = new Office_m(); ?> <?php foreach ($rows as $row) { ?> <?php $bg = $this->Helps->set_line_colors(); ?> <?php $office->get_by_office_id($row->office_id); ?> <?php $type_employment = $this->options->type_employment(); ?> <tr bgcolor="<?php
function jo_preview($office_id = '', $period = '') { $this->Employee->fields = array('id', 'employee_id', 'office_id', 'lname', 'fname', 'mname', 'tax_status', 'dependents'); $this->Employee->employment_type = 4; $rows = $this->Employee->get_employee_list($office_id, ''); $o = new Office_m(); $o->get_by_office_id($office_id); $disbursing_officer = $o->disbursing_officer; $str = $o->office_name; if (strlen($str) % 2 == 1) { $str .= ' '; } $length = strlen($str) / 2; $arr2 = str_split($str, $length); $office_page1 = $arr2[0]; $office_page2 = $arr2[1]; list($month, $day1, $day2, $year) = explode("-", $period); $month_name = $this->Helps->get_month_name($month); $period_text = 'For the Month of ' . $month_name . ' ' . $day1 . '-' . $day2 . ', ' . $year; if (strlen($period_text) % 2 == 1) { $period_text .= ' '; } $length = strlen($period_text) / 2; $period_text_arr = str_split($period_text, $length); $period_page1 = $period_text_arr[0]; $period_page2 = $period_text_arr[1]; $agency_accountant = Setting::getField('agency_accountant'); $agency_accountant_position = Setting::getField('agency_accountant_position'); $head_of_office = Setting::getField('head_of_office'); $head_of_office_position = Setting::getField('head_of_office_position'); $heading = '<table width="100%" border="0"> <tr> <td> </td> <td> </td> <td> </td> <td align="right"></td> <td> </td> <td align="right"><H1>DAILY WAGE PAY</H1></td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="right"> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="right">' . strtoupper($office_page1) . '</td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="right"><strong>' . $period_page1 . '</strong></td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="right"> </td> </tr> <tr> <td colspan="6" style="font-size:11px">We acknowledge receipt of the sum shown opposite our names as full compensation for the services rendered for the period stated.</td> </tr> </table>'; $page = ' <table width="100%" border="1"> <tr> <td width="3%" rowspan="3" align="center" valign="middle"><strong>No.</strong></td> <td width="45%" rowspan="3" align="center" valign="middle"><strong>NAME</strong></td> <td width="19%" rowspan="3" align="center" valign="middle"><strong>TIN</strong></td> <td width="12%" rowspan="3" align="center" valign="middle"><strong>Tax Exemption</strong></td> <td width="12%" rowspan="3" align="center" valign="middle"><strong>Rate per Day</strong></td> <td width="6%" rowspan="3" align="center" valign="middle"><strong>Rate per Hour</strong></td> <td width="3%"> </td> </tr> <tr> <td> </td> </tr> <tr> <td> </td> </tr>'; $grand_total_salary = 0; $grand_total_amount_due = 0; $deduction = 0; $p = new Personal_m(); $r = new Rates(); $j = new Jo_days(); $n = 1; foreach ($rows as $row) { $p->get_by_employee_id($row['id']); $r->get_by_employee_id($row['employee_id']); $j->where('employee_id', $row['employee_id']); $j->where('period', $period); $j->get(); $total_salary = $r->rate_per_day * $j->days; $grand_total_salary += $total_salary; $total_amount_due = $total_salary - $deduction; $grand_total_amount_due += $total_amount_due; $tax_status = $row['tax_status'] != 'Single' ? 'ME' . $row['dependents'] : 'S'; $page .= '<tr> <td>' . $n . '</td> <td>' . strtoupper($row['lname']) . ', ' . $row['fname'] . ' ' . $row['mname'] . '</td> <td>' . $p->tin . '</td> <td>' . $tax_status . '</td> <td align="right">' . number_format($r->rate_per_day, 2) . '</td> <td> </td> <td> </td> </tr>'; $n++; } $page .= '<tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td><strong>TOTAL</strong></td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> </table> <table width="100%" border="1"> <tr> <td><table width="100%" border="0"> <tr> <td width="3%"> </td> <td width="64%">CERTIFIED</td> <td width="4%"> </td> <td width="6%"> </td> <td width="4%"> </td> <td width="16%"> </td> <td width="3%"> </td> </tr> <tr> <td> </td> <td colspan="6">Each person whose name appears on this roll had rendered services for the time stated</td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="center">_______________________</td> <td> </td> </tr> <tr> <td> </td> <td><strong>' . strtoupper($o->office_head) . '</strong></td> <td> </td> <td> </td> <td> </td> <td align="center">Date</td> <td> </td> </tr> <tr> <td> </td> <td colspan="5" style="font-size:11px">' . $o->position . '</td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> </table></td> </tr> </table> <table width="100%" border="1"> <tr> <td><table width="100%"> <tr> <td width="3%"> </td> <td width="35%">CERTIFIED: Funds available in the amount of</td> <td width="33%">' . number_format($grand_total_amount_due, 2) . '</td> <td width="6%"> </td> <td width="4%"> </td> <td width="16%"> </td> <td width="3%"> </td> </tr> <tr> <td> </td> <td colspan="6"> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="center"> </td> <td> </td> </tr> <tr> <td> </td> <td align="center"><strong>' . $agency_accountant . '</strong></td> <td> </td> <td> </td> <td> </td> <td align="center">_______________________</td> <td> </td> </tr> <tr> <td> </td> <td align="center">' . $agency_accountant_position . '</td> <td> </td> <td> </td> <td> </td> <td align="center">Date</td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> </table></td> </tr> </table> <pagebreak /> '; $page2 = '<table width="100%" border="0"> <tr> <td><H1>ROLL - JOB ORDER</H1></td> <td> </td> <td> </td> <td align="right"></td> <td> </td> <td align="right"></td> </tr> <tr> <td></td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="right"> </td> </tr> <tr> <td>' . strtoupper($office_page2) . '</td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="right"> </td> </tr> <tr> <td><strong>' . $period_page2 . '</strong></td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="right"> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="right"> </td> </tr> <tr> <td colspan="6"> </td> </tr> </table> <table width="100%" border="1"> <tr> <td width="5%" rowspan="3" align="center" valign="middle"><strong>No of Hours</strong></td> <td width="19%" rowspan="3" align="center" valign="middle"><strong>No. of Days with Pay</strong></td> <td width="15%" rowspan="3" align="center" valign="middle"><strong>Total Amount of Salary</strong></td> <td width="7%" rowspan="3" align="center" valign="middle"><strong>Pag-ibig Personal Contribution</strong></td> <td width="10%" rowspan="3" align="center" valign="middle"><strong>Total Deductions</strong></td> <td width="13%" rowspan="3" align="center" valign="middle"><strong>Total Amount Due</strong></td> <td width="5%" rowspan="3" align="center" valign="middle"><strong>No.</strong></td> <td width="20%" rowspan="3" align="center" valign="middle"><strong>SIGNATURE OR THUMBMARK</strong></td> <td width="6%"> </td> </tr> <tr> <td> </td> </tr> <tr> <td> </td> </tr>'; $n = 1; $grand_total_salary = 0; $grand_total_amount_due = 0; $deduction = 0; $j = new Jo_days(); $r = new Rates(); foreach ($rows as $row) { $j->where('employee_id', $row['employee_id']); $j->where('period', $period); $j->get(); $r->get_by_employee_id($row['employee_id']); $total_salary = $r->rate_per_day * $j->days; $grand_total_salary += $total_salary; $deduction = $r->pagibig_amount; $total_amount_due = $total_salary - $deduction; $grand_total_amount_due += $total_amount_due; $page2 .= ' <tr> <td></td> <td align="center">' . $j->days . '</td> <td align="right">' . number_format($total_salary, 2) . '</td> <td>' . $r->pagibig_amount . '</td> <td align="right">' . $deduction . '</td> <td align="right">' . number_format($total_amount_due, 2) . '</td> <td>' . $n . '</td> <td></td> <td> </td> </tr>'; $n++; } $page2 .= ' <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td><strong>TOTAL</strong></td> <td align="right"><strong>' . number_format($grand_total_salary, 2) . '</strong></td> <td> </td> <td> </td> <td align="right"><strong>' . number_format($grand_total_amount_due, 2) . '</strong></td> <td> </td> <td> </td> <td> </td> </tr> </table> <table width="100%" border="1"> <tr> <td><table width="100%" border="0"> <tr> <td width="3%"> </td> <td colspan="2">APPROVED FOR PAYMENT</td> <td width="31%"> </td> <td width="4%"> </td> <td width="16%"> </td> <td width="3%"> </td> </tr> <tr> <td> </td> <td colspan="6"> </td> </tr> <tr> <td> </td> <td width="17%"> </td> <td width="26%"> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="center">_______________________</td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td align="center"><strong>' . $head_of_office . '</strong></td> <td> </td> <td> </td> <td align="center">Date</td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td align="center">' . $head_of_office_position . '</td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> </table></td> </tr> </table> <table width="100%" border="1"> <tr> <td><table width="100%" border="0"> <tr> <td width="3%"> </td> <td colspan="6">CERTIFIED: Each person whose name appears on the above rolls has been</td> </tr> <tr> <td> </td> <td colspan="6">paid the amount stated opposite his name after identifying himself</td> </tr> <tr> <td> </td> <td width="17%"> </td> <td width="26%"> </td> <td width="31%"> </td> <td width="4%"> </td> <td width="16%"> </td> <td width="3%"> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="center"> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td align="center"><strong>' . $disbursing_officer . '</strong></td> <td> </td> <td> </td> <td align="center">_______________________</td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td align="center">Disbursing Officer</td> <td> </td> <td> </td> <td align="center">Date</td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> </table></td> </tr> </table> '; $html = $heading . $page . $page2; $params = array('format' => 'Legal'); $this->load->library('mpdf', $params); //$mpdf=new mPDF('c','Letter'); $this->mpdf->mirrorMargins = 1; // Use different Odd/Even headers and footers and mirror margins $stylesheet = file_get_contents(base_url() . 'css/mpdf/mpdfstyletables.css'); $this->mpdf->WriteHTML($stylesheet, 1); // The parameter 1 tells that this is css/style only and no $this->mpdf->WriteHTML($html); $this->mpdf->Output(); }
function dtr() { $data['page_name'] = '<b>View/Print DTR</b>'; $data['msg'] = ''; $data['focus_field'] = 'employee_id'; $data['pop_up'] = 0; // Use for office listbox $data['options'] = $this->options->office_options(); $data['selected'] = Session::get('office_id'); // Type of employment $data['permanent_options'] = $this->options->type_employment($all = TRUE); $data['permanent_selected'] = ''; // Months $data['month_options'] = $this->options->month_options(); $data['month_selected'] = date('m'); // Period from $data['days_options'] = $this->options->days_options(); // Period to $data['days_options'] = $this->options->days_options(); $data['days_selected'] = date('d'); $data['year_options'] = $this->options->year_options(2009, 2020); //2010 - 2020 $data['year_selected'] = date('Y'); $show_employee_number_dtr = Setting::getField('show_employee_number_dtr'); //If ($op == 1) ================== START ========================== if (Input::get('op') == 1) { $data['month_selected'] = Input::get('month'); $data['days_selected'] = Input::get('period_to'); $data['year_selected'] = Input::get('year'); // Get the data that need to process $this->employee_array[] = Input::get('employee_id'); $this->employee_array[] = Input::get('hidden_employee_id'); // Dont compute dates $this->dont_compute_dates = Setting::getField('dont_compute'); $this->month = Input::get('month'); $this->year = Input::get('year'); $this->period_from = Input::get('period_from'); $this->period_to = Input::get('period_to'); //$start_date = '1'; // If the $this->period_from is not 1 if ($this->period_from != '1') { $this->start_date = Input::get('period_from'); // Start of viewing DTR $this->period_from = '1'; // We will still use the first day } // If the Multiple employee checkbox is checked if (Input::get('multi_employee')) { // Array of employee from checkboxes $employees = Input::get('employee'); if (is_array($employees)) { $this->employee_array = $employees; } } // If the request is from view attendance page===>>>> $this->from_view_attendance(); // Remove empty array $this->employee_array = array_filter($this->employee_array); // Foreach($employee_array as $employee_id) ========= START ============= foreach ($this->employee_array as $employee_id) { $this->employee_id = $employee_id; $between_from = $this->year . '-' . $this->month . '-' . $this->period_from; $between_to = $this->year . '-' . $this->month . '-' . $this->period_to; // Dates to be delete after insert to table $array_of_deleted_dates = $this->Dtr->get_blank_dates($this->employee_id, $this->period_from, $this->period_to, $this->year, $this->month); // Get employee info $this->Employee->fields = array('fname', 'mname', 'lname', 'extension', 'shift_type', 'friday_exempted', 'office_id', 'detailed_office_id', 'assistant_dept_head'); //Fields $name = $this->Employee->get_employee_info($this->employee_id); $this->friday_exempted = $name['friday_exempted']; //echo $this->friday_exempted; //exit; // Check what type of user is logged // If leave manager $this->load->library('session'); if (Session::get('user_type') == 5) { // If the office is not equal to office id of user logged if (Session::get('office_id') != $name['office_id']) { echo '<font color="red">You are not allowed to view this records!</font>'; exit; } } $whole_name = $name['fname'] . ' ' . $name['mname'] . ' ' . $name['lname']; if ($name['extension'] != '') { $whole_name = $name['fname'] . ' ' . $name['mname'] . ' ' . $name['lname'] . ', ' . $name['extension']; } // If the LGU wants to see the last name in DTR first if (Setting::getField('last_name_first_dtr') == 'yes') { $whole_name = $name['lname'] . ', ' . $name['fname'] . ' ' . $name['mname']; if ($name['extension'] != '') { //$whole_name = $name['fname'].' '.$name['mname'].' '.$name['lname'].', '.$name['extension']; $whole_name = $name['lname'] . ', ' . $name['fname'] . ' ' . $name['extension'] . ' ' . $name['mname']; } } $this->shift_type = $name['shift_type']; $this->load->library('fpdf'); //define('FPDF_FONTPATH', $this->config->item('fonts_path')); $this->load->library('fpdi'); // initiate FPDI $this->pdf = new FPDI(); // add a page $this->pdf->AddPage(); // set the sourcefile $this->pdf->setSourceFile('dtr/template/dtr.pdf'); // select the first page $tplIdx = $this->pdf->importPage(1); // use the page we imported $this->pdf->useTemplate($tplIdx); // set font, font style, font size. $this->pdf->SetFont('Times', 'B', 11); #################################### #THIS IS FOR THE NAME OF EMPLOYEE # #################################### if ($show_employee_number_dtr == 'yes') { $this->pdf->SetXY(80, 10); $this->pdf->Write(0, $this->employee_id); $this->pdf->SetX(175); $this->pdf->Write(0, $this->employee_id); } // set initial placement $this->pdf->SetXY(30, 22.5); // line break $this->pdf->Ln(5); // go to 25 X (indent) $this->pdf->SetX(40); // write $this->pdf->Write(0, ucwords(strtolower(utf8_decode($whole_name)))); // go to 25 X (indent) $this->pdf->SetX(130); // write $this->pdf->Write(0, ucwords(strtolower(utf8_decode($whole_name)))); ######################################## #THIS IS FOR THE NAME OF EMPLOYEE (END)# ######################################## #################################### #THIS IS FOR THE MONTH # #################################### $month2 = $this->Helps->get_month_name($this->month); // line break $this->pdf->Ln(11); // go to 25 X (indent) $this->pdf->SetX(43); // write $this->pdf->Write(0, ucwords(strtolower($month2 . ' ' . $this->start_date . '-' . $this->period_to . ', ' . $this->year))); // go to 25 X (indent) $this->pdf->SetX(137); // write $this->pdf->Write(0, ucwords(strtolower($month2 . ' ' . $this->start_date . '-' . $this->period_to . ', ' . $this->year))); #################################### #THIS IS FOR THE MONTH (END) # #################################### $this->pdf->Ln(28.5); $this->pdf->SetFont('Times', '', 9); // This will start the writing process to pdf // DTR query result $this->Dtr->fields = array('am_login', 'am_logout', 'pm_login', 'pm_logout', 'ot_login', 'ot_logout', 'leave_type_id', 'log_date', 'manual_log_id'); $dtr_result = $this->Dtr->employee_dtr($between_from, $between_to, $this->employee_id); //foreach ($dtr_result as $row) ========= START ==================================== foreach ($dtr_result as $row) { $this->set_dtr($row); // // Split the logged_date // As of PHP 5.3.0 the regex extension is deprecated, // calling this function will issue an E_DEPRECATED notice. list($log_year, $log_month, $log_day) = explode('-', $this->log_date); // Check if the day is Sat or Sun $this->sat_or_sun = $this->Helps->is_sat_sun($log_month, $log_day, $log_year); // Check if the day is holiday $this->is_holiday = $this->Holiday->is_holiday($this->log_date); $allow_forty_hours = Setting::getField('allow_forty_hours'); // If the $this->period_from is not 1 something like // June 16-30 2012 if ($this->start_date != '1') { if ($log_day < $this->start_date) { $this->am_login = ''; $this->am_logout = ''; $this->pm_login = ''; $this->pm_logout = ''; $this->ot_login = ''; $this->ot_logout = ''; $this->sat_or_sun = ''; $this->is_holiday = FALSE; } } // If regular hours (8-5) // We can also use shift_type 3 here because it has // 4 logs //if( $this->shift_type == 1 ) if ($this->shift_type == 1 || $this->shift_type == 3) { $this->regular_hours(); $this->allow_40hrs == FALSE; } // If shifting if ($this->shift_type == 2) { if ($allow_forty_hours == 1) { // Allow 40 hrs per week $this->allow_40hrs = TRUE; } $this->shifting_same_day(); } // If 24 hrs //if ($this->shift_type == 3) if ($this->shift_type == 4) { if ($allow_forty_hours == 1) { // Allow 40 hrs per week $this->allow_40hrs = TRUE; } $this->shifting_same_day(); // added 7.27.2011 5:47pm } //echo $this->log_date.' -- '.$this->Helps->hours_late.'<br>'; //===========RESET Late and undertime $this->Helps->hours_late = 0; $this->Helps->count_late = 0; $this->Helps->hours_undertime = 0; $this->Helps->count_undertime = 0; $this->Helps->am_login = 0; $this->Helps->pm_login = 0; $this->Helps->am_logout = 0; $this->Helps->pm_logout = 0; $this->Helps->pm_late_hours = 0; $this->Helps->pm_undertime_hours = 0; // Set the line number from where in the pdf position will be place $line_numbers = array(4, 6, 8, 11, 14, 17, 19, 21, 24, 28); $line_number_view = in_array($this->line_number, $line_numbers) ? 4 : 3.5; $this->pdf->Ln($line_number_view); // Check for saturdays and sundays // If the date has log on it if ($this->am_login != "" or $this->am_logout != "" or $this->pm_login != "" or $this->pm_logout != "" or $this->ot_login != "" or $this->ot_logout != "") { //Do nothing // If the date is holiday if ($this->is_holiday == TRUE) { // Lets check if the holiday is half day if ($this->Holiday->half_day == TRUE) { if ($this->Holiday->am_pm == 'am') { $this->am_login = strtoupper($this->Holiday->holiday_name($this->log_date)); } else { $this->pm_login = strtoupper($this->Holiday->holiday_name($this->log_date)); } } } } else { // Do if not Leave //if ( $this->leave_type_id != 0 ) //{ if ($this->sat_or_sun == 'Saturday') { $this->am_login = '******'; } if ($this->sat_or_sun == 'Sunday') { $this->am_login = '******'; } // If the date is holiday if ($this->is_holiday == TRUE) { $this->am_login = strtoupper($this->Holiday->holiday_name($this->log_date)); if ($this->Holiday->am_pm == 'pm') { //$this->am_login = ''; } } //} } // Lets check if the logs has atleast one OB in entries $has_ob = FALSE; $has_ob = $this->Helps->has_ob($this->am_login, $this->am_logout, $this->pm_login, $this->pm_logout); $ob_location = ''; if ($has_ob == TRUE) { $ob_location = $this->Manual_log->get_notes($this->manual_log_id); } // Check if Official Business (Change Official Business to OB) $this->am_login = $this->Helps->is_ob($this->am_login); $this->am_logout = $this->Helps->is_ob($this->am_logout); $this->pm_login = $this->Helps->is_ob($this->pm_login); $this->pm_logout = $this->Helps->is_ob($this->pm_logout); // If whole day ob if ($this->am_login == 'OB' && $this->am_logout == 'OB' && $this->pm_login == 'OB' && $this->pm_logout == 'OB') { $ob_location = ''; $notes = $this->Manual_log->get_notes($this->manual_log_id); if (trim($notes) == '') { $this->am_login = '******'; $this->am_logout = 'OB'; $this->pm_login = '******'; $this->pm_logout = 'OB'; } else { $this->am_login = '******'; $this->am_logout = ''; $this->pm_login = $notes; $this->pm_logout = ''; } } // Check if Travel Order (Change Travel Order to To) $this->am_login = $this->Helps->is_to($this->am_login); $this->am_logout = $this->Helps->is_to($this->am_logout); $this->pm_login = $this->Helps->is_to($this->pm_login); $this->pm_logout = $this->Helps->is_to($this->pm_logout); // If whole day to if ($this->am_login == 'TO' && $this->am_logout == 'TO' && $this->pm_login == 'TO' && $this->pm_logout == 'TO') { $notes = $this->Manual_log->get_notes($this->manual_log_id); if (trim($notes) == '') { $this->am_login = '******'; $this->am_logout = 'TO'; $this->pm_login = '******'; $this->pm_logout = 'TO'; } else { $this->am_login = '******'; $this->am_logout = ''; $this->pm_login = trim($notes); $this->pm_logout = ''; } } // Check if the log is leave if ($this->leave_type_id != 0 && $this->am_login == 'Leave' && $this->am_logout == 'Leave' && $this->pm_login == 'Leave' && $this->pm_logout == 'Leave') { $this->am_login = strtoupper($this->Leave_type->get_leave_name($this->leave_type_id)); $this->am_logout = ''; $this->pm_login = ''; $this->pm_logout = ''; } $am_is_leave = FALSE; // If half day leave (morning) if ($this->leave_type_id != 0 && $this->am_login == 'Leave' && $this->am_logout == 'Leave') { $this->am_login = strtoupper($this->Leave_type->get_leave_code($this->leave_type_id)); $this->am_logout = ''; $am_is_leave = TRUE; } $pm_is_leave = FALSE; // If half day leave (afternoon) if ($this->leave_type_id != 0 && $this->pm_login == 'Leave' && $this->pm_logout == 'Leave') { $this->pm_login = strtoupper($this->Leave_type->get_leave_code($this->leave_type_id)); $this->pm_logout = ''; $pm_is_leave = TRUE; } // Execute only if regular hours (8-5) // and special sched (added 08-08-2011) if ($this->shift_type == 1 || $this->shift_type == 3) { // We need to check if the settings enabled for this halfday tardy // Check if there is no log on am or pm // For the compliant to CSC MC 17 series of 2010 // put VL if absent on AM and VL if absent on PM // AM Absent if ($this->am_login == '' && $this->am_logout == '' && $this->pm_login != '' && $this->pm_logout != '') { //$this->am_login = '******'; //$this->am_login = '******'; // Update 2.8.2013 // Put Tardy only if not saturday or sunday if ($this->sat_or_sun != 'Saturday' and $this->sat_or_sun != 'Sunday' and $this->is_holiday == FALSE) { $this->am_login = '******'; $this->am_logout = ''; // Change font color $this->Helps->font_color_am_login = 200; } } // PM Absent if ($this->am_login != '' && $this->am_logout != '' && $this->pm_login == '' && $this->pm_logout == '') { //$this->pm_login = '******'; $this->pm_login = '******'; $this->pm_logout = ''; // Check if saturday or sunday and shift_id == 1 // if true we dont need to put undertime to DTR if ($this->shift_type == 1 && ($this->sat_or_sun == 'Saturday' || $this->sat_or_sun == 'Sunday')) { $this->pm_login = ''; } // Change font color $this->Helps->font_color_pm_login = 200; // add this lines 12.14.2012 8.37am /* if ( $this->Holiday->is_holiday($this->log_date) and $this->Holiday->half_day == TRUE and $this->Holiday->am_pm == 'pm' ) { $this->pm_logout = ''; } */ // end add 12.14.2012 8.37am } else { if ($this->am_login != '' && $this->am_logout != '' && $this->pm_login != '' && $this->pm_logout == '') { $this->pm_logout = 'Undertime'; // add this lines 12.14.2012 8.37am if ($this->Holiday->is_holiday($this->log_date) and $this->Holiday->half_day == TRUE and $this->Holiday->am_pm == 'pm') { $this->pm_logout = ''; } // end add 12.14.2012 8.37am // Check if saturday or sunday and shift_id == 1 // if true we dont need to put undertime to DTR if ($this->shift_type == 1 && ($this->sat_or_sun == 'Saturday' || $this->sat_or_sun == 'Sunday')) { $this->pm_logout = ''; } // If pm is leave if ($pm_is_leave == TRUE) { $this->pm_logout = ''; } // Change font color $this->Helps->font_color_pm_logout = 200; } else { if ($this->am_login != '' && $this->am_logout != '' && $this->pm_login == '' && $this->pm_logout != '') { //$this->pm_logout= 'Undertime'; $this->pm_login = '******'; // If pm is leave if ($pm_is_leave == TRUE) { //$this->pm_logout = ''; } // Change font color $this->Helps->font_color_pm_login = 200; } else { if ($this->am_login != '' && $this->am_logout == '' && $this->pm_login != '' && $this->pm_logout != '' && $this->leave_type_id == 0) { $this->am_logout = 'Tardy'; // If pm is leave if ($pm_is_leave == TRUE) { //$this->pm_logout = ''; } //$this->leave_type_id // Change font color $this->Helps->font_color_am_logout = 200; } else { if ($this->am_login == '' && $this->am_logout == 'OB' && $this->pm_login == 'OB' && $this->pm_logout == 'OB' && $this->leave_type_id == 0) { $this->am_login = '******'; // If pm is leave if ($pm_is_leave == TRUE) { //$this->pm_logout = ''; } // Change font color $this->Helps->font_color_am_login = 200; } } } } } } //if ($this->log_date == '2013-03-30') //{ //var_dump( $this->pm_login);exit; //} //convert the time to 12 hour //am login A $this->pdf->SetX(24); $this->pdf->SetTextColor($this->Helps->font_color_am_login, 0, 0); $this->pdf->SetFont('Times', $this->Helps->am_font_bold, 9); $this->pdf->Write(0, $this->am_login); //am login B $this->pdf->SetX(118); $this->pdf->Write(0, $this->am_login); $this->Helps->font_color_am_login = 0; $this->Helps->am_font_bold = ''; //am logout A $this->pdf->SetX(36); $this->pdf->SetTextColor($this->Helps->font_color_am_logout, 0, 0); $this->pdf->SetFont('Times', $this->Helps->am_out_bold, 9); $this->pdf->Write(0, $this->am_logout); //am logout B $this->pdf->SetX(130); $this->pdf->Write(0, $this->am_logout); $this->Helps->font_color_am_logout = 0; $this->Helps->am_out_bold = ''; //pm login A $this->pdf->SetX(50); $this->pdf->SetTextColor($this->Helps->font_color_pm_login, 0, 0); $this->pdf->SetFont('Times', $this->Helps->pm_font_bold, 9); // Change format(only if notes is blank) if (isset($notes) && $notes != '') { $this->pm_login = $notes; } else { // If pm login is not leave and pm login is not half day absent(vacation leave) // If( ($this->leave_type_id == 0 && $this->pm_login != 'Vacation Leave') ) orig if ($this->leave_type_id == 0 && $this->pm_login != 'Undertime' && $this->pm_login != 'UT') { $this->pm_login = $this->Helps->change_format($this->pm_login, 1, $format = ''); // add this lines 12.14.2012 8.37am if ($this->Holiday->is_holiday($this->log_date) and $this->Holiday->half_day == TRUE and $this->Holiday->am_pm == 'pm') { $this->pm_login = $this->Holiday->holiday_name($this->log_date); } // end add 12.14.2012 8.37am } // If leave in the pm and pm_login is not equal to leave code(VL, SPL) if ($this->leave_type_id != 0 && $this->pm_login != strtoupper($this->Leave_type->get_leave_code($this->leave_type_id))) { $this->pm_login = $this->Helps->change_format($this->pm_login, 1, $format = ''); } } //echo //if ($this->log_date == '2012-03-30') //{ //var_dump( $this->pm_login);exit; //} // Reset the notes to blank $notes = ''; $this->pdf->Write(0, $this->pm_login); //pm login B $this->pdf->SetX(144); $this->pdf->Write(0, $this->pm_login); $this->Helps->font_color_pm_login = 0; $this->Helps->pm_font_bold = ''; //pm logout A $this->pdf->SetX(62); $this->pdf->SetTextColor($this->Helps->font_color_pm_logout, 0, 0); $this->pdf->SetFont('Times', $this->Helps->pm_out_bold, 9); // Change format if the entry is not leave and not Undertime or (leave in the morning) if ($this->leave_type_id == 0 && $this->pm_logout != 'Undertime' or $am_is_leave == TRUE) { $this->pm_logout = $this->Helps->change_format($this->pm_logout, 1, $format = ''); } $this->pdf->Write(0, $this->pm_logout); //pm logout B $this->pdf->SetX(157); $this->pdf->Write(0, $this->pm_logout); $this->Helps->font_color_pm_logout = 0; $this->Helps->pm_out_bold = ''; //ot login A $this->pdf->SetX(74); $this->pdf->SetTextColor(0, 0, 0); if ($has_ob == TRUE and trim($ob_location) != '') { $this->ot_login = $ob_location; } else { $this->ot_login = $this->Helps->change_format($this->ot_login, 1, $format = ''); } $this->pdf->Write(0, $this->ot_login); //ot login B $this->pdf->SetX(169); $this->pdf->SetTextColor(0, 0, 0); $this->pdf->Write(0, $this->ot_login); //ot logout A $this->pdf->SetX(88); $this->pdf->SetTextColor(0, 0, 0); $this->ot_logout = $this->Helps->change_format($this->ot_logout, 1, $format = ''); $this->pdf->Write(0, $this->ot_logout); //ot logout B $this->pdf->SetX(182); $this->pdf->SetTextColor(0, 0, 0); $this->pdf->Write(0, $this->ot_logout); $this->line_number++; $this->Holiday->half_day = FALSE; // reset //echo $this->log_date.' '.$this->late_final.'<br>'; //exit; } //foreach ($dtr_result as $row) ========= END ==================================== //exit; // If allow the 40 hrs per week (offsettings)===================================== if ($this->allow_40hrs == TRUE) { // If the work for 1st week is 40 hours or more or 5 days or more if ($this->Helps->compute_time($this->week1_hours) >= '5 days') { // Subtract the week 1 total late and undertime count $this->late_count -= $this->week1_late_count; $this->undertime_count -= $this->week1_undertime_count; // Subtract the week 1 total late and undertime hours $this->late_final -= $this->week1_late_final; $this->undertime_final -= $this->week1_undertime_final; } // If the work for 2nd week is 40 hours or more or 5 days or more if ($this->Helps->compute_time($this->week2_hours) >= '5 days') { // Subtract the week 2 total late and undertime count $this->late_count -= $this->week2_late_count; $this->undertime_count -= $this->week2_undertime_count; // Subtract the week 2 total late and undertime hours $this->late_final -= $this->week2_late_final; $this->undertime_final -= $this->week2_undertime_final; } // If the work for 3rd week is 40 hours or more or 5 days or more if ($this->Helps->compute_time($this->week3_hours) >= '5 days') { // Subtract the week 3 total late and undertime count $this->late_count -= $this->week3_late_count; $this->undertime_count -= $this->week3_undertime_count; // Subtract the week 3 total late and undertime hours $this->late_final -= $this->week3_late_final; $this->undertime_final -= $this->week3_undertime_final; } // If the work for 4th week is 40 hours or more or 5 days or more if ($this->Helps->compute_time($this->week4_hours) >= '5 days') { // Subtract the week 4 total late and undertime count $this->late_count -= $this->week4_late_count; $this->undertime_count -= $this->week4_undertime_count; // Subtract the week 4 total late and undertime hours $this->late_final -= $this->week4_late_final; $this->undertime_final -= $this->week4_undertime_final; } } // ================================================================= // set initial placement $this->pdf->SetXY(30, 34); //$this->pdf->Ln(160.5); $this->pdf->Ln(153); //total A $this->pdf->SetX(50); //$this->pdf->Write(0, ucwords(($this->Helps->compute_time($this->number_of_hours_work)))); //total B $this->pdf->SetX(145); //$this->pdf->Write(0, ucwords(($this->Helps->compute_time($this->number_of_hours_work)))); // LGU CODE $lgu_code = Setting::getField('lgu_code'); if ($lgu_code == 'marinduque_province') { // Total tardiness $this->total_tardiness = $this->late_final + $this->undertime_final; //$this->late_count += $this->undertime_count; $this->undertime_final = $this->Helps->compute_time($this->undertime_final + $this->late_final); $this->late_final = ''; } else { // Total tardiness $this->total_tardiness = $this->late_final + $this->undertime_final; // Compute the late in words $this->late_final = $this->Helps->compute_time($this->late_final); // Compute undertime $this->undertime_final = $this->Helps->compute_time($this->undertime_final); } // Total $this->pdf->Ln(48); $this->pdf->SetX(17); $this->pdf->Write(0, 'Tardiness:'); $this->pdf->SetX(40); $this->pdf->Write(0, '(' . $this->late_count . 'x)' . $this->late_final); $this->pdf->SetX(110); $this->pdf->Write(0, 'Tardiness:'); $this->pdf->SetX(133); $this->pdf->Write(0, '(' . $this->late_count . 'x)' . $this->late_final); $this->pdf->Ln(6); $this->pdf->SetX(17); $this->pdf->Write(0, 'Under time:'); $this->pdf->SetX(40); if ($lgu_code == 'marinduque_province') { $this->pdf->Write(0, $this->undertime_final); } else { $this->pdf->Write(0, '(' . $this->undertime_count . 'x) ' . $this->undertime_final); } $this->pdf->SetX(110); $this->pdf->Write(0, 'Under time:'); $this->pdf->SetX(133); if ($lgu_code == 'marinduque_province') { $this->pdf->Write(0, $this->undertime_final); } else { $this->pdf->Write(0, '(' . $this->undertime_count . 'x) ' . $this->undertime_final); } //overtime $this->pdf->Ln(6); $this->number_of_hours_work = $this->Helps->compute_time($this->number_of_hours_work); $this->pdf->SetX(17); //$this->pdf->Write(0, ucwords(('Number of Tardiness:'))); $this->pdf->SetX(50); //$this->pdf->Write(0, ucwords(($late_count + $undertime_count))); $this->pdf->SetX(110); //$this->pdf->Write(0, ucwords(('Number of Tardiness:'))); $this->pdf->SetX(143); //$this->pdf->Write(0, ucwords(($late_count + $undertime_count))); //overtime $this->overtime = $this->Helps->compute_time($this->overtime); $print_overtime_in_dtr = Setting::getField('print_overtime_in_dtr'); if ($print_overtime_in_dtr == 1) { $this->pdf->SetX(17); $this->pdf->Write(0, ucwords('Over time:')); $this->pdf->Write(0, ucwords($this->overtime)); $this->pdf->SetX(110); $this->pdf->Write(0, ucwords('Over time:')); $this->pdf->Write(0, ucwords($this->overtime)); } // If allow the 40 hrs per week if ($this->allow_40hrs == TRUE) { $this->pdf->Ln(6); $this->pdf->SetX(17); $this->pdf->Write(0, 'The system allow the 40 hrs a week'); $this->pdf->SetX(110); $this->pdf->Write(0, 'The system allow the 40 hrs a week'); // We require hours only here. $this->Helps->hours_only = TRUE; $this->pdf->Ln(4); $this->pdf->SetX(17); $this->pdf->Write(0, '1st week: ' . $this->Helps->compute_time($this->week1_hours)); $this->pdf->SetX(110); $this->pdf->Write(0, '1st week: ' . $this->Helps->compute_time($this->week1_hours)); $this->pdf->Ln(4); $this->pdf->SetX(17); $this->pdf->Write(0, '2nd week: ' . $this->Helps->compute_time($this->week2_hours)); $this->pdf->SetX(110); $this->pdf->Write(0, '2nd week: ' . $this->Helps->compute_time($this->week2_hours)); $this->pdf->Ln(4); $this->pdf->SetX(17); $this->pdf->Write(0, '3rd week: ' . $this->Helps->compute_time($this->week3_hours)); $this->pdf->SetX(110); $this->pdf->Write(0, '3rd week: ' . $this->Helps->compute_time($this->week3_hours)); $this->pdf->Ln(4); $this->pdf->SetX(17); $this->pdf->Write(0, '4th week: ' . $this->Helps->compute_time($this->week4_hours)); $this->pdf->SetX(110); $this->pdf->Write(0, '4th week: ' . $this->Helps->compute_time($this->week4_hours)); } // Add office head and designation $print_office_head_in_dtr = Setting::getField('print_office_head_in_dtr'); if ($print_office_head_in_dtr == 1) { $office = $this->Office->get_office_info($name['office_id']); // If detailed if ($name['detailed_office_id'] != 0) { $detailed_office = $this->Office->get_office_info($name['detailed_office_id']); $office['office_head'] = $detailed_office['office_head']; $office['position'] = $detailed_office['position']; } // If Employee is Department Head $o = new Office_m(); $o->get_by_employee_id($this->employee_id); if ($o->exists()) { if ($lgu_code == 'marinduque_province') { $office['office_head'] = 'CARMENCITA O. REYES'; $office['position'] = 'Governor'; } else { $office['office_head'] = 'ATTORNEY AGUSTIN M. ROCAMORA'; $office['position'] = 'City Administrator'; } } // Check if assistant if ($lgu_code == '') { if ($name['assistant_dept_head'] == 1) { $office['office_head'] = 'ATTORNEY AGUSTIN M. ROCAMORA'; $office['position'] = 'City Administrator'; } } // We need to work out for this as exception if ($this->employee_id === '61') { $office['office_head'] = 'ANTONIO L. UY, JR. M.D.'; $office['position'] = 'Vice Governor'; } // We need to work out for this as exception (Puerto) if ($this->employee_id == '013001') { $office['office_head'] = 'LUCILO BAYRON'; $office['position'] = 'Vice Mayor'; } // For Quirino Province if ($this->employee_id == '122265') { $office['office_head'] = 'PELIGIO H. OBLIGACION, JR.'; $office['position'] = 'Supervising Administrative Officer'; } $this->pdf->SetXY(17, 217); $this->pdf->Cell(73, 4, strtoupper($office['office_head']), '0', 0, 'C', FALSE); $this->pdf->SetX(110); $this->pdf->Cell(73, 4, strtoupper($office['office_head']), '0', 0, 'C', FALSE); $this->pdf->Ln(4); $this->pdf->SetX(17); $this->pdf->Cell(73, 4, $office['position'], '0', 0, 'C', FALSE); $this->pdf->SetX(110); $this->pdf->Cell(73, 4, $office['position'], '0', 0, 'C', FALSE); } // Process the adding of undertime to leave card $this->leave_card_undertime(); // Reset $this->late_count = 0; $this->late_final = 0; $this->undertime_count = 0; $this->undertime_final = 0; $this->line_number = 1; $this->overtime = 0; $this->number_of_hours_work = 0; header('Cache-Control: maxage=3600'); //Adjust maxage appropriately header('Pragma: public'); // If the parameter is D = download F = save as file $this->pdf->Output('dtr/archives/' . $name['office_id'] . "_{$employee_id}.pdf", 'F'); // All name of dtr file. put in an array $multiple_dtr[] = 'dtr/archives/' . $name['office_id'] . "_{$employee_id}.pdf"; foreach ($array_of_deleted_dates as $dates) { $this->Dtr->delete_dtr($this->employee_id, $dates); } } //foreach($employee_array as $employee_id) ========= START ==================================== if (file_exists('dtr/archives/' . $name['office_id'] . ".pdf")) { unlink('dtr/archives/' . $name['office_id'] . ".pdf"); } /* // Concatenate the pdf files $this->pdf = new FPDI(); $this->pdf->setFiles($multiple_dtr); $this->pdf->concat(); $this->pdf->Output('dtr/archives/'.$name['office_id'].".pdf", 'F'); */ // Changed on 1.28.2012 // Since I updated the fpdf and fpdi libraries, // I did this for safe update of libraries // Orig is on top of this comments $this->load->library('concat_pdf'); $this->concat_pdf->setFiles($multiple_dtr); $this->concat_pdf->concat(); $this->concat_pdf->Output('dtr/archives/' . $name['office_id'] . ".pdf", 'F'); // Delete all files foreach ($this->array_pdf as $filename) { if (file_exists($filename)) { unlink($filename); } } $data['pop_up'] = 1; $data['office_id'] = $name['office_id']; $_POST['office_id'] = $name['office_id']; // added 2011-02-14 Session::put('from_view_attendance_office_id', $name['office_id']); // added 2013-11-22 // Delete all tardiness with zero seconds $this->Tardiness->delete_zero_seconds(); } //if ($op == 1) ================== END ========================== //To do: execute if page is not from view attendance if ($this->input->get('from_view_attendance') != TRUE) { $data['main_content'] = 'dtr'; return View::make('includes/template', $data); } }
function cto_apps($id = '') { $c = CompensatoryTimeoff::find($id); $name = $this->Employee->get_employee_info($c->employee_id); $office_name = $this->Office->get_office_name($name['office_id']); $this->load->library('fpdf'); define('FPDF_FONTPATH', $this->config->item('fonts_path')); $this->load->library('fpdi'); $pdf = new FPDI('P', 'mm', 'Legal'); // add a page $pdf->AddPage(); // set the sourcefile $pdf->setSourceFile('dtr/template/app_for_offset.pdf'); // select the first page $tplIdx = $pdf->importPage(1); // use the page we imported $pdf->useTemplate($tplIdx); // set font, font style, font size. $pdf->SetFont('Arial', 'B', 12); // set initial placement $pdf->SetXY(158, 10.5); $pdf->Write(0, 'Tracking no: ' . $id); $pdf->Ln(9); $pdf->SetX(158); $pdf->Ln(20); // go to 25 X (indent) $pdf->SetX(12); $this->Office->fields = array('office_code'); $office = $this->Office->get_office_info($name['office_id']); // write office $pdf->SetFont('Arial', 'B', 10); $pdf->Write(0, $office['office_name']); $pdf->SetFont('Arial', 'B', 12); //lname $pdf->SetX(99); $pdf->Write(0, $name['lname']); //fname $pdf->SetX(145); $pdf->Write(0, $name['fname']); //mname $pdf->SetX(187); $pdf->Write(0, $name['mname'][0] . '.'); $pdf->Ln(10); //date of file $pdf->SetX(20); $pdf->Write(0, $c->date_file); //position $pdf->SetFont('Arial', 'B', 10); $pdf->SetX(63); $pdf->Write(0, $name['position']); $pdf->SetFont('Arial', 'B', 12); // We need to check what salary grade the office use if ($office['salary_grade_type'] == 'hospital') { $this->Salary_grade->salary_grade_type = 'hospital'; } //monthly salary $pdf->SetX(140); $pdf->Write(0, 'P ' . number_format($this->Salary_grade->get_monthly_salary($name['salary_grade'], $name['step']), 2)); $days = 'day'; if ($c->days > 1) { $days = 'days'; } $pdf->Ln(13); $pdf->SetX(30); $pdf->Write(0, $c->days . ' ' . $days); $pdf->SetX(140); //$pdf->Write(0, 'daily rate here'); $pdf->Ln(13); $pdf->SetX(50); $pdf->Write(0, $this->Helps->get_month_name($c->month) . ' ' . $c->dates . ', ' . $c->year); $cto_balances_as_of = date("F d, Y", strtotime($c->date_file . "-1 day")); $pdf->SetXY(30, 106); $pdf->Write(0, $cto_balances_as_of); // Compute balances // (balance + earn) - spent $cto = CompensatoryTimeoff::getBalance($c->employee_id); //$balance = $cto->days; $balance = $cto; $cto = CompensatoryTimeoff::getEarnedSpent($c->employee_id); //$earn = $cto->days; $earn = $cto; $cto = CompensatoryTimeoff::getEarnedSpent($c->employee_id, 'spent'); //$spent = $cto->days; $spent = $cto; $total_balance = $balance + $earn - $spent; $pdf->SetXY(35, 116); $pdf->Write(0, $total_balance); $pdf->SetX(87); $pdf->Write(0, ''); // hours here // Get office head $office = $this->Office->get_office_info($name['office_id']); // If detailed if ($name['detailed_office_id'] != 0) { $detailed_office = $this->Office->get_office_info($name['detailed_office_id']); $office['office_head'] = $detailed_office['office_head']; $office['position'] = $detailed_office['position']; } // If Employee is Department head $o = new Office_m(); $o->get_by_employee_id($c->employee_id); if ($o->exists()) { $office['office_head'] = 'CARMENCITA O. REYES'; $office['position'] = 'Governor'; } // We need to work out for this as exception if ($c->employee_id == '61') { $office['office_head'] = 'ANTONIO L. UY, JR. M.D.'; $office['position'] = 'Vice Governor'; } $pdf->Ln(6); $pdf->SetX(120); $pdf->Cell(73, 4, strtoupper($office['office_head']), '0', 0, 'C', FALSE); $pdf->Ln(5); $pdf->SetFont('Arial', '', 10); $pdf->SetX(120); $pdf->Cell(73, 4, $office['position'], '0', 0, 'C', FALSE); $pdf->SetFont('Arial', 'B', 12); // Statement of CTO signatory $statement_certified = Setting::getField('cto_certification'); $statement_certified_position = Setting::getField('cto_certification_position'); $pdf->Ln(5); $pdf->SetX(22); $pdf->Cell(73, 4, strtoupper($statement_certified), '0', 0, 'C', FALSE); $pdf->Ln(5); $pdf->SetFont('Arial', '', 10); $pdf->SetX(22); $pdf->Cell(73, 4, $statement_certified_position, '0', 0, 'C', FALSE); $pdf->SetFont('Arial', 'B', 12); // ====================Second Form ============= $pdf->Ln(44); $pdf->SetX(12); // write office $pdf->SetFont('Arial', 'B', 10); $pdf->Write(0, $office['office_name']); $pdf->SetFont('Arial', 'B', 12); //lname $pdf->SetX(99); $pdf->Write(0, $name['lname']); //fname $pdf->SetX(145); $pdf->Write(0, $name['fname']); //mname $pdf->SetX(187); $pdf->Write(0, $name['mname'][0] . '.'); $pdf->Ln(10); //date of file $pdf->SetX(20); $pdf->Write(0, $c->date_file); //position $pdf->SetFont('Arial', 'B', 10); $pdf->SetX(63); $pdf->Write(0, $name['position']); $pdf->SetFont('Arial', 'B', 12); //monthly salary $pdf->SetX(140); $pdf->Write(0, 'P ' . number_format($this->Salary_grade->get_monthly_salary($name['salary_grade'], $name['step']), 2)); $pdf->Ln(13); $pdf->SetX(30); $pdf->Write(0, $c->days . ' ' . $days); $pdf->SetX(140); //$pdf->Write(0, 'daily rate here'); $pdf->Ln(13); $pdf->SetX(50); $pdf->Write(0, $this->Helps->get_month_name($c->month) . ' ' . $c->dates . ', ' . $c->year); $cto_balances_as_of = date("F d, Y", strtotime($c->date_file . "-1 day")); $pdf->Ln(30); $pdf->SetX(30); //$pdf->Write(0, $cto_balances_as_of); $pdf->Ln(10); $pdf->SetX(35); //$pdf->Write(0, $total_balance); $pdf->Ln(6); $pdf->SetX(120); $pdf->Cell(73, 4, strtoupper($office['office_head']), '0', 0, 'C', FALSE); $pdf->Ln(5); $pdf->SetFont('Arial', '', 10); $pdf->SetX(120); $pdf->Cell(73, 4, $office['position'], '0', 0, 'C', FALSE); $pdf->SetFont('Arial', 'B', 12); $pdf->Ln(5); $pdf->SetX(22); $pdf->Cell(73, 4, strtoupper($statement_certified), '0', 0, 'C', FALSE); $pdf->Ln(5); $pdf->SetFont('Arial', '', 10); $pdf->SetX(22); $pdf->Cell(73, 4, $statement_certified_position, '0', 0, 'C', FALSE); $pdf->SetFont('Arial', 'B', 12); header('Cache-Control: maxage=3600'); //Adjust maxage appropriately header('Pragma: public'); $pdf->Output('dtr/reports/cto-apps-' . intval($c->employee_id) . '.pdf', 'I'); //return Redirect::to('dtr/reports/leave-apps-'.$rows['employee_id'].'.pdf', 'refresh'); }
/** * Get DTR by offices and range of date * * @since Version 1.0 * @param int $office_id * @param string(date) $date * @param string(date) $date2 * @param varchar $employee_id * @param bool $flex * @return array */ function get_office_dtr($office_id, $date, $date2 = '', $employee_id = '', $flex = '') { $data = array(); $rows = array(); $this->Employee->fields = array('employee_id', 'office_id'); $employees = $this->Employee->get_employee_list($office_id, ''); $days = $this->Helps->get_days_in_between($date, $date2); // If uses for single employee only if ($employee_id != '') { $employees = array(array('employee_id' => $employee_id)); } // Add new dates in the view dtr even if this is blank foreach ($employees as $employee) { $office_id2 = $this->Employee->get_single_field('office_id', $employee['employee_id']); foreach ($days as $day) { // Insert to dtr if the log_date and employee id // is not in the dtr table $is_log_date_exists = $this->is_log_date_exists($employee['employee_id'], $day); if ($is_log_date_exists === FALSE) { // Insert blank dtr $this->insert_blank_dtr($office_id2, $employee['employee_id'], $day); } } } $this->db->select('dtr.id, dtr.employee_id, dtr.am_login, dtr.am_logout, dtr.pm_login, dtr.pm_logout, dtr.ot_login, dtr.ot_logout, dtr.log_date, dtr.manual_log_id, dtr.office_id, dtr.orig_dtr, employee.lname, employee.fname, employee.shift_type'); $this->db->from('dtr'); $this->db->join('employee', 'dtr.employee_id = employee.employee_id'); //$this->db->where('dtr.employee_id', $employee_id); // if ($this->double_incomplete == FALSE) { $this->db->where('employee.office_id', $office_id); } $this->db->where("dtr.log_date BETWEEN '{$date}' AND '{$date2}'"); if ($this->double_incomplete == TRUE) { // Get offices(internal) $o = new Office_m(); $o->where('office_location', 'internal'); $offices = $o->get(); foreach ($offices as $office) { $off[] = $office->office_id; } $this->db->where_in('employee.office_id', $off); $this->db->where("(ats_dtr.am_login = '' OR `ats_dtr`.`pm_login` = '' OR `ats_dtr`.`am_logout` = '' OR `ats_dtr`.`pm_logout` = '')"); } $this->db->order_by('dtr.office_id, employee.lname, employee.fname, dtr.log_date'); $q = $this->db->get(); //echo $this->db->last_query(); // GSO LAGUNA // ORDER BY ".TABLEPREF."dtr.am_login, ".TABLEPREF."employee.lname"; // $this->db->order_by('dtr.am_login, employee.lname'); // If uses for single employee only if ($employee_id != '') { $this->db->select('dtr.id, dtr.employee_id, dtr.am_login, dtr.am_logout, dtr.pm_login, dtr.pm_logout, dtr.ot_login, dtr.ot_logout, dtr.log_date, dtr.manual_log_id, dtr.office_id, dtr.orig_dtr, employee.lname, employee.fname, employee.shift_type'); $this->db->from('dtr'); $this->db->join('employee', 'dtr.employee_id = employee.employee_id'); $this->db->where('dtr.employee_id', $employee_id); $this->db->where("dtr.log_date BETWEEN '{$date}' AND '{$date2}'"); $this->db->order_by('dtr.log_date'); $q = $this->db->get(); // Check what type of user is logged // If leave manager $this->load->library('session'); if (Session::get('user_type') == 5) { // If the office is not equal to office id of user logged if (Session::get('office_id') != $employee['office_id']) { //echo '<font color="red">You are not allowed to view this records!</font>'; //return ; $this->db->where('id', 0); $q = $this->db->get('dtr'); } } } if ($q->num_rows() > 0) { foreach ($q->result_array() as $row) { $data[] = $row; } } return $data; $q->free_result(); }
function divisions($office_id = '') { $o = new Office_m(); $o->get_by_office_id($office_id); $data['page_name'] = '<b>Divisions of "' . $o->office_name . '"</b>'; $data['msg'] = ''; $this->load->library('pagination'); $divisions = new Division(); $config['base_url'] = base_url() . 'training_manage/course'; $config['total_rows'] = $divisions->count(); $config['per_page'] = '15'; $config['full_tag_open'] = '<p>'; $config['full_tag_close'] = '</p>'; $this->pagination->initialize($config); // How many related records we want to limit ourselves to $limit = $config['per_page']; // Set the offset for our paging $offset = $this->uri->segment(4); $divisions->where('office_id', $office_id); $divisions->order_by('name'); $data['rows'] = $divisions->get($limit, $offset); $data['office_id'] = $office_id; $data['page'] = $this->uri->segment(3); $data['main_content'] = 'divisions'; return View::make('includes/template', $data); }
function back_id($results) { $params = array('mode' => '', 'format' => 'Legal', 'default_font_size' => 0, 'default_font' => '', 'mgl' => '0', 'mgr' => '0', 'mgt' => '0', 'mgb' => '0', 'mgh' => '0', 'mgf' => '0', 'orientation' => 'P'); $this->load->library('mpdf', $params); // LOAD a stylesheet //$this->mpdf->SetHTMLHeader('<div align="center" style="font-size:15">LAGUNA UNIVERSITY PROPERTY INVENTORY SYSTEM<div>'); $stylesheet = file_get_contents(base_url() . 'css/mpdf/mpdfstyletables.css'); $this->mpdf->WriteHTML($stylesheet, 1); // The parameter 1 tells that this is css/style only and no body/html/text //$today = date("F, l, d, Y - H:i:s a"); //$this->mpdf->SetFooter($today.'||{PAGENO} of {nbpg}'); $tbl_start_b = '<table border="0"><tr>'; $this->mpdf->WriteHTML($tbl_start_b); $x = '4'; //4 start counting $y = '0'; foreach ($results as $result) { //get info from PDS table $p = new Pds_personal_info_m(); $row = $p->get_by_employee_id($result->employee_id); //get info from Employee table $e = new Employee_m(); $e_row = $e->get_by_id($val); $blood_type = ''; if (strlen($row->blood_type) >= 1) { $blood_type = """ . $row->blood_type . """; } $y++; $o = new Office_m(); $office = $o->get_by_office_id($e_row->office_id); $html_f = '<td align="center"> <table border="0" width="205" height="320" style="background-image: url(images/id/id-back.png) no-repeat; font-size:9px; font-family:Arial" > <tr><td height="12" colspan="2"></td></tr> <tr> <td width="20%" height="37" align="left">ADDRESS:</td> <td align="center">' . ucwords(strtolower($row->permanent_address)) . '</td> </tr> <tr> <td height="18" align="left" valign="bottom">BIRTHDAY:</td> <td align="center" valign="bottom">' . $row->birth_date . '</td> </tr> <tr> <td height="18" align="left" valign="bottom">BLOOD TYPE:</td> <td align="center" valign="bottom">' . $blood_type . '</td> </tr> <tr> <td height="18" align="left" valign="bottom">GSIS:</td> <td align="center" valign="bottom">' . $row->gsis . '</td> </tr> <tr> <td height="20" align="left" valign="bottom">PAG-IBIG:</td> <td align="center" valign="bottom">' . $row->pagibig . '</td> </tr> <tr> <td height="20" align="left" valign="bottom">PHILHEALTH:</td> <td align="center" valign="bottom">' . $row->philhealth . '</td> </tr> <tr> <td height="20" align="left" valign="bottom">TIN:</td> <td align="center" valign="bottom">' . $row->tin . '</td> </tr> <tr> <td height="10" colspan="2" align="center"> This card must be surrendered immediately upon termination or separation from service. if found. please send or mail to</td> </tr> <tr> <td align="center" colspan="2"> <b>Provincial Government of Laguna<br>' . $office->office_name . '</b> <br>' . $office->office_address . ' </td> </tr> <tr> <td align="center" colspan="2" height="20" valign="bottom"><b>IN CASE OF EMERGENCY, PLEASE NOTIFY:</b></td> </tr> <tr> <td align="center" colspan="2"><b> <br /> </b></td> </tr> <tr> <td align="center" height="61" colspan="2" style="background-image: url(images/id/gov.signiture.png) no-repeat;"> </td> </tr> </table></td>'; if ($y == $x) { $html_f = ' <tr><td align="center"> <table border="0" width="205" height="320" style="background-image: url(images/id/id-back.png) no-repeat; font-size:9px; font-family:Arial" > <tr><td height="12" colspan="2"></td></tr> <tr> <td width="20%" height="37" align="left">ADDRESS:</td> <td align="center">' . ucwords(strtolower($row->permanent_address)) . '</td> </tr> <tr> <td height="18" align="left" valign="bottom">BIRTHDAY:</td> <td align="center" valign="bottom">' . $row->birth_date . '</td> </tr> <tr> <td height="18" align="left" valign="bottom">BLOOD TYPE:</td> <td align="center" valign="bottom">' . $blood_type . '</td> </tr> <tr> <td height="18" align="left" valign="bottom">GSIS:</td> <td align="center" valign="bottom">' . $row->gsis . '</td> </tr> <tr> <td height="20" align="left" valign="bottom">PAG-IBIG:</td> <td align="center" valign="bottom">' . $row->pagibig . '</td> </tr> <tr> <td height="20" align="left" valign="bottom">PHILHEALTH:</td> <td align="center" valign="bottom">' . $row->philhealth . '</td> </tr> <tr> <td height="20" align="left" valign="bottom">TIN:</td> <td align="center" valign="bottom">' . $row->tin . '</td> </tr> <tr> <td height="10" colspan="2" align="center"> This card must be surrendered immediately upon termination or separation from service. if found. please send or mail to</td> </tr> <tr> <td align="center" colspan="2"> <b>Provincial Government of Laguna<br>' . $office->office_name . '</b> <br>' . $office->office_address . ' </td> </tr> <tr> <td align="center" colspan="2" height="20" valign="bottom"><b>IN CASE OF EMERGENCY, PLEASE NOTIFY:</b></td> </tr> <tr> <td align="center" colspan="2"><b> <br /> </b></td> </tr> <tr> <td align="center" height="61" colspan="2" style="background-image: url(images/id/gov.signiture.png) no-repeat;"> </td> </tr> </table></td></tr>'; $x = $x + 3; //3 count of generated id per column } $this->mpdf->WriteHTML($html_f); } $tbl_end_b = '</tr></table>'; $this->mpdf->WriteHTML($tbl_end_b); header('Cache-Control: maxage=3600'); //Adjust maxage appropriately header('Pragma: public'); $this->mpdf->Output('dtr/template/id_generated/back_id.pdf', 'F'); return TRUE; }
?> <div class="clean-green"><?php echo Session::flashData('msg'); ?> </div> <?php } else { } ?> <form action="" method="post"> <table width="100%" border="0" cellpadding="5" cellspacing="5"> <tr> <td align="right"><strong>Office:</strong></td> <td> <?php $o = new Office_m(); $o->get_by_office_id($office_id); echo $o->office_name; ?> </td> <td></td> </tr> <tr> <td align="right"><strong>Division Name:</strong></td> <td><input name="name" type="text" id="name" value="<?php echo $division->name; ?> " size="50" /></td> <td></td> </tr> <tr>
<?php //output the data $x = 2; $y = 1; $rows = $this->Office_pass->get_office_pass(50); $office = ''; foreach ($rows as $row) { $id = $row['id']; $employee_id = $row['employee_id']; $date = $row['date']; $time_out = $row['time_out']; $time_in = $row['time_in']; $seconds = $row['seconds']; $this->Employee->fields = array('lname', 'fname', 'mname', 'office_id'); $employee = $this->Employee->get_employee_info($employee_id); $office = new Office_m(); $office->get_by_office_id($employee['office_id']); $bg = $this->Helps->set_line_colors(); ?> <tr bgcolor="<?php echo $bg; ?> " onmouseover="this.bgColor = '<?php echo $this->config->item('mouseover_linecolor'); ?> ';" onmouseout ="this.bgColor = '<?php echo $bg; ?> ';" style="border-bottom: 1px solid #999999;"> <td bgcolor=""><input name="employee[]" type="checkbox" value="<?php
function preview($rows, $report_name = '') { $html = ' <table width="100%" border="0"> <tr> <td colspan="3" align="center">' . $report_name . '</td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> </table> <table width="100%" border="1"> <tbody><tr> <td width="10%"><strong>Employee ID</strong></td> <td width="9%"><strong>Name</strong></td> <td width="4%"><strong>Sex</strong></td> <td width="10%"><strong>Position/<br /> Designation</strong></td> <td width="13%"><strong>Office / Department</strong></td> <td width="11%"><strong>Employment Status</strong></td> <td width="6%"><strong>Salary Grade</strong></td> <td width="9%"><strong>Eligibility</strong></td> <td width="11%"><strong>Education</strong></td> <td width="8%"><strong>Birthday</strong></td> <td width="9%"><strong>Address</strong></td></tr>'; $params = array('format' => 'Letter-L'); $this->load->library('mpdf', $params); // LOAD a stylesheet $stylesheet = file_get_contents(base_url() . 'css/mpdf/mpdfstyletables.css'); $this->mpdf->WriteHTML($stylesheet, 1); // The parameter 1 tells that this is css/style only and no body/html/text $this->mpdf->WriteHTML($html); $office = new Office_m(); foreach ($rows as $row) { $office->get_by_office_id($row->office_id); $type_employment = $this->options->type_employment(); $birth_date = $row->birth_date; if ($row->birth_date == '0000-00-00') { $birth_date = ''; } $entry = ' <tr> <td>' . $row->employee_id . '</td> <td>' . $row->lname . ',' . $row->fname . ' ' . $row->mname . '</td> <td>' . $row->sex . '</td> <td>' . $row->position . '</td> <td>' . $office->office_name . '</td> <td>' . $type_employment[$row->permanent] . '</td> <td>' . $row->salary_grade . '/' . $row->step . '</td> <td>' . $row->eligibility . '</td> <td>' . $row->education . '</td> <td>' . $birth_date . '</td> <td>' . $row->res_address . '</td> </tr>'; $this->mpdf->WriteHTML($entry); } $signatories = ' <tr><td><p> </p></td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td><td> </td></tr> </tbody></table>'; // Signatories $sr_prepared = Setting::getField('sr_prepared'); $sr_prepared_position = Setting::getField('sr_prepared_position'); $sr_certified = Setting::getField('sr_certified'); $sr_certified_position = Setting::getField('sr_certified_position'); $signatories .= ' <table width="100%" border="0"> <tr> <td width="38%"> </td> <td width="23%"> </td> <td width="39%"> </td> </tr> <tr> <td align="center">PREPARED BY:</td> <td> </td> <td align="center">CERTIFIED CORRECT:</td> </tr> <tr> <td align="center"> </td> <td> </td> <td align="center"> </td> </tr> <tr> <td align="center"> </td> <td> </td> <td align="center"> </td> </tr> <tr> <td align="center">' . $sr_prepared . '</td> <td> </td> <td align="center">' . $sr_certified . '</td> </tr> <tr> <td align="center">' . $sr_prepared_position . '</td> <td> </td> <td align="center">' . $sr_certified_position . '</td> </tr> </table> '; $this->mpdf->WriteHTML($signatories); $this->mpdf->Output('dtr/template/pds/archives/pds_' . date('Y_m_d') . '.pdf', 'F'); return 'dtr/template/pds/archives/pds_' . date('Y_m_d') . '.pdf'; exit; $this->load->helper('settings'); $this->load->library('fpdf'); //define('FPDF_FONTPATH',$this->config->item('fonts_path')); $this->load->library('fpdi'); // initiate FPDI $pdf = new FPDI('L', 'mm', 'Letter'); // add a page $pdf->AddPage(); // set the sourcefile //$pdf->setSourceFile('dtr/template/service_record/service_record.pdf'); // import page 1 //$tplIdx = $pdf->importPage(1); // use the imported page and place it at point 10,10 with a width of 100 mm //$pdf->useTemplate($tplIdx, 1, 1, 210); // now write some text above the imported page $pdf->SetFont('Arial'); $pdf->SetTextColor(0, 0, 0); $pdf->SetXY(15, 60); $pdf->SetFont('Arial', '', 16); $pdf->Cell(0, 3, "Report Name", '', 1, 'C', false); //$pdf->Ln(4); //$e = new Employee_m(); //$e->get_by_employee_id( $employee_id ); $pdf->SetFont('Arial', '', 12); //$pdf->Cell(0,8,"Employee No.:".$e->id ,'',1,'L',false); //$pdf->Ln(2); //$pdf->SetFont('Arial', '', 12); //$pdf->Cell(0,8,"Employee Name:".$e->lname.', '.$e->fname.' '.$e->mname ,'',1,'L',false); $pdf->Ln(4); $pdf->Cell(0, 8, "Emp ID Name Sex Position/Designation Office Employment Status Salary Grade Eligibility Education Birth Day Address", '1', 1, 'L', false); $pdf->Ln(4); $i = 1; $this->load->helper('text'); //$pdf->Cell(30,12, word_wrap('msayado maahhn ndhah ahhhehe so ano gagawin mo now', 10) ,'1',1,'L',false); //$pdf->MultiCell(30,3,word_wrap("hello this is a sample nlong text with line break ", 15) ,'1',1,'L',false); //$pdf->MultiCell(30,3,word_wrap("hello this is a sample nlong text with line break ", 15) ,'0',1,'L',false); foreach ($rows as $row) { $pdf->SetFont('Arial', '', 11); $pdf->SetX(10); //$pdf->Write(0, $row->id); $pdf->Cell(15, 12, $row->id, '1', 0, 'L', false); $pdf->SetX(29); //$pdf->Write(0, $row->lname.', '.$row->fname.''.$row->mname); $pdf->Cell(30, 12, word_wrap($row->lname . ', ' . $row->fname . '' . $row->mname, 10), '1', 1, 'L', false); $pdf->SetFont('Arial', '', 8); $pdf->SetX(62); $pdf->Write(0, $row->sex); $pdf->SetX(75); //$pdf->Write(0, $row->company); $pdf->Write(0, $row->position); //$pdf->SetFont('Arial', '', 12); $pdf->SetX(160); $pdf->Write(0, $row->movement); //$pdf->SetX(150); //$pdf->Write(0, $row->salary_grade); $pdf->SetFont('Arial', '', 8); $pdf->SetX(185); //$pdf->Write(0, $row->status); if ($row->govt_service == 1) { $row->govt_service = 'Yes'; } else { $row->govt_service = 'No'; } $pdf->SetX(190); //$pdf->Write(0, $row->govt_service); $pdf->SetFont('Arial', '', 12); if ($i == 6 || $i == 10 || $i == 13 || $i == 16 || $i == 19 || $i == 22) { $pdf->Ln(8); } else { $pdf->Ln(7); } $i++; } $pdf->Cell(0, 8, "--------------------------------------------------------- Nothing Follows ---------------------------------------------------------", '', 1, 'C', false); // Signatories $pdf->Ln(15); $pdf->SetX(20); $pdf->Cell(90, 5, "PREPARED BY:", '0', 0, 'C', false); $pdf->Cell(90, 5, "CERTIFIED CORRECT:", '0', 1, 'C', false); $pdf->Ln(10); $sr_prepared = Setting::getField('sr_prepared'); $sr_prepared_position = Setting::getField('sr_prepared_position'); $sr_certified = Setting::getField('sr_certified'); $sr_certified_position = Setting::getField('sr_certified_position'); $pdf->SetX(20); $pdf->Cell(90, 5, $sr_prepared, '0', 0, 'C', false); //4th param border $pdf->Cell(90, 5, $sr_certified, '0', 1, 'C', false); $pdf->SetX(20); $pdf->Cell(90, 5, $sr_prepared_position, '0', 0, 'C', false); $pdf->Cell(90, 5, $sr_certified_position, '0', 1, 'C', false); // Output $pdf->Output('dtr/template/pds/archives/pds_' . date('Y_m_d') . '.pdf', 'F'); return 'dtr/template/pds/archives/pds_' . date('Y_m_d') . '.pdf'; }