</table> <form method="post" action="" enctype="multipart/form-data"> <table id="dtr.table" width="100%" border="0" class="type-one"> <tr class="type-one-header"> <th width="56%" bgcolor="#D6D6D6">Name</th> <th width="44%" bgcolor="#D6D6D6"> </th> </tr> <?php $oe = new Employee_m(); ?> <?php foreach ($employees as $employee) { ?> <?php $oe->get_by_employee_id($employee); ?> <?php $bg = $this->Helps->set_line_colors(); ?> <tr bgcolor="<?php echo $bg; ?> " onmouseover="this.bgColor = '<?php echo $this->config->item('mouseover_linecolor'); ?> ';" onmouseout ="this.bgColor = '<?php echo $bg; ?>
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'; }
function employee_schedule_save($id = '', $page = '') { $data['page_name'] = '<b>Save Employee Schedule</b>'; $data['msg'] = ''; $data['selected'] = Session::get('office_id'); if ($id != '') { $sd = new Schedule_detail(); $sd->get_by_id($id); $data['selected'] = $sd->office_id; } // Use for office listbox $data['options'] = $this->options->office_options(TRUE); $this->load->helper('options'); $sd = new Schedule_detail(); $data['sched'] = $sd->get_by_id($id); $dates = unserialize($sd->dates); if ($dates == '') { $dates = array('year' => date('Y'), 'period_from' => 1, 'period_to' => date('d'), 'month' => date('m')); } $db_employees = unserialize($sd->employees); if (!Input::get('op')) { // if the database has value on it add the value from database to session if (is_array($db_employees)) { if (!is_array(Session::get('employees'))) { Session::put('employees', array()); } $employees = array_merge(Session::get('employees'), $db_employees); Session::put('employees', $employees); } } if (Input::get('op')) { $employees = Session::get('employees'); $month_year = Input::get('year') . '-' . Input::get('month'); $between_from = $month_year . '-' . Input::get('period_from'); $between_to = $month_year . '-' . Input::get('period_to'); $dates = array('year' => Input::get('year'), 'period_from' => Input::get('period_from'), 'period_to' => Input::get('period_to'), 'month' => Input::get('month')); $days = $this->Helps->get_days_in_between($between_from, $between_to); if (!Input::get('op')) { if (is_array($db_employees)) { $employees = array_merge($employees, $db_employees); } } $employees = array_unique($employees); $sd->name = Input::get('name'); $sd->employees = serialize($employees); $sd->dates = serialize($dates); $sd->schedule_id = Input::get('schedule_id'); $sd->office_id = Input::get('office_id'); $sd->save(); Session::flash('msg', 'Schedule saved!'); // Get the schedule $s = new Schedule(); $s->get_by_id(Input::get('schedule_id')); $times = unserialize($s->times); // Check if 2 logs or 4 logs if ($times['am_in_hour'] != '' && $times['am_out_hour'] != '' && $times['pm_in_hour'] != '' && $times['pm_out_hour'] != '') { $sched_data['hour_from'] = ''; $sched_data['hour_to'] = ''; $sched_data['am_in'] = $times['am_in_hour'] . ':' . $times['am_in_min']; $sched_data['am_out'] = $times['am_out_hour'] . ':' . $times['am_out_min']; $sched_data['pm_in'] = $times['pm_in_hour'] . ':' . $times['pm_in_min']; $sched_data['pm_out'] = $times['pm_out_hour'] . ':' . $times['pm_out_min']; $shift_id = 3; $shift_type = 3; } else { //echo '2 times'; // IN if ($times['am_in_hour'] != '') { $sched_data['hour_from'] = $times['am_in_hour'] . ':' . $times['am_in_min']; } else { if ($times['pm_in_hour'] != '') { $sched_data['hour_from'] = $times['pm_in_hour'] . ':' . $times['pm_in_min']; } } // OUT if ($times['am_out_hour'] != '') { $sched_data['hour_to'] = $times['am_out_hour'] . ':' . $times['am_out_min']; } else { if ($times['pm_out_hour'] != '') { $sched_data['hour_to'] = $times['pm_out_hour'] . ':' . $times['pm_out_min']; } } $sched_data['am_in'] = ''; $sched_data['am_out'] = ''; $sched_data['pm_in'] = ''; $sched_data['pm_out'] = ''; $shift_id = 2; $shift_type = 2; // Check if 24 hrs if ($sched_data['hour_from'] == $sched_data['hour_to']) { $shift_id = 4; $shift_type = 4; } } foreach ($days as $day) { //echo $day."<br>"; $sched_data['date'] = $day; $oe = new Employee_m(); foreach ($employees as $employee) { // Change the shift ID $oe->get_by_employee_id($employee); $oe->shift_id = $shift_id; $oe->shift_type = $shift_type; $oe->save(); // Check if there is schedule for this date $sched_data['employee_id'] = $employee; $is_schedule_exists = $this->Schedule_employees->is_schedule_exists($employee, $day); // Update if ($is_schedule_exists == TRUE) { $this->Schedule_employees->update($sched_data, $day, $employee); } else { $this->Schedule_employees->insert($sched_data); } } } //Unset the session //$employees = array(); //Session::put($employees); Session::forget('employees'); //return Redirect::to('settings_manage/schedules/'.$page, 'refresh'); Session::flash('msg', 'Schedule saved!'); $data['msg'] = 'Employee Schedule has been saved!'; } // Months $data['month_options'] = $this->options->month_options(); $data['month_selected'] = $dates['month']; //print_r($dates); // Period from $data['days_options'] = $this->options->days_options(); $data['period_from_selected'] = $dates['period_from']; // Period to $data['days_options'] = $this->options->days_options(); $data['period_to_selected'] = $dates['period_to']; $data['year_options'] = $this->options->year_options(2009, 2020); //2010 - 2020 $data['year_selected'] = $dates['year']; $data['main_content'] = 'employee_schedule_save'; return View::make('includes/template', $data); }
function show_image_url($employee_id = '') { //echo '3'; //exit; $e = new Employee_m(); $e->get_by_employee_id($employee_id); //echo $this->db->last_query(); echo '<img src="' . base_url() . 'pics/' . $e->pics . '">'; }