Example #1
0
 function page3($employee_id)
 {
     $this->load->helper('settings');
     $this->load->library('fpdf');
     //define('FPDF_FONTPATH',$this->config->item('fonts_path'));
     $this->load->library('fpdi');
     //print_r($personal_info);
     // initiate FPDI
     $pdf = new FPDI('P', 'mm', 'Legal');
     // add a page
     $pdf->AddPage();
     // set the sourcefile
     $pdf->setSourceFile('dtr/template/pds/page3.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(8, 31);
     $org = new Organization();
     $orgs = $org->get_by_employee_id($employee_id);
     $i = 1;
     foreach ($orgs as $org) {
         $pdf->SetX(8);
         $pdf->Write(0, $org->name);
         $pdf->SetFont('Arial', '', 8);
         $pdf->SetX(95);
         $pdf->Write(0, $org->inclusive_date_from);
         $pdf->SetX(117);
         $pdf->Write(0, $org->inclusive_date_from);
         $pdf->SetFont('Arial', '', 12);
         $pdf->SetX(138);
         $pdf->Write(0, $org->number_of_hours);
         $pdf->SetX(155);
         $pdf->Write(0, $org->position);
         $pdf->SetX(188);
         $pdf->Write(0, $org->license_release_date);
         $pdf->SetFont('Arial', '', 12);
         if ($i == 2 || $i == 6) {
             $pdf->Ln(8);
         } else {
             $pdf->Ln(7);
         }
         $i++;
     }
     // ther info
     $pdf->SetXY(8, 258);
     $i = new Other_info();
     $infos = $i->get_by_employee_id($employee_id);
     $i = 1;
     foreach ($infos as $info) {
         $pdf->SetFont('Arial', '', 8);
         $pdf->SetX(8);
         $pdf->Write(0, $info->special_skills);
         $pdf->SetX(58);
         $pdf->Write(0, $info->recognition);
         $pdf->SetX(155);
         //$pdf->Write(0, $info->membership_organization);
         $pdf->Write(0, str_replace('…', '..', character_limiter($info->membership_organization, 25)));
         $pdf->SetX(138);
         $pdf->Write(0, $info->number_hours);
         $pdf->SetX(155);
         $pdf->Write(0, $info->conducted_by);
         $pdf->SetFont('Arial', '', 12);
         if ($i == 6 || $i == 10 || $i == 11 || $i == 16) {
             $pdf->Ln(8);
         } else {
             $pdf->Ln(7);
         }
         $i++;
     }
     //Training (we set this code below other info
     // because of long list of trainings
     // but this will be first in page
     $pdf->SetXY(8, 105);
     $t = new Training();
     $t->order_by('date_from', 'DESC');
     // Lets set the limit first
     //
     //$t->limit(18);
     $trainings = $t->get_by_employee_id($employee_id);
     $i = 1;
     foreach ($trainings as $training) {
         $pdf->SetFont('Arial', '', 8);
         $pdf->SetX(8);
         //$pdf->Write(0, $training->name);
         $pdf->Write(0, str_replace('…', '..', character_limiter($training->name, 50)));
         $pdf->SetX(95);
         $pdf->Write(0, $training->date_from);
         $pdf->SetX(117);
         $pdf->Write(0, $training->date_to);
         $pdf->SetX(138);
         $pdf->Write(0, $training->number_hours);
         $pdf->SetX(155);
         //$pdf->Write(0, $training->conducted_by);
         $pdf->Write(0, str_replace('…', '..', character_limiter($training->conducted_by, 25)));
         $pdf->SetFont('Arial', '', 12);
         if ($i == 6 || $i == 10 || $i == 11 || $i == 16) {
             $pdf->Ln(8);
         } else {
             $pdf->Ln(7);
         }
         if ($i == 18) {
             //break;
             $pdf->AddPage();
         }
         $i++;
     }
     // Output
     $pdf->Output('dtr/template/pds/page3_' . $employee_id . '.pdf', 'F');
     //header("location:".base_url()."resources/pdfs/archives/page3_".$employee_id.'.pdf');
     $this->pds[] = 'dtr/template/pds/page3_' . $employee_id . '.pdf';
 }
Example #2
0
    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">&nbsp;</td>
		  </tr>
		  <tr>
		  <td colspan="4" align="center" style="font-family:\'Times New Roman\', Times, serif">&nbsp;</td>
		  </tr>
		  <tr>
			<td colspan="4" align="center" style="font-size:18px;">Employee Training Record</td>
		  </tr>
		  <tr>
			<td width="16%">&nbsp;</td>
			<td width="35%">&nbsp;</td>
			<td width="27%">&nbsp;</td>
			<td width="22%">&nbsp;</td>
		  </tr>
		  <tr>
			<td align="left"><strong>Name:</strong></td>
			<td>' . $employee->lname . ', ' . $employee->fname . ' ' . $employee->mname . '</td>
			<td>&nbsp;</td>
			<td>&nbsp;</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>&nbsp;</td>
		<td>&nbsp;</td>
		<td>&nbsp;</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>&nbsp;</td>
	  <td>&nbsp;</td>
	  <td>&nbsp;</td>
	  <td>&nbsp;</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%">&nbsp;</td>
		<td width="23%">&nbsp;</td>
		<td width="39%">&nbsp;</td>
	  </tr>
	  <tr>
		<td align="center">PREPARED BY:</td>
		<td>&nbsp;</td>
		<td align="center">CERTIFIED CORRECT:</td>
	  </tr>
	  <tr>
		<td align="center">&nbsp;</td>
		<td>&nbsp;</td>
		<td align="center">&nbsp;</td>
	  </tr>
	  <tr>
		<td align="center">&nbsp;</td>
		<td>&nbsp;</td>
		<td align="center">&nbsp;</td>
	  </tr>
	  <tr>
		<td align="center">' . $training_prepared . '</td>
		<td>&nbsp;</td>
		<td align="center">' . $training_certified . '</td>
	  </tr>
	  <tr>
		<td align="center">' . $training_prepared_position . '</td>
		<td>&nbsp;</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');
    }
Example #3
0
 function employees($employee_id = '')
 {
     $data['page_name'] = '<b>Employee\'s Training Record</b>';
     $data['focus_field'] = 'tra_name';
     $data['msg'] = '';
     $employee_id = Input::get('employee_id');
     $e = new Employee_m();
     $data['employee'] = $e->get_by_id(Input::get('employee_id'));
     $data['pics'] = file_exists('pics/' . $e->pics) ? $e->pics : 'not_available.jpg';
     $image_properties = array('src' => base_url() . 'pics/' . $data['pics'], 'width' => '140', 'height' => '140');
     $data['pics'] = $image_properties;
     $em = new Employee_movement_m();
     $em->get_by_id($e->employee_movement_id);
     $data['employment_movement'] = $em->employee_movement;
     if (Input::get('op')) {
         // TRAINING PROGRAMS=========================
         $tra_name = Input::get('tra_name');
         $tra_date_from = Input::get('tra_date_from');
         $tra_date_to = Input::get('tra_date_to');
         $tra_hours = Input::get('tra_hours');
         $tra_conduct = Input::get('tra_conduct');
         $tra_location = Input::get('tra_location');
         $t = new Training();
         $t->get_by_employee_id($employee_id);
         $t->delete_all();
         $i = 0;
         foreach ($tra_name as $tra) {
             if ($tra != "") {
                 $t = new Training();
                 $t->employee_id = $employee_id;
                 $t->name = $tra_name[$i];
                 $t->date_from = $tra_date_from[$i];
                 $t->date_to = $tra_date_to[$i];
                 $t->number_hours = $tra_hours[$i];
                 $t->conducted_by = $tra_conduct[$i];
                 $t->location = $tra_location[$i];
                 $t->save();
             }
             $i++;
         }
         $data['msg'] = 'Trainings has been saved!';
     }
     // Recommended trainings
     if (Input::get('op2')) {
         $recommends = Input::get('recommend_id');
         $reco_year = Input::get('reco_year');
         $course_id = Input::get('course_id');
         $relevant = Input::get('relevant');
         $reco_remarks = Input::get('reco_remarks');
         $i = 0;
         foreach ($recommends as $r_id) {
             if ($reco_year[$i] != '') {
                 $t = new Training_recomended_m();
                 $t->where('course_id', $course_id[$i]);
                 $t->where('reco_year', $reco_year[$i]);
                 $t->where('employee_id', $employee_id);
                 $t->get();
                 $t->employee_id = $employee_id;
                 $t->reco_year = $reco_year[$i];
                 $t->course_id = $course_id[$i];
                 $t->relevant = $relevant[$i];
                 $t->reco_remarks = $reco_remarks[$i];
                 $t->save();
             }
             $i++;
         }
         // Remove checked
         if (Input::get('remove')) {
             foreach (Input::get('remove') as $recommended_id) {
                 $t = new Training_recomended_m();
                 $t->get_by_id($recommended_id);
                 $t->delete();
             }
         }
     }
     // Actual duties
     if (Input::get('op3')) {
         $duties_ids = Input::get('duties_id');
         $duty_from = Input::get('duty_from');
         $duty_to = Input::get('duty_to');
         $duty_desc = Input::get('duty_desc');
         $i = 0;
         foreach ($duties_ids as $r_id) {
             if ($duty_from[$i] != '') {
                 $ed = new Employee_duty_m();
                 $ed->get_by_id($r_id);
                 $ed->employee_id = $employee_id;
                 $ed->duty_from = $duty_from[$i];
                 $ed->duty_to = $duty_to[$i];
                 $ed->duty_desc = $duty_desc[$i];
                 $ed->save();
             }
             $i++;
         }
     }
     // Training===========================================================
     $t = new Training();
     $t->order_by('date_from', 'DESC');
     $data['trains'] = $t->get_by_employee_id($employee_id);
     $data['tra_location_options'] = array('local' => 'Local', 'regional' => 'Regional', 'national' => 'National', 'international' => 'International');
     if ($employee_id == '') {
         $data['trains'] = array();
     }
     // Recommended Trainings
     $t = new Training_recomended_m();
     $t->order_by('reco_year');
     $data['recommends'] = $t->get_by_employee_id($employee_id);
     // Actual Duties
     $ed = new Employee_duty_m();
     $ed->order_by('duty_from');
     $data['duties'] = $ed->get_by_employee_id($employee_id);
     $data['selected'] = $e->office_id;
     //Use for office listbox
     $data['options'] = $this->options->office_options();
     // Courses
     $t = new Training_course();
     $data['courses'] = $t->courses();
     $data['employee_id'] = $employee_id;
     $data['main_content'] = 'employees';
     return View::make('includes/template', $data);
 }