$grand_total_salary = 0; ?> <?php $grand_total_amount_due = 0; ?> <?php $deduction = 0; ?> <?php $c = new Cos_status(); ?> <?php $j = new Jo_days(); ?> <?php $p = new Personal_m(); ?> <?php foreach ($rows as $row) { ?> <?php $p->get_by_employee_id($row['id']); ?> <?php $c->get_by_employee_id($row['employee_id']); ?> <?php $j->get_days($period, $row['employee_id']); ?>
function back_id($results) { $this->load->helper('settings'); //print preview of MR $this->load->library('fpdf'); $this->load->library('fpdi'); // initiate FPDI $pdf = new FPDI('L'); // add a page $pdf->AddPage(); // set the sourcefile $pagecount = $pdf->setSourceFile('pdf-report/id/back-id.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); // now write some text above the imported page $pdf->SetTextColor(0, 0, 0); $pdf->SetFont('Arial', '', 7); $n = 1; foreach ($results as $result) { $s = new Personal_m(); $row = $s->get_by_employee_id($result->employee_id); //======================== START Column 1 | Right to Left ============================== if ($n == 11) { //add new page $pdf->addPage(); for ($n = 1; $n <= 1; $n++) { $tplidx = $pdf->ImportPage(1); $pdf->useTemplate($tplIdx); //, 1, 1, 210 } $n = $n - 1; } $bday = $row->birth_date; $address = $row->res_address; $blood_type = '"' . $row->blood_type . '"'; $gsis = $row->gsis; $pagibig = $row->pagibig; $philhealth = $row->philhealth; $tin = $row->tin; $emergency = ''; $contact = $row->cp; //----------------------------- Row 1 ---------------------------------- ///Birthday if ($n == 1) { //Birthday if ($bday != '0000-00-00') { $pdf->SetXY(247, 23); $pdf->Cell(50, 0, date('F d, Y', strtotime(date('F d, Y', strtotime($bday)))), '0', 0, 'C', false); } //Address $pdf->SetXY(257, 15); $addr = splitstroverflow(ucwords(strtolower(utf8_decode($address))), 28); $pdf->Cell(30, 0, $addr[0], '0', 0, 'C', false); //display text overflow if ($addr[1]) { $pdf->Ln(2.5); $pdf->SetX(257); $pdf->Cell(30, 0, $addr[1], '0', 0, 'C', false); } if ($addr[2]) { $pdf->Ln(2.5); $pdf->SetX(257); $pdf->Cell(30, 0, $addr[2], '0', 0, 'C', false); } if ($addr[3]) { $pdf->Ln(2.5); $pdf->SetX(257); $pdf->Cell(30, 0, $addr[3], '0', 0, 'C', false); } //Blood Type $pdf->SetXY(247, 28.3); $pdf->Cell(50, 0, strtoupper($blood_type), '0', 0, 'C', false); //GSIS $pdf->SetXY(247, 33); $pdf->Cell(50, 0, strtoupper($gsis), '0', 0, 'C', false); //PAGIBIG $pdf->SetXY(247, 38); $pdf->Cell(50, 0, strtoupper($pagibig), '0', 0, 'C', false); //PHILHEALTH $pdf->SetXY(247, 43.5); $pdf->Cell(50, 0, strtoupper($philhealth), '0', 0, 'C', false); //PHILHEALTH $pdf->SetXY(247, 48.5); $pdf->Cell(50, 0, strtoupper($tin), '0', 0, 'C', false); //in case of emergency $pdf->SetXY(235, 75.5); $pdf->Cell(60, 0, strtoupper($emergency), '0', 0, 'C', false); //CP No. $pdf->SetXY(250, 78); $cpno = splitstroverflow($contact, 13); $pdf->Cell(30, 0, $cpno[0], '0', 0, 'C', false); if ($cpno[1]) { $pdf->Ln(3); $pdf->SetX(250); $pdf->Cell(30, 0, $cpno[1], '0', 0, 'C', false); } } //----------------------------- Row 2 ---------------------------------- if ($n == 2) { //Birthday if ($bday != '0000-00-00') { $pdf->SetXY(189, 23); $pdf->Cell(50, 0, date('F d, Y', strtotime(date('F d, Y', strtotime($bday)))), '0', 0, 'C', false); } //Address $pdf->SetXY(199, 15); $addr = splitstroverflow(ucwords(strtolower(utf8_decode($address))), 28); $pdf->Cell(30, 0, $addr[0], '0', 0, 'C', false); //display text overflow if ($addr[1]) { $pdf->Ln(2.5); $pdf->SetX(199); $pdf->Cell(30, 0, $addr[1], '0', 0, 'C', false); } if ($addr[2]) { $pdf->Ln(2.5); $pdf->SetX(199); $pdf->Cell(30, 0, $addr[2], '0', 0, 'C', false); } if ($addr[3]) { $pdf->Ln(2.5); $pdf->SetX(199); $pdf->Cell(30, 0, $addr[3], '0', 0, 'C', false); } //Blood Type $pdf->SetXY(189, 28.3); $pdf->Cell(50, 0, strtoupper($blood_type), '0', 0, 'C', false); //GSIS $pdf->SetXY(189, 33); $pdf->Cell(50, 0, strtoupper($gsis), '0', 0, 'C', false); //PAGIBIG $pdf->SetXY(189, 38); $pdf->Cell(50, 0, strtoupper($pagibig), '0', 0, 'C', false); //PHILHEALTH $pdf->SetXY(189, 43.5); $pdf->Cell(50, 0, strtoupper($philhealth), '0', 0, 'C', false); //PHILHEALTH $pdf->SetXY(189, 48.5); $pdf->Cell(50, 0, strtoupper($tin), '0', 0, 'C', false); //in case of emergency $pdf->SetXY(177, 75.5); $pdf->Cell(60, 0, strtoupper($emergency), '0', 0, 'C', false); //CP No. $pdf->SetXY(192, 78); $cpno = splitstroverflow($contact, 13); $pdf->Cell(30, 0, $cpno[0], '0', 0, 'C', false); if ($cpno[1]) { $pdf->Ln(3); $pdf->SetX(192); $pdf->Cell(30, 0, $cpno[1], '0', 0, 'C', false); } } //----------------------------- Row 3 ---------------------------------- if ($n == 3) { //Birthday if ($bday != '0000-00-00') { $pdf->SetXY(131, 23); $pdf->Cell(50, 0, date('F d, Y', strtotime(date('F d, Y', strtotime($bday)))), '0', 0, 'C', false); } //Address $pdf->SetXY(141, 15); $addr = splitstroverflow(ucwords(strtolower(utf8_decode($address))), 28); $pdf->Cell(30, 0, $addr[0], '0', 0, 'C', false); //display text overflow if ($addr[1]) { $pdf->Ln(2.5); $pdf->SetX(141); $pdf->Cell(30, 0, $addr[1], '0', 0, 'C', false); } if ($addr[2]) { $pdf->Ln(2.5); $pdf->SetX(141); $pdf->Cell(30, 0, $addr[2], '0', 0, 'C', false); } if ($addr[3]) { $pdf->Ln(2.5); $pdf->SetX(141); $pdf->Cell(30, 0, $addr[3], '0', 0, 'C', false); } //Blood Type $pdf->SetXY(131, 28.3); $pdf->Cell(50, 0, strtoupper($blood_type), '0', 0, 'C', false); //GSIS $pdf->SetXY(131, 33); $pdf->Cell(50, 0, strtoupper($gsis), '0', 0, 'C', false); //PAGIBIG $pdf->SetXY(131, 38); $pdf->Cell(50, 0, strtoupper($pagibig), '0', 0, 'C', false); //PHILHEALTH $pdf->SetXY(131, 43.5); $pdf->Cell(50, 0, strtoupper($philhealth), '0', 0, 'C', false); //PHILHEALTH $pdf->SetXY(131, 48.5); $pdf->Cell(50, 0, strtoupper($tin), '0', 0, 'C', false); //in case of emergency $pdf->SetXY(119, 75.5); $pdf->Cell(60, 0, strtoupper($emergency), '0', 0, 'C', false); //CP No. $pdf->SetXY(134, 78); $cpno = splitstroverflow($contact, 13); $pdf->Cell(30, 0, $cpno[0], '0', 0, 'C', false); if ($cpno[1]) { $pdf->Ln(3); $pdf->SetX(134); $pdf->Cell(30, 0, $cpno[1], '0', 0, 'C', false); } } //----------------------------- Row 4 ---------------------------------- if ($n == 4) { //Birthday if ($bday != '0000-00-00') { $pdf->SetXY(73, 23); $pdf->Cell(50, 0, date('F d, Y', strtotime(date('F d, Y', strtotime($bday)))), '0', 0, 'C', false); } //Address $pdf->SetXY(83, 15); $addr = splitstroverflow(ucwords(strtolower(utf8_decode($address))), 28); $pdf->Cell(30, 0, $addr[0], '0', 0, 'C', false); //display text overflow if ($addr[1]) { $pdf->Ln(2.5); $pdf->SetX(83); $pdf->Cell(30, 0, $addr[1], '0', 0, 'C', false); } if ($addr[2]) { $pdf->Ln(2.5); $pdf->SetX(83); $pdf->Cell(30, 0, $addr[2], '0', 0, 'C', false); } if ($addr[3]) { $pdf->Ln(2.5); $pdf->SetX(3); $pdf->Cell(30, 0, $addr[3], '0', 0, 'C', false); } //Blood Type $pdf->SetXY(73, 28.3); $pdf->Cell(50, 0, strtoupper($blood_type), '0', 0, 'C', false); //GSIS $pdf->SetXY(73, 33); $pdf->Cell(50, 0, strtoupper($gsis), '0', 0, 'C', false); //PAGIBIG $pdf->SetXY(73, 38); $pdf->Cell(50, 0, strtoupper($pagibig), '0', 0, 'C', false); //PHILHEALTH $pdf->SetXY(73, 43.5); $pdf->Cell(50, 0, strtoupper($philhealth), '0', 0, 'C', false); //PHILHEALTH $pdf->SetXY(73, 48.5); $pdf->Cell(50, 0, strtoupper($tin), '0', 0, 'C', false); //in case of emergency $pdf->SetXY(61, 75.5); $pdf->Cell(60, 0, strtoupper($emergency), '0', 0, 'C', false); //CP No. $pdf->SetXY(76, 78); $cpno = splitstroverflow($contact, 13); $pdf->Cell(30, 0, $cpno[0], '0', 0, 'C', false); if ($cpno[1]) { $pdf->Ln(3); $pdf->SetX(76); $pdf->Cell(30, 0, $cpno[1], '0', 0, 'C', false); } } //----------------------------- Row 5 ---------------------------------- if ($n == 5) { //Birthday if ($bday != '0000-00-00') { $pdf->SetXY(15, 23); $pdf->Cell(50, 0, date('F d, Y', strtotime(date('F d, Y', strtotime($bday)))), '0', 0, 'C', false); } //Address $pdf->SetXY(25, 15); $addr = splitstroverflow(ucwords(strtolower(utf8_decode($address))), 28); $pdf->Cell(30, 0, $addr[0], '0', 0, 'C', false); //display text overflow if ($addr[1]) { $pdf->Ln(2.5); $pdf->SetX(25); $pdf->Cell(30, 0, $addr[1], '0', 0, 'C', false); } if ($addr[2]) { $pdf->Ln(2.5); $pdf->SetX(25); $pdf->Cell(30, 0, $addr[2], '0', 0, 'C', false); } if ($addr[3]) { $pdf->Ln(2.5); $pdf->SetX(25); $pdf->Cell(30, 0, $addr[3], '0', 0, 'C', false); } //Blood Type $pdf->SetXY(15, 28.3); $pdf->Cell(50, 0, strtoupper($blood_type), '0', 0, 'C', false); //GSIS $pdf->SetXY(15, 33); $pdf->Cell(50, 0, strtoupper($gsis), '0', 0, 'C', false); //PAGIBIG $pdf->SetXY(15, 38); $pdf->Cell(50, 0, strtoupper($pagibig), '0', 0, 'C', false); //PHILHEALTH $pdf->SetXY(15, 43.5); $pdf->Cell(50, 0, strtoupper($philhealth), '0', 0, 'C', false); //PHILHEALTH $pdf->SetXY(15, 48.5); $pdf->Cell(50, 0, strtoupper($tin), '0', 0, 'C', false); //in case of emergency $pdf->SetXY(3, 75.5); $pdf->Cell(60, 0, strtoupper($emergency), '0', 0, 'C', false); //CP No. $pdf->SetXY(18, 78); $cpno = splitstroverflow($contact, 13); $pdf->Cell(30, 0, $cpno[0], '0', 0, 'C', false); if ($cpno[1]) { $pdf->Ln(3); $pdf->SetX(18); $pdf->Cell(30, 0, $cpno[1], '0', 0, 'C', false); } } //======================== END Column 1 | Right to Left ============================== //======================== START Column 2 | Right to Left ============================== //----------------------------- Row 1 ---------------------------------- ///Birthday if ($n == 6) { //Birthday if ($bday != '0000-00-00') { $pdf->SetXY(247, 123.5); $pdf->Cell(50, 0, date('F d, Y', strtotime(date('F d, Y', strtotime($bday)))), '0', 0, 'C', false); } //Address $pdf->SetXY(257, 115); $addr = splitstroverflow(ucwords(strtolower(utf8_decode($address))), 28); $pdf->Cell(30, 0, $addr[0], '0', 0, 'C', false); //display text overflow if ($addr[1]) { $pdf->Ln(2.5); $pdf->SetX(257); $pdf->Cell(30, 0, $addr[1], '0', 0, 'C', false); } if ($addr[2]) { $pdf->Ln(2.5); $pdf->SetX(257); $pdf->Cell(30, 0, $addr[2], '0', 0, 'C', false); } if ($addr[3]) { $pdf->Ln(2.5); $pdf->SetX(257); $pdf->Cell(30, 0, $addr[3], '0', 0, 'C', false); } //Blood Type $pdf->SetXY(247, 128.5); $pdf->Cell(50, 0, strtoupper($blood_type), '0', 0, 'C', false); //GSIS $pdf->SetXY(247, 133.5); $pdf->Cell(50, 0, strtoupper($gsis), '0', 0, 'C', false); //PAGIBIG $pdf->SetXY(247, 138.5); $pdf->Cell(50, 0, strtoupper($pagibig), '0', 0, 'C', false); //PHILHEALTH $pdf->SetXY(247, 144); $pdf->Cell(50, 0, strtoupper($philhealth), '0', 0, 'C', false); //TIN $pdf->SetXY(247, 149); $pdf->Cell(50, 0, strtoupper($tin), '0', 0, 'C', false); //in case of emergency $pdf->SetXY(235, 176.3); $pdf->Cell(60, 0, strtoupper($emergency), '0', 0, 'C', false); //CP No. $pdf->SetXY(250, 178.5); $cpno = splitstroverflow($contact, 13); $pdf->Cell(30, 0, $cpno[0], '0', 0, 'C', false); if ($cpno[1]) { $pdf->Ln(3); $pdf->SetX(250); $pdf->Cell(30, 0, $cpno[1], '0', 0, 'C', false); } } //----------------------------- Row 2 ---------------------------------- //----------------------------- Row 2 ---------------------------------- if ($n == 7) { //Birthday if ($bday != '0000-00-00') { $pdf->SetXY(189, 123.5); $pdf->Cell(50, 0, date('F d, Y', strtotime(date('F d, Y', strtotime($bday)))), '0', 0, 'C', false); } //Address $pdf->SetXY(199, 115); $addr = splitstroverflow(ucwords(strtolower(utf8_decode($address))), 28); $pdf->Cell(30, 0, $addr[0], '0', 0, 'C', false); //display text overflow if ($addr[1]) { $pdf->Ln(2.5); $pdf->SetX(199); $pdf->Cell(30, 0, $addr[1], '0', 0, 'C', false); } if ($addr[2]) { $pdf->Ln(2.5); $pdf->SetX(199); $pdf->Cell(30, 0, $addr[2], '0', 0, 'C', false); } if ($addr[3]) { $pdf->Ln(2.5); $pdf->SetX(199); $pdf->Cell(30, 0, $addr[3], '0', 0, 'C', false); } //Blood Type $pdf->SetXY(189, 128.5); $pdf->Cell(50, 0, strtoupper($blood_type), '0', 0, 'C', false); //GSIS $pdf->SetXY(189, 133.5); $pdf->Cell(50, 0, strtoupper($gsis), '0', 0, 'C', false); //PAGIBIG $pdf->SetXY(189, 138.5); $pdf->Cell(50, 0, strtoupper($pagibig), '0', 0, 'C', false); //PHILHEALTH $pdf->SetXY(189, 144); $pdf->Cell(50, 0, strtoupper($philhealth), '0', 0, 'C', false); //tin $pdf->SetXY(189, 149); $pdf->Cell(50, 0, strtoupper($tin), '0', 0, 'C', false); //in case of emergency $pdf->SetXY(177, 176.3); $pdf->Cell(60, 0, strtoupper($emergency), '0', 0, 'C', false); //CP No. $pdf->SetXY(192, 178.5); $cpno = splitstroverflow($contact, 13); $pdf->Cell(30, 0, $cpno[0], '0', 0, 'C', false); if ($cpno[1]) { $pdf->Ln(3); $pdf->SetX(192); $pdf->Cell(30, 0, $cpno[1], '0', 0, 'C', false); } } //----------------------------- Row 3 ---------------------------------- if ($n == 8) { //Birthday if ($bday != '0000-00-00') { $pdf->SetXY(131, 123.5); $pdf->Cell(50, 0, date('F d, Y', strtotime(date('F d, Y', strtotime($bday)))), '0', 0, 'C', false); } //Address $pdf->SetXY(141, 115); $addr = splitstroverflow(ucwords(strtolower(utf8_decode($address))), 28); $pdf->Cell(30, 0, $addr[0], '0', 0, 'C', false); //display text overflow if ($addr[1]) { $pdf->Ln(2.5); $pdf->SetX(141); $pdf->Cell(30, 0, $addr[1], '0', 0, 'C', false); } if ($addr[2]) { $pdf->Ln(2.5); $pdf->SetX(141); $pdf->Cell(30, 0, $addr[2], '0', 0, 'C', false); } if ($addr[3]) { $pdf->Ln(2.5); $pdf->SetX(141); $pdf->Cell(30, 0, $addr[3], '0', 0, 'C', false); } //Blood Type $pdf->SetXY(131, 128.5); $pdf->Cell(50, 0, strtoupper($blood_type), '0', 0, 'C', false); //GSIS $pdf->SetXY(131, 133.5); $pdf->Cell(50, 0, strtoupper($gsis), '0', 0, 'C', false); //PAGIBIG $pdf->SetXY(131, 138.5); $pdf->Cell(50, 0, strtoupper($pagibig), '0', 0, 'C', false); //PHILHEALTH $pdf->SetXY(131, 144); $pdf->Cell(50, 0, strtoupper($philhealth), '0', 0, 'C', false); //PHILHEALTH $pdf->SetXY(131, 149); $pdf->Cell(50, 0, strtoupper($tin), '0', 0, 'C', false); //in case of emergency $pdf->SetXY(119, 176.3); $pdf->Cell(60, 0, strtoupper($emergency), '0', 0, 'C', false); //CP No. $pdf->SetXY(134, 178.5); $cpno = splitstroverflow($contact, 13); $pdf->Cell(30, 0, $cpno[0], '0', 0, 'C', false); if ($cpno[1]) { $pdf->Ln(3); $pdf->SetX(134); $pdf->Cell(30, 0, $cpno[1], '0', 0, 'C', false); } } //----------------------------- Row 4 ---------------------------------- if ($n == 9) { //Birthday if ($bday != '0000-00-00') { $pdf->SetXY(73, 123.5); $pdf->Cell(50, 0, date('F d, Y', strtotime(date('F d, Y', strtotime($bday)))), '0', 0, 'C', false); } //Address $pdf->SetXY(83, 115); $addr = splitstroverflow(ucwords(strtolower(utf8_decode($address))), 28); $pdf->Cell(30, 0, $addr[0], '0', 0, 'C', false); //display text overflow if ($addr[1]) { $pdf->Ln(2.5); $pdf->SetX(83); $pdf->Cell(30, 0, $addr[1], '0', 0, 'C', false); } if ($addr[2]) { $pdf->Ln(2.5); $pdf->SetX(83); $pdf->Cell(30, 0, $addr[2], '0', 0, 'C', false); } if ($addr[3]) { $pdf->Ln(2.5); $pdf->SetX(3); $pdf->Cell(30, 0, $addr[3], '0', 0, 'C', false); } //Blood Type $pdf->SetXY(73, 128.5); $pdf->Cell(50, 0, strtoupper($blood_type), '0', 0, 'C', false); //GSIS $pdf->SetXY(73, 133.5); $pdf->Cell(50, 0, strtoupper($gsis), '0', 0, 'C', false); //PAGIBIG $pdf->SetXY(73, 138.5); $pdf->Cell(50, 0, strtoupper($pagibig), '0', 0, 'C', false); //PHILHEALTH $pdf->SetXY(73, 144); $pdf->Cell(50, 0, strtoupper($philhealth), '0', 0, 'C', false); //PHILHEALTH $pdf->SetXY(73, 149); $pdf->Cell(50, 0, strtoupper($tin), '0', 0, 'C', false); //in case of emergency $pdf->SetXY(61, 176.3); $pdf->Cell(60, 0, strtoupper($emergency), '0', 0, 'C', false); //CP No. $pdf->SetXY(76, 178.5); $cpno = splitstroverflow($contact, 13); $pdf->Cell(30, 0, $cpno[0], '0', 0, 'C', false); if ($cpno[1]) { $pdf->Ln(3); $pdf->SetX(76); $pdf->Cell(30, 0, $cpno[1], '0', 0, 'C', false); } } //----------------------------- Row 5 ---------------------------------- if ($n == 10) { //Birthday if ($bday != '0000-00-00') { $pdf->SetXY(15, 123.5); $pdf->Cell(50, 0, date('F d, Y', strtotime(date('F d, Y', strtotime($bday)))), '0', 0, 'C', false); } //Address $pdf->SetXY(25, 115); $addr = splitstroverflow(ucwords(strtolower(utf8_decode($address))), 28); $pdf->Cell(30, 0, $addr[0], '0', 0, 'C', false); //display text overflow if ($addr[1]) { $pdf->Ln(2.5); $pdf->SetX(25); $pdf->Cell(30, 0, $addr[1], '0', 0, 'C', false); } if ($addr[2]) { $pdf->Ln(2.5); $pdf->SetX(25); $pdf->Cell(30, 0, $addr[2], '0', 0, 'C', false); } if ($addr[3]) { $pdf->Ln(2.5); $pdf->SetX(25); $pdf->Cell(30, 0, $addr[3], '0', 0, 'C', false); } //Blood Type $pdf->SetXY(15, 128.5); $pdf->Cell(50, 0, strtoupper($blood_type), '0', 0, 'C', false); //GSIS $pdf->SetXY(15, 133.5); $pdf->Cell(50, 0, strtoupper($gsis), '0', 0, 'C', false); //PAGIBIG $pdf->SetXY(15, 138.5); $pdf->Cell(50, 0, strtoupper($pagibig), '0', 0, 'C', false); //PHILHEALTH $pdf->SetXY(15, 144); $pdf->Cell(50, 0, strtoupper($philhealth), '0', 0, 'C', false); //tin $pdf->SetXY(15, 149); $pdf->Cell(50, 0, strtoupper($tin), '0', 0, 'C', false); //in case of emergency $pdf->SetXY(3, 176.3); $pdf->Cell(60, 0, strtoupper($emergency), '0', 0, 'C', false); //CP No. $pdf->SetXY(18, 178.5); $cpno = splitstroverflow($contact, 13); $pdf->Cell(30, 0, $cpno[0], '0', 0, 'C', false); if ($cpno[1]) { $pdf->Ln(3); $pdf->SetX(18); $pdf->Cell(30, 0, $cpno[1], '0', 0, 'C', false); } } //======================== END Column 2 | Right to Left ============================== $n++; } // Output $pdf->Output('pdf-report/back-id.pdf', 'F'); return 'pdf-report/back-id.pdf'; }
/** * Enter description here... * */ function add_employee() { $data['page_name'] = '<b>Add employee</b>'; $data['msg'] = ''; //Office $data['options'] = $this->options->office_options(); $data['selected'] = Session::get('office_id'); // Divisions options $data['division_options'] = $this->options->division_options(Session::get('office_id')); //Detailed office $detailed_options = $this->options->office_options($add_select = TRUE); $data['detailed_options'] = $detailed_options; $data['detailed_selected'] = ''; //Type of employment $data['permanent_options'] = $this->options->type_employment(); $data['permanent_selected'] = ''; //Salary grade options $data['sg_options'] = $this->options->salary_grade(); $data['sg_selected'] = ''; //Step increment $data['step_options'] = $this->options->step(); $data['step_selected'] = ''; //Shift List $data['shifts_options'] = $this->options->shift(); // Lets check if the auto generate employee // number is enabled $data['employee_id_readonly'] = ''; $data['auto_generate_employee_id'] = 'no'; $auto_generate_employee_id = Setting::getField('auto_generate_employee_id'); $data['auto_employee_id'] = ''; if ($auto_generate_employee_id == 'yes') { $data['employee_id_readonly'] = 'readonly'; $data['auto_generate_employee_id'] = 'yes'; // Lets get the maximum employee_id $e = new Employee_m(); $e->where('office_id', Session::get('office_id')); $e->select_max('employee_id'); $e->get(); //$data['auto_employee_id'] = $e->employee_id + 1; //echo $this->db->last_query(); } //If form submit if (Input::get('op')) { $this->form_validation->set_rules('employee_id', 'Employee ID', 'required|callback_employee_id_check'); $this->form_validation->set_rules('salutation', 'Salutation', 'required'); $this->form_validation->set_rules('lname', 'Last Name', 'required'); $this->form_validation->set_rules('fname', 'First Name', 'required'); $this->form_validation->set_rules('extension', 'First Name', ''); $this->form_validation->set_rules('position', 'Position', 'required'); $this->form_validation->set_rules('permanent', 'Type of employment', 'required'); //$this->form_validation->set_rules('password', 'Password', 'required|matches[repassword]'); if ($this->form_validation->run($this) == FALSE) { $data['selected'] = Input::get('office_id'); $data['detailed_selected'] = Input::get('detailed_office_id'); $data['permanent_selected'] = Input::get('permanent'); $data['sg_selected'] = Input::get('sg'); $data['step_selected'] = Input::get('step'); } else { $shift_id = Input::get('shift2'); $shift_type = Input::get('shift2'); //File name of the photo $file_register = Session::get('file_register'); $finger_pics = '/../' . current_work_dir() . '/pics/' . Session::get('file_register'); $info = array('employee_id' => Input::get('employee_id'), 'lname' => Input::get('lname'), 'fname' => Input::get('fname'), 'mname' => Input::get('mname'), 'extension' => Input::get('extension'), 'position' => Input::get('position'), 'assistant_dept_head' => Input::get('assistant_dept_head'), 'office_id' => Input::get('office_id'), 'division_id' => Input::get('division_id'), 'section_id' => Input::get('section_id'), 'detailed_office_id' => Input::get('detailed_office_id'), 'salut' => Input::get('salutation'), 'pics' => $file_register, 'finger_pics' => $finger_pics, 'shift_id' => $shift_id, 'shift_type' => $shift_type, 'status' => 1, 'permanent' => Input::get('permanent'), 'first_day_of_service' => Input::get('first_day_of_service'), 'salary_grade' => Input::get('sg'), 'step' => Input::get('step'), 'newly_added' => 1, 'updated' => 1, 'emergency_contact' => Input::get('emergency_contact'), 'emergency_contact_no' => Input::get('emergency_contact_no')); $id = $this->Employee->add_employee($info); $this->Logs->insert_logs('employees', 'ADD EMPLOYEE', 'Add new employee (' . $id . ')', $id); // Use for messaging Session::flash('msg', 'New Employee added!'); if ($this->config->item('active_apps') == 'hris') { // Add to personal info $p = new Personal_m(); $p->get_by_employee_id($id); $p->employee_id = $id; $p->lname = Input::get('lname'); $p->fname = Input::get('fname'); $p->mname = Input::get('mname'); $p->save(); // Redirect to pds page //return Redirect::to('pds/employee_profile/'.$id, 'refresh'); } // Redirect to adding new employee form return Redirect::to('employees/add_employee', 'refresh'); } } $data['main_content'] = 'add_employee'; return View::make('includes/template', $data); }
function jo_preview($office_id = '', $period = '') { $this->Employee->fields = array('id', 'employee_id', 'office_id', 'lname', 'fname', 'mname', 'tax_status', 'dependents'); $this->Employee->employment_type = 4; $rows = $this->Employee->get_employee_list($office_id, ''); $o = new Office_m(); $o->get_by_office_id($office_id); $disbursing_officer = $o->disbursing_officer; $str = $o->office_name; if (strlen($str) % 2 == 1) { $str .= ' '; } $length = strlen($str) / 2; $arr2 = str_split($str, $length); $office_page1 = $arr2[0]; $office_page2 = $arr2[1]; list($month, $day1, $day2, $year) = explode("-", $period); $month_name = $this->Helps->get_month_name($month); $period_text = 'For the Month of ' . $month_name . ' ' . $day1 . '-' . $day2 . ', ' . $year; if (strlen($period_text) % 2 == 1) { $period_text .= ' '; } $length = strlen($period_text) / 2; $period_text_arr = str_split($period_text, $length); $period_page1 = $period_text_arr[0]; $period_page2 = $period_text_arr[1]; $agency_accountant = Setting::getField('agency_accountant'); $agency_accountant_position = Setting::getField('agency_accountant_position'); $head_of_office = Setting::getField('head_of_office'); $head_of_office_position = Setting::getField('head_of_office_position'); $heading = '<table width="100%" border="0"> <tr> <td> </td> <td> </td> <td> </td> <td align="right"></td> <td> </td> <td align="right"><H1>DAILY WAGE PAY</H1></td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="right"> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="right">' . strtoupper($office_page1) . '</td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="right"><strong>' . $period_page1 . '</strong></td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="right"> </td> </tr> <tr> <td colspan="6" style="font-size:11px">We acknowledge receipt of the sum shown opposite our names as full compensation for the services rendered for the period stated.</td> </tr> </table>'; $page = ' <table width="100%" border="1"> <tr> <td width="3%" rowspan="3" align="center" valign="middle"><strong>No.</strong></td> <td width="45%" rowspan="3" align="center" valign="middle"><strong>NAME</strong></td> <td width="19%" rowspan="3" align="center" valign="middle"><strong>TIN</strong></td> <td width="12%" rowspan="3" align="center" valign="middle"><strong>Tax Exemption</strong></td> <td width="12%" rowspan="3" align="center" valign="middle"><strong>Rate per Day</strong></td> <td width="6%" rowspan="3" align="center" valign="middle"><strong>Rate per Hour</strong></td> <td width="3%"> </td> </tr> <tr> <td> </td> </tr> <tr> <td> </td> </tr>'; $grand_total_salary = 0; $grand_total_amount_due = 0; $deduction = 0; $p = new Personal_m(); $r = new Rates(); $j = new Jo_days(); $n = 1; foreach ($rows as $row) { $p->get_by_employee_id($row['id']); $r->get_by_employee_id($row['employee_id']); $j->where('employee_id', $row['employee_id']); $j->where('period', $period); $j->get(); $total_salary = $r->rate_per_day * $j->days; $grand_total_salary += $total_salary; $total_amount_due = $total_salary - $deduction; $grand_total_amount_due += $total_amount_due; $tax_status = $row['tax_status'] != 'Single' ? 'ME' . $row['dependents'] : 'S'; $page .= '<tr> <td>' . $n . '</td> <td>' . strtoupper($row['lname']) . ', ' . $row['fname'] . ' ' . $row['mname'] . '</td> <td>' . $p->tin . '</td> <td>' . $tax_status . '</td> <td align="right">' . number_format($r->rate_per_day, 2) . '</td> <td> </td> <td> </td> </tr>'; $n++; } $page .= '<tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td><strong>TOTAL</strong></td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> </table> <table width="100%" border="1"> <tr> <td><table width="100%" border="0"> <tr> <td width="3%"> </td> <td width="64%">CERTIFIED</td> <td width="4%"> </td> <td width="6%"> </td> <td width="4%"> </td> <td width="16%"> </td> <td width="3%"> </td> </tr> <tr> <td> </td> <td colspan="6">Each person whose name appears on this roll had rendered services for the time stated</td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="center">_______________________</td> <td> </td> </tr> <tr> <td> </td> <td><strong>' . strtoupper($o->office_head) . '</strong></td> <td> </td> <td> </td> <td> </td> <td align="center">Date</td> <td> </td> </tr> <tr> <td> </td> <td colspan="5" style="font-size:11px">' . $o->position . '</td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> </table></td> </tr> </table> <table width="100%" border="1"> <tr> <td><table width="100%"> <tr> <td width="3%"> </td> <td width="35%">CERTIFIED: Funds available in the amount of</td> <td width="33%">' . number_format($grand_total_amount_due, 2) . '</td> <td width="6%"> </td> <td width="4%"> </td> <td width="16%"> </td> <td width="3%"> </td> </tr> <tr> <td> </td> <td colspan="6"> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="center"> </td> <td> </td> </tr> <tr> <td> </td> <td align="center"><strong>' . $agency_accountant . '</strong></td> <td> </td> <td> </td> <td> </td> <td align="center">_______________________</td> <td> </td> </tr> <tr> <td> </td> <td align="center">' . $agency_accountant_position . '</td> <td> </td> <td> </td> <td> </td> <td align="center">Date</td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> </table></td> </tr> </table> <pagebreak /> '; $page2 = '<table width="100%" border="0"> <tr> <td><H1>ROLL - JOB ORDER</H1></td> <td> </td> <td> </td> <td align="right"></td> <td> </td> <td align="right"></td> </tr> <tr> <td></td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="right"> </td> </tr> <tr> <td>' . strtoupper($office_page2) . '</td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="right"> </td> </tr> <tr> <td><strong>' . $period_page2 . '</strong></td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="right"> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="right"> </td> </tr> <tr> <td colspan="6"> </td> </tr> </table> <table width="100%" border="1"> <tr> <td width="5%" rowspan="3" align="center" valign="middle"><strong>No of Hours</strong></td> <td width="19%" rowspan="3" align="center" valign="middle"><strong>No. of Days with Pay</strong></td> <td width="15%" rowspan="3" align="center" valign="middle"><strong>Total Amount of Salary</strong></td> <td width="7%" rowspan="3" align="center" valign="middle"><strong>Pag-ibig Personal Contribution</strong></td> <td width="10%" rowspan="3" align="center" valign="middle"><strong>Total Deductions</strong></td> <td width="13%" rowspan="3" align="center" valign="middle"><strong>Total Amount Due</strong></td> <td width="5%" rowspan="3" align="center" valign="middle"><strong>No.</strong></td> <td width="20%" rowspan="3" align="center" valign="middle"><strong>SIGNATURE OR THUMBMARK</strong></td> <td width="6%"> </td> </tr> <tr> <td> </td> </tr> <tr> <td> </td> </tr>'; $n = 1; $grand_total_salary = 0; $grand_total_amount_due = 0; $deduction = 0; $j = new Jo_days(); $r = new Rates(); foreach ($rows as $row) { $j->where('employee_id', $row['employee_id']); $j->where('period', $period); $j->get(); $r->get_by_employee_id($row['employee_id']); $total_salary = $r->rate_per_day * $j->days; $grand_total_salary += $total_salary; $deduction = $r->pagibig_amount; $total_amount_due = $total_salary - $deduction; $grand_total_amount_due += $total_amount_due; $page2 .= ' <tr> <td></td> <td align="center">' . $j->days . '</td> <td align="right">' . number_format($total_salary, 2) . '</td> <td>' . $r->pagibig_amount . '</td> <td align="right">' . $deduction . '</td> <td align="right">' . number_format($total_amount_due, 2) . '</td> <td>' . $n . '</td> <td></td> <td> </td> </tr>'; $n++; } $page2 .= ' <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td><strong>TOTAL</strong></td> <td align="right"><strong>' . number_format($grand_total_salary, 2) . '</strong></td> <td> </td> <td> </td> <td align="right"><strong>' . number_format($grand_total_amount_due, 2) . '</strong></td> <td> </td> <td> </td> <td> </td> </tr> </table> <table width="100%" border="1"> <tr> <td><table width="100%" border="0"> <tr> <td width="3%"> </td> <td colspan="2">APPROVED FOR PAYMENT</td> <td width="31%"> </td> <td width="4%"> </td> <td width="16%"> </td> <td width="3%"> </td> </tr> <tr> <td> </td> <td colspan="6"> </td> </tr> <tr> <td> </td> <td width="17%"> </td> <td width="26%"> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="center">_______________________</td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td align="center"><strong>' . $head_of_office . '</strong></td> <td> </td> <td> </td> <td align="center">Date</td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td align="center">' . $head_of_office_position . '</td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> </table></td> </tr> </table> <table width="100%" border="1"> <tr> <td><table width="100%" border="0"> <tr> <td width="3%"> </td> <td colspan="6">CERTIFIED: Each person whose name appears on the above rolls has been</td> </tr> <tr> <td> </td> <td colspan="6">paid the amount stated opposite his name after identifying himself</td> </tr> <tr> <td> </td> <td width="17%"> </td> <td width="26%"> </td> <td width="31%"> </td> <td width="4%"> </td> <td width="16%"> </td> <td width="3%"> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td align="center"> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td align="center"><strong>' . $disbursing_officer . '</strong></td> <td> </td> <td> </td> <td align="center">_______________________</td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td align="center">Disbursing Officer</td> <td> </td> <td> </td> <td align="center">Date</td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> </table></td> </tr> </table> '; $html = $heading . $page . $page2; $params = array('format' => 'Legal'); $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->WriteHTML($html); $this->mpdf->Output(); }
function schedule_retirement_pay($date_retired = '', $employee_id = '1') { $data = array(); $data['msg'] = ''; $this->load->library('fpdf'); if (!defined('FPDF_FONTPATH')) { define('FPDF_FONTPATH', $this->config->item('fonts_path')); } $this->load->library('fpdi'); // initiate FPDI $pdf = new FPDI('L', 'mm', 'Legal'); $pdf->SetAutoPageBreak(FALSE); // add a page $pdf->AddPage(); // set the sourcefile $pdf->setSourceFile('dtr/template/leave/schedule_retirement_pay.pdf'); // select the first page $tplIdx = $pdf->importPage(1); // use the page we imported $pdf->useTemplate($tplIdx); $e = new Employee_m(); $e->get_by_employee_id($employee_id); // set font, font style, font size. $pdf->SetFont('Times', '', 10); $pdf->SetTextColor(89, 89, 89); // set initial placement $pdf->SetXY(142, 20.5); $personal = new Personal_m(); $personal->where('employee_id', $e->id); $personal->get(1); $this->load->helper('date'); $o = new Office_m(); $o->get_by_office_id($e->office_id); $period = 'January 1, 2012 May 10, 2012'; $office_name = $o->office_name; $lgu_name = Setting::getField('lgu_name'); //var_dump($date_retired); $date_retired_diff = $date_retired; $date_birth = convert_long_date($personal->birth_date, TRUE); $first_day_of_service = convert_long_date($e->first_day_of_service); $date_retired = convert_long_date($date_retired, TRUE); $salary = $this->Salary_grade->get_monthly_salary($e->salary_grade, $e->step); //$pdf->SetX(114); $pdf->Write(0, $period); $pdf->Ln(10); $pdf->SetX(63); $pdf->Write(0, $office_name); $pdf->Ln(5); $pdf->SetX(63); $pdf->Write(0, $lgu_name); $pdf->SetFont('Times', 'B', 10); $pdf->Ln(21.5); $pdf->SetX(14); $pdf->Write(0, $e->fname . ' ' . substr($e->mname, 0, 1) . '. ' . $e->lname); $pdf->SetFont('Times', '', 10); $pdf->SetX(65); $pdf->Write(0, $date_birth); $pdf->SetX(88); $pdf->Write(0, $date_retired); $date1 = new DateTime("1970-7-01"); $date2 = new DateTime("2011-11-16"); $date1 = new DateTime($e->first_day_of_service); $date2 = new DateTime($date_retired_diff); $interval = $date1->diff($date2); //echo "difference " . $interval->y . " years, " . $interval->m." months, ".$interval->d." days "; if ($interval->y != 0) { $pdf->SetX(114); $pdf->Write(0, $interval->y . " years"); } if ($interval->m != 0) { $pdf->Ln(5); $pdf->SetX(114); $pdf->Write(0, $interval->m . " months"); } if ($interval->d != 0) { $pdf->Ln(5); $pdf->SetX(114); $pdf->Write(0, $interval->d . " days"); } // Salary $pdf->SetXY(145, 53); $pdf->Cell(20, 8, number_format($salary, 2), '', 0, 'C', FALSE); $total_leave = $this->Leave_card->get_total_leave_credits($employee_id); $vacation_leave = $total_leave['vacation']; $sick_leave = $total_leave['sick']; $total = $vacation_leave + $sick_leave; $terminal_leave = $salary * $total * 0.0478087; // vacation leave $pdf->SetXY(203, 58); $pdf->Cell(20, 8, number_format($vacation_leave, 3), '', 0, 'R', FALSE); // sick leave $pdf->SetXY(203, 63); $pdf->Cell(20, 8, number_format($sick_leave, 3), '', 0, 'R', FALSE); // total $pdf->SetXY(203, 68); $pdf->Cell(20, 8, number_format($total, 3), '', 0, 'R', FALSE); // terminal leave $pdf->SetX(274); $pdf->Cell(20, 8, number_format($terminal_leave, 2), '', 0, 'R', FALSE); $pdf->SetFont('Times', 'B', 10); // grand total leave $pdf->SetXY(203, 119); $pdf->Cell(20, 8, number_format($total, 3), '', 0, 'R', FALSE); // total terminal amount $pdf->SetX(274); $pdf->Cell(20, 8, number_format($terminal_leave, 2), '', 0, 'R', FALSE); // Signatories $pdf->Ln(35); $pdf->SetX(13); $pdf->Cell(50, 8, Setting::getField('retirement_signatory_prepared'), '', 0, 'C', FALSE); // date $pdf->SetFont('Times', '', 10); $pdf->SetX(76); $pdf->Cell(50, 8, date('F d, Y'), '', 0, 'C', FALSE); $pdf->SetFont('Times', 'B', 10); $pdf->SetX(147); $pdf->Cell(50, 8, Setting::getField('retirement_signatory_approved'), '', 0, 'C', FALSE); $pdf->SetFont('Times', '', 10); $pdf->Ln(5); $pdf->SetX(13); $pdf->Cell(50, 8, Setting::getField('retirement_signatory_prepared_position'), '', 0, 'C', FALSE); $pdf->SetX(146); $pdf->Cell(50, 8, Setting::getField('retirement_signatory_approved_position'), '', 0, 'C', FALSE); $pdf->SetFont('Times', 'B', 10); $pdf->Ln(25); $pdf->SetX(13); $pdf->Cell(50, 8, Setting::getField('retirement_signatory_certified'), '', 0, 'C', FALSE); $pdf->SetX(88); $pdf->Cell(50, 8, Setting::getField('retirement_signatory_attested'), '', 0, 'C', FALSE); $pdf->SetX(147); $pdf->Cell(50, 8, Setting::getField('retirement_signatory_availability'), '', 0, 'C', FALSE); $pdf->SetX(223); $pdf->Cell(50, 8, Setting::getField('retirement_signatory_noted'), '', 0, 'C', FALSE); $pdf->SetFont('Times', '', 10); $pdf->Ln(5); $pdf->SetX(13); $pdf->Cell(50, 8, Setting::getField('retirement_signatory_certified_position'), '', 0, 'C', FALSE); $pdf->SetX(88); $pdf->Cell(50, 8, Setting::getField('retirement_signatory_attested_position'), '', 0, 'C', FALSE); $pdf->SetX(147); $pdf->Cell(50, 8, Setting::getField('retirement_signatory_availability_position'), '', 0, 'C', FALSE); $pdf->SetX(223); $pdf->Cell(50, 8, Setting::getField('retirement_signatory_noted_position'), '', 0, 'C', FALSE); header('Cache-Control: maxage=3600'); //Adjust maxage appropriately header('Pragma: public'); $pdf->Output('dtr/reports/schedule_retirement_pay' . $employee_id . '.pdf', 'F'); // index 'L' for landscape $this->pages['L'] = 'dtr/reports/schedule_retirement_pay' . $employee_id . '.pdf'; }