function edit_place($mode = '') { if ($mode == 'adcom') { $s = new Staff_entitlement_m(); $s->where('id', Input::get('rowid')); $s->get(); if (Input::get('colid') == 'effectivity_date') { $s->effectivity_date = Input::get('new'); } if (Input::get('colid') == 'ineffectivity_date') { $s->ineffectivity_date = Input::get('new'); } if (Input::get('colid') == 'amount') { $s->amount = Input::get('new'); } $s->save(); exit; } }
<th width="12%" bgcolor="#D6D6D6"><strong>Ineffectivity Date</strong></th> <th width="9%" bgcolor="#D6D6D6">Amount</th> <th width="12%" bgcolor="#D6D6D6"> </th> <th width="7%" bgcolor="#D6D6D6"> </th> </tr> <?php $i = 0; ?> <?php $s = new Staff_entitlement_m(); ?> <?php foreach ($rows as $row) { ?> <?php $s->where('employee_id', $row->id); $s->where('additional_compensation_id', $additional_compensation_id); $s->get(); if ($s->exists()) { $id = $s->id; //echo 'hehe'; } else { $s->employee_id = $row->id; $s->additional_compensation_id = $additional_compensation_id; $s->effectivity_date = ''; $s->ineffectivity_date = ''; $s->amount = ''; $s->save(); $id = $s->id; } // last param of dg_editCell is the size of the textbox
function staff_entitlement($employee_id = '') { $data['page_name'] = '<b>Staff Entitlement</b>'; //Use for office listbox $data['options'] = $this->options->office_options(); $data['selected'] = Session::get('office_id'); $data['employee_id'] = $employee_id; $data['msg'] = ''; $p = new Staff_entitlement_m(); $this->load->library('pagination'); $config['base_url'] = base_url() . 'payroll/additional_compensation/staff_entitlement/'; $config['total_rows'] = $p->get()->count(); $config['per_page'] = '15'; $this->pagination->initialize($config); // How many related records we want to limit ourselves to $limit = $config['per_page']; // Set the offset for our paging $offset = $this->uri->segment(3); // Get all positions //$p = new Position(); //$p->order_by('desc'); //$data['deductions'] = $p->get($limit, $offset); $data['deductions'] = array(); if ($employee_id) { $p->where('employee_id', $employee_id); $data['deductions'] = $p->get($limit, $offset); } if (Input::get('op')) { $data['employee_id'] = Input::get('employee_id'); $data['selected'] = Input::get('office_id'); $p->where('employee_id', Input::get('employee_id')); $data['deductions'] = $p->get($limit, $offset); } $data['main_content'] = 'additional_compensation/staff_entitlement/staff_entitlement'; return View::make('includes/template', $data); }