function budget_expenditures_options($e = '') { $this->load->model('budget_expenditure_m'); $options = array(); $b = new Budget_expenditure_m(); $expenditures = $b->order_by('expenditures')->get(); $options[0] = '---ALL---'; foreach ($expenditures as $expenditure) { $options[$expenditure->id] = $expenditure->expenditures; } return $options; }
function budget_expenditures_options($e = '') { //$ci &= get_instance(); //$this->load->model('budget_expenditure_m'); $options = array(); $b = new Budget_expenditure_m(); $expenditures = $b->order_by('account_code')->get(); $options[''] = '---ALL---'; foreach ($expenditures as $expenditure) { $options[$expenditure->id] = $expenditure->expenditures; } return $options; }
/** * Enter description here... * */ function index($id = '', $from_budget = '') { $data['page_name'] = '<b>Expenses</b>'; $data['msg'] = ''; $data['id'] = ''; $data['from_budget'] = $from_budget; $this->load->library('pagination'); $b = new Budget_expenditure_m(); $config['base_url'] = base_url() . 'budget/index'; $config['total_rows'] = $b->get()->count(); $config['per_page'] = '500'; $config['full_tag_open'] = '<p>'; $config['full_tag_close'] = '</p>'; $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); //$b->order_by('training_type'); $data['expenditures'] = $b->get($limit, $offset); $e = new Budget_expenses_m(); if (Input::get('op')) { if (Input::get('budget_expenditure_id') != 0) { $e->where('budget_expenditure_id', Input::get('budget_expenditure_id')); } } // If the id is from url if ($id != '') { $e->where('budget_expenditure_id', $id); $data['id'] = $id; } $e->order_by('date'); $data['expenses'] = $e->get(); $data['page'] = $this->uri->segment(3); $data['main_content'] = 'expenses/index'; return View::make('includes/template', $data); }
/** * Enter description here... * * @param unknown_type $username */ function delete($id = '') { $b = new Budget_expenditure_m(); $b->get_by_id($id)->delete(); Session::flash('msg', 'User has been deleted!'); return Redirect::to('budget/', 'refresh'); }