Ejemplo n.º 1
0
 private function system_edit()
 {
     if ($this->permissions['edit']) {
         $user = User_helper::get_user();
         $id = $user->id;
         $uisc_id = $user->uisc_id;
         $this->current_action = 'edit';
         $ajax['status'] = true;
         $data = array();
         $data['title'] = $this->lang->line("EDIT_PROFILE");
         $data['uisc_detail'] = $this->Profile_view_model->get_uisc_info($id, $uisc_id);
         $data['secretary'] = $this->Profile_view_model->get_secretary_info($id, $uisc_id);
         $data['chairmen_info'] = Query_helper::get_info($this->config->item('table_entrepreneur_chairmen_info'), '*', array('uisc_id =' . $uisc_id), 1);
         $data['entrepreneur_info'] = Query_helper::get_info($this->config->item('table_entrepreneur_infos'), '*', array('user_id =' . $id, 'uisc_id =' . $uisc_id), 1);
         $data['education_info'] = Query_helper::get_info($this->config->item('table_entrepreneur_education'), '*', array('user_id =' . $id, 'uisc_id =' . $uisc_id), 1);
         $data['training_info'] = Query_helper::get_info($this->config->item('table_training'), '*', array('user_id =' . $id, 'uisc_id =' . $uisc_id), 0);
         $data['investment_info'] = Query_helper::get_info($this->config->item('table_investment'), '*', array('user_id =' . $id, 'uisc_id =' . $uisc_id), 1);
         $data['location_info'] = Query_helper::get_info($this->config->item('table_center_location'), '*', array('user_id =' . $id, 'uisc_id =' . $uisc_id), 1);
         $data['resources_info'] = Query_helper::get_info($this->config->item('table_uisc_resources'), '*', array('user_id =' . $id, 'uisc_id =' . $uisc_id), 0);
         $data['device_info'] = Query_helper::get_info($this->config->item('table_device_infos'), '*', array('user_id =' . $id, 'uisc_id =' . $uisc_id), 1);
         $data['electricity_info'] = Query_helper::get_info($this->config->item('table_electricity'), '*', array('user_id =' . $id, 'uisc_id =' . $uisc_id), 1);
         $data['resources'] = $this->Profile_view_model->get_resource_info($id, $uisc_id);
         $ajax['system_content'][] = array("id" => "#system_wrapper_top_menu", "html" => $this->load_view("top_menu", "", true));
         $ajax['system_content'][] = array("id" => "#system_wrapper", "html" => $this->load_view("profile/profile_view/system_add_edit", $data, true));
         if ($this->message) {
             $ajax['system_message'] = $this->message;
         }
         $ajax['system_page_url'] = $this->get_encoded_url('profile/profile_view/index/edit/' . $id);
         $this->jsonReturn($ajax);
     } else {
         $ajax['status'] = true;
         $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
         $this->jsonReturn($ajax);
     }
 }
Ejemplo n.º 2
0
 public function login()
 {
     $user = User_helper::get_user();
     if ($user) {
         $this->dashboard_page();
     } else {
         if ($this->input->post()) {
             if (User_helper::login($this->input->post("username"), $this->input->post("password"))) {
                 $user = User_helper::get_user();
                 $user_info['user_id'] = $user->id;
                 $user_info['login_time'] = time();
                 $user_info['ip_address'] = $this->input->ip_address();
                 $user_info['request_headers'] = json_encode($this->input->request_headers());
                 Query_helper::add($this->config->item('table_user_login_history'), $user_info);
                 $this->dashboard_page($this->lang->line("MSG_LOGIN_SUCCESS"));
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_USERNAME_PASSWORD_INVALID");
                 $this->jsonReturn($ajax);
             }
         } else {
             $this->login_page();
             //login page view
         }
     }
 }
Ejemplo n.º 3
0
Archivo: Common.php Proyecto: mazba/ams
 public function user_info()
 {
     $id = $_POST['id'];
     $data['users'] = Query_helper::get_info($this->config->item('table_users'), '*', array('status = ' . $this->config->item('STATUS_ACTIVE'), "id = " . $id), 1);
     $ajax['system_content'][] = array("id" => "#user_model_body", "html" => $this->load_view("common/user_info", $data, true));
     $this->jsonReturn($ajax);
 }
Ejemplo n.º 4
0
 private function dcms_save()
 {
     $user = User_helper::get_user();
     $data = array();
     if (!$this->check_validation()) {
         $ajax['status'] = false;
         $ajax['system_message'] = $this->message;
         $this->jsonReturn($ajax);
     } else {
         $data['suggestion'] = $this->input->post('suggestion');
         $data['date'] = date('Y-m-d');
         $data['uisc_id'] = $user->uisc_id;
         $data['created'] = $user->id;
         $data['user_id'] = $user->id;
         $this->db->trans_start();
         //DB Transaction Handle START
         Query_helper::add($this->config->item('table_suggestion'), $data);
         $this->db->trans_complete();
         //DB Transaction Handle END
         if ($this->db->trans_status() === TRUE) {
             $this->message = $this->lang->line("MSG_CREATE_SUCCESS");
             $this->dcms_add();
         } else {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("MSG_CREATE_FAIL");
             $this->jsonReturn($ajax);
         }
     }
 }
Ejemplo n.º 5
0
 public function get_product_list_by_category()
 {
     $category_id = $this->input->post('category_id');
     $products = Query_helper::get_info($this->config->item('table_product'), array('product_name value', 'product_name text'), array('category_id=' . $category_id), 0, 0, 'product_name');
     $ajax['status'] = true;
     $ajax['system_content'][] = array("id" => "#product_name", "html" => $this->load_view("dropdown", array('drop_down_options' => $products), true));
     $this->jsonReturn($ajax);
 }
Ejemplo n.º 6
0
 public function get_municipal_ward()
 {
     $zilla_id = $this->input->post('zilla_id');
     $municipal_id = $this->input->post('municipal_id');
     $municipal_wards = Query_helper::get_info($this->config->item('table_municipal_wards'), array('wardid value', 'wardname text'), array('visible = 1', 'zillaid = ' . $zilla_id, 'municipalid = ' . $municipal_id));
     $ajax['status'] = true;
     $ajax['system_content'][] = array("id" => "#user_municipal_ward_id", "html" => $this->load_view("dropdown", array('drop_down_options' => $municipal_wards), true));
     $this->jsonReturn($ajax);
 }
Ejemplo n.º 7
0
 private function system_save()
 {
     $user = User_helper::get_user();
     $id = $this->input->post("id");
     if ($id > 0) {
         if (!$this->permissions['edit']) {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
             $this->jsonReturn($ajax);
             die;
         }
     } else {
         if (!$this->permissions['add']) {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
             $this->jsonReturn($ajax);
             die;
         }
     }
     if (!$this->check_validation()) {
         $ajax['status'] = false;
         $ajax['system_message'] = $this->message;
         $this->jsonReturn($ajax);
     } else {
         $userDetail = array();
         $userDetail['ques_id'] = $this->input->post('ques_id');
         $userDetail['ques_ans'] = $this->input->post('ques_ans');
         if ($id > 0) {
             $userDetail['update_by'] = $user->id;
             $userDetail['update_date'] = time();
             $this->db->trans_start();
             //DB Transaction Handle START
             Query_helper::update($this->config->item('table_users'), $userDetail, array("id = " . $id));
             $this->db->trans_complete();
             //DB Transaction Handle END
             if ($this->db->trans_status() === TRUE) {
                 $this->message = $this->lang->line("MSG_UPDATE_SUCCESS");
                 $save_and_new = $this->input->post('system_save_new_status');
                 if ($save_and_new == 1) {
                     $this->system_edit();
                 } else {
                     $this->system_edit();
                 }
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_UPDATE_FAIL");
                 $this->jsonReturn($ajax);
             }
         } else {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("MSG_UPDATE_FAIL");
             $this->jsonReturn($ajax);
         }
     }
 }
Ejemplo n.º 8
0
 public function index()
 {
     $user = User_helper::get_user();
     $data['divisions'] = array();
     $data['display_divisions'] = false;
     $data['default_divisions'] = true;
     $data['zillas'] = array();
     $data['display_zillas'] = false;
     $data['default_zillas'] = true;
     $data['upazilas'] = array();
     $data['display_upazilas'] = false;
     $data['default_upazilas'] = true;
     $data['unions'] = array();
     $data['display_unions'] = false;
     $data['default_unions'] = true;
     if ($user->user_group_id == $this->config->item('SUPER_ADMIN_GROUP_ID') || $user->user_group_id == $this->config->item('A_TO_I_GROUP_ID') || $user->user_group_id == $this->config->item('DONOR_GROUP_ID') || $user->user_group_id == $this->config->item('MINISTRY_GROUP_ID')) {
         $data['divisions'] = Query_helper::get_info($this->config->item('table_divisions'), array('divid value', 'divname text'), array());
         $data['display_divisions'] = true;
         $data['default_divisions'] = true;
     } else {
         $data['divisions'] = Query_helper::get_info($this->config->item('table_divisions'), array('divid value', 'divname text'), array('divid =' . $user->division));
         $data['display_divisions'] = true;
         $data['default_divisions'] = false;
         $data['display_zillas'] = true;
         if ($user->user_group_id == $this->config->item('DIVISION_GROUP_ID')) {
             $data['zillas'] = Query_helper::get_info($this->config->item('table_zillas'), array('zillaid value', 'zillaname text'), array('visible = 1', 'divid = ' . $user->division));
             $data['default_zillas'] = true;
             $data['display_upazilas'] = false;
         } else {
             $data['zillas'] = Query_helper::get_info($this->config->item('table_zillas'), array('zillaid value', 'zillaname text'), array('visible = 1', 'divid = ' . $user->division, 'zillaid =' . $user->zilla));
             $data['default_zillas'] = false;
             $data['display_upazilas'] = true;
             if ($user->user_group_id == $this->config->item('DISTRICT_GROUP_ID')) {
                 $data['upazilas'] = Query_helper::get_info($this->config->item('table_upazilas'), array('upazilaid value', 'upazilaname text'), array('visible = 1', 'zillaid = ' . $user->zilla));
                 $data['default_upazilas'] = true;
                 //$data['display_unions']=true;
             } else {
                 $data['upazilas'] = Query_helper::get_info($this->config->item('table_upazilas'), array('upazilaid value', 'upazilaname text'), array('visible = 1', 'zillaid = ' . $user->zilla, 'upazilaid = ' . $user->upazila));
                 $data['default_upazilas'] = false;
                 $data['display_unions'] = true;
                 $data['unions'] = Query_helper::get_info($this->config->item('table_unions'), array('unionid value', 'unionname text'), array('visible = 1', 'zillaid = ' . $user->zilla, 'upazilaid=' . $user->upazila));
                 $data['default_unions'] = true;
                 //TODO
                 //increase report menu for union users
             }
         }
     }
     $ajax['status'] = true;
     $data['title'] = $this->lang->line("REPORT_UISC_REGISTRATION_TITLE");
     $ajax['system_content'][] = array("id" => "#system_wrapper_top_menu", "html" => $this->load_view("top_menu", "", true));
     $ajax['system_content'][] = array("id" => "#system_wrapper", "html" => $this->load_view("report/registered_union_list", $data, true));
     $ajax['system_page_url'] = $this->get_encoded_url('report/registered_union_list');
     $this->jsonReturn($ajax);
 }
 public function index()
 {
     $user = User_helper::get_user();
     $data['divisions'] = array();
     $data['display_divisions'] = false;
     $data['default_divisions'] = true;
     $data['zillas'] = array();
     $data['display_zillas'] = false;
     $data['default_zillas'] = true;
     $data['municipal'] = array();
     $data['display_city_corporation'] = false;
     $data['default_city_corporation'] = true;
     $data['city_corporation_ward'] = array();
     $data['display_city_corporation_ward'] = false;
     $data['default_city_corporation_ward'] = true;
     if ($user->user_group_level == $this->config->item('SUPER_ADMIN_GROUP_ID') || $user->user_group_level == $this->config->item('A_TO_I_GROUP_ID') || $user->user_group_level == $this->config->item('DONOR_GROUP_ID') || $user->user_group_level == $this->config->item('MINISTRY_GROUP_ID')) {
         $data['divisions'] = Query_helper::get_info($this->config->item('table_divisions'), array('divid value', 'divname text'), array());
         $data['display_divisions'] = true;
         $data['default_divisions'] = true;
     } else {
         $data['divisions'] = Query_helper::get_info($this->config->item('table_divisions'), array('divid value', 'divname text'), array('divid =' . $user->division));
         $data['display_divisions'] = true;
         $data['default_divisions'] = false;
         $data['display_zillas'] = true;
         if ($user->user_group_level == $this->config->item('DIVISION_GROUP_ID')) {
             $data['zillas'] = Query_helper::get_info($this->config->item('table_zillas'), array('zillaid value', 'zillaname text'), array('visible = 1', 'divid = ' . $user->division));
             $data['default_zillas'] = true;
             $data['display_city_corporation'] = false;
         } else {
             $data['zillas'] = Query_helper::get_info($this->config->item('table_zillas'), array('zillaid value', 'zillaname text'), array('visible = 1', 'divid = ' . $user->division, 'zillaid =' . $user->zilla));
             $data['default_zillas'] = false;
             $data['display_city_corporation'] = true;
             if ($user->user_group_level == $this->config->item('DISTRICT_GROUP_ID')) {
                 $data['city_corporations'] = Query_helper::get_info($this->config->item('table_city_corporations'), array('citycorporationid value', 'citycorporationname text'), array('visible = 1', 'zillaid = ' . $user->zilla, 'divid=' . $user->division));
                 $data['default_city_corporation'] = true;
                 //$data['display_unions']=true;
             } else {
                 $data['city_corporations'] = Query_helper::get_info($this->config->item('table_city_corporations'), array('citycorporationid value', 'citycorporationname text'), array('visible = 1', 'zillaid = ' . $user->zilla, 'divid=' . $user->division, 'citycorporationid=' . $user->citycorporation));
                 $data['default_city_corporation'] = false;
                 $data['display_city_corporation_ward'] = true;
                 $data['city_corporation_words'] = Query_helper::get_info($this->config->item('table_city_corporation_wards'), array('citycorporationwardid value', 'wardname text'), array('visible = 1', 'zillaid = ' . $user->zilla, 'divid=' . $user->division, 'citycorporationid = ' . $user->citycorporation));
                 $data['default_city_corporation_ward'] = true;
                 //TODO
                 //increase report menu for union users
             }
         }
     }
     $ajax['status'] = true;
     $data['title'] = $this->lang->line("REPORT_COUNTRY_WISE_CITY_CORPORATION_MONTHLY_INCOME_TITLE");
     $ajax['system_content'][] = array("id" => "#system_wrapper_top_menu", "html" => $this->load_view("top_menu", "", true));
     $ajax['system_content'][] = array("id" => "#system_wrapper", "html" => $this->load_view("report/country_wise_city_corporation_monthly_income_list", $data, true));
     $ajax['system_page_url'] = $this->get_encoded_url('report/country_wise_city_corporation_monthly_income_list');
     $this->jsonReturn($ajax);
 }
 public function index()
 {
     $user = User_helper::get_user();
     $data['divisions'] = array();
     $data['display_divisions'] = false;
     $data['default_divisions'] = true;
     $data['zillas'] = array();
     $data['display_zillas'] = false;
     $data['default_zillas'] = true;
     $data['municipal'] = array();
     $data['display_municipal'] = false;
     $data['default_municipal'] = true;
     $data['municipal_ward'] = array();
     $data['display_municipal_ward'] = false;
     $data['default_municipal_ward'] = true;
     if ($user->user_group_level == $this->config->item('SUPER_ADMIN_GROUP_ID') || $user->user_group_level == $this->config->item('A_TO_I_GROUP_ID') || $user->user_group_level == $this->config->item('DONOR_GROUP_ID') || $user->user_group_level == $this->config->item('MINISTRY_GROUP_ID')) {
         $data['divisions'] = Query_helper::get_info($this->config->item('table_divisions'), array('divid value', 'divname text'), array());
         $data['display_divisions'] = true;
         $data['default_divisions'] = true;
     } else {
         $data['divisions'] = Query_helper::get_info($this->config->item('table_divisions'), array('divid value', 'divname text'), array('divid =' . $user->division));
         $data['display_divisions'] = true;
         $data['default_divisions'] = false;
         $data['display_zillas'] = true;
         if ($user->user_group_level == $this->config->item('DIVISION_GROUP_ID')) {
             $data['zillas'] = Query_helper::get_info($this->config->item('table_zillas'), array('zillaid value', 'zillaname text'), array('visible = 1', 'divid = ' . $user->division));
             $data['default_zillas'] = true;
             $data['display_municipal'] = false;
         } else {
             $data['zillas'] = Query_helper::get_info($this->config->item('table_zillas'), array('zillaid value', 'zillaname text'), array('visible = 1', 'divid = ' . $user->division, 'zillaid =' . $user->zilla));
             $data['default_zillas'] = false;
             $data['display_municipal'] = true;
             if ($user->user_group_level == $this->config->item('DISTRICT_GROUP_ID')) {
                 $data['municipals'] = Query_helper::get_info($this->config->item('table_municipals'), array('municipalid value', 'municipalname text'), array('visible = 1', 'zillaid = ' . $user->zilla));
                 $data['default_municipal'] = true;
                 //$data['display_unions']=true;
             } else {
                 $data['municipals'] = Query_helper::get_info($this->config->item('table_municipals'), array('municipalid value', 'municipalname text'), array('visible = 1', 'zillaid = ' . $user->zilla, 'municipalid = ' . $user->municipal));
                 $data['default_municipal'] = false;
                 $data['display_municipal_ward'] = true;
                 $data['municipal_wards'] = Query_helper::get_info($this->config->item('table_municipal_wards'), array('wardid value', 'wardname text'), array('visible = 1', 'zillaid = ' . $user->zilla, 'municipalid = ' . $user->municipal));
                 $data['default_municipal_ward'] = true;
                 //TODO
                 //increase report menu for union users
             }
         }
     }
     $ajax['status'] = true;
     //$data['title']=$this->lang->line("REPORT_CABINET_MUNICIPAL_SERVICE_HOLDER_INCOME_TITLE");
     //$ajax['system_content'][]=array("id"=>"#system_wrapper_top_menu","html"=>$this->load_view("top_menu","",true));
     $ajax['system_content'][] = array("id" => "#go_location", "html" => $this->load_view("report/cabinet/cabinet_municipal_service_holder_income_list", $data, true));
     //$ajax['system_page_url']=$this->get_encoded_url('report/cabinet/cabinet_municipal_service_holder_income_list');
     $this->jsonReturn($ajax);
 }
Ejemplo n.º 11
0
 private function dcms_list()
 {
     if ($this->permissions['list']) {
         $this->current_action = 'list';
         $ajax['status'] = true;
         //$ajax['system_content'][] = array("id" => "#system_wrapper_top_menu", "html" => $this->load_view("top_menu", "", true));
         $data['services'] = Query_helper::get_info($this->config->item('table_api_services'), '*', array('status =1'));
         $ajax['system_content'][] = array("id" => "#system_wrapper", "html" => $this->load_view("esheba_management/external_service/list", $data, true));
         //approval/entrepreneur_approval/dcms_list
         if ($this->message) {
             $ajax['system_message'] = $this->message;
         }
         $ajax['system_page_url'] = $this->get_encoded_url('esheba_management/services/index/list');
         //approval/Entrepreneur_approval
         $ajax['system_page_title'] = $this->lang->line("SERVICES");
         $this->jsonReturn($ajax);
     } else {
         $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
         $this->jsonReturn($ajax);
     }
 }
Ejemplo n.º 12
0
 public function index($service_id)
 {
     $user = User_helper::get_user();
     $time = time();
     $service_info = Query_helper::get_info($this->config->item('table_api_services'), '*', array('status =1', 'id =' . $service_id), 1);
     if ($service_info) {
         $data['auth_token'] = random_string('unique') . $time;
         $data['user_id'] = $user->id;
         $data['service_id'] = $service_id;
         $data['time'] = $time;
         $data['status'] = 1;
         $id = Query_helper::add($this->config->item('table_api_auth_token'), $data);
         if ($id) {
             redirect($service_info['service_url'] . $data['auth_token'], 'refresh');
         } else {
             echo "Unable to save data";
         }
     } else {
         echo "invalid service";
     }
 }
Ejemplo n.º 13
0
 public function upload_excel_file()
 {
     $user = User_helper::get_user();
     if ($_FILES["file"]['name'] != "") {
         $arr = explode(".", $_FILES["file"]['name']);
         $ext = $arr[sizeof($arr) - 1];
     }
     $size = $_FILES["file"]['size'];
     $this->load->library('upload');
     $fileName = 'template_' . $user->id . '_' . date('Ymdhis');
     if ($ext == 'xls' || $ext == 'xlsx') {
         System_helper::upload_excel_file($fileName, $save_dir = "uploads/excel", $max_size = 60000, $types = 'xls|xlsx');
         if ($ext == 'xls') {
             $path = "uploads/excel/" . $fileName . '.xls';
         } else {
             $path = "uploads/excel/" . $fileName . '.xlsx';
         }
         if ($size < 60000) {
             $i = 0;
             $totalcount = 0;
             $objPHPExcel = PHPExcel_IOFactory::load($path);
             foreach ($objPHPExcel->getWorksheetIterator() as $worksheet) {
                 $worksheetTitle = $worksheet->getTitle();
                 $highestRow = $worksheet->getHighestRow();
                 $highestColumn = $worksheet->getHighestColumn();
                 $highestColumnIndex = PHPExcel_Cell::columnIndexFromString($highestColumn);
                 $nrColumns = ord($highestColumn) - 64;
                 for ($row = 1; $row <= $highestRow; ++$row) {
                     for ($col = 0; $col < $highestColumnIndex; ++$col) {
                         $cell = $worksheet->getCellByColumnAndRow($col, $row);
                         $val = $cell->getValue();
                         $dataType = PHPExcel_Cell_DataType::dataTypeForValue($val);
                     }
                 }
             }
             $total_men = 0;
             $total_women = 0;
             $total_tribe = 0;
             $total_disability = 0;
             $total_services = 0;
             $total_income = 0;
             $check_income = false;
             for ($row = 3; $row <= $highestRow; ++$row) {
                 $val = array();
                 for ($col = 0; $col < $highestColumnIndex; ++$col) {
                     $cell = $worksheet->getCellByColumnAndRow($col, $row);
                     $val[] = $cell->getValue();
                 }
                 if ($val[3] != "" && $val[3] != null) {
                     $serial[$i] = System_helper::Get_Bng_to_Eng($val[0]);
                     $customer_name[$i] = $val[1];
                     $gender[$i] = $val[2];
                     $service_name[$i] = $val[3];
                     $amount[$i] = System_helper::Get_Bng_to_Eng(abs($val[4]));
                     if (strlen($amount[$i]) > 6) {
                         $check_income = true;
                     }
                     if ($this->Service_template_model->check_uisc_service_existence($service_name[$i])) {
                         $totalcount = $totalcount + $i;
                         $total_services++;
                         $total_income = $total_income + System_helper::Get_Bng_to_Eng($amount[$i]);
                         if ($gender[$i] == $this->lang->line('MALE_VAL')) {
                             $total_men++;
                         } elseif ($gender[$i] == $this->lang->line('FEMALE_VAL')) {
                             $total_women++;
                         } elseif ($gender[$i] == $this->lang->line('TRIBE_VAL')) {
                             $total_tribe++;
                         } elseif ($gender[$i] == $this->lang->line('DISABILITY_VAL')) {
                             $total_disability++;
                         }
                     }
                     ++$i;
                 }
             }
             $DateCell = $worksheet->getCellByColumnAndRow('1', '1');
             $invDateRaw = $DateCell->getValue();
             if (is_float($invDateRaw)) {
                 $newDate = System_helper::ExcelToPHPDate($invDateRaw);
                 $invDate = date('Y-m-d', $newDate);
             } else {
                 $invDate = $invDateRaw;
             }
             if ($this->Service_template_model->chk_existing_uploded_excel_file($invDate) < 2) {
                 $invoice_data = array();
                 $zilla_invoice_data = array();
                 $invoice_details_data = array();
                 $zilla_invoice_details_data = array();
                 $user_zilla = $user->zilla;
                 $zilla_table_invoice = str_pad($user_zilla, 2, "0", STR_PAD_LEFT) . '_invoices';
                 $zilla_table_invoice_details = str_pad($user_zilla, 2, "0", STR_PAD_LEFT) . '_invoice_details';
                 $uisc_id = $user->uisc_id;
                 $user_group_id = $user->user_group_id;
                 $division = $user->division;
                 $zilla = $user->zilla;
                 $upazila = $user->upazila;
                 $unioun = $user->unioun;
                 $citycorporation = $user->citycorporation;
                 //$citycorporationward = $user->citycorporationward;
                 $municipal = $user->municipal;
                 //$municipalward = $user->municipalward;
                 $invoice_date = $invDate;
                 $customerPost = $customer_name;
                 $servicePost = $service_name;
                 $genderPost = $gender;
                 $earningPost = $amount;
                 $count = sizeof($customerPost);
                 $invoice_data['uisc_id'] = $uisc_id;
                 $invoice_data['unionid'] = $unioun;
                 $invoice_data['municipalid'] = $municipal;
                 $invoice_data['citycorporationid'] = $citycorporation;
                 $invoice_data['upazilaid'] = $upazila;
                 $invoice_data['zillaid'] = $zilla;
                 $invoice_data['divid'] = $division;
                 $invoice_data['type'] = $user_group_id;
                 $invoice_data['invoice_date'] = $invoice_date;
                 $invoice_data['total_income'] = $total_income;
                 $invoice_data['total_service'] = $total_services;
                 $invoice_data['total_men'] = $total_men;
                 $invoice_data['total_women'] = $total_women;
                 $invoice_data['total_tribe'] = $total_tribe;
                 $invoice_data['total_disability'] = $total_disability;
                 $zilla_invoice_data['uisc_id'] = $uisc_id;
                 $zilla_invoice_data['unionid'] = $unioun;
                 $zilla_invoice_data['municipalid'] = $municipal;
                 $zilla_invoice_data['citycorporationid'] = $citycorporation;
                 $zilla_invoice_data['upazilaid'] = $upazila;
                 $zilla_invoice_data['zillaid'] = $zilla;
                 $zilla_invoice_data['divid'] = $division;
                 $zilla_invoice_data['type'] = $user_group_id;
                 $zilla_invoice_data['invoice_date'] = $invoice_date;
                 $zilla_invoice_data['total_income'] = $total_income;
                 $zilla_invoice_data['total_service'] = $total_services;
                 $zilla_invoice_data['total_men'] = $total_men;
                 $zilla_invoice_data['total_women'] = $total_women;
                 //                    echo $zilla_table_invoice;
                 //                    print_r($zilla_invoice_data);exit;
                 if (!$check_income) {
                     if ($total_services > 0) {
                         $this->db->trans_start();
                         //DB Transaction Handle START
                         //$delete_invoice_data['invoice_date'] = $invoice_date;
                         //Query_helper::delete('invoices', $delete_invoice_data);
                         if ($this->Service_template_model->delete_invoice_data($invoice_date)) {
                             $invoice_id = Query_helper::add('invoices', $invoice_data);
                             $zilla_invoice_id = Query_helper::add($zilla_table_invoice, $zilla_invoice_data);
                             for ($i = 0; $i < $count; $i++) {
                                 if ($this->Service_template_model->check_uisc_service_existence($servicePost[$i])) {
                                     list($service_id, $service_name) = $this->Service_template_model->check_uisc_service_existence($servicePost[$i]);
                                     $invoice_details_data['invoice_id'] = $invoice_id;
                                     $invoice_details_data['receiver_name'] = $customerPost[$i];
                                     $invoice_details_data['receiver_sex'] = $genderPost[$i];
                                     $invoice_details_data['service_id'] = $service_id;
                                     //$this->Service_template_model->get_service_id($servicePost[$i]);
                                     $invoice_details_data['income'] = System_helper::Get_Bng_to_Eng($earningPost[$i]);
                                     $invoice_details_data['service_name'] = $service_name;
                                     //$this->Service_template_model->get_service_name($servicePost[$i]);
                                     $zilla_invoice_details_data['invoice_id'] = $zilla_invoice_id;
                                     $zilla_invoice_details_data['receiver_name'] = $customerPost[$i];
                                     $zilla_invoice_details_data['receiver_sex'] = $genderPost[$i];
                                     $zilla_invoice_details_data['service_id'] = $service_id;
                                     //$this->Service_template_model->get_service_id($servicePost[$i]);
                                     $zilla_invoice_details_data['income'] = System_helper::Get_Bng_to_Eng($earningPost[$i]);
                                     $zilla_invoice_details_data['service_name'] = $service_name;
                                     //$this->Service_template_model->get_service_name($servicePost[$i]);
                                     Query_helper::add('invoice_details', $invoice_details_data);
                                     Query_helper::add($zilla_table_invoice_details, $zilla_invoice_details_data);
                                 }
                             }
                             $fileInfo = array('user_id' => $user->id, 'uisc_id' => $uisc_id, 'file_name' => $fileName, 'upload_date' => strtotime($invDate), 'create_date' => time());
                             Query_helper::add($this->config->item('table_excel_history'), $fileInfo);
                             $this->db->trans_complete();
                             //DB Transaction Handle END
                             if ($this->db->trans_status() === TRUE) {
                                 $this->message = $this->lang->line("MSG_CREATE_SUCCESS");
                                 $this->dcms_add();
                             } else {
                                 $ajax['status'] = false;
                                 $ajax['system_message'] = $this->lang->line("MSG_CREATE_FAIL");
                                 $this->jsonReturn($ajax);
                             }
                         } else {
                             $ajax['status'] = false;
                             $ajax['system_message'] = $this->lang->line("MSG_CREATE_FAIL");
                             $this->jsonReturn($ajax);
                         }
                     } else {
                         $ajax['status'] = false;
                         $ajax['system_message'] = $this->lang->line("NO_SERVICES_IN_UISC");
                         $this->jsonReturn($ajax);
                     }
                 } else {
                     $ajax['status'] = false;
                     $ajax['system_message'] = $this->lang->line("MSG_INCOME_AMOUNT_INVALID");
                     $this->jsonReturn($ajax);
                 }
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_MAXIMUM_NUMBER_OF_FILES");
                 $this->jsonReturn($ajax);
             }
         } else {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("MSG_MAX_SIZE");
             $this->jsonReturn($ajax);
         }
     } else {
         $ajax['status'] = false;
         $ajax['system_message'] = $this->lang->line("MSG_EXCEL_ONLY");
         $this->jsonReturn($ajax);
     }
 }
Ejemplo n.º 14
0
 private function system_save()
 {
     $user = User_helper::get_user();
     $id = $this->input->post("id");
     if (!$this->permissions['edit']) {
         $ajax['status'] = false;
         $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
         $this->jsonReturn($ajax);
         die;
     }
     if (!$this->check_validation()) {
         $ajax['status'] = false;
         $ajax['system_message'] = $this->message;
         $this->jsonReturn($ajax);
     } else {
         $tasks = $this->input->post('tasks');
         $user_group_id = $this->input->post('id');
         $time = time();
         $this->db->trans_start();
         //DB Transaction Handle START
         foreach ($tasks as $task) {
             $data = array();
             if (isset($task['list']) && $task['list'] == 1) {
                 $data['list'] = 1;
             } else {
                 $data['list'] = 0;
             }
             if (isset($task['view']) && $task['view'] == 1) {
                 $data['view'] = 1;
             } else {
                 $data['view'] = 0;
             }
             if (isset($task['add']) && $task['add'] == 1) {
                 $data['add'] = 1;
             } else {
                 $data['add'] = 0;
             }
             if (isset($task['edit']) && $task['edit'] == 1) {
                 $data['edit'] = 1;
             } else {
                 $data['edit'] = 0;
             }
             if (isset($task['delete']) && $task['delete'] == 1) {
                 $data['delete'] = 1;
             } else {
                 $data['delete'] = 0;
             }
             if (isset($task['report']) && $task['report'] == 1) {
                 $data['report'] = 1;
             } else {
                 $data['report'] = 0;
             }
             if (isset($task['print']) && $task['print'] == 1) {
                 $data['print'] = 1;
             } else {
                 $data['print'] = 0;
             }
             if ($data['view'] || $data['add'] || $data['edit'] || $data['delete'] || $data['report'] || $data['print']) {
                 $data['list'] = 1;
             }
             if ($task['ugr_id'] > 0) {
                 $data['update_by'] = $user->id;
                 $data['update_date'] = $time;
                 Query_helper::update($this->config->item('table_user_group_role'), $data, array("id = " . $task['ugr_id']));
             } else {
                 $data['user_group_id'] = $user_group_id;
                 $data['component_id'] = $task['component_id'];
                 $data['module_id'] = $task['module_id'];
                 $data['task_id'] = $task['task_id'];
                 $data['create_by'] = $user->id;
                 $data['create_date'] = $time;
                 Query_helper::add($this->config->item('table_user_group_role'), $data);
             }
         }
         $this->db->trans_complete();
         //DB Transaction Handle END
         if ($this->db->trans_status() === TRUE) {
             $this->message = $this->lang->line("MSG_ROLE_ASSIGN_SUCCESS");
             $this->system_list();
         } else {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("MSG_ROLE_ASSIGN_FAIL");
             $this->jsonReturn($ajax);
         }
     }
 }
Ejemplo n.º 15
0
 private function system_save()
 {
     $user = User_helper::get_user();
     $id = $this->input->post("id");
     if ($id > 0) {
         if (!$this->permissions['edit']) {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
             $this->jsonReturn($ajax);
             die;
         }
     } else {
         if (!$this->permissions['add']) {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
             $this->jsonReturn($ajax);
             die;
         }
     }
     if (!$this->check_validation()) {
         $ajax['status'] = false;
         $ajax['system_message'] = $this->message;
         $this->jsonReturn($ajax);
     } else {
         if ($id > 0) {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("MSG_UPDATE_FAIL");
             $this->jsonReturn($ajax);
         } else {
             $data = array();
             $user_id = $user->id;
             $uisc_id = $user->uisc_id;
             $data['uisc_id'] = $uisc_id;
             $data['user_id'] = $user_id;
             $data['question'] = $this->input->post('question');
             $data['user_type'] = $this->input->post('user_group');
             $data['create_by'] = $user_id;
             $data['create_date'] = time();
             $this->db->trans_start();
             //DB Transaction Handle START
             Query_helper::add($this->config->item('table_faqs'), $data);
             $this->db->trans_complete();
             //DB Transaction Handle END
             if ($this->db->trans_status() === TRUE) {
                 $this->message = $this->lang->line("MSG_CREATE_SUCCESS");
                 $save_and_new = $this->input->post('system_save_new_status');
                 if ($save_and_new == 1) {
                     $this->system_add();
                 } else {
                     $this->system_list();
                 }
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_CREATE_FAIL");
                 $this->jsonReturn($ajax);
             }
         }
     }
 }
Ejemplo n.º 16
0
>
                        <?php 
if (isset($uisc_id) && $uisc_id > 0) {
    if ($upazila > 0) {
        $center_type_udc = $this->config->item('ONLINE_UNION_GROUP_ID');
        $udcs = Query_helper::get_info($this->config->item('table_uisc_infos'), array('id value', 'uisc_name text'), array('uisc_type = ' . $center_type_udc, 'zilla = ' . $zilla, 'upazilla = ' . $upazila, 'union = ' . $union));
        $CI->load_view("dropdown", array('drop_down_options' => $udcs, 'drop_down_selected' => $uisc_id));
    }
    if ($citycorporation > 0) {
        $center_type_cdc = $this->config->item('ONLINE_CITY_CORPORATION_WORD_GROUP_ID');
        $cdcs = Query_helper::get_info($this->config->item('table_uisc_infos'), array('id value', 'uisc_name text'), array('uisc_type = ' . $center_type_cdc, 'zilla = ' . $zilla, 'citycorporation = ' . $citycorporation, 'citycorporationward = ' . $citycorporationward));
        $CI->load_view("dropdown", array('drop_down_options' => $cdcs, 'drop_down_selected' => $uisc_id));
    }
    if ($municipal > 0) {
        $center_type_pdc = $this->config->item('ONLINE_MUNICIPAL_WORD_GROUP_ID');
        $pdcs = Query_helper::get_info($this->config->item('table_uisc_infos'), array('id value', 'uisc_name text'), array('uisc_type = ' . $center_type_pdc, 'zilla = ' . $zilla, 'municipal = ' . $municipal, 'municipalward = ' . $municipalward));
        $CI->load_view("dropdown", array('drop_down_options' => $pdcs, 'drop_down_selected' => $uisc_id));
    }
    ?>
                            <input type="hidden" name="digital_center" value="<?php 
    echo $uisc_id;
    ?>
" />
                        <?php 
}
?>
                    </select>
                </div>
            </div>

Ejemplo n.º 17
0
 private function dcms_save()
 {
     $time = time();
     $user = User_helper::get_user();
     $id = $this->input->post("id");
     if (!$this->check_validation()) {
         $ajax['status'] = false;
         $ajax['system_message'] = $this->message;
         $this->jsonReturn($ajax);
     } else {
         if ($id > 0) {
             $data = $this->input->post('service');
             $data['update_by'] = $user->id;
             $data['update_date'] = time();
             $directory = 'images/service_logo';
             $uploaded = System_helper::upload_file($directory, 5120, 'jpg|png');
             if ($uploaded) {
                 $data['service_logo'] = $uploaded['service_logo']['info']['file_name'];
             }
             $id = Query_helper::update($this->config->item('table_api_services'), $data, ['id =' . $id]);
             if ($id) {
                 $this->message = $this->lang->line("MSG_CREATE_SUCCESS");
                 $save_and_new = $this->input->post('system_save_new_status');
                 if ($save_and_new == 1) {
                     $this->dcms_add();
                 } else {
                     $this->dcms_list();
                 }
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_CREATE_FAIL");
                 $this->jsonReturn($ajax);
             }
         } else {
             $data = $this->input->post('service');
             $data['create_by'] = $user->id;
             $data['create_date'] = time();
             $directory = 'images/service_logo';
             $uploaded = System_helper::upload_file($directory, 5120, 'jpg|png');
             if ($uploaded) {
                 $data['service_logo'] = $uploaded['service_logo']['info']['file_name'];
             }
             $id = Query_helper::add($this->config->item('table_api_services'), $data);
             if ($id) {
                 $this->message = $this->lang->line("MSG_CREATE_SUCCESS");
                 $save_and_new = $this->input->post('system_save_new_status');
                 if ($save_and_new == 1) {
                     $this->dcms_add();
                 } else {
                     $this->dcms_list();
                 }
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_CREATE_FAIL");
                 $this->jsonReturn($ajax);
             }
         }
     }
 }
Ejemplo n.º 18
0
 private function system_save()
 {
     $user = User_helper::get_user();
     $id = $this->input->post("id");
     if ($id > 0) {
         if (!$this->permissions['edit']) {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
             $this->jsonReturn($ajax);
             die;
         }
     } else {
         if (!$this->permissions['add']) {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
             $this->jsonReturn($ajax);
             die;
         }
     }
     if (!$this->check_validation()) {
         $ajax['status'] = false;
         $ajax['system_message'] = $this->message;
         $this->jsonReturn($ajax);
     } else {
         $ticket_detail = $this->input->post('ticket');
         $dir = $this->config->item("file_upload");
         $uploaded = System_helper::upload_file($dir['ticket_issue'], 1024, 'gif|jpg|png|xls|xlsx|pdf|doc|docx');
         if (array_key_exists('issue_attachment', $uploaded)) {
             if ($uploaded['issue_attachment']['status']) {
                 $ticket_detail['issue_attachment'] = $uploaded['issue_attachment']['info']['file_name'];
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->message .= $uploaded['issue_attachment']['message'] . '<br>';
                 $this->jsonReturn($ajax);
             }
         }
         $comment_detail = $this->input->post('comment');
         if ($id > 0) {
             unset($ticket_detail['id']);
             $ticket_detail['update_by'] = $user->id;
             $ticket_detail['update_date'] = time();
             $this->db->trans_start();
             //DB Transaction Handle START
             //Query_helper::update($this->config->item('table_ticket_issue'),$ticket_detail,array("id = ".$id));
             $comment_detail['type'] = $this->config->item('ticket_comment_end_user');
             $comment_detail['ticket_issue_id'] = $id;
             $comment_detail['create_by'] = $user->id;
             $comment_detail['create_date'] = time();
             Query_helper::add($this->config->item('table_ticket_resolve_comment'), $comment_detail);
             $this->db->trans_complete();
             //DB Transaction Handle END
             if ($this->db->trans_status() === TRUE) {
                 $this->message = $this->lang->line("MSG_UPDATE_SUCCESS");
                 $save_and_new = $this->input->post('system_save_new_status');
                 if ($save_and_new == 1) {
                     $this->system_add();
                 } else {
                     $this->system_list();
                 }
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_UPDATE_FAIL");
                 $this->jsonReturn($ajax);
             }
         } else {
             $ticket_detail['status'] = $this->config->item('STATUS_INACTIVE');
             $ticket_detail['create_by'] = $user->id;
             $ticket_detail['create_date'] = time();
             $this->db->trans_start();
             //DB Transaction Handle START
             Query_helper::add($this->config->item('table_ticket_issue'), $ticket_detail);
             $this->db->trans_complete();
             //DB Transaction Handle END
             if ($this->db->trans_status() === TRUE) {
                 $this->message = $this->lang->line("MSG_CREATE_SUCCESS");
                 $save_and_new = $this->input->post('system_save_new_status');
                 if ($save_and_new == 1) {
                     $this->system_add();
                 } else {
                     $this->system_list();
                 }
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_CREATE_FAIL");
                 $this->jsonReturn($ajax);
             }
         }
     }
 }
Ejemplo n.º 19
0
 private function system_save()
 {
     $user = User_helper::get_user();
     $id = $this->input->post("id");
     if ($id > 0) {
         if (!$this->permissions['edit']) {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
             $this->jsonReturn($ajax);
             die;
         }
     } else {
         if (!$this->permissions['add']) {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
             $this->jsonReturn($ajax);
             die;
         }
     }
     if (!$this->check_validation()) {
         $ajax['status'] = false;
         $ajax['system_message'] = $this->message;
         $this->jsonReturn($ajax);
     } else {
         $userDetail = array();
         $userDetail['password'] = $this->input->post('password');
         $userDetail['confirm_password'] = $this->input->post('confirm_password');
         if ($id > 0) {
             if ($userDetail['password'] != "") {
                 $actual_password = $userDetail['password'];
                 $encryptPass = md5(md5($userDetail['password']));
                 unset($userDetail['password']);
                 unset($userDetail['confirm_password']);
                 $userDetail['password'] = $encryptPass;
             } else {
                 unset($userDetail['password']);
                 unset($userDetail['confirm_password']);
             }
         } else {
             $encryptPass = md5(md5($userDetail['password']));
             unset($userDetail['password']);
             unset($userDetail['confirm_password']);
             $userDetail['password'] = $encryptPass;
         }
         if ($id > 0) {
             $userDetail['update_by'] = $user->id;
             $userDetail['update_date'] = time();
             $this->db->trans_start();
             //DB Transaction Handle START
             Query_helper::update($this->config->item('table_users'), $userDetail, array("id = " . $id));
             $this->db->trans_complete();
             //DB Transaction Handle END
             if ($this->db->trans_status() === TRUE) {
                 //                    $this->load->library('email');
                 //                    $this->email->set_mailtype("html");
                 //                    $this->email->from('*****@*****.**');
                 //                    $this->email->to('*****@*****.**');
                 //                    $mail_body = $this->load->view('mail_all_applicant', $data, true);
                 //                    $subject = "ইউজার আইডি ও পাসওয়ার্ড ";
                 //                    $this->email->subject($subject);
                 //                    $this->email->message($mail_body);
                 //                    $email = $this->email->send();
                 //                    if ($email) {
                 //                        $user_info = $this->test_model->email_sent('send', $user_infos['username'], $applicant_email);
                 //                    } else {
                 //                        $user_info = $this->test_model->email_sent('not send', $user_infos['username'], $applicant_email);
                 //                    }
                 //                    $this->email->print_debugger();
                 $this->message = $this->lang->line("MSG_UPDATE_SUCCESS");
                 $save_and_new = $this->input->post('system_save_new_status');
                 if ($save_and_new == 1) {
                     $subject = $this->lang->line('ADMIN_PASSWORD_CHANGE_SUBJECT_TITLE');
                     $msg = "আপনার পাসওয়ার্ড পরিবর্তন করা হয়েছে। আপনার নতুন পাসওয়ার্ডঃ  " . $actual_password;
                     $from_email = $this->config->item('from_mail_address');
                     $to_email = $userDetail['email'];
                     $cc_email = $from_email;
                     User_helper::mail_send($from_email, $to_email, $cc_email, '', $subject, $msg);
                     $this->system_edit();
                 } else {
                     $this->system_edit();
                 }
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_UPDATE_FAIL");
                 $this->jsonReturn($ajax);
             }
         } else {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("MSG_UPDATE_FAIL");
             $this->jsonReturn($ajax);
         }
     }
 }
Ejemplo n.º 20
0
            foreach ($zilla['upazilla'] as $upazilla) {
                ?>
                <tr>
                    <th colspan="<?php 
                echo $numDays + 4;
                ?>
" class="text-center">
                        <?php 
                echo $upazilla['upazilla_name'] . $this->lang->line('UPAZILLA_NAME');
                ?>
 <br>
                        <?php 
                echo !isset($upazilas) ? $this->config->item('month')[$month] . '-' . System_helper::Get_Eng_to_Bng($year) . "<br/>" : "";
                ?>
                        <?php 
                echo $this->lang->line('TOTAL_UNION') . ' ' . System_helper::Get_Eng_to_Bng(count(Query_helper::get_info($this->config->item('table_unions'), 'rowid', array('zillaid =' . $zilla['zilla_id'], 'upazilaid =' . $upazilla['upazilla_id']))));
                ?>
                    </th>
                </tr>
                <tr>
                    <th><?php 
                echo $this->lang->line('UNION');
                ?>
</th>
                    <th><?php 
                echo $this->lang->line('CENTER');
                ?>
</th>
                    <?php 
                for ($d = 1; $d <= $numDays; $d++) {
                    ?>
Ejemplo n.º 21
0
 private function system_save()
 {
     $user = User_helper::get_user();
     $id = $this->input->post("id");
     if ($id > 0) {
         if (!$this->permissions['edit']) {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
             $this->jsonReturn($ajax);
             die;
         }
     } else {
         if (!$this->permissions['add']) {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
             $this->jsonReturn($ajax);
             die;
         }
     }
     if (!$this->check_validation()) {
         $ajax['status'] = false;
         $ajax['system_message'] = $this->message;
         $this->jsonReturn($ajax);
     } else {
         $data = $this->input->post('product');
         $dir = $this->config->item("file_upload");
         $uploaded = System_helper::upload_file($dir['users'], 1024, 'gif|jpg|png|doc|pdf|xls|xlsx');
         $attachment = '';
         if (array_key_exists('attachment', $uploaded)) {
             if ($uploaded['attachment']['status']) {
                 $attachment = $uploaded['attachment']['info']['file_name'];
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->message .= $uploaded['attachment']['message'] . '<br>';
                 $this->jsonReturn($ajax);
             }
         }
         if ($id > 0) {
             unset($data['id']);
             $data['update_by'] = $user->id;
             $data['attachment'] = $attachment;
             $data['status'] = 1;
             $data['warranty_start_date'] = strtotime($data['warranty_start_date']);
             $data['warranty_end_date'] = strtotime($data['warranty_end_date']);
             $data['purchase_date'] = strtotime($data['purchase_date']);
             $data['update_date'] = time();
             $data['product_code'] = $data['product_code'][0];
             $data['serial_number'] = $data['serial_number'][0];
             $this->db->trans_start();
             //DB Transaction Handle START
             Query_helper::update($this->config->item('table_product'), $data, array("id = " . $id));
             $this->db->trans_complete();
             //DB Transaction Handle END
             if ($this->db->trans_status() === TRUE) {
                 $this->message = $this->lang->line("MSG_UPDATE_SUCCESS");
                 $save_and_new = $this->input->post('system_save_new_status');
                 if ($save_and_new == 1) {
                     $this->system_add();
                 } else {
                     $this->system_list();
                 }
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_UPDATE_FAIL");
                 $this->jsonReturn($ajax);
             }
         } else {
             $data['create_by'] = $user->id;
             $data['create_date'] = time();
             $data['status'] = 1;
             $data['attachment'] = $attachment;
             $data['warranty_start_date'] = strtotime($data['warranty_start_date']);
             $data['warranty_end_date'] = strtotime($data['warranty_end_date']);
             $data['purchase_date'] = strtotime($data['purchase_date']);
             $data['quantity'] = 1;
             $product_code = $data['product_code'];
             $serial_number = $data['serial_number'];
             unset($data['product_code']);
             unset($data['serial_number']);
             $this->db->trans_start();
             //DB Transaction Handle START
             foreach ($product_code as $key => $code) {
                 $data['product_code'] = $code;
                 $data['serial_number'] = $serial_number[$key];
                 Query_helper::add($this->config->item('table_product'), $data);
             }
             $this->db->trans_complete();
             //DB Transaction Handle END
             if ($this->db->trans_status() === TRUE) {
                 $this->message = $this->lang->line("MSG_CREATE_SUCCESS");
                 $save_and_new = $this->input->post('system_save_new_status');
                 if ($save_and_new == 1) {
                     $this->system_add();
                 } else {
                     $this->system_list();
                 }
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_CREATE_FAIL");
                 $this->jsonReturn($ajax);
             }
         }
     }
 }
Ejemplo n.º 22
0
Archivo: Task.php Proyecto: mazba/ams
 public function get_modules_by_component_id()
 {
     $component_id = $this->input->post('component_id');
     $modules = Query_helper::get_info($this->config->item('table_module'), array('id value', 'name_' . $this->get_language_code() . ' text'), array('component_id = ' . $component_id, 'status !=99'));
     $ajax['status'] = true;
     $ajax['system_content'][] = array("id" => "#module_options", "html" => $this->load_view("dropdown", array('drop_down_options' => $modules), true));
     $this->jsonReturn($ajax);
 }
Ejemplo n.º 23
0
 public function system_save()
 {
     $id = $this->input->post("id");
     $data = $this->input->post('task');
     $user = User_helper::get_user();
     if ($id > 0) {
         $this->db->trans_start();
         //DB Transaction Handle START
         $data['modified_by'] = $user->user_id;
         $data['modification_date'] = time();
         Query_helper::update($this->config->item('table_task'), $data, array("id = " . $id));
         $this->db->trans_complete();
         //DB Transaction Handle END
         if ($this->db->trans_status() === TRUE) {
             $this->message = $this->lang->line("MSG_UPDATE_SUCCESS");
             $this->system_list();
         } else {
             $this->message = $this->lang->line("MSG_NOT_UPDATED_SUCCESS");
         }
     } else {
         $this->db->trans_start();
         //DB Transaction Handle START
         $data['created_by'] = $user->user_id;
         $data['creation_date'] = time();
         Query_helper::add($this->config->item('table_task'), $data);
         $this->db->trans_complete();
         //DB Transaction Handle END
         if ($this->db->trans_status() === TRUE) {
             $this->message = $this->lang->line("MSG_CREATE_SUCCESS");
             $this->system_list();
         } else {
             $this->message = $this->lang->line("MSG_NOT_SAVED_SUCCESS");
         }
     }
 }
Ejemplo n.º 24
0
 public function education_classescollege()
 {
     $classes = $this->input->post('classes');
     $educationlevel = Query_helper::get_info($this->config->item('table_classes'), array('id value', 'name text'), array('education_level_id = ' . $classes));
     $ajax['status'] = true;
     $ajax['system_content'][] = array("id" => "#classes", "html" => $this->load_view("dropdown", array('drop_down_options' => $educationlevel), true));
     $this->jsonReturn($ajax);
 }
Ejemplo n.º 25
0
 private function system_batch_delete()
 {
     if ($this->permissions['delete']) {
         $user = User_helper::get_user();
         $selected_ids = $this->input->post('selected_ids');
         $this->db->trans_start();
         //DB Transaction Handle START
         foreach ($selected_ids as $id) {
             Query_helper::update($this->config->item('table_services'), array('status' => 99, 'update_by' => $user->id, 'update_date' => time()), array("id = " . $id));
         }
         $this->db->trans_complete();
         //DB Transaction Handle END
         if ($this->db->trans_status() === TRUE) {
             $this->message = $this->lang->line("MSG_DELETE_SUCCESS");
             $this->system_list();
         } else {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("MSG_DELETE_FAIL");
             $this->jsonReturn($ajax);
         }
     } else {
         $ajax['status'] = false;
         $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
         $this->jsonReturn($ajax);
     }
 }
Ejemplo n.º 26
0
 private function system_save()
 {
     $user = User_helper::get_user();
     $id = $this->input->post("id");
     if ($id > 0) {
         if (!$this->permissions['edit']) {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
             $this->jsonReturn($ajax);
             die;
         }
     } else {
         if (!$this->permissions['add']) {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
             $this->jsonReturn($ajax);
             die;
         }
     }
     if (!$this->check_validation()) {
         $ajax['status'] = false;
         $ajax['system_message'] = $this->message;
         $this->jsonReturn($ajax);
     } else {
         $userDetail = $this->input->post('user_detail');
         if ($id > 0) {
             if ($userDetail['password'] != "") {
                 $encryptPass = md5(md5($userDetail['password']));
                 unset($userDetail['password']);
                 unset($userDetail['confirm_password']);
                 $userDetail['password'] = $encryptPass;
             } else {
                 unset($userDetail['password']);
                 unset($userDetail['confirm_password']);
             }
         } else {
             $encryptPass = md5(md5($userDetail['password']));
             unset($userDetail['password']);
             unset($userDetail['confirm_password']);
             $userDetail['password'] = $encryptPass;
         }
         $user_group_id_level = explode('-', $this->input->post("user_detail[user_group_id]"));
         $user_group_id = $user_group_id_level[0];
         //$user_group_level=$user_group_id_level[1];
         $userDetail['user_group_id'] = $user_group_id;
         $date_of_birth = strtotime($userDetail['dob']);
         $userDetail['dob'] = $date_of_birth;
         $dir = $this->config->item("file_upload");
         $uploaded = System_helper::upload_file($dir['users'], 1024, 'gif|jpg|png');
         if (array_key_exists('picture_name', $uploaded)) {
             if ($uploaded['picture_name']['status']) {
                 $userDetail['picture_name'] = $uploaded['picture_name']['info']['file_name'];
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->message .= $uploaded['picture_name']['message'] . '<br>';
                 $this->jsonReturn($ajax);
             }
         }
         if ($id > 0) {
             unset($userDetail['id']);
             $userDetail['update_by'] = $user->id;
             $userDetail['update_date'] = time();
             $this->db->trans_start();
             //DB Transaction Handle START
             Query_helper::update($this->config->item('table_users'), $userDetail, array("id = " . $id));
             $this->db->trans_complete();
             //DB Transaction Handle END
             if ($this->db->trans_status() === TRUE) {
                 $this->message = $this->lang->line("MSG_UPDATE_SUCCESS");
                 $save_and_new = $this->input->post('system_save_new_status');
                 if ($save_and_new == 1) {
                     $this->system_add();
                 } else {
                     $this->system_list();
                 }
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_UPDATE_FAIL");
                 $this->jsonReturn($ajax);
             }
         } else {
             $userDetail['status'] = $this->config->item('STATUS_ACTIVE');
             $userDetail['create_by'] = $user->id;
             $userDetail['create_date'] = time();
             $this->db->trans_start();
             //DB Transaction Handle START
             Query_helper::add($this->config->item('table_users'), $userDetail);
             $this->db->trans_complete();
             //DB Transaction Handle END
             if ($this->db->trans_status() === TRUE) {
                 $this->message = $this->lang->line("MSG_CREATE_SUCCESS");
                 $save_and_new = $this->input->post('system_save_new_status');
                 if ($save_and_new == 1) {
                     $this->system_add();
                 } else {
                     $this->system_list();
                 }
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_CREATE_FAIL");
                 $this->jsonReturn($ajax);
             }
         }
     }
 }
Ejemplo n.º 27
0
 private function system_save()
 {
     $user = User_helper::get_user();
     $id = $this->input->post("id");
     if ($id > 0) {
         if (!$this->permissions['edit']) {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
             $this->jsonReturn($ajax);
             die;
         }
     } else {
         if (!$this->permissions['add']) {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
             $this->jsonReturn($ajax);
             die;
         }
     }
     if (!$this->check_validation()) {
         $ajax['status'] = false;
         $ajax['system_message'] = $this->message;
         $this->jsonReturn($ajax);
     } else {
         $user_id = $this->input->post('user_id');
         //$row_id=$this->input->post('row_id');
         $ticket_issue_id = $this->input->post('ticket_issue_id');
         $ticket_priority = $this->input->post('ticket_priority');
         $count = count($this->input->post('row_id'));
         if ($id > 0) {
             //                unset($ticket_detail['id']);
             //
             //                $ticket_detail['update_by']=$user->id;
             //                $ticket_detail['update_date']=time();
             //
             //                $this->db->trans_start();  //DB Transaction Handle START
             //
             //                Query_helper::update($this->config->item('table_ticket_assign'),$ticket_detail,array("id = ".$id));
             //
             //                $this->db->trans_complete();   //DB Transaction Handle END
             //
             //                if ($this->db->trans_status() === TRUE)
             //                {
             //                    $this->message=$this->lang->line("MSG_UPDATE_SUCCESS");
             //                    $save_and_new=$this->input->post('system_save_new_status');
             //                    if($save_and_new==1)
             //                    {
             //                        $this->system_add();
             //                    }
             //                    else
             //                    {
             //                        $this->system_list();
             //                    }
             //                }
             //                else
             //                {
             //                    $ajax['status']=false;
             //                    $ajax['system_message']=$this->lang->line("MSG_UPDATE_FAIL");
             //                    $this->jsonReturn($ajax);
             //                }
         } else {
             $ticket_detail['status'] = $this->config->item('STATUS_ASSIGN');
             $ticket_detail['create_by'] = $user->id;
             $ticket_detail['create_date'] = time();
             $ticket_issue_detail['status'] = $this->config->item('STATUS_ASSIGN');
             $ticket_issue_detail['update_by'] = $user->id;
             $ticket_issue_detail['update_date'] = time();
             $this->db->trans_start();
             //DB Transaction Handle START
             for ($i = 0; $i < $count; $i++) {
                 if (isset($ticket_issue_id[$i])) {
                     $ticket_detail['user_id'] = $user_id;
                     $ticket_detail['ticket_issue_id'] = $ticket_issue_id[$i];
                     $ticket_detail['priority'] = $ticket_priority[$i];
                     Query_helper::add($this->config->item('table_ticket_assign'), $ticket_detail);
                     Query_helper::update($this->config->item('table_ticket_issue'), $ticket_issue_detail, array("id = " . $ticket_issue_id[$i]));
                 }
             }
             $this->db->trans_complete();
             //DB Transaction Handle END
             if ($this->db->trans_status() === TRUE) {
                 $this->message = $this->lang->line("MSG_CREATE_SUCCESS");
                 $save_and_new = $this->input->post('system_save_new_status');
                 if ($save_and_new == 1) {
                     $this->system_add();
                 } else {
                     $this->system_list();
                 }
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_CREATE_FAIL");
                 $this->jsonReturn($ajax);
             }
         }
     }
 }
Ejemplo n.º 28
0
 private function system_save()
 {
     $user = User_helper::get_user();
     $id = $this->input->post("id");
     if ($id > 0) {
         if (!$this->permissions['edit']) {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
             $this->jsonReturn($ajax);
             die;
         }
     } else {
         if (!$this->permissions['add']) {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
             $this->jsonReturn($ajax);
             die;
         }
     }
     if (!$this->check_validation()) {
         $ajax['status'] = false;
         $ajax['system_message'] = $this->message;
         $this->jsonReturn($ajax);
     } else {
         $media_info = $this->input->post('media');
         $dir = $this->config->item("dcms_upload");
         if ($media_info['media_type'] == 1) {
             $directory = $dir['media_photo'];
             unset($media_info['video_link']);
             unset($media_info['print_year']);
             unset($media_info['external_link']);
         } elseif ($media_info['media_type'] == 2) {
             $directory = $dir['media_photo'];
             unset($media_info['print_year']);
             unset($media_info['external_link']);
         } elseif ($media_info['media_type'] == 3) {
             $directory = $dir['media_print'];
             unset($media_info['video_link']);
         } elseif ($media_info['media_type'] == 4) {
             $directory = $dir['media_publication'];
             unset($media_info['video_link']);
             unset($media_info['print_year']);
         }
         $uploaded = System_helper::upload_file($directory, 5120, 'gif|jpg|png|pdf|doc|docx');
         if (array_key_exists('file_name', $uploaded)) {
             if ($uploaded['file_name']['status']) {
                 $media_info['file_name'] = $uploaded['file_name']['info']['file_name'];
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->message .= $uploaded['file_name']['message'] . '<br>';
                 $this->jsonReturn($ajax);
             }
         }
         if ($id > 0) {
             unset($media_info['id']);
             $media_info['update_by'] = $user->id;
             $media_info['update_date'] = time();
             $this->db->trans_start();
             //DB Transaction Handle START
             Query_helper::update($this->config->item('table_media'), $media_info, array("id = " . $id));
             $this->db->trans_complete();
             //DB Transaction Handle END
             if ($this->db->trans_status() === TRUE) {
                 $this->message = $this->lang->line("MSG_UPDATE_SUCCESS");
                 $save_and_new = $this->input->post('system_save_new_status');
                 if ($save_and_new == 1) {
                     $this->system_add();
                 } else {
                     $this->system_list();
                 }
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_UPDATE_FAIL");
                 $this->jsonReturn($ajax);
             }
         } else {
             $media_info['create_by'] = $user->id;
             $media_info['create_date'] = time();
             $this->db->trans_start();
             //DB Transaction Handle START
             Query_helper::add($this->config->item('table_media'), $media_info);
             $this->db->trans_complete();
             //DB Transaction Handle END
             if ($this->db->trans_status() === TRUE) {
                 $this->message = $this->lang->line("MSG_CREATE_SUCCESS");
                 $save_and_new = $this->input->post('system_save_new_status');
                 if ($save_and_new == 1) {
                     $this->system_add();
                 } else {
                     $this->system_list();
                 }
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_CREATE_FAIL");
                 $this->jsonReturn($ajax);
             }
         }
     }
 }
Ejemplo n.º 29
0
 private function system_save()
 {
     $user = User_helper::get_user();
     $id = $this->input->post("id");
     $data = $this->input->post('key');
     $keyConfig = $this->config->item('KEY_TYPE');
     if ($id > 0) {
         if (!$this->permissions['edit']) {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
             $this->jsonReturn($ajax);
         }
     } else {
         if (!$this->permissions['add']) {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
             $this->jsonReturn($ajax);
         }
     }
     if (!$this->check_validation()) {
         $ajax['status'] = false;
         $ajax['system_message'] = $this->message;
         $this->jsonReturn($ajax);
     } else {
         if ($data['parent'] == $keyConfig['CAMPUS'] || $data['parent'] == $keyConfig['SESSION']) {
             $data['description'] = json_encode($this->input->post('description'));
         }
         if ($id > 0) {
             $data['update_by'] = $user->id;
             $data['update_date'] = time();
             $this->db->trans_start();
             //DB Transaction Handle START
             Query_helper::update($this->config->item('table_system_keyword'), $data, array("id = " . $id));
             $this->db->trans_complete();
             //DB Transaction Handle END
             if ($this->db->trans_status() === TRUE) {
                 $this->message = $this->lang->line("MSG_UPDATE_SUCCESS");
                 $save_and_new = $this->input->post('system_save_new_status');
                 if ($save_and_new == 1) {
                     $this->system_add();
                 } else {
                     $this->system_list();
                 }
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_UPDATE_FAIL");
                 $this->jsonReturn($ajax);
             }
         } else {
             $data['create_by'] = $user->id;
             $data['create_date'] = time();
             $this->db->trans_start();
             //DB Transaction Handle START
             Query_helper::add($this->config->item('table_system_keyword'), $data);
             $this->db->trans_complete();
             //DB Transaction Handle END
             if ($this->db->trans_status() === TRUE) {
                 $this->message = $this->lang->line("MSG_CREATE_SUCCESS");
                 $save_and_new = $this->input->post('system_save_new_status');
                 if ($save_and_new == 1) {
                     $this->system_add();
                 } else {
                     $this->system_list();
                 }
             } else {
                 $ajax['status'] = false;
                 $ajax['system_message'] = $this->lang->line("MSG_CREATE_FAIL");
                 $this->jsonReturn($ajax);
             }
         }
     }
 }
Ejemplo n.º 30
0
 private function system_save()
 {
     $user = User_helper::get_user();
     if (!$this->permissions['add']) {
         $ajax['status'] = false;
         $ajax['system_message'] = $this->lang->line("YOU_DONT_HAVE_ACCESS");
         $this->jsonReturn($ajax);
         die;
     }
     if (!$this->check_validation()) {
         $ajax['status'] = false;
         $ajax['system_message'] = $this->message;
         $this->jsonReturn($ajax);
     } else {
         $data = $this->input->post('requisition');
         $data['create_by'] = $user->id;
         $data['create_date'] = time();
         $data['user_id'] = $user->id;
         $this->load->helper('string');
         $data['requisition_id'] = time() . random_string('alpha', 3);
         $this->db->trans_start();
         //DB Transaction Handle START
         Query_helper::add($this->config->item('table_requisition'), $data);
         $this->db->trans_complete();
         //DB Transaction Handle END
         if ($this->db->trans_status() === TRUE) {
             $this->message = $this->lang->line("MSG_CREATE_SUCCESS");
             $save_and_new = $this->input->post('system_save_new_status');
             if ($save_and_new == 1) {
                 $this->system_add();
             } else {
                 $this->system_list();
             }
         } else {
             $ajax['status'] = false;
             $ajax['system_message'] = $this->lang->line("MSG_CREATE_FAIL");
             $this->jsonReturn($ajax);
         }
     }
 }