function loan_save($id = '', $employee_id = '') { $data['page_name'] = '<b>Save Loan Schedule</b>'; $data['employee_id'] = $employee_id; $data['msg'] = ''; $di = new Deduction_loan(); $data['deduction'] = $di->get_by_id($id); if (Input::get('op')) { // Add employee id if insert only if ($id == 0) { $di->employee_id = $employee_id; } $di->deduction_information_id = Input::get('deduction_information_id'); $di->date_loan = Input::get('date_loan'); $di->loan_gross = Input::get('loan_gross'); $di->months_pay = Input::get('months_pay'); $di->monthly_pay = Input::get('monthly_pay'); $di->date_from = Input::get('date_from'); $di->date_to = Input::get('date_to'); $di->status = Input::get('status') ? Input::get('status') : 'inactive'; $di->save(); return Redirect::to('payroll/deduction/loan/' . $employee_id, 'refresh'); } $d = new Deduction_information(); $d->order_by('desc'); $d->where('type', 'loan'); $data['informations'] = $d->get(); $data['main_content'] = 'deduction/loan/loan_save'; return View::make('includes/template', $data); }