public function editAction()
 {
     $id = $this->getRequest()->getParam("id");
     $db = new saleorder_Model_DbTable_DbSaleOrder();
     $saleorder = $db->getSaleOrderById($id);
     $datas = $db->getAllProduct();
     if ($this->getRequest()->isPost()) {
         $data = $this->getRequest()->getPost();
         //print_r($data);exit();
         if (isset($data['save'])) {
         }
         if (isset($data['save_add'])) {
         }
         if (isset($data['save_close'])) {
         } elseif (isset($data["km"]) == 2) {
             $dbs = new Application_Model_DbTable_DbSiteLanguages();
             $ids = 2;
             $lang = $dbs->getbyid($ids);
             $session_lang = new Zend_Session_Namespace('lang');
             $session_lang->unlock();
             $session_lang->lang_id = $lang['id'];
             $session_lang->lang = $lang['language'];
             //print_r($lang);exit();
         } elseif (isset($data["en"]) == 1) {
             $dbs = new Application_Model_DbTable_DbSiteLanguages();
             $ids = 1;
             $lang = $dbs->getbyid($ids);
             $session_lang = new Zend_Session_Namespace('lang');
             $session_lang->unlock();
             $session_lang->lang_id = $lang['id'];
             $session_lang->lang = $lang['language'];
         }
     }
     $form = new saleorder_Form_FrmSaleOrder();
     $this->view->frm = $form->FrmSaleOrder($saleorder);
     $this->view->getdata = $datas;
     $this->view->saleorder = $saleorder;
 }
 public function addAction()
 {
     $form = new phurchase_Form_FrmVendor();
     $this->view->frmcate = $form->FrmProCate();
     if ($this->getRequest()->isPost()) {
         $data = $this->getRequest()->getPost();
         //print_r($data);exit();
         $db = new phurchase_Model_DbTable_DbVendor();
         if (isset($data['save'])) {
             $db->addProCate($data);
             Application_Form_FrmMessage::message("ការបញ្ចូលបានជោគជ័យ");
             Application_Form_FrmMessage::redirectUrl('/phurchase/vendor/add');
         } elseif (isset($data['save_close'])) {
             $db->addProCate($data);
             Application_Form_FrmMessage::message("ការបញ្ចូលបានជោគជ័យ");
             Application_Form_FrmMessage::redirectUrl('/phurchase/vendor');
         } elseif (isset($data["km"]) == 2) {
             $dbs = new Application_Model_DbTable_DbSiteLanguages();
             $ids = 2;
             $lang = $dbs->getbyid($ids);
             $session_lang = new Zend_Session_Namespace('lang');
             $session_lang->unlock();
             $session_lang->lang_id = $lang['id'];
             $session_lang->lang = $lang['language'];
             //print_r($lang);exit();
         } elseif (isset($data["en"]) == 1) {
             $dbs = new Application_Model_DbTable_DbSiteLanguages();
             $ids = 1;
             $lang = $dbs->getbyid($ids);
             $session_lang = new Zend_Session_Namespace('lang');
             $session_lang->unlock();
             $session_lang->lang_id = $lang['id'];
             $session_lang->lang = $lang['language'];
             //$this->_redirect('/login');
             //exit();
         }
     }
 }
 public function editAction()
 {
     $id = $this->getRequest()->getParam("id");
     $db = new location_Model_DbTable_DbLocation();
     $row = $db->getLocationById($id);
     $this->view->icon = $row["icon"];
     if ($this->getRequest()->isPost()) {
         $data = $this->getRequest()->getPost();
         //print_r($data);exit();
         if (isset($data['save'])) {
             $db->updat($data, $id);
             Application_Form_FrmMessage::message("ការកែប្រែបានជោគជ័យ");
             Application_Form_FrmMessage::redirectUrl('/location/index/edit/id/' . $id);
         }
         if (isset($data['save_add'])) {
             $db->updat($data, $id);
             Application_Form_FrmMessage::message("ការកែប្រែបានជោគជ័យ");
             Application_Form_FrmMessage::redirectUrl('/location/index/add');
         }
         if (isset($data['save_close'])) {
             $db->updat($data, $id);
             Application_Form_FrmMessage::message("ការកែប្រែបានជោគជ័យ");
             Application_Form_FrmMessage::redirectUrl('/location');
         } elseif (isset($data["km"]) == 2) {
             $dbs = new Application_Model_DbTable_DbSiteLanguages();
             $ids = 2;
             $lang = $dbs->getbyid($ids);
             $session_lang = new Zend_Session_Namespace('lang');
             $session_lang->unlock();
             $session_lang->lang_id = $lang['id'];
             $session_lang->lang = $lang['language'];
             //print_r($lang);exit();
         } elseif (isset($data["en"]) == 1) {
             $dbs = new Application_Model_DbTable_DbSiteLanguages();
             $ids = 1;
             $lang = $dbs->getbyid($ids);
             $session_lang = new Zend_Session_Namespace('lang');
             $session_lang->unlock();
             $session_lang->lang_id = $lang['id'];
             $session_lang->lang = $lang['language'];
             //$this->_redirect('/login');
             //exit();
         }
     }
     $form = new location_Form_FrmLocation();
     $this->view->frmcate = $form->FrmLocation($row);
 }
 public function adjustAction()
 {
     $db = new product_Model_DbTable_DbProduct();
     $db_global = new saleorder_Model_DbTable_DbSaleOrder();
     $itemRows = $db_global->getProductOption();
     $this->view->itemsOption = $itemRows;
     if ($this->getRequest()->isPost()) {
         $data = $this->getRequest()->getPost();
         //print_r($data);exit();
         if (isset($data['search'])) {
             $search = array('advance_search' => $data['txt_search'], 'pro_id' => $data['add_item'], 'cate_id' => $data['cat_id'], 'brand' => $data['brand']);
         } elseif (isset($data['update'])) {
             $db->adjust($data);
             $this->_redirect("/product/index/adjust");
         } elseif (isset($data["km"]) == 2) {
             $dbs = new Application_Model_DbTable_DbSiteLanguages();
             $ids = 2;
             $lang = $dbs->getbyid($ids);
             $session_lang = new Zend_Session_Namespace('lang');
             $session_lang->unlock();
             $session_lang->lang_id = $lang['id'];
             $session_lang->lang = $lang['language'];
             //print_r($lang);exit();
         } elseif (isset($data["en"]) == 1) {
             $dbs = new Application_Model_DbTable_DbSiteLanguages();
             $ids = 1;
             $lang = $dbs->getbyid($ids);
             $session_lang = new Zend_Session_Namespace('lang');
             $session_lang->unlock();
             $session_lang->lang_id = $lang['id'];
             $session_lang->lang = $lang['language'];
             //$this->_redirect('/login');
             //exit();
         }
     } else {
         $search = array('advance_search' => '', 'pro_id' => -1, 'cate_id' => -1, 'brand' => -1);
     }
     $datas = $db->getProductAdjust($search);
     $this->view->getdata = $datas;
     $frm = new product_Form_Frmproduct();
     $this->view->frmSearch = $frm->frmSearch();
 }
 public function changePasswordAction()
 {
     $id = $this->getRequest()->getParam('id');
     $form = new users_Form_FrmUser();
     $this->view->frmusers = $form->frmuser();
     if ($this->getRequest()->isPost()) {
         $data = $this->getRequest()->getPost();
         $db = new users_Model_DbTable_DbUser();
         $old_password = $this->getRequest()->getParam('old_password');
         $password = $this->getRequest()->getParam('password');
         if (isset($data['save'])) {
             if ($db->getpassword($id, $old_password)) {
                 $db->changePassword($id, md5($password));
                 Application_Form_FrmMessage::message("កាបញ្ចូលប្រភេទអ្នកប្រើប្រាស់បានជោគជ័យ");
             } else {
                 Application_Form_FrmMessage::message("កាបញ្ចូលមិនបានជោគជ័យ");
             }
         }
         if (isset($data['save_close'])) {
             if ($db->getpassword($id, $old_password)) {
                 $db->changePassword($id, md5($password));
                 Application_Form_FrmMessage::message("កាបញ្ចូលប្រភេទអ្នកប្រើប្រាស់បានជោគជ័យ");
                 Application_Form_FrmMessage::redirectUrl('/users');
             } else {
                 Application_Form_FrmMessage::message("កាបញ្ចូលមិនបានជោគជ័យ");
             }
         } elseif (isset($data["km"]) == 2) {
             $dbs = new Application_Model_DbTable_DbSiteLanguages();
             $ids = 2;
             $lang = $dbs->getbyid($ids);
             $session_lang = new Zend_Session_Namespace('lang');
             $session_lang->unlock();
             $session_lang->lang_id = $lang['id'];
             $session_lang->lang = $lang['language'];
             //print_r($lang);exit();
         } elseif (isset($data["en"]) == 1) {
             $dbs = new Application_Model_DbTable_DbSiteLanguages();
             $ids = 1;
             $lang = $dbs->getbyid($ids);
             $session_lang = new Zend_Session_Namespace('lang');
             $session_lang->unlock();
             $session_lang->lang_id = $lang['id'];
             $session_lang->lang = $lang['language'];
             //$this->_redirect('/login');
             //exit();
         }
     }
 }
 public function poseditAction()
 {
     $id = $this->getRequest()->getParam('id');
     $db = new saleorder_Model_DbTable_DbSaleOrder();
     $db_global = new Application_Model_DbTable_DbGlobal();
     $session = $session_user = new Zend_Session_Namespace('auth');
     $user_id = $session_user->fullname;
     $this->view->user = $user_id;
     $qty_warning = $db_global->getSettingByCode(6);
     $this->view->qty_warning = $qty_warning;
     $row_sale_order = $db_global->getSaleOrderById($id);
     $row_sale_order_detail = $db_global->getSaleOrderDetail($id);
     $this->view->data_sale_order = $row_sale_order_detail;
     $form = new saleorder_Form_FrmSaleOrder();
     $this->view->frm = $form->FrmSaleOrder($row_sale_order);
     $currency_setting = $db_global->getSettingByCode(1);
     $company_name = $db_global->getSettingByCode(4);
     $slogan = $db_global->getSettingByCode(5);
     $address = $db_global->getSettingByCode(2);
     $tel = $db_global->getSettingByCode(3);
     $this->view->currency_setting = $currency_setting;
     $this->view->company_name = $company_name;
     $this->view->slogan = $slogan;
     $this->view->address = $address;
     $this->view->tel = $tel;
     $itemRows = $db->getProductOption();
     $this->view->itemsOption = $itemRows;
     if ($this->getRequest()->isPost()) {
         $data = $this->getRequest()->getPost();
         if (isset($data["save"])) {
             // 				print_r($data);exit();
             $db->editOrder($data, $id);
             Application_Form_FrmMessage::redirectUrl('/index/pos');
         } elseif (isset($data["km"]) == 2) {
             $dbs = new Application_Model_DbTable_DbSiteLanguages();
             $ids = 2;
             $lang = $dbs->getbyid($ids);
             $session_lang = new Zend_Session_Namespace('lang');
             $session_lang->unlock();
             $session_lang->lang_id = $lang['id'];
             $session_lang->lang = $lang['language'];
             //print_r($lang);exit();
         } elseif (isset($data["en"]) == 1) {
             $dbs = new Application_Model_DbTable_DbSiteLanguages();
             $ids = 1;
             $lang = $dbs->getbyid($ids);
             $session_lang = new Zend_Session_Namespace('lang');
             $session_lang->unlock();
             $session_lang->lang_id = $lang['id'];
             $session_lang->lang = $lang['language'];
             //$this->_redirect('/login');
             //exit();
         }
     }
 }