Example #1
0
<?php

if ($name['first_day_of_service'] == '') {
    $name['first_day_of_service'] = date('Y-m-d');
}
$name['first_day_of_service'] = convert_long_date($name['first_day_of_service']);
$lgu_code = Setting::getField('lgu_code');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Leave Info</title>
<link href="<?php 
echo base_url();
?>
css/style.css" rel="stylesheet" type="text/css">
<link href="<?php 
echo base_url();
?>
css/style_form.css" rel="stylesheet" type="text/css">
<link href="<?php 
echo base_url();
?>
css/style_table.css" rel="stylesheet" type="text/css">
<link href="<?php 
echo base_url();
?>
css/style_layout.css" rel="stylesheet" type="text/css">
<link href="<?php 
echo base_url();
Example #2
0
 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';
 }