function up()
 {
     $lgu_code = Setting::getField('lgu_code');
     if ($lgu_code == '') {
         if ($this->db->table_exists('pds_work_experience')) {
             $this->db->where('govt_service', 1);
             $this->db->order_by('id');
             $q = $this->db->get('pds_work_experience');
             if ($q->num_rows() > 0) {
                 foreach ($q->result_array() as $row) {
                     $s = new Service_record();
                     $s->employee_id = $row['employee_id'];
                     $s->date_from = $row['inclusive_date_from'];
                     $s->date_to = $row['inclusive_date_to'];
                     $s->designation = $row['position'];
                     $s->status = $row['status'];
                     $s->salary = $row['monthly_salary'];
                     $s->office_entity = $row['company'];
                     $s->save();
                 }
             }
         }
     }
 }
Пример #2
0
    function sr_print_preview($employee_id = '', $report_name = '')
    {
        $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');
        $logo = 'dtr/template/logo/logo.jpg';
        // Laguna Province
        if ($lgu_code == 'laguna_province') {
            $logo = 'dtr/template/laguna_province/logo.jpg';
        }
        $employee = new Employee_m();
        $employee->get_by_id($employee_id);
        $personal = new Personal();
        $personal->get_by_employee_id($employee_id);
        // 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');
        $service = '<table width="100%" border="0" cellpadding="5" cellspacing="5">
  <tr>
    <td colspan="5" align="center" style="font-size:25px"><strong>SERVICE RECORD</strong></td>
  </tr>
  <tr>
    <td width="24%" align="left"><strong>Employee Number :</strong></td>
    <td width="22%"><b>' . $employee->employee_id . '</b></td>
    <td width="15%">&nbsp;</td>
    <td width="29%">&nbsp;</td>
    <td width="10%">&nbsp;</td>
  </tr>
  <tr>
    <td align="left"><strong>Name :</strong></td>
    <td colspan="3" style="font-family:\'Times New Roman\', Times, serif"><em><b>' . $employee->lname . ',   ' . $employee->fname . '    ' . $employee->mname . '</b></em></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td align="left"><strong>Birthday :</strong></td>
    <td><em><b>' . $employee->birth_date . '</b></em></td>
    <td align="right"><strong>Birthplace :</strong></td>
    <td><em><b>' . $personal->birth_place . '</b></em></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td colspan="5" align="left" style="font-size:11px"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<em>This is to certify that the employee named herein above actually rendered services in this Office as shown by the service record below, each line of which is supported by appointment and other papers actually issued by this Office and approved by the authorities concerned.</em></td>
  </tr>
</table>


<table width="100%" border="1">
  <tr>
    <td colspan="2" align="center" valign="middle">SERVICE<br />
    (Inclusive Date)</td>
    <td colspan="3" align="center" valign="middle">RECORDS OF APPOINTMENT</td>
    <td align="center" valign="middle">OFFICE ENTITY / DIVISION</td>
    <td align="center" valign="middle">L/V ABS<br />
    W/O PAY</td>
    <td colspan="2" align="center" valign="middle">SEPARATION</td>
  </tr>
  <tr>
    <td align="center">From</td>
    <td align="center">To</td>
    <td align="center">Designation</td>
    <td align="center">Status</td>
    <td align="center">Salary</td>
    <td align="center">Station/Place of Assignment/Branch</td>
    <td align="center">&nbsp;</td>
    <td align="center">Date</td>
    <td align="center">Cause</td>
  </tr>



';
        $html = '
<!-- defines the headers/footers - this must occur before the headers/footers are set -->

<!--mpdf
<htmlpagefooter name="myfooter">
<table width="100%">
  <tr>
    <td colspan="3" align="center">-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --  </td>
  </tr>
  <tr>
    <td colspan="3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Issued in compliance with Executive Order No. 54 Dated August 10, 1954, and in accordance with Circular No. 58, dated August 10, 1954, of the System.</td>
  </tr>
  <tr>
    <td width="19%">&nbsp;</td>
    <td width="42%">&nbsp;</td>
    <td width="39%">&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td align="center">PREPARED BY</td>
    <td align="center">CERTIFIED CORRECT</td>
  </tr>
  <tr>
    <td align="center">' . date('F d, Y') . '</td>
    <td align="center">&nbsp;</td>
    <td align="center">&nbsp;</td>
  </tr>
  <tr>
    <td align="center">Date</td>
    <td align="center">&nbsp;</td>
    <td align="center">&nbsp;</td>
  </tr>
  <tr>
    <td align="center">&nbsp;</td>
    <td align="center">' . $sr_prepared . '</td>
    <td align="center">' . $sr_certified . '</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td align="center">' . $sr_prepared_position . '</td>
    <td align="center">' . $sr_certified_position . '</td>
  </tr>
</table></htmlpagefooter>

mpdf-->

<!-- set the headers/footers - they will occur from here on in the document -->
<!--mpdf
<sethtmlpagefooter name="myfooter" page="all" value="1"/>
mpdf-->

<table width="100%" border="0">
  <tr>
    <td>&nbsp;</td>
    <td align="center" style="font-family:\'Times New Roman\', Times, serif"><b><em>' . $a . '</em></b></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td align="center" style="font-family:\'Times New Roman\', Times, serif"><b><em>' . $b . '</em></b></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td align="center" style="font-family:\'Times New Roman\', Times, serif"><b><em>' . $c . '</em></b></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td align="center" style="font-family:\'Times New Roman\', Times, serif"><b><em>' . $d . '</em></b></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
<style type="text/css">
#apDiv1 {
	position:absolute;
	width:104px;
	height:106px;
	z-index:1;
	left: 100px;
	top: 55px;
}
</style>
<div id="apDiv1"><img src="' . base_url() . $logo . '" alt="" name="logo" width="110" height="110"/></div>

' . $service;
        $s = new Service_record();
        //$s->order_by('date_from');
        $s->select('id, employee_id, date_from, date_to, designation, status, salary, office_entity, branch, remarks, lwop, separation_date, separation_cause, STR_TO_DATE(date_from,"%m/%d/%Y") as nice_date', false);
        $s->order_by("nice_date");
        $rows = $s->get_by_employee_id($employee_id);
        $i = 1;
        // Number of entries to display per page
        $first_page = Setting::getField('service_record_entries_first_page');
        $second_page = Setting::getField('service_record_entries_second_page');
        $third_page = Setting::getField('service_record_entries_3rd_page');
        $fourth_page = Setting::getField('service_record_entries_4th_page');
        //for ($i ==0; $i != 70; $i ++)
        foreach ($rows as $row) {
            $number_character = strlen($row->designation . $row->salary . $row->salary . $row->office_entity . $row->lwop . $row->separation_date . $row->separation_cause);
            $html .= '<tr>
				<td align="center">' . $row->date_from . '</td>
				<td align="center">' . $row->date_to . '</td>
				<td align="center">' . $row->designation . '</td>
				<td align="center">' . $row->status . '</td>
				<td align="right">' . $row->salary . '</td>
				<td align="center">' . $row->office_entity . '</td>
				<td align="left">' . $row->lwop . '</td>
				<td align="left">' . $row->separation_date . '</td>
				<td align="left" style="font-size:7">' . $row->separation_cause . '</td>
			  </tr>';
            // Second page
            if ($i == $first_page) {
                $html .= '</table>';
                // close the table
                $html .= '<pagebreak />' . $service;
            }
            // If there is third page
            if ($i == $first_page + $second_page) {
                $html .= '</table>';
                // close the table
                $html .= '<pagebreak />' . $service;
            }
            // If there is 4th page
            if ($i == $first_page + $second_page + $third_page) {
                $html .= '</table>';
                // close the table
                $html .= '<pagebreak />' . $service;
            }
            // If there is 5th page
            if ($i == $first_page + $second_page + $third_page + $fourth_page) {
                $html .= '</table>';
                // close the table
                $html .= '<pagebreak />' . $service;
            }
            $i++;
        }
        $html .= '</table>';
        //$html.='
        //<pagebreak />
        //'.$service.'</table>
        //<pagebreak />
        //';
        $params = array('format' => 'Letter');
        $params = array('format' => 'Legal');
        $params = array('format' => Setting::getField('service_record_paper_size'));
        $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->SetHTMLHeader('Page {PAGENO} of {nb}', '', false);
        //$this->mpdf->SetHTMLFooter('{PAGENO}');
        $this->mpdf->WriteHTML($html);
        $this->mpdf->Output();
    }