Ejemplo n.º 1
0
 function examination($employee_id = '')
 {
     $data['page_name'] = '<b>Personal Data Sheet</b>';
     $data['section_name'] = '<b>Personal Information</b>';
     $data['focus_field'] = 'type';
     $data['msg'] = '';
     $e = new Employee_m();
     $data['employee'] = $e->get_by_id($employee_id);
     if (Input::get('op')) {
         $eligibility = new Eligibility();
         $eligibility->where('employee_id', $employee_id)->get();
         $eligibility->delete_all();
         // SERVICE ELIGIBILITY=================================
         $types = Input::get('type');
         $rating = Input::get('rating');
         $date_exam_conferment = Input::get('date_exam_conferment');
         $place_exam_conferment = Input::get('place_exam_conferment');
         $license_no = Input::get('license_no');
         $license_release_date = Input::get('license_release_date');
         $i = 0;
         foreach ($types as $type) {
             if ($type != "") {
                 $e = new Eligibility();
                 $e->employee_id = $employee_id;
                 $e->type = $types[$i];
                 $e->rating = $rating[$i];
                 $e->date_exam_conferment = $date_exam_conferment[$i];
                 $e->place_exam_conferment = $place_exam_conferment[$i];
                 $e->license_no = $license_no[$i];
                 $e->license_release_date = $license_release_date[$i];
                 $e->save();
             }
             $i++;
         }
         $data['msg'] = 'Examinations has been saved!';
     }
     $e = new Eligibility();
     // Service ===========================================================
     $e->order_by('id');
     $services = $e->get_by_employee_id($employee_id);
     $i = 0;
     foreach ($services as $service) {
         $data['services']['type'][] = $service->type;
         $data['services']['rating'][] = $service->rating;
         $data['services']['date_exam_conferment'][] = $service->date_exam_conferment;
         $data['services']['place_exam_conferment'][] = $service->place_exam_conferment;
         $data['services']['license_no'][] = $service->license_no;
         $data['services']['license_release_date'][] = $service->license_release_date;
         $i++;
     }
     if ($i <= 7) {
         while ($i != 7) {
             $data['services']['type'][] = '';
             $data['services']['rating'][] = '';
             $data['services']['date_exam_conferment'][] = '';
             $data['services']['place_exam_conferment'][] = '';
             $data['services']['license_no'][] = '';
             $data['services']['license_release_date'][] = '';
             $i++;
         }
     }
     $e = new Employee_m();
     $e->get_by_id($employee_id);
     $data['selected'] = $e->office_id;
     //Use for office listbox
     $data['options'] = $this->options->office_options();
     $data['employee_id'] = $employee_id;
     $data['main_content'] = 'examination';
     return View::make('includes/template', $data);
 }
Ejemplo n.º 2
0
 function page2($employee_id)
 {
     $this->load->helper('settings');
     $this->load->library('fpdf');
     $this->load->library('fpdi');
     // initiate FPDI
     $pdf = new FPDI('P', 'mm', 'Legal');
     // add a page
     $pdf->AddPage();
     // set the sourcefile
     $pdf->setSourceFile('dtr/template/pds/page2.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, 32);
     $e = new Eligibility();
     //$eligs = $this->Eligibility->get_eligibility($employee_id);
     $eligs = $e->get_by_employee_id($employee_id);
     $i = 1;
     $this->load->helper('text');
     foreach ($eligs as $elig) {
         $pdf->SetFont('Arial', '', 7);
         $pdf->SetX(8);
         //$pdf->Write(0, character_limiter($elig->type, 20));
         $pdf->Write(0, str_replace('&#8230;', '..', character_limiter($elig->type, 25)));
         //$pdf->MultiCell(51,3,word_wrap($elig->type, 30) ,'',1,'L',true);
         $pdf->SetX(58);
         $pdf->Write(0, $elig->rating);
         $pdf->SetX(75);
         $pdf->Write(0, $elig->date_exam_conferment);
         $pdf->SetX(98);
         $pdf->Write(0, $elig->place_exam_conferment);
         $pdf->SetX(167);
         $pdf->Write(0, $elig->license_no);
         $pdf->SetFont('Arial', '', 8);
         $pdf->SetX(188);
         $pdf->Write(0, $elig->license_release_date);
         $pdf->SetFont('Arial', '', 12);
         if ($i == 2 || $i == 6) {
             $pdf->Ln(8);
         } else {
             $pdf->Ln(7);
         }
         $i++;
     }
     //work ===================================================================================================
     $pdf->SetXY(8, 115);
     $work = new Work();
     // $work->limit(25);
     $work->order_by('inclusive_date_from', 'DESC');
     $works = $work->get_by_employee_id($employee_id);
     $i = 1;
     $this->load->helper('text');
     foreach ($works as $work) {
         $pdf->SetFont('Arial', '', 8);
         $pdf->SetX(7);
         list($year, $month, $day) = explode('-', $work->inclusive_date_from);
         $inclusive_date_from = $month . '/' . $day . '/' . $year;
         $pdf->Write(0, $inclusive_date_from);
         list($year, $month, $day) = explode('-', $work->inclusive_date_to);
         $inclusive_date_to = $month . '/' . $day . '/' . $year;
         if ($work->inclusive_date_to == 'Present') {
             $inclusive_date_to = 'Present';
         }
         $pdf->SetX(22);
         $pdf->Write(0, $inclusive_date_to);
         $pdf->SetFont('Arial', '', 8);
         $pdf->SetX(39);
         $pdf->Write(0, str_replace('&#8230;', '..', character_limiter($work->position, 20)));
         $pdf->SetX(75);
         //$pdf->Write(0, $work->company);
         $pdf->Write(0, str_replace('&#8230;', '..', character_limiter($work->company, 35)));
         //$pdf->SetFont('Arial', '', 12);
         $pdf->SetX(132);
         $pdf->Write(0, $work->monthly_salary);
         $pdf->SetX(150);
         $pdf->Write(0, $work->salary_grade);
         $pdf->SetFont('Arial', '', 8);
         $pdf->SetX(166);
         $pdf->Write(0, $work->status);
         if ($work->govt_service == 1) {
             $work->govt_service = 'Yes';
         } else {
             $work->govt_service = 'No';
         }
         $pdf->SetX(190);
         $pdf->Write(0, $work->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);
         }
         if ($i == 25) {
             //break;
             $pdf->AddPage();
         }
         $i++;
     }
     // Output
     $pdf->Output('dtr/template/pds/page2_' . $employee_id . '.pdf', 'F');
     //header("location:".base_url()."resources/pdfs/archives/page2_".$employee_id.'.pdf');
     $this->pds[] = 'dtr/template/pds/page2_' . $employee_id . '.pdf';
 }