Example #1
0
 public function indexAction()
 {
     // action body
     //create sesesion
     $session_search_user = new Zend_Session_Namespace('search_user');
     if (empty($session_search_user->limit)) {
         $session_search_user->limit = Application_Form_FrmNavigation::getLimit();
         $session_search_user->active = -1;
         $session_search_user->user_type = -1;
         $session_search_user->txtsearch = '';
         $session_search_user->lock();
     }
     //start page nevigation
     $limit = $session_search_user->limit;
     $start = $this->getRequest()->getParam('limit_satrt', 0);
     $db_user = new Application_Model_DbTable_DbUsers();
     $this->view->activelist = $this->activelist;
     $this->view->active = $session_search_user->active;
     $this->view->user_typelist = $this->user_typelist;
     $this->view->user_type = $session_search_user->user_type;
     if ($this->getRequest()->isPost()) {
         $user_seach_data = $this->getRequest()->getPost();
         //set session when submit
         $session_search_user->unlock();
         $session_search_user->limit = $user_seach_data['rows_per_page'];
         $session_search_user->active = $user_seach_data['active'];
         $session_search_user->user_type = $user_seach_data['user_type'];
         $session_search_user->txtsearch = $user_seach_data['txtsearch'];
         $session_search_user->lock();
         //set value for display
         $this->view->txtsearch = $user_seach_data['txtsearch'];
         $this->view->active = $user_seach_data['active'];
         $this->view->user_type = $user_seach_data['user_type'];
         $limit = $user_seach_data['rows_per_page'];
         $users = $db_user->getUserListBy($user_seach_data, $start, $limit);
         $record_count = $db_user->getUserListTotal($user_seach_data);
     } else {
         if ($session_search_user->active > -1 || $session_search_user->user_type > -1 || !empty($session_search_user->txtsearch)) {
             $user_seach_data = array('active' => $session_search_user->active, 'user_type' => $session_search_user->user_type, 'txtsearch' => $session_search_user->txtsearch);
             $users = $db_user->getUserListBy($user_seach_data, $start, $limit);
             $record_count = $db_user->getUserListTotal($user_seach_data);
         } else {
             $users = $db_user->getUserList($start, $limit);
             $record_count = $db_user->getUserListTotal();
         }
     }
     $result = array();
     $row_num = $start;
     foreach ($users as $i => $user) {
         $result[$i] = array('num' => ++$row_num, 'name' => $user['name'], 'id' => $user['id'], 'user_name' => $user['user_name'], 'active' => $this->activelist[$user['active']], 'user_type' => $this->user_typelist[$user['user_type']]);
     }
     $this->view->userlist = Zend_Json::encode($result);
     $page = new Application_Form_FrmNavigation(self::REDIRECT_URL, $start, $limit, $record_count);
     $page->init(self::REDIRECT_URL, $start, $limit, $record_count);
     $this->view->nevigation = $page->navigationPage();
     $this->view->rows_per_page = $page->getRowsPerPage($limit, 'frmlist_users');
     $this->view->result_row = $page->getResultRows();
 }
Example #2
0
 public function indexAction()
 {
     // action body
     //create sesesion
     $session_search_agent = new Zend_Session_Namespace('search_agent');
     if (empty($session_search_agent->limit)) {
         $session_search_agent->limit = Application_Form_FrmNavigation::getLimit();
         $session_search_agent->active = -1;
         $session_search_agent->province = -1;
         $session_search_agent->txtsearch = '';
         $session_search_agent->lock();
     }
     //start page nevigation
     $limit = $session_search_agent->limit;
     $start = $this->getRequest()->getParam('limit_satrt', 0);
     $pro = new Application_Model_DbTable_DbProvinces();
     $this->view->provincelist = $pro->getProvinceList();
     $this->view->province = $session_search_agent->province;
     $db_agent = new Application_Model_DbTable_DbAgents();
     $this->view->activelist = $this->activelist;
     $this->view->active = $session_search_agent->active;
     if ($this->getRequest()->isPost()) {
         $agent_seach_data = $this->getRequest()->getPost();
         //set session when submit
         $session_search_agent->unlock();
         $session_search_agent->limit = $agent_seach_data['rows_per_page'];
         $session_search_agent->active = $agent_seach_data['active'];
         $session_search_agent->province = $agent_seach_data['province'];
         $session_search_agent->txtsearch = $agent_seach_data['txtsearch'];
         $session_search_agent->lock();
         $this->view->province = $agent_seach_data['province'];
         $this->view->txtsearch = $agent_seach_data['txtsearch'];
         $this->view->active = $agent_seach_data['active'];
         $limit = $session_search_agent->limit;
         $agents = $db_agent->getAgentListBy($agent_seach_data, $start, $limit);
         $record_count = $db_agent->getAgentListTotal($agent_seach_data);
     } else {
         if (!empty($session_search_agent->txtsearch) || $session_search_agent->active > -1 || $session_search_agent->province > -1) {
             $agent_seach_data = array('active' => $session_search_agent->active, 'province' => $session_search_agent->province, 'txtsearch' => $session_search_agent->txtsearch);
             $agents = $db_agent->getAgentListBy($agent_seach_data, $start, $limit);
             $record_count = $db_agent->getAgentListTotal($agent_seach_data);
         } else {
             $agents = $db_agent->getAgentList($start, $limit);
             $record_count = $db_agent->getAgentListTotal();
         }
     }
     $result = array();
     $row_num = $start;
     foreach ($agents as $i => $agent) {
         $result[$i] = array('num' => ++$row_num, 'id' => $agent['id'], 'tel' => $agent['tel'], 'name' => $agent['name'], 'proname' => $agent['proname'], 'khan' => $agent['khan'], 'sangkat' => $agent['sangkat'], 'block' => $agent['block']);
     }
     $this->view->agentlist = Zend_Json::encode($result);
     $page = new Application_Form_FrmNavigation(self::REDIRECT_URL, $start, $limit, $record_count);
     $page->init(self::REDIRECT_URL, $start, $limit, $record_count);
     $this->view->nevigation = $page->navigationPage();
     $this->view->rows_per_page = $page->getRowsPerPage($limit, 'frmlist_agent');
     $this->view->result_row = $page->getResultRows();
 }
 public function indexAction()
 {
     try {
         $newstudent_session = Application_Model_DbTable_DbGlobal::SessionNavigetor('new-student');
         if (empty($newstudent_session->limit)) {
             $newstudent_session->limit = Application_Form_FrmNavigation::getLimit();
             $newstudent_session->lock();
         }
         $limit = $newstudent_session->limit;
         $start = $this->start();
         if ($this->getRequest()->isPost()) {
             $_data = $this->getRequest()->getPost();
             $newstudent_session->unlock();
             $newstudent_session->limit = $_data['rows_per_page'];
             $newstudent_session->lock();
             //set value for display
             $search = array('txtsearch' => $newstudent_session->txtsearch, 'title' => $_data['title'], 'status' => $_data['status_search'], 'subjec_name' => $_data['subjec_name']);
             $limit = $newstudent_session->limit;
         } else {
             $search = '';
         }
         $db = new Foundation_Model_DbTable_DbNewStudent();
         $teacher = $db->getAllNewStudent($search, $start, $limit);
         $record_count = $teacher[1];
         $row_num = $start;
         if (!empty($teacher)) {
             foreach ($teacher[0] as $i => $rs) {
                 $result[$i] = array('id' => $rs['id'], 'num' => ++$row_num, 'stu_khname' => $rs['stu_khname'], 'stu_enname' => $rs['stu_enname'], 'sex' => $rs['sex'], 'stu_card' => $rs['stu_card'], 'dob' => $rs['dob'], 'phone' => $rs['phone'], 'degree' => Application_Model_DbTable_DbGlobal::getAllDegreeById($rs["degree"]), 'major_id' => $rs["major_name"], 'session' => Application_Model_DbTable_DbGlobal::getSessionById($rs["session"]), 'status' => $this->activelist[$rs["status"]], 'create_date' => $rs["create_date"], 'user_name' => $rs["user_name"]);
             }
         } else {
             $result = Application_Model_DbTable_DbGlobal::getResultWarning();
         }
         $gride = new Application_Form_Frmlist();
         $collumn = array("NAME_KH", "NAME_EN", "SEX", "ID_NUMBER", "DOB", "PHONE", "DEGREE", "MAJORS", "SESSION", "STATUS", "CREATED_DATE", "BY_USER");
         $this->view->grideview = $gride->grideView(BASE_URL . "/foundation/newstudent/edit-student", "/foundation/newstudent/index", $collumn, @$result, $start, $limit, $record_count);
     } catch (Exception $e) {
         Application_Form_FrmMessage::message("Application Error");
         Application_Model_DbTable_DbUserLog::writeMessageError($e->getMessage());
     }
     $frm = new Application_Form_FrmOther();
     $this->view->add_major = $frm->FrmAddMajor(null);
     $frm = new Global_Form_FrmSearchMajor();
     $frm = $frm->frmSearchTeacher();
     Application_Model_Decorator::removeAllDecorator($frm);
     $this->view->frm_search = $frm;
 }
Example #4
0
 public function indexAction()
 {
     // action body
     try {
         $db_tran = new Application_Model_DbTable_DbGlobal();
         //create sesesion
         $session_transfer = new Zend_Session_Namespace('search_acl');
         if (empty($session_transfer->limit)) {
             $session_transfer->limit = Application_Form_FrmNavigation::getLimit();
             $session_transfer->lock();
         }
         $sql = "SELECT `acl_id`,`module`,`controller`,`action`,`status` FROM rsv_acl_acl";
         if ($this->getRequest()->isPost()) {
             $formdata = $this->getRequest()->getPost();
             $session_transfer->unlock();
             $session_transfer->limit = $formdata['rows_per_page'];
             $session_transfer->lock();
         }
         //start page nevigation
         $limit = $session_transfer->limit;
         $start = $this->getRequest()->getParam('limit_satrt', 0);
         $result = $db_tran->getGlobalDbListBy($sql, $start, $limit);
         $record_count = $db_tran->getGlobalDbListTotal($sql);
         $row_num = $start;
         if (empty($result)) {
             $result = array('err' => 1, 'msg' => 'មិន​ទាន់​មាន​ទន្និន័យ​នូវ​ឡើយ​ទេ!');
         }
         //print_r($result); exit;
         $this->view->list = Zend_Json::encode($result);
         $page = new Application_Form_FrmNavigation(self::REDIRECT_URL, $start, $limit, $record_count);
         $page->init(self::REDIRECT_URL, $start, $limit, $record_count);
         $this->view->nevigation = $page->navigationPage();
         $this->view->rows_per_page = $page->getRowsPerPage($limit, 'frmlist');
         $this->view->result_row = $page->getResultRows();
     } catch (Exception $e) {
     }
 }
 public function indexAction()
 {
     try {
         $db_tran = new Application_Model_DbTable_Dbpsc();
         //create sesesion
         $session_capital = new Zend_Session_Namespace('search_capital');
         if (empty($session_capital->limit)) {
             $session_capital->limit = Application_Form_FrmNavigation::getLimit();
             $session_capital->type_money = -1;
             $session_capital->staff_name = -1;
             $session_capital->from_date = date('Y-m-d');
             $session_capital->to_date = date('Y-m-d');
             $session_capital->lock();
         }
         //start page nevigation
         $limit = $session_capital->limit;
         $start = $this->getRequest()->getParam('limit_satrt', 0);
         $this->view->from_date = $session_capital->from_date;
         $this->view->to_date = $session_capital->to_date;
         $this->view->staff = $session_capital->staff;
         $cur = new Application_Model_DbTable_DbCurrencies();
         $this->view->currencylist = $cur->getCurrencyList();
         $this->view->type_money = $session_capital->type_money;
         if ($this->getRequest()->isPost()) {
             $formdata = $this->getRequest()->getPost();
             $session_capital->unlock();
             $session_capital->limit = $formdata['rows_per_page'];
             $session_capital->type_money = $formdata['type_money'];
             $session_capital->staff_name = $formdata['staff_name'];
             $session_capital->from_date = $formdata['from_date'];
             $session_capital->to_date = $formdata['to_date'];
             $session_capital->lock();
             $this->view->type_money = $formdata['type_money'];
             $this->view->staff_name = $formdata['staff_name'];
             $this->view->from_date = $session_capital->from_date;
             $this->view->to_date = $session_capital->to_date;
             $limit = $session_capital->limit;
         } else {
             $formdata = array('from_date' => $session_capital->from_date, 'to_date' => $session_capital->to_date, 'type_money' => $session_capital->type_money, 'staff_name' => $session_capital->staff_name);
         }
         $trans = $db_tran->getPscAmountListBy($formdata, $start, $limit);
         $record_count = $db_tran->getAllPscList($formdata);
         $result = array();
         $row_num = $start;
         if (!empty($trans)) {
             foreach ($trans as $i => $tran) {
                 $expired = '';
                 $is_expired = 0;
                 $volum = Application_Model_DbTable_DbGlobal::CurrencyOption($tran['currency_type'], $tran['volum']);
                 $result[$i] = array('num' => ++$row_num, 'id' => $tran['id'], 'staff_name' => $tran['staff_name'], 'currency_type' => $this->curr_type[$tran['currency_type']], 'volum' => number_format($volum) . ' ' . $this->curr_type[$tran['currency_type']], 'psc_amount' => $tran['psc_amount'] . " សន្លឹក", 'total_amount' => number_format($volum * $tran['psc_amount']) . ' ' . $this->curr_type[$tran['currency_type']], 'note' => $tran['note'], 'date' => date_format(date_create($tran['date']), "d/m/Y"), 'img' => $tran['id']);
             }
         } else {
             $result = array('err' => 1, 'msg' => 'មិន​ទាន់​មាន​ទន្និន័យ​នូវ​ឡើយ​ទេ!');
         }
         $this->view->tranlist = Zend_Json::encode($result);
         $page = new Application_Form_FrmNavigation(self::REDIRECT_URL, $start, $limit, $record_count);
         $page->init(self::REDIRECT_URL, $start, $limit, $record_count);
         $this->view->nevigation = $page->navigationPage();
         $this->view->rows_per_page = $page->getRowsPerPage($limit, 'frmlist_mt');
         $this->view->result_row = $page->getResultRows();
         $usr_mod = new Application_Model_DbTable_DbUsers();
         $user_list = $usr_mod->getUserListSelect();
         array_unshift($user_list, array('id' => '-1', "name" => "ជ្រើសរើសឈ្មោះបុគ្គលិក"));
         $this->view->users = $user_list;
         $session_user = new Zend_Session_Namespace('auth');
         $this->view->user_name = $session_user->last_name . ' ' . $session_user->first_name;
         $db_keycode = new Application_Model_DbTable_DbKeycode();
         $this->view->keycode = $db_keycode->getKeyCodeMiniInv();
         $this->view->rpt_list = $db_tran->countAllStaffpcsAmount($formdata);
         $this->view->curr_type = $this->curr_typesimble;
     } catch (Exception $e) {
     }
 }
Example #6
0
 public function indexAction()
 {
     try {
         $db_tran = new Application_Model_DbTable_DbKbank();
         //create sesesion
         $search_kbank = new Zend_Session_Namespace('search_kbank');
         if (empty($search_kbank->limit)) {
             $search_kbank->limit = Application_Form_FrmNavigation::getLimit();
             $search_kbank->type_money = -1;
             $search_kbank->txtsearch = "";
             $search_kbank->from_date = date('Y-m-d');
             $search_kbank->to_date = date('Y-m-d');
             $search_kbank->sender = -1;
             $search_kbank->lock();
         }
         //start page nevigation
         $limit = $search_kbank->limit;
         $start = $this->getRequest()->getParam('limit_satrt', 0);
         $this->view->from_date = $search_kbank->from_date;
         $this->view->to_date = $search_kbank->to_date;
         $this->view->sender_id = $search_kbank->sender;
         $cur = new Application_Model_DbTable_DbCurrencies();
         $this->view->currencylist = $cur->getCurrencyList();
         $this->view->type_money = $search_kbank->type_money;
         $this->view->statuslist = $this->statuslist;
         $this->view->txtsearch = $search_kbank->txtsearch;
         if ($this->getRequest()->isPost()) {
             $formdata = $this->getRequest()->getPost();
             // 				print_r($formdata);
             $search_kbank->unlock();
             $search_kbank->txtsearch = $formdata['txt_search'];
             $search_kbank->limit = $formdata['rows_per_page'];
             $search_kbank->type_money = $formdata['type_money'];
             $search_kbank->from_date = $formdata['from_date'];
             $search_kbank->to_date = $formdata['to_date'];
             $search_kbank->sender = $formdata['sender'];
             $search_kbank->lock();
             $this->view->txtsearch = $formdata['txt_search'];
             $this->view->type_money = $formdata['type_money'];
             $this->view->sender_id = $formdata['sender'];
             $this->view->from_date = $search_kbank->from_date;
             $this->view->to_date = $search_kbank->to_date;
             $limit = $search_kbank->limit;
             $trans = $db_tran->getTransactionListBy($formdata, $start, $limit);
             $record_count = $db_tran->getTransactionListTotal($formdata);
         } else {
             $formdata = array('txt_search' => $search_kbank->txtsearch, 'tran_type' => $search_kbank->tran_type, 'from_date' => $search_kbank->from_date, 'to_date' => $search_kbank->to_date, 'type_money' => $search_kbank->type_money, 'sender' => $search_kbank->sender);
             $trans = $db_tran->getTransactionListBy($formdata, $start, $limit);
             $record_count = $db_tran->getTransactionListTotal($formdata);
         }
         $result = array();
         $row_num = $start;
         if (!empty($trans)) {
             foreach ($trans as $i => $tran) {
                 $expired = '';
                 $is_expired = 0;
                 $amount = $tran['symbol'] . ' ' . number_format($tran['money_inaccount']);
                 $sub_agent = empty($tran['subname']) ? "" : "(" . $tran['subname'] . ")";
                 $inc_no = sprintf("%'010s", $tran['invoice']);
                 $current_date = $search_kbank->to_date;
                 $current_date = date_format(date_create($current_date), "d/m/Y");
                 if ($current_date >= date_format(date_create($tran['end_date']), "d/m/Y")) {
                     $expired = $current_date - date_format(date_create($tran['end_date']), "d/m/Y");
                     if ($expired == 0) {
                         $expired = 'ថ្ងៃនេះ';
                     } else {
                         $expired .= ' ថ្ងៃ';
                     }
                     $is_expired = 1;
                 }
                 $result[$i] = array('num' => ++$row_num, 'id' => $tran['id'], 'sender_name' => $tran['sender_name'], 'tel' => $tran['tel'], 'account_no' => $tran['acc_no'], 'invoice' => $tran['invoice'], 'amount' => $amount, 'start_date' => date_format(date_create($tran['start_date']), "d/m/Y"), 'expired_date' => date_format(date_create($tran['end_date']), "d/m/Y"), 'amount_month' => $tran['amount_month'] . ' ' . $this->pay_term[$tran['pay_term']], 'amount_expired' => $expired, 'is_expired' => $is_expired, 'is_extend' => $tran["is_extend"] == 1 ? "ពន្យា" : "ផ្ញើរ");
             }
         } else {
             $result = array('err' => 1, 'msg' => 'មិន​ទាន់​មាន​ទន្និន័យ​នូវ​ឡើយ​ទេ!');
         }
         $this->view->tranlist = Zend_Json::encode($result);
         $page = new Application_Form_FrmNavigation(self::REDIRECT_URL, $start, $limit, $record_count);
         $page->init(self::REDIRECT_URL, $start, $limit, $record_count);
         $this->view->nevigation = $page->navigationPage();
         $this->view->rows_per_page = $page->getRowsPerPage($limit, 'frmlist_mt');
         $this->view->result_row = $page->getResultRows();
         $sender = new Application_Model_DbTable_DbSender();
         $_sender = $sender->getAllSenderKbank();
         array_unshift($_sender, array('id' => '-1', "name" => "ជ្រើសរើសឈ្មោះអ្នកផ្ញើរ"));
         $this->view->sender = $_sender;
     } catch (Exception $e) {
     }
 }
 public function viewUserAccessAction()
 {
     /* Initialize action controller here */
     if ($this->getRequest()->getParam('id')) {
         $id = $this->getRequest()->getParam('id');
         $db = new RsvAcl_Model_DbTable_DbUserType();
         $userAccessQuery = "SELECT user_type_id, user_type, status from rms_acl_user_type where user_type_id=" . $id;
         $rows = $db->getUserTypeInfo($userAccessQuery);
         $this->view->rs = $rows;
         //Add filter search
         $gc = new Application_Model_GlobalClass();
         // For list all module
         $sql = "SELECT DISTINCT acl.`module` FROM `rms_acl_acl` AS acl";
         $this->view->optoin_mod = $gc->getOptonsHtml($sql, "module", "module");
         // For list all controller
         $sql = "SELECT DISTINCT acl.`controller` FROM `rms_acl_acl` AS acl WHERE acl.`status` = 1";
         $this->view->optoin_con = $gc->getOptonsHtml($sql, "controller", "controller");
         // For List all action
         $sql = "SELECT DISTINCT acl.`action` FROM `rms_acl_acl` AS acl WHERE acl.`status` = 1";
         $this->view->optoin_act = $gc->getOptonsHtml($sql, "action", "action");
         //For Status enable or disable
         $this->view->optoin_status = $gc->getYesNoOption();
         $where = " ";
         $status = null;
         if ($this->getRequest()->isPost()) {
             $post = $this->getRequest()->getPost();
             if (!empty($post['fmod'])) {
                 $where .= " AND acl.`module` = '" . $post['fmod'] . "' ";
             }
             if (!empty($post['fcon'])) {
                 $where .= " AND acl.`controller` = '" . $post['fcon'] . "' ";
             }
             if (!empty($post['fact'])) {
                 $where .= " AND acl.`action` = '" . $post['fact'] . "' ";
             }
             if (!empty($post['fstatus'])) {
                 $status = $post['fstatus'] === "Yes" ? 1 : 0;
                 //$where .= " AND  acl.`status` = " . $st ;
             }
             $this->view->datafiter = $post;
             //echo $where; exit;
         }
         //Sophen add here
         //to assign project list in view
         $db_acl = new Application_Model_DbTable_DbGlobal();
         $sqlNotParentId = "SELECT user_type_id FROM `rms_acl_user_type` WHERE `parent_id` =" . $id;
         $notParentId = $db_acl->getGlobalDb($sqlNotParentId);
         $usernotparentid = $notParentId[0]['user_type_id'];
         if ($id == 1) {
             //Display all for admin id = 1
             //Do not change admin id = 1 in database
             //Otherwise, it error
             $sql = "select acl.acl_id,CONCAT(acl.module,'/', acl.controller,'/', acl.action) AS user_access\n\t\t\t\t\t\tfrom rms_acl_acl as acl \n\t\t\t\t\t\tWHERE 1 " . $where;
         } else {
             //Display all of his/her parent access
             $sql = "SELECT acl.acl_id, CONCAT(acl.module,'/', acl.controller,'/', acl.action) AS user_access, acl.status \n\t\t\t\t\t\tFROM rms_acl_user_access AS ua \n\t\t\t\t\t\tINNER JOIN rms_acl_user_type AS ut ON (ua.user_type_id = ut.parent_id)\n\t\t\t\t\t\tINNER JOIN rms_acl_acl AS acl ON (acl.acl_id = ua.acl_id) WHERE ut.user_type_id =" . $id . $where;
         }
         //echo $sql; exit;
         $acl = $db_acl->getGlobalDb($sql);
         $acl = is_null($acl) ? array() : $acl;
         //print_r($acl);
         $this->view->acl = $acl;
         if (!$usernotparentid) {
             ///Display only of his/her parent access	and not have user_type_id of user access in user type parent id
             //ua.user_type_id != ut.parent_id
             $sql_acl = "SELECT acl.acl_id, CONCAT(acl.module,'/', acl.controller,'/', acl.action) AS user_access, acl.status \n\t\t\t\t\t\t\tFROM rms_acl_user_access AS ua \n\t\t\t\t\t\t\tINNER JOIN rms_acl_user_type AS ut ON (ua.user_type_id = ut.user_type_id)\n\t\t\t\t\t\t\tINNER JOIN rms_acl_acl AS acl ON (acl.acl_id = ua.acl_id) WHERE ua.user_type_id =" . $id . $where;
         } else {
             //Display only he / she access in rms_acl_user_access
             $sql_acl = "SELECT acl.acl_id, CONCAT(acl.module,'/', acl.controller,'/', acl.action) AS user_access, acl.status \n\t\t\t\t\t\t\tFROM rms_acl_user_access AS ua \n\t\t\t\t\t\t\tINNER JOIN rms_acl_user_type AS ut ON (ua.user_type_id = ut.parent_id)\n\t\t\t\t\t\t\tINNER JOIN rms_acl_acl AS acl ON (acl.acl_id = ua.acl_id) WHERE ua.user_type_id =" . $id . $where;
         }
         $acl_name = $db_acl->getGlobalDb($sql_acl);
         $acl_name = is_null($acl_name) ? array() : $acl_name;
         // 			$imgnone='<img src="'.BASE_URL.'/images/icon/none.png"/>';
         // 			$imgtick='<img src="'.BASE_URL.'/images/icon/tick.png"/>';
         $rows = array();
         $num = 1;
         foreach ($acl as $com) {
             $img = '<img src="' . BASE_URL . '/images/icon/none.png" id="img_' . $com['acl_id'] . '" onclick="changeStatus(' . $com['acl_id'] . ',' . $id . ');" class="pointer"/>';
             $tmp_status = 0;
             foreach ($acl_name as $read) {
                 if ($read['acl_id'] == $com['acl_id']) {
                     $img = '<img src="' . BASE_URL . '/images/icon/tick.png" id="img_' . $com['acl_id'] . '" onclick="changeStatus(' . $com['acl_id'] . ', ' . $id . ');" class="pointer"/>';
                     $tmp_status = 1;
                     break;
                 }
             }
             if (!empty($status) || $status === 0) {
                 if ($tmp_status !== $status) {
                     continue;
                 }
             }
             $rows[] = array('num' => $num++, 'acl_id' => $com['acl_id'], "user_access" => $com['user_access'], 'status' => $tmp_status);
         }
         // 			$list=new Application_Form_Frmlist();
         // 			$tr = Application_Form_FrmLanguages::getCurrentlanguage();
         // 			$columns=array($tr->translate('URL'), $tr->translate('STATUS'));
         // 			$this->view->acl_name = $list->getCheckList('radio', $columns, $rows);
         $db_tran = new Application_Model_DbTable_DbGlobal();
         //create sesesion
         $session_transfer = new Zend_Session_Namespace('search_user-access-acl');
         if (empty($session_transfer->limit)) {
             $session_transfer->limit = Application_Form_FrmNavigation::getLimit();
             $session_transfer->lock();
         }
         if ($this->getRequest()->isPost() && $this->getRequest()->getParam("btsave") !== "Search") {
             $formdata = $this->getRequest()->getPost();
             $session_transfer->unlock();
             $session_transfer->limit = $formdata['rows_per_page'];
             $session_transfer->lock();
         }
         //start page nevigation
         $limit = $session_transfer->limit;
         $start = $this->getRequest()->getParam('limit_satrt', 0);
         $result = array();
         if ($limit == "All") {
             $result = $rows;
         } else {
             for ($i = $start; $i < $start + $limit; $i++) {
                 if (count($rows) == $i) {
                     break;
                 }
                 $result[] = $rows[$i];
             }
         }
         $record_count = count($rows);
         if (empty($result)) {
             $result = array('err' => 1, 'msg' => 'មិន​ទាន់​មាន​ទន្និន�យ​នូវ​ឡើយ​ទ�!');
         }
         $this->view->list = Zend_Json::encode($result);
         $page = new Application_Form_FrmNavigation();
         $page->init(self::REDIRECT_URL . "/view-user-access?id=" . $id, $start, $limit, $record_count, "&");
         $this->view->nevigation = $page->navigationPage();
         $this->view->rows_per_page = $page->getRowsPerPage($limit, 'frmlist');
         $this->view->result_row = $page->getResultRows();
     }
 }
Example #8
0
 public function indexAction()
 {
     // action body
     //Get Session User
     try {
         $db_owe = new Application_Model_DbTable_DbPayment();
         //create sesesion
         $session_transfer = new Zend_Session_Namespace('search_transfer');
         if (empty($session_transfer->limit)) {
             $session_transfer->limit = Application_Form_FrmNavigation::getLimit();
             $session_transfer->status = -1;
             $session_transfer->type_money = -1;
             $session_transfer->sender_name = "";
             $session_transfer->loan = -1;
             $session_transfer->province = -1;
             $session_transfer->agent = -1;
             $session_transfer->from_date = date('Y-m-d');
             $session_transfer->to_date = date('Y-m-d');
             $session_transfer->lock();
         }
         //start page nevigation
         $limit = $session_transfer->limit;
         $start = $this->getRequest()->getParam('limit_satrt', 0);
         $this->view->from_date = $session_transfer->from_date;
         $this->view->to_date = $session_transfer->to_date;
         $this->view->status = $session_transfer->status;
         $cur = new Application_Model_DbTable_DbCurrencies();
         $this->view->currencylist = $cur->getCurrencyList();
         $this->view->type_money = $session_transfer->type_money;
         $this->view->sender_name = $session_transfer->sender_name;
         $pro = new Application_Model_DbTable_DbProvinces();
         $this->view->provincelist = $pro->getProvinceList();
         //$this->view->province = $session_transfer->province;
         $agent = new Application_Model_DbTable_DbAgents();
         //$this->view->agentlist = $agent->getAgentListSelect();
         //$this->view->agent = $session_transfer->agent;
         if ($this->getRequest()->isPost()) {
             $formdata = $this->getRequest()->getPost();
             $session_transfer->unlock();
             $session_transfer->sender_name = $formdata['sender_name'];
             $session_transfer->limit = $formdata['rows_per_page'];
             $session_transfer->from_date = $formdata['from_date'];
             $session_transfer->to_date = $formdata['to_date'];
             $session_transfer->lock();
             $this->view->sender_name = $formdata['sender_name'];
             $this->view->from_date = $session_transfer->from_date;
             $this->view->to_date = $session_transfer->to_date;
             $limit = $session_transfer->limit;
             $result = $db_owe->getTransactionOweList($formdata, $start, $limit);
             $record_count = $db_owe->getTransactionOweListTotal($formdata);
         } else {
             $formdata = array('sender_name' => $session_transfer->sender_name, 'status' => $session_transfer->status, 'status_loan' => $session_transfer->loan, 'from_date' => $session_transfer->from_date, 'to_date' => $session_transfer->to_date, 'type_money' => $session_transfer->type_money);
             //print_r($formdata); exit();
             $result = $db_owe->getTransactionOweList($formdata, $start, $limit);
             $record_count = $db_owe->getTransactionOweListTotal($formdata);
         }
         $row_num = $start;
         //print_r($result);exit;
         if (!empty($result)) {
             $tra_id = '';
             foreach ($result as $i => $rs) {
                 $refund_dollar = 0;
                 $refund_bath = 0;
                 $refund_riel = 0;
                 $refund_txt = 'refund_dollar';
                 if ($rs["curency_type"] == 1) {
                     $refund_dollar = $rs["refund"];
                 } else {
                     if ($rs["curency_type"] == 2) {
                         $refund_bath = $rs["refund"];
                         $refund_txt = 'refund_bath';
                     } else {
                         $refund_riel = $rs["refund"];
                         $refund_txt = 'refund_riel';
                     }
                 }
                 //echo $tra_id."=".$rs["invoice_found"]."<br/><br/>";
                 if ($tra_id != $rs["invoice_found"]) {
                     $tra_id = $rs["invoice_found"];
                     $result_row[$tra_id] = array('num' => ++$row_num, "found_id" => $rs["invoice_found"], "invoice_found" => $rs["invoice_found"], "sender_name" => $rs["sender_name"], "refund_dollar" => $refund_dollar, "refund_bath" => $refund_bath, "refund_riel" => $refund_riel, "date_refund" => $rs["date_refund"]);
                     //print_r($result_row);echo "<br/> ***New <br/>";
                 } else {
                     $result_row[$tra_id][$refund_txt] = $rs["refund"];
                     //print_r($result_row);echo "<br/>***old<br/>";
                 }
             }
             $i = 0;
             foreach ($result_row as $val) {
                 $result_rows[$i] = $val;
                 $i++;
             }
             //print_r($result_rows);
             //     			exit;
             //     				//format amount
             //     				$amount = $tran['symbol'].' '.number_format($tran['amount']);
             //     				$sub_agent = (empty($tran['subname']))? "":"(".$tran['subname'].")";
             //     				$inc_no = sprintf("%'010s",  $tran['invoice_no']);
             //     				$result[$i] = array(
             //     						'num' => (++$row_num),
             //     						'id' => $tran['id'],
             //     						'amount' => $amount,
             //     						'agentname' => $tran['agentname'].$sub_agent,
             //     						'reciever_tel' => $tran['reciever_tel'],
             //     						'invoice_no'=> $inc_no,
             //     						'send_date'=> date_format(date_create($tran['send_date']), "d/m/Y"),
             //     						//'status'=> $this->statuslist[$tran['status']],
             //     						//'status_loan'=> $this->loanlist[$tran['status_loan']],
             //     						'sender_name'=>$tran['sender_name'],
             //     						'reciever_name'=>$tran['reciever_name']
             //     				);
             //     			}
         } else {
             $result_rows = array('err' => 1, 'msg' => 'មិន​ទាន់​មាន​ទន្និន័យ​នូវ​ឡើយ​ទេ!');
         }
         $this->view->tranlist = Zend_Json::encode($result_rows);
         $sender = new Application_Model_DbTable_DbSender();
         //$this->view->loanlist =($this->loanlist);
         //     		$this->view->senderlist = $sender->getAllSenderNameOwe();
         //     		print_r($sender->getAllSenderNameOwe());
         $page = new Application_Form_FrmNavigation(self::REDIRECT_URL, $start, $limit, $record_count);
         $page->init(self::REDIRECT_URL, $start, $limit, $record_count);
         $this->view->nevigation = $page->navigationPage();
         //print_r($limit);exit;
         $this->view->rows_per_page = $page->getRowsPerPage($limit, 'frmlist_mt');
         $this->view->result_row = $page->getResultRows();
         $sender = new Application_Model_DbTable_DbSender();
         $this->view->senderlist = $sender->getAllSenderNameFound();
     } catch (Exception $e) {
     }
 }
 public function indexAction()
 {
     try {
         $db_tran = new Application_Model_DbTable_DbKbank();
         //create sesesion
         $session_withdraw = new Zend_Session_Namespace('search_withdraw');
         if (empty($session_withdraw->limit)) {
             $session_withdraw->limit = Application_Form_FrmNavigation::getLimit();
             $session_withdraw->type_money = -1;
             $session_withdraw->sender = -1;
             $session_withdraw->txtsearch = "";
             $session_withdraw->from_date = date('Y-m-d');
             $session_withdraw->to_date = date('Y-m-d');
             $session_withdraw->lock();
         }
         //start page nevigation
         $limit = $session_withdraw->limit;
         $start = $this->getRequest()->getParam('limit_satrt', 0);
         $this->view->from_date = $session_withdraw->from_date;
         $this->view->to_date = $session_withdraw->to_date;
         $this->view->sender_id = $session_withdraw->sender;
         $cur = new Application_Model_DbTable_DbCurrencies();
         $this->view->currencylist = $cur->getCurrencyList();
         $this->view->type_money = $session_withdraw->type_money;
         $this->view->txtsearch = $session_withdraw->txtsearch;
         if ($this->getRequest()->isPost()) {
             $formdata = $this->getRequest()->getPost();
             // 				print_r($formdata);
             $session_withdraw->unlock();
             $session_withdraw->txtsearch = $formdata['txt_search'];
             $session_withdraw->limit = $formdata['rows_per_page'];
             $session_withdraw->type_money = $formdata['type_money'];
             $session_withdraw->sender = $formdata['sender'];
             $session_withdraw->from_date = $formdata['from_date'];
             $session_withdraw->to_date = $formdata['to_date'];
             $session_withdraw->lock();
             $this->view->txtsearch = $formdata['txt_search'];
             $this->view->type_money = $formdata['type_money'];
             $this->view->sender_id = $formdata['sender'];
             $this->view->from_date = $session_withdraw->from_date;
             $this->view->to_date = $session_withdraw->to_date;
             $limit = $session_withdraw->limit;
             $trans = $db_tran->getTranWithDrawListBy($formdata, $start, $limit);
             $record_count = $db_tran->getTranWithDrawListTotal($formdata);
         } else {
             $formdata = array('txt_search' => $session_withdraw->txtsearch, 'tran_type' => $session_withdraw->tran_type, 'from_date' => $session_withdraw->from_date, 'to_date' => $session_withdraw->to_date, 'type_money' => $session_withdraw->type_money, 'sender' => $session_withdraw->sender);
             $trans = $db_tran->getTranWithDrawListBy($formdata, $start, $limit);
             $record_count = $db_tran->getTranWithDrawListTotal($formdata);
         }
         $result = array();
         $row_num = $start;
         if (!empty($trans)) {
             foreach ($trans as $i => $tran) {
                 $expired = '';
                 $is_expired = 0;
                 $result[$i] = array('num' => ++$row_num, 'id' => $tran['id'], 'sender_name' => $tran['sender_name'], 'tel' => $tran['tel'], 'account_no' => $tran['acc_no'], 'invoice' => $tran['invoice'], 'amount_dollar' => $tran['wd_amountdollar'] . " \$", 'amount_bath' => $tran['wd_amountbath'] . " B", 'amount_riel' => $tran['wd_amountriel'] . " R", 'create_date' => date_format(date_create($tran['create_date']), "d/m/Y"));
             }
         } else {
             $result = array('err' => 1, 'msg' => 'មិន​ទាន់​មាន​ទន្និន័យ​នូវ​ឡើយ​ទេ!');
         }
         $this->view->tranlist = Zend_Json::encode($result);
         $page = new Application_Form_FrmNavigation(self::REDIRECT_URL, $start, $limit, $record_count);
         $page->init(self::REDIRECT_URL, $start, $limit, $record_count);
         $this->view->nevigation = $page->navigationPage();
         $this->view->rows_per_page = $page->getRowsPerPage($limit, 'frmlist_mt');
         $this->view->result_row = $page->getResultRows();
         $sender = new Application_Model_DbTable_DbSender();
         $_sender = $sender->getAllSenderKbank();
         array_unshift($_sender, array('id' => '-1', "name" => "បន្ថែមឈ្មោះអ្នកផ្ញើរ"));
         $this->view->sender = $_sender;
         $cur = new Application_Model_DbTable_DbCurrencies();
     } catch (Exception $e) {
     }
 }