load->config('ci-blog'); $this->balance_group = $this->config->item('ci_balance_group'); $this->balance_type = $this->config->item('ci_balance_type'); $this->sch_setting_detail = $this->setting_model->getSetting(); } function index() { if (!$this->rbac->hasPrivilege('fees_carry_forward', 'can_view')) { access_denied(); } $this->session->set_userdata('top_menu', 'Fees Collection'); $this->session->set_userdata('sub_menu', 'feesforward/index'); $data['title'] = 'Add Feesforward'; $data['title_list'] = 'Recent FeeType'; $class = $this->class_model->get(); $data['adm_auto_insert'] = $this->sch_setting_detail->adm_auto_insert; $data['sch_setting'] = $this->sch_setting_detail; $data['classlist'] = $class; $action = $this->input->post('action'); $class_id = $this->input->post('class_id'); $section_id = $this->input->post('section_id'); if ($this->input->server('REQUEST_METHOD') == "POST") { $setting_result = $this->setting_model->get(); $current_session = $setting_result[0]['session_id']; $data['current_session'] = $current_session; $pre_session = $this->session_model->getPreSession($current_session); $data['pre_session'] = $pre_session; //=========date============== $fees_due_days = $setting_result[0]['fee_due_days']; if ($fees_due_days > 0 && $fees_due_days != "") { $due_date = date('Y-m-d', strtotime('+' . $fees_due_days . ' day')); $data['due_date_formated'] = date($setting_result[0]['date_format'], $this->customlib->dateYYYYMMDDtoStrtotime($due_date)); } else { $due_date = date('Y-m-d'); $data['due_date_formated'] = date($this->customlib->getSchoolDateFormat(), $this->customlib->dateYYYYMMDDtoStrtotime($due_date)); ; } //======================== if ($action == 'search') { $this->form_validation->set_rules('class_id', $this->lang->line('class'), 'required'); $this->form_validation->set_rules('section_id', $this->lang->line('section'), 'required'); if ($this->form_validation->run() == TRUE) { $data['student_due_fee'] = array(); if (!empty($pre_session)) { $student_Array = json_decode($this->findPreviousBalanceFees($pre_session->id, $class_id, $section_id, $current_session)); $data['student_due_fee'] = $student_Array->student_Array; $data['is_update'] = $student_Array->is_update; } } } else if ($action == 'fee_submit') { $student_Array = json_decode($this->findPreviousBalanceFees($pre_session->id, $class_id, $section_id, $current_session)); $data['student_due_fee'] = $student_Array->student_Array; $data['is_update'] = $student_Array->is_update; $this->form_validation->set_rules('due_date', $this->lang->line('date'), 'required'); $counter = $this->input->post('student_counter'); if ($this->form_validation->run() == TRUE) { $due_date = date('Y-m-d', $this->customlib->datetostrtotime($this->input->post('due_date'))); $student_data = array(); foreach ($counter as $count_key => $count_value) { $student_array = array(); $student_array['student_session_id'] = $this->input->post('student_sesion[' . $count_value . ']'); $student_array['amount'] = $this->input->post('amount[' . $count_value . ']'); $student_array['is_system'] = 1; $student_array['fee_session_group_id'] = 0; $student_data[] = $student_array; } $student_due_fee = $this->studentfeemaster_model->addPreviousBal($student_data, $due_date); $this->session->set_flashdata('msg', '