function family($employee_id = '') { $data['page_name'] = '<b>Personal Data Sheet</b>'; $data['section_name'] = '<b>Personal Information</b>'; $data['focus_field'] = 'spouse_lname'; $data['msg'] = ''; $e = new Employee_m(); $data['employee'] = $e->get_by_id($employee_id); $family = new Family(); if (Input::get('op')) { $family->get_by_employee_id($employee_id); $family->employee_id = $employee_id; $family->spouse_lname = Input::get('spouse_lname'); $family->spouse_fname = Input::get('spouse_fname'); $family->spouse_mname = Input::get('spouse_mname'); $family->spouse_occupation = Input::get('spouse_occupation'); $family->spouse_employer = Input::get('spouse_employer'); $family->spouse_biz_ad = Input::get('spouse_biz_ad'); $family->spouse_tel = Input::get('spouse_tel'); $family->father_lname = Input::get('father_lname'); $family->father_fname = Input::get('father_fname'); $family->father_mname = Input::get('father_mname'); $family->mother_lname = Input::get('mother_lname'); $family->mother_fname = Input::get('mother_fname'); $family->mother_mname = Input::get('mother_mname'); $family->save(); // Children $c = new Children(); $c->get_by_employee_id($employee_id); $c->delete_all(); $children = Input::get('children'); $children_birth_day = Input::get('children_birth_day'); $i = 0; foreach ($children as $child) { if ($child != "") { $c = new Children(); $c->employee_id = $employee_id; $c->children = $children[$i]; $c->birth_date = $children_birth_day[$i]; $c->save(); } $i++; } $data['msg'] = 'Family Background has been saved!'; } $family = new Family(); $data['family'] = $family->get_by_employee_id($employee_id); // Children=================================================== $children = new Children(); $children->order_by('birth_date'); $children = $children->get_by_employee_id($employee_id); $i = 0; foreach ($children as $child) { $data['children']['name'][] = $child->children; $data['children']['birth_date'][] = $child->birth_date; $i++; } if ($i <= 14) { while ($i != 14) { $data['children']['name'][] = ''; $data['children']['birth_date'][] = ''; $i++; } } $data['selected'] = $e->office_id; // Use for office listbox $data['options'] = $this->options->office_options(); $data['employee_id'] = $employee_id; $data['main_content'] = 'family'; return View::make('includes/template', $data); }
function page1($employee_id) { $this->load->helper('settings'); $this->load->library('fpdf'); //define('FPDF_FONTPATH',$this->config->item('fonts_path')); $this->load->library('fpdi'); //$this->load->model('Personal_Info'); //Get personal info //$pi = $this->Personal_Info->get_personal_info($employee_id); $pi = new Personal(); $pi->get_by_employee_id($employee_id); //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/page1.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); /******************************* *START PERSONAL INFORMATION == ******************************/ $split[0] = ''; $split[1] = ''; $split[2] = ''; $split[3] = ''; $split[4] = ''; $split[5] = ''; $split[6] = ''; $split[7] = ''; $split[8] = ''; $split[9] = ''; $split[10] = ''; $split[11] = ''; $split[12] = ''; $split[13] = ''; $split[14] = ''; $split[15] = ''; $split[16] = ''; $split[17] = ''; $split[18] = ''; $split[19] = ''; $split[20] = ''; $split[21] = ''; $split[22] = ''; $split[23] = ''; $split[24] = ''; $split[25] = ''; $split[26] = ''; $split[27] = ''; $split[28] = ''; $split[29] = ''; //$pdf->MultiCell(0,3,"hello this is a sample \nlong text with line break" ,'',1,'L',false); //$pdf->MultiCell(0,3,"hello this is a sample \nlong text with line break" ,'',1,'L',false); //$pdf->MultiCell(0,3,"hello this is a sample \nlong text with line break" ,'',1,'L',false); $this->load->helper('text'); //$pdf->MultiCell(0,3,word_wrap("hello this is a sample nlong text with line break", 15) ,'',1,'L',false); $split = str_split($pi->lname); // Write something ==LAST NAME ========= $pdf->SetXY(39, 53); $pdf->Write(0, $split[0]); $pdf->SetX(44); $pdf->Write(0, $split[1]); $pdf->SetX(49); $pdf->Write(0, $split[2]); $pdf->SetX(54); $pdf->Write(0, $split[3]); $pdf->SetX(60); $pdf->Write(0, $split[4]); $pdf->SetX(65); $pdf->Write(0, $split[5]); $pdf->SetX(70); $pdf->Write(0, $split[6]); $pdf->SetX(75); $pdf->Write(0, $split[7]); $pdf->SetX(81); $pdf->Write(0, $split[8]); $pdf->SetX(86); $pdf->Write(0, $split[9]); $pdf->SetX(91); $pdf->Write(0, $split[10]); $pdf->SetX(96); $pdf->Write(0, $split[11]); $pdf->SetX(101); $pdf->Write(0, $split[12]); $pdf->SetX(106); $pdf->Write(0, $split[13]); $pdf->SetX(111); $pdf->Write(0, $split[14]); $pdf->SetX(116); $pdf->Write(0, $split[15]); $pdf->SetX(121); $pdf->Write(0, $split[16]); $pdf->SetX(126); $pdf->Write(0, $split[17]); $pdf->SetX(131); $pdf->Write(0, $split[18]); $pdf->SetX(137); $pdf->Write(0, $split[19]); $pdf->SetX(142); $pdf->Write(0, $split[20]); $pdf->SetX(147); $pdf->Write(0, $split[21]); $pdf->SetX(152); $pdf->Write(0, $split[22]); $pdf->SetX(157); $pdf->Write(0, $split[23]); $pdf->SetX(163); $pdf->Write(0, $split[24]); $pdf->SetX(168); $pdf->Write(0, $split[25]); $pdf->SetX(173); $pdf->Write(0, $split[26]); $pdf->SetX(178); $pdf->Write(0, $split[27]); $pdf->SetX(183); $pdf->Write(0, $split[28]); $pdf->SetX(188); $pdf->Write(0, $split[29]); // line break //=========FIRST NAME==== $split = str_split($pi->fname); $pdf->Ln(6); $pdf->SetX(39); $pdf->Write(0, $split[0]); $pdf->SetX(44); $pdf->Write(0, $split[1]); $pdf->SetX(49); $pdf->Write(0, $split[2]); $pdf->SetX(54); $pdf->Write(0, $split[3]); $pdf->SetX(60); $pdf->Write(0, $split[4]); $pdf->SetX(65); $pdf->Write(0, $split[5]); $pdf->SetX(70); $pdf->Write(0, $split[6]); $pdf->SetX(75); $pdf->Write(0, $split[7]); $pdf->SetX(81); $pdf->Write(0, $split[8]); $pdf->SetX(86); $pdf->Write(0, $split[9]); $pdf->SetX(91); $pdf->Write(0, $split[10]); $pdf->SetX(96); $pdf->Write(0, $split[11]); $pdf->SetX(101); $pdf->Write(0, $split[12]); $pdf->SetX(106); $pdf->Write(0, $split[13]); $pdf->SetX(111); $pdf->Write(0, $split[14]); $pdf->SetX(116); $pdf->Write(0, $split[15]); $pdf->SetX(121); $pdf->Write(0, $split[16]); $pdf->SetX(126); $pdf->Write(0, $split[17]); $pdf->SetX(131); $pdf->Write(0, $split[18]); $pdf->SetX(137); $pdf->Write(0, $split[19]); $pdf->SetX(142); $pdf->Write(0, $split[20]); $pdf->SetX(147); $pdf->Write(0, $split[21]); $pdf->SetX(152); $pdf->Write(0, $split[22]); $pdf->SetX(157); $pdf->Write(0, $split[23]); $pdf->SetX(163); $pdf->Write(0, $split[24]); $pdf->SetX(168); $pdf->Write(0, $split[25]); $pdf->SetX(173); $pdf->Write(0, $split[26]); $pdf->SetX(178); $pdf->Write(0, $split[27]); $pdf->SetX(183); $pdf->Write(0, $split[28]); $pdf->SetX(188); $pdf->Write(0, $split[29]); //======== MNAME $split = str_split($pi->mname); // line break $pdf->Ln(6); $pdf->SetX(39); $pdf->Write(0, $split[0]); $pdf->SetX(44); $pdf->Write(0, $split[1]); $pdf->SetX(49); $pdf->Write(0, $split[2]); $pdf->SetX(54); $pdf->Write(0, $split[3]); $pdf->SetX(60); $pdf->Write(0, $split[4]); $pdf->SetX(65); $pdf->Write(0, $split[5]); $pdf->SetX(70); $pdf->Write(0, $split[6]); $pdf->SetX(75); $pdf->Write(0, $split[7]); $pdf->SetX(81); $pdf->Write(0, $split[8]); $pdf->SetX(86); $pdf->Write(0, $split[9]); $pdf->SetX(91); $pdf->Write(0, $split[10]); $pdf->SetX(96); $pdf->Write(0, $split[11]); $pdf->SetX(101); $pdf->Write(0, $split[12]); $pdf->SetX(106); $pdf->Write(0, $split[13]); $pdf->SetX(111); $pdf->Write(0, $split[14]); $pdf->SetX(116); $pdf->Write(0, $split[15]); $pdf->SetX(121); $pdf->Write(0, $split[16]); $pdf->SetX(126); $pdf->Write(0, $split[17]); $pdf->SetX(131); $pdf->Write(0, $split[18]); $pdf->SetX(137); $pdf->Write(0, $split[19]); $pdf->SetX(142); $pdf->Write(0, $split[20]); $pdf->SetX(147); $pdf->Write(0, $split[21]); $pdf->SetX(152); $pdf->Write(0, $split[22]); $pdf->SetX(157); $pdf->Write(0, $split[23]); $pdf->SetX(163); $pdf->Write(0, $split[24]); $pdf->SetX(168); $pdf->Write(0, $split[25]); $pdf->SetX(173); $pdf->Write(0, $split[26]); $pdf->SetX(178); $pdf->Write(0, $split[27]); $pdf->SetX(183); $pdf->Write(0, $split[28]); $pdf->SetX(188); $pdf->Write(0, $split[29]); $pdf->SetX(189); $pdf->Write(0, $pi->extension); $date = $pi->birth_date; list($year, $month, $day) = explode('-', $date); $pdf->Ln(6); $pdf->SetX(67); $pdf->Write(0, $month . '-' . $day . '-' . $year); $res_address = splitstroverflow($pi->res_address, 30); $pdf->SetX(126); $pdf->Write(0, $res_address[0]); $pdf->Ln(4); $pdf->SetX(39); $pdf->Write(0, $pi->birth_place); $pdf->SetX(126); $pdf->Write(0, $res_address[1]); $pdf->Ln(5); if ($pi->sex == 'M') { $setx = 41.5; } if ($pi->sex == 'F') { $setx = 58; } $pdf->SetX($setx); $pdf->Write(0, 'X'); if ($pi->civil_status == 1) { $pdf->SetXY(41.5, 85); $pdf->Write(0, 'X'); } if ($pi->civil_status == 2) { $pdf->SetXY(41.5, 89); $pdf->Write(0, 'X'); } if ($pi->civil_status == 3) { $pdf->SetXY(41.5, 94.5); $pdf->Write(0, 'X'); } if ($pi->civil_status == 4) { $pdf->SetXY(64, 85); $pdf->Write(0, 'X'); } if ($pi->civil_status == 5) { $pdf->SetXY(64, 89); $pdf->Write(0, 'X'); } if ($pi->civil_status == 6) { $pdf->SetXY(64, 94.5); $pdf->Write(0, 'X'); } //citizeship $pdf->SetXY(39, 103); $pdf->Write(0, $pi->citizenship); $pdf->Ln(5.2); $pdf->SetX(39); $pdf->Write(0, $pi->height); $pdf->Ln(5.2); $pdf->SetX(39); $pdf->Write(0, $pi->weight); $pdf->Ln(5.2); $pdf->SetX(39); $pdf->Write(0, $pi->blood_type); $pdf->Ln(4); $pdf->SetX(39); $pdf->Write(0, $pi->gsis); $pdf->Ln(5); $pdf->SetX(39); $pdf->Write(0, $pi->pagibig); $pdf->Ln(4); $pdf->SetX(39); $pdf->Write(0, $pi->philhealth); $pdf->Ln(5); $pdf->SetX(39); $pdf->Write(0, $pi->sss); $pdf->SetXY(126, 85); $pdf->Write(0, $pi->res_zip); $pdf->Ln(5); $pdf->SetX(126); $pdf->Write(0, $pi->res_tel); $pdf->Ln(5); $pdf->SetX(126); $permanent_address = splitstroverflow($pi->permanent_address, 30); $pdf->Write(0, $permanent_address[0]); $pdf->Ln(4); $pdf->SetX(126); $pdf->Write(0, $permanent_address[1]); $pdf->Ln(15); $pdf->SetX(126); $pdf->Write(0, $pi->permanent_zip); $pdf->Ln(4); $pdf->SetX(126); $pdf->Write(0, $pi->permanent_tel); $pdf->Ln(4.3); $pdf->SetX(126); $pdf->Write(0, $pi->email); $pdf->Ln(4.9); $pdf->SetX(126); $pdf->Write(0, $pi->cp); $pdf->Ln(4.3); $pdf->SetX(126); $pdf->Write(0, $pi->agency_employee_no); $pdf->Ln(4.3); $pdf->SetX(126); $pdf->Write(0, $pi->tin); /******************************* *END PERSONAL INFORMATION ===== ******************************/ //====================================================================== /******************************* *START FAMILY BACK GROUND======= ******************************/ //Get family background //$fb = $this->Family_Background->get_family_background($employee_id); $fb = new Family(); $fb->get_by_employee_id($employee_id); $pdf->SetXY(39, 146); $pdf->Write(0, $fb->spouse_lname); $pdf->Ln(4.3); $pdf->SetX(39); $pdf->Write(0, $fb->spouse_fname); $pdf->Ln(4.3); $pdf->SetX(39); $pdf->Write(0, $fb->spouse_mname); $pdf->Ln(5); $pdf->SetX(39); $pdf->Write(0, $fb->spouse_occupation); $pdf->Ln(5); $pdf->SetX(39); $pdf->Write(0, $fb->spouse_employer); $pdf->Ln(5); $pdf->SetX(39); $pdf->Write(0, $fb->spouse_biz_ad); $pdf->Ln(5); $pdf->SetX(39); $pdf->Write(0, $fb->spouse_tel); $pdf->Ln(9); $pdf->SetX(57); $pdf->Write(0, $fb->father_lname); $pdf->Ln(4.5); $pdf->SetX(57); $pdf->Write(0, $fb->father_fname); $pdf->Ln(4.5); $pdf->SetX(57); $pdf->Write(0, $fb->father_mname); $pdf->Ln(4.5); $pdf->SetX(57); $pdf->Write(0, $fb->mother_lname); $pdf->Ln(4.5); $pdf->SetX(57); $pdf->Write(0, $fb->mother_fname); $pdf->Ln(4.5); $pdf->SetX(57); $pdf->Write(0, $fb->mother_mname); /******************************* *END FAMILY BACK GROUND======= ******************************/ //============================================================================= /******************************* *START CHILDREN================ ******************************/ //$children = $this->Children->get_child($employee_id); $children = new Children(); $children->order_by('birth_date'); $children->get_by_employee_id($employee_id); $pdf->SetXY(110, 145); $i = 1; $pdf->SetFont('Arial', '', 10); foreach ($children as $child) { if ($i == 7 || $i == 9 || $i == 11) { $pdf->Ln(4.5); } else { $pdf->Ln(5); } $pdf->SetX(110); $pdf->Write(0, $child->children); $date = $child->birth_date; list($year, $month, $day) = explode('-', $date); $pdf->SetX(170); $pdf->Write(0, $month . '/' . $day . '/' . $year); $i++; } /******************************* *END CHILDREN================== ******************************/ //===================================================================== /******************************* *START EDUC================== ******************************/ $e = new Education(); //$educs = $this->Educational_Background->get_educ($employee_id, $level = 1); $educs = $e->get_single_educ($employee_id, $level = 1); $pdf->SetFont('Arial', '', 10); $pdf->SetXY(39, 233); // /******************************* *END EDUC================== ******************************/ foreach ($educs as $educ) { $sch = wordwrap(ucwords(strtolower($educ->school_name)), 23, "|"); $sch = explode("|", $sch); //$degree = wordwrap($educ->degree_course, 15, "|"); $degree = wordwrap(ucwords(strtolower($educ->degree_course)), 15, "|"); $degree = explode("|", $degree); $pdf->Write(0, $sch[0]); $pdf->SetX(78); $pdf->Write(0, $degree[0]); $pdf->SetX(107); $pdf->Write(0, $educ->year_graduated); $pdf->SetX(130); $pdf->Write(0, $educ->highest_grade); $pdf->SetX(150); $pdf->Write(0, $educ->attend_from); $pdf->SetX(163); $pdf->Write(0, $educ->attend_to); $pdf->SetX(177); $pdf->Write(0, $educ->scholarship); $pdf->Ln(3); $pdf->SetX(39); $pdf->Write(0, $sch[1]); $pdf->SetX(78); $pdf->Write(0, $degree[1]); $pdf->Ln(3); $pdf->SetX(39); $pdf->Write(0, $sch[2]); $pdf->SetX(78); $pdf->Write(0, $degree[2]); $pdf->Ln(3); $pdf->SetX(39); $pdf->Write(0, $sch[3]); $pdf->SetX(78); $pdf->Write(0, $degree[3]); } //secondary // $educs = $this->Educational_Background->get_educ($employee_id, $level = 2); $educs = $e->get_single_educ($employee_id, $level = 2); $pdf->SetXY(39, 246); foreach ($educs as $educ) { //$sch = wordwrap($educ->school_name, 23, "|"); $sch = wordwrap(ucwords(strtolower($educ->school_name)), 23, "|"); $sch = explode("|", $sch); //$degree = wordwrap($educ->degree_course, 15, "|"); $degree = wordwrap(ucwords(strtolower($educ->degree_course)), 15, "|"); $degree = explode("|", $degree); $pdf->Write(0, $sch[0]); $pdf->SetX(78); $pdf->Write(0, $degree[0]); $pdf->SetX(107); $pdf->Write(0, $educ->year_graduated); $pdf->SetX(130); $pdf->Write(0, $educ->highest_grade); $pdf->SetX(150); $pdf->Write(0, $educ->attend_from); $pdf->SetX(163); $pdf->Write(0, $educ->attend_to); $pdf->SetX(177); $pdf->Write(0, $educ->scholarship); $pdf->Ln(3); $pdf->SetX(39); $pdf->Write(0, $sch[1]); $pdf->SetX(78); $pdf->Write(0, $degree[1]); $pdf->Ln(3); $pdf->SetX(39); $pdf->Write(0, $sch[2]); $pdf->SetX(78); $pdf->Write(0, $degree[2]); $pdf->Ln(3); $pdf->SetX(39); $pdf->Write(0, $sch[3]); $pdf->SetX(78); $pdf->Write(0, $degree[3]); } //vocational // $educs = $this->Educational_Background->get_educ($employee_id, $level = 3); $educs = $e->get_single_educ($employee_id, $level = 3); $pdf->SetXY(39, 259); foreach ($educs as $educ) { //$sch = wordwrap($educ->school_name, 23, "|"); $sch = wordwrap(ucwords(strtolower($educ->school_name)), 23, "|"); $sch = explode("|", $sch); //$degree = wordwrap($educ->degree_course, 15, "|"); $degree = wordwrap(ucwords(strtolower($educ->degree_course)), 15, "|"); $degree = explode("|", $degree); $pdf->Write(0, $sch[0]); $pdf->SetX(78); $pdf->Write(0, $degree[0]); $pdf->SetX(107); $pdf->Write(0, $educ->year_graduated); $pdf->SetX(130); $pdf->Write(0, $educ->highest_grade); $pdf->SetX(150); $pdf->Write(0, $educ->attend_from); $pdf->SetX(163); $pdf->Write(0, $educ->attend_to); $pdf->SetX(177); $pdf->Write(0, $educ->scholarship); $pdf->Ln(3); $pdf->SetX(39); $pdf->Write(0, $sch[1]); $pdf->SetX(78); $pdf->Write(0, $degree[1]); $pdf->Ln(3); $pdf->SetX(39); $pdf->Write(0, $sch[2]); $pdf->SetX(78); $pdf->Write(0, $degree[2]); $pdf->Ln(3); $pdf->SetX(39); $pdf->Write(0, $sch[3]); $pdf->SetX(78); $pdf->Write(0, $degree[3]); } //college // $educs = $this->Educational_Background->get_educ($employee_id, $level = 4); $educs = $e->get_single_educ($employee_id, $level = 4); $pdf->SetXY(39, 274); foreach ($educs as $educ) { //$sch = wordwrap($educ->school_name, 23, "|"); $sch = wordwrap(ucwords(strtolower($educ->school_name)), 23, "|"); $sch = explode("|", $sch); //$degree = wordwrap($educ->degree_course, 15, "|"); $degree = wordwrap(ucwords(strtolower($educ->degree_course)), 15, "|"); $degree = explode("|", $degree); $pdf->Write(0, $sch[0]); $pdf->SetX(78); $pdf->Write(0, $degree[0]); $pdf->SetX(107); $pdf->Write(0, $educ->year_graduated); $pdf->SetX(130); $pdf->Write(0, $educ->highest_grade); $pdf->SetX(150); $pdf->Write(0, $educ->attend_from); $pdf->SetX(163); $pdf->Write(0, $educ->attend_to); $pdf->SetX(177); $pdf->Write(0, $educ->scholarship); $pdf->Ln(3); $pdf->SetX(39); $pdf->Write(0, $sch[1]); $pdf->SetX(78); $pdf->Write(0, $degree[1]); $pdf->Ln(3); $pdf->SetX(39); $pdf->Write(0, $sch[2]); $pdf->SetX(78); $pdf->Write(0, $degree[2]); $pdf->Ln(3); $pdf->SetX(39); $pdf->Write(0, $sch[3]); $pdf->SetX(78); $pdf->Write(0, $degree[3]); } //graduate studies //$educs = $this->Educational_Background->get_educ($employee_id, $level = 5); $educs = $e->get_single_educ($employee_id, $level = 5); $pdf->SetXY(39, 290); foreach ($educs as $educ) { //$sch = wordwrap($educ->school_name, 23, "|"); $sch = wordwrap(ucwords(strtolower($educ->school_name)), 23, "|"); $sch = explode("|", $sch); //$degree = wordwrap($educ->degree_course, 15, "|"); $degree = wordwrap(ucwords(strtolower($educ->degree_course)), 15, "|"); $degree = explode("|", $degree); $pdf->Write(0, $sch[0]); $pdf->SetX(78); $pdf->Write(0, $degree[0]); $pdf->SetX(107); $pdf->Write(0, $educ->year_graduated); $pdf->SetX(130); $pdf->Write(0, $educ->highest_grade); $pdf->SetX(150); $pdf->Write(0, $educ->attend_from); $pdf->SetX(163); $pdf->Write(0, $educ->attend_to); $pdf->SetX(177); $pdf->Write(0, $educ->scholarship); $pdf->Ln(3); $pdf->SetX(39); $pdf->Write(0, $sch[1]); $pdf->SetX(78); $pdf->Write(0, $degree[1]); $pdf->Ln(3); $pdf->SetX(39); $pdf->Write(0, $sch[2]); $pdf->SetX(78); $pdf->Write(0, $degree[2]); $pdf->Ln(3); $pdf->SetX(39); $pdf->Write(0, $sch[3]); $pdf->SetX(78); $pdf->Write(0, $degree[3]); } // Output //$pdf->Output('resources/pdfs/archives/page1_'.$employee_id.'.pdf', 'F'); $pdf->Output('dtr/template/pds/page1_' . $employee_id . '.pdf', 'F'); $this->pds[] = 'dtr/template/pds/page1_' . $employee_id . '.pdf'; //$this->pds[] = 'resources/pdfs/archives/page1_'.$employee_id.'.pdf'; //header("location:".base_url()."resources/pdfs/archives/page1_".$employee_id.'.pdf'); }