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('…', '..', 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('…', '..', character_limiter($work->position, 20))); $pdf->SetX(75); //$pdf->Write(0, $work->company); $pdf->Write(0, str_replace('…', '..', 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'; }
function work($employee_id = '') { $data['page_name'] = '<b>Personal Data Sheet</b>'; $data['section_name'] = '<b>Personal Information</b>'; $data['focus_field'] = 'work_date1'; $data['msg'] = ''; $e = new Employee_m(); $data['employee'] = $e->get_by_id($employee_id); if (Input::get('op')) { // WORK EXPERIENCE================================= $work_date1 = Input::get('work_date1'); $work_date2 = Input::get('work_date2'); $work_position = Input::get('work_position'); $work_office = Input::get('work_office'); $work_salary = Input::get('work_salary'); $work_sg = Input::get('work_sg'); $work_status = Input::get('work_status'); $movement = Input::get('movement'); $work_service = Input::get('work_service'); $work = new Work(); $work->get_by_employee_id($employee_id); $work->delete_all(); $i = 0; foreach ($work_date1 as $work_date) { if ($work_date != "") { $work = new Work(); $work->employee_id = $employee_id; $work->inclusive_date_from = $work_date1[$i]; $work->inclusive_date_to = $work_date2[$i]; $work->position = $work_position[$i]; $work->company = $work_office[$i]; $work->monthly_salary = $work_salary[$i]; $work->salary_grade = $work_sg[$i]; $work->status = $work_status[$i]; $work->movement = $movement[$i]; $work->govt_service = $work_service[$i]; $work->save(); } $i++; } $data['msg'] = 'Work Experience has been saved!'; } // Work============================================================= $work = new Work(); $work->order_by('inclusive_date_from', 'DESC'); $data['works'] = $work->get_by_employee_id($employee_id); $data['govt_service_options'] = array('1' => 'Yes', '0' => 'No'); if ($employee_id == '') { $data['works'] = array(); } $data['selected'] = $e->office_id; // Use for office listbox $data['options'] = $this->options->office_options(); $data['employee_id'] = $employee_id; $data['main_content'] = 'work'; return View::make('includes/template', $data); }
function preview($employee_id) { $this->load->helper('settings'); $this->load->library('fpdf'); //define('FPDF_FONTPATH',$this->config->item('fonts_path')); $this->load->library('fpdi'); //$pi = new Personal(); //$pi->get_by_employee_id( $employee_id ); //print_r($personal_info); // initiate FPDI $pdf = new FPDI('P', '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, "Employee's Service Record", '', 1, 'C', false); $pdf->Ln(4); $e = new Employee_m(); $e->get_by_id($employee_id); $pdf->SetFont('Arial', '', 12); $pdf->Cell(0, 8, "Employee No.:" . $e->employee_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, "Date From Date To Position Department Movement Status Status", '1', 1, 'L', false); $pdf->Ln(4); $work = new Work(); $work->where('govt_service', '1'); $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(10); 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(29); $pdf->Write(0, $inclusive_date_to); $pdf->SetFont('Arial', '', 8); $pdf->SetX(50); $pdf->Write(0, str_replace('…', '..', character_limiter($work->position, 35))); $pdf->SetX(100); //$pdf->Write(0, $work->company); $pdf->Write(0, str_replace('…', '..', character_limiter($work->company, 35))); //$pdf->SetFont('Arial', '', 12); $pdf->SetX(160); $pdf->Write(0, $work->movement); //$pdf->SetX(150); //$pdf->Write(0, $work->salary_grade); $pdf->SetFont('Arial', '', 8); $pdf->SetX(185); $pdf->Write(0, $work->status); $work->govt_service = $work->govt_service == 1 ? 'Yes' : '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); } $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/service_record/archives/service_record_' . $employee_id . '.pdf', 'I'); }