public function indexAction()
 {
     $formfilter = new RsvAcl_Form_FrmUser();
     $this->view->formfilter = $formfilter;
     $where = "";
     // action body
     $tr = Application_Form_FrmLanguages::getCurrentlanguage();
     $getUser = new RsvAcl_Model_DbTable_DbUser();
     if ($this->getRequest()->getParam('user_type_filter')) {
         $user_type_id = $this->getRequest()->getParam('user_type_filter');
         $where = " where user_type_id=" . $user_type_id;
     }
     $userQuery = "select `user_id`,`username`,`created_date`,`modified_date`,`status` from rsv_acl_user";
     $userQuery = $userQuery . $where;
     $rows = $getUser->getUserInfo($userQuery);
     if ($rows) {
         $imgnone = '<img src="' . BASE_URL . '/images/icon/none.png"/>';
         $imgtick = '<img src="' . BASE_URL . '/images/icon/tick.png"/>';
         foreach ($rows as $i => $row) {
             if ($row['status'] == 1) {
                 $rows[$i]['status'] = $imgtick;
             } else {
                 $rows[$i]['status'] = $imgnone;
             }
         }
         $link = array("rsvAcl", "user", "view-user");
         $links = array('username' => $link);
         $list = new Application_Form_Frmlist();
         $columns = array($tr->translate('USER_NAME_CAP'), $tr->translate('CREATED_DATE'), $tr->translate('MODIFIED_DATE'), $tr->translate('STATUS_CAP'));
         $this->view->form = $list->getCheckList('radio', $columns, $rows, $links);
     } else {
         $this->view->form = $tr->translate('NO_RECORD_FOUND');
     }
     Application_Model_Decorator::removeAllDecorator($formfilter);
 }
 public function indexAction()
 {
     // action body
     //$this->_helper->layout()->disableLayout();
     $tr = Application_Form_FrmLanguages::getCurrentlanguage();
     $getAcl = new RsvAcl_Model_DbTable_DbAcl();
     $aclQuery = "SELECT `acl_id`,`module`,`controller`,`action`,`status` FROM rsv_acl_acl";
     $rows = $getAcl->getAclInfo($aclQuery);
     if ($rows) {
         $imgnone = '<img src="' . BASE_URL . '/images/icon/none.png"/>';
         $imgtick = '<img src="' . BASE_URL . '/images/icon/tick.png"/>';
         foreach ($rows as $i => $row) {
             if ($row['status'] == 1) {
                 $rows[$i]['status'] = $imgtick;
             } else {
                 $rows[$i]['status'] = $imgnone;
             }
         }
         $list = new Application_Form_Frmlist();
         $columns = array($tr->translate('MODULE'), $tr->translate('CONTROLLER'), $tr->translate('ACTION'), $tr->translate('STATUS'));
         $link = array("rsvAcl", "acl", "view-acl");
         $links = array('module' => $link, 'controller' => $link, "action" => $link);
         $this->view->form = $list->getCheckList('radio', $columns, $rows, $links);
     } else {
         $this->view->form = $tr->translate('NO_RECORD_FOUND');
     }
 }
 public function indexAction()
 {
     $formFilter = new sales_Form_FrmStockFilter();
     $this->view->formFilter = $formFilter;
     Application_Model_Decorator::removeAllDecorator($formFilter);
     $list = new Application_Form_Frmlist();
     $db = new Application_Model_DbTable_DbGlobal();
     $sales_agent_sql = "SELECT sg.agent_id, sg.name, sg.phone, sg.email, sg.address, sg.job_title, l.Name, sg.description\n        FROM tb_sale_agent AS sg \n        INNER JOIN tb_sublocation As l ON l.LocationId = sg.stock_id WHERE 1 ";
     if ($this->getRequest()->isPost()) {
         $search = $this->getRequest()->getPost();
         if ($search["s_name"] != '') {
             $sales_agent_sql .= " AND sg.name LIKE '%" . $search['s_name'] . "%'";
             $sales_agent_sql .= " OR sg.phone LIKE '%" . $search['s_name'] . "%'";
         }
         if ($search["stock_location"] != '' and $search["stock_location"] != 0) {
             $sales_agent_sql .= " AND sg.stock_id = " . $search['stock_location'];
         }
     }
     $sales_agent_sql .= " ORDER BY sg.agent_id DESC";
     $rows = $db->getGlobalDb($sales_agent_sql);
     $columns = array("SALE-AGENT", "CONTACT_NUM_CAP", "EMAIL_CAP", "ADDRESS_CAP", "POSTION_CAP", "LOCATION_NAME_CAP", "DESC_CAP");
     $link = array('module' => 'sales', 'controller' => 'sale-agent', 'action' => 'update-sale-agent');
     $urlEdit = BASE_URL . "/sales/sale-agent/update-sale-agent";
     $glClass = new Application_Model_GlobalClass();
     $this->view->list = $list->getCheckList(1, $columns, $rows, array('name' => $link), $urlEdit);
 }
Esempio n. 4
0
 public function indexAction()
 {
     $formfilter = new RsvAcl_Form_FrmUser();
     $this->view->formfilter = $formfilter;
     $where = "";
     // action body
     $tr = Application_Form_FrmLanguages::getCurrentlanguage();
     $getUser = new RsvAcl_Model_DbTable_DbUser();
     if ($this->getRequest()->getParam('user_type_filter')) {
         $user_type_id = $this->getRequest()->getParam('user_type_filter');
         $where = " where user_type_id=" . $user_type_id;
     }
     $userQuery = "select \n        \t\t\t\t\tu.`user_id`,\n        \t\t\t\t\tu.`username`,\n        \t\t\t\t\tu.`created_date`,\n        \t\t\t\t\tu.`modified_date`, \n        \t\t\t\t\t(SELECT ut.`user_type` FROM `rsv_acl_user_type` AS ut WHERE ut.`user_type_id` = u.`user_type_id`) as u_type,\n        \t\t\t\t\t(SELECT c.`name_sh` FROM `fi_cso` AS c WHERE c.`id` = \n        \t\t\t\t\t\t(SELECT i.`cso_id` FROM `fi_users_info` AS i WHERE i.`id` = u.`user_id`)\n        \t\t\t\t\t) as cso_name,\n        \t\t\t\t\tu.`status` \n        \t\t\t  from rsv_acl_user as u";
     $userQuery = $userQuery . $where;
     $rows = $getUser->getUserInfo($userQuery);
     if ($rows) {
         $imgnone = '<img src="' . BASE_URL . '/images/icon/none.png"/>';
         $imgtick = '<img src="' . BASE_URL . '/images/icon/tick.png"/>';
         foreach ($rows as $i => $row) {
             if ($row['status'] == 1) {
                 $rows[$i]['status'] = $imgtick;
             } else {
                 $rows[$i]['status'] = $imgnone;
             }
         }
         $link = array("rsvAcl", "user", "view-user");
         $links = array('username' => $link);
         $list = new Application_Form_Frmlist();
         $columns = array('NAME', 'CREATED_DATE', 'MODIFIED_DATE', 'TYPE_OF', 'CSO', 'STATUS');
         $this->view->form = $list->getCheckList('radio', $columns, $rows, $links);
     } else {
         $this->view->form = $tr->translate('NO_RECORD_FOUND');
     }
     Application_Model_Decorator::removeAllDecorator($formfilter);
 }
 public function indexAction()
 {
     $db = new setting_Model_DbTable_DbSetting();
     $rs = $db->getAllSetting();
     $columns = array("KEY_NAME", "KEY_VALUE");
     $link = array('module' => 'product', 'controller' => 'index', 'action' => 'product-detail');
     $list = new Application_Form_Frmlist();
     $this->view->list = $list->getCheckList(1, $columns, $rs, array('item_name' => $link, 'Name' => $link));
 }
 public function indexAction()
 {
     $formFilter = new Application_Form_Frmsearch();
     $this->view->formFilter = $formFilter;
     Application_Model_Decorator::removeAllDecorator($formFilter);
     $list = new Application_Form_Frmlist();
     $db = new Application_Model_DbTable_DbGlobal();
     // 		$vendor_sql = "SELECT p.order_id, p.order, p.date_order, p.status, v.v_name, p.all_total,u.username
     // 						FROM tb_purchase_order AS p ,
     // 						tb_vendor AS v,rsv_acl_user u
     // 		                WHERE v.vendor_id=p.vendor_id AND u.user_id = p.user_mod ";
     $vendor_sql = "SELECT \n\t\t\t\t  p.order_id,\n\t\t\t\t  p.order,\n\t\t\t\t  p.date_order,\n\t\t\t\t  p.status,\n\t\t\t\t  (SELECT v.v_name FROM tb_vendor AS v WHERE v.vendor_id = p.vendor_id) AS VendorName,\n\t\t\t\t  p.all_total,\n\t\t\t\t  (SELECT u.username FROM rsv_acl_user AS u WHERE u.user_id = p.user_mod) AS userName\n\t\t\t\t  FROM tb_purchase_order AS p WHERE 1";
     $user = $this->GetuserInfoAction();
     $str_condition = " AND p.LocationId";
     $vendor_sql .= $db->getAccessPermission($user["level"], $str_condition, $user["location_id"]);
     $this->view->level = $user["level"];
     if ($this->getRequest()->isPost()) {
         $post = $this->getRequest()->getPost();
         //echo $post["order"];
         if ($post['order'] != '') {
             $vendor_sql .= " AND p.order LIKE '%" . $post['order'] . "%'";
         }
         if ($post['vendor_name'] != '' and $post['vendor_name'] != 0) {
             $vendor_sql .= " AND p.vendor_id =" . $post['vendor_name'];
         }
         // 				if($post['phone'] !=''){
         // 					$vendor_sql .= " AND v.phone LIKE '%".$post['phone']."%'";
         // 				}
         if ($post['status'] != '') {
             $vendor_sql .= " AND p.status =" . $post['status'];
         }
         $start_date = $post['search_start_date'];
         $end_date = $post['search_end_date'];
         if ($start_date != "" && $end_date != "" && strtotime($end_date) >= strtotime($start_date)) {
             $vendor_sql .= " AND p.date_order BETWEEN '{$start_date}' AND '{$end_date}'";
         }
     } else {
         $vendor_sql .= " AND p.status=4 ";
     }
     //echo $vendor_sql;exit();
     $vendor_sql .= " ORDER BY p.order_id DESC";
     //**************************************
     $rows = $db->getGlobalDb($vendor_sql);
     //print_r($rows);exit();
     $glClass = new Application_Model_GlobalClass();
     $rows = $glClass->getStatusType($rows, BASE_URL, true);
     $columns = array("PURCHASE_ORDER_CAP", "ORDER_DATE_CAP", "STATUS_CAP", "VENDOR_NAME_CAP", "TOTAL_CAP_DOLLAR", strtoupper("BY_USER_CAP"));
     $link = array('module' => 'purchase', 'controller' => 'index', 'action' => 'detail-purchase-order');
     // url link to update purchase order
     $urlEdit = BASE_URL . "/purchase/index/update-purchase-order";
     $this->view->list = $list->getCheckList(1, $columns, $rows, array('order' => $link), $urlEdit);
 }
 public function indexAction()
 {
     $tr = Application_Form_FrmLanguages::getCurrentlanguage();
     $getUser = new RsvAcl_Model_DbTable_DbUserType();
     $userQuery = "SELECT u.user_type_id,u.user_type,(SELECT u1.user_type FROM `rsv_acl_user_type` u1 WHERE u1.user_type_id = u.parent_id LIMIT 1) parent_id FROM `rsv_acl_user_type` u";
     $rows = $getUser->getUserTypeInfo($userQuery);
     if ($rows) {
         $link = array("rsvAcl", "user-type", "view-user-type");
         $links = array('user_type' => $link);
         $list = new Application_Form_Frmlist();
         $columns = array($tr->translate('USER_TYPE_CAP'), $tr->translate('TYPE_OF_CAP'));
         $this->view->form = $list->getCheckList('radio', $columns, $rows, $links);
     } else {
         $this->view->form = $tr->translate('NO_RECORD_FOUND');
     }
 }
 public function indexAction()
 {
     $formFilter = new Product_Form_FrmProductFilter();
     $this->view->formFilter = $formFilter;
     //$cate = $formFilter->listCategory();
     //$this->view->cate = $cate;
     $list = new Application_Form_Frmlist();
     $user_info = new Application_Model_DbTable_DbGetUserInfo();
     $result = $user_info->getUserInfo();
     $db = new Application_Model_DbTable_DbGlobal();
     //     	$productSql = "SELECT p.pro_id,p.item_name,p.item_code,g.Name As cate_name, b.Name as LocationName, lo.Name, pl.qty
     //     	FROM tb_product AS p
     //     	INNER JOIN tb_prolocation AS pl ON pl.pro_id = p.pro_id
     //     	INNER JOIN tb_category AS g ON g.CategoryId = p.cate_id
     //     	INNER JOIN tb_branch as b ON b.branch_id = p.brand_id
     //     	INNER JOIN tb_sublocation AS lo ON lo.LocationId = pl.LocationId WHERE 1 ";
     $productSql = "SELECT \n\t\t\t\tp.pro_id \n\t\t\t\t,p.item_name\n\t\t\t\t,p.item_code\n\t\t\t\t,(SELECT g.Name FROM tb_category AS g WHERE g.CategoryId = (SELECT cate_id FROM tb_product WHERE pro_id = pl.`pro_id` LIMIT 1)) AS Cate_name\n\t\t\t\t,(SELECT b.Name FROM tb_branch AS b WHERE b.branch_id = (SELECT brand_id FROM tb_product WHERE pro_id = pl.`pro_id` LIMIT 1 )) AS Branch\n\t\t\t\t,(SELECT lo.Name FROM tb_sublocation AS lo WHERE lo.LocationId = pl.LocationId LIMIT 1) AS LocationName\n\t\t\t\t,pl.qty\n\t\t\tFROM tb_prolocation AS pl,tb_product AS p WHERE pl.`pro_id`=p.pro_id ";
     $str_condition = " AND pl.LocationId";
     $productSql .= $db->getAccessPermission($result["level"], $str_condition, $result["location_id"]);
     if ($this->getRequest()->isPost()) {
         $post = $this->getRequest()->getPost();
         $productName = $this->getRequest()->getParam('s_name');
         if ($post['LocationId'] !== '' and $post['LocationId'] != 0) {
             $productSql .= " AND pl.LocationId = " . trim($post['LocationId']);
         }
         if ($post['p_name'] != '') {
             $productSql .= " AND p.item_name LIKE '%" . trim($post['p_name']) . "%'";
             $productSql .= " OR p.item_code LIKE '%" . trim($post['p_name']) . "%'";
         }
         if ($post['category_id'] !== '' and $post['category_id'] != 0) {
             //echo $post['category_id']; exit();
             $productSql .= " AND p.cate_id =" . trim($post['category_id']);
         }
         if ($post['branch_id'] !== '' and $post['branch_id'] != 0) {
             $productSql .= " AND p.brand_id =" . trim($post['branch_id']);
         }
     }
     //echo $productSql;exit();
     $productSql .= " ORDER BY p.item_name,p.cate_id DESC";
     $rows = $db->getGlobalDb($productSql);
     $link = array('module' => 'product', 'controller' => 'index', 'action' => 'update');
     $columns = array("ITEM_NAME_CAP", "item_code", "CATEGORY_CAP", "BRAND_CAP", "LOCATION_NAME_CAP", "QTY_HAND_CAP");
     $urlEdit = BASE_URL . "/distributor/index/update";
     $urlEdit = BASE_URL . "/product/index/update";
     $this->view->list = $list->getCheckList(1, $columns, $rows, array('item_name' => $link), $urlEdit);
     Application_Model_Decorator::removeAllDecorator($formFilter);
 }
 public function indexAction()
 {
     $formFilter = new Application_Form_Frmsearch();
     $this->view->formFilter = $formFilter;
     $list = new Application_Form_Frmlist();
     $db = new Application_Model_DbTable_DbGlobal();
     $sale_order_sql = "SELECT o.order_id,o.order,o.date_order, o.status,c.cust_name, o.all_total, u.username\n\t\t\t\t\t  FROM tb_sales_order AS o ,tb_customer AS c, rsv_acl_user AS u\n\t\t\t\t\t  WHERE c.customer_id=o.customer_id AND o.user_mod = u.user_id ";
     // 		$sale_order_sql = "SELECT o.order_id,o.order,o.date_order, o.status,c.cust_name, o.all_total, o.paid,o.balance
     // 		FROM tb_sales_order AS o INNER JOIN tb_customer AS c ON c.customer_id=o.customer_id";
     $user = $this->GetuserInfoAction();
     $str_condition = " AND o.LocationId";
     $sale_order_sql .= $db->getAccessPermission($user["level"], $str_condition, $user["location_id"]);
     if ($this->getRequest()->isPost()) {
         $post = $this->getRequest()->getPost();
         //echo $post["order"];
         if ($post['order'] != '') {
             $sale_order_sql .= " AND o.order LIKE '%" . $post['order'] . "%'";
         }
         // 			if($post['customer_id'] !=''){
         // 				$sale_order_sql .= " AND c.customer_id LIKE '%".$post['customer_id']."%'";
         // 			}
         if ($post['sale_agent_id'] != '' and $post['sale_agent_id'] != 0) {
             $sale_order_sql .= " AND o.sales_ref = " . $post['sale_agent_id'];
         }
         if ($post['status'] != '') {
             $sale_order_sql .= " AND o.status =" . $post['status'];
         }
         $start_date = $post['search_start_date'];
         $end_date = $post['search_end_date'];
         if ($start_date != "" && $end_date != "" && strtotime($end_date) >= strtotime($start_date)) {
             $sale_order_sql .= " AND o.date_order BETWEEN '{$start_date}' AND '{$end_date}'";
         }
     } else {
         //$sale_order_sql.="";
     }
     $sale_order_sql .= " ORDER BY o.order_id DESC";
     $rows = $db->getGlobalDb($sale_order_sql);
     $glClass = new Application_Model_GlobalClass();
     $rows = $glClass->getStatusType($rows, BASE_URL, true);
     $columns = array("ORDER_ADD_CAP", "ORDER_DATE_CAP", "STATUS_CAP", "CON_NAME_CAP", "TOTAL_CAP_DOLLAR", "BY_USER_CAP");
     //$columns=array("ORDER_ADD_CAP","ORDER_DATE_CAP","STATUS_CAP", "CON_NAME_CAP","TOTAL_CAP_DOLLAR","PAID_DOLLAR_CAP","BALANCE_CAP");
     $link = array('module' => 'sales', 'controller' => 'sales-order', 'action' => 'detail-sales-order');
     $urlEdit = BASE_URL . "/sales/sales-order/update-sales";
     $this->view->list = $list->getCheckList(1, $columns, $rows, array('order' => $link, 'cust_name' => $link, 'contact_name' => $link), $urlEdit);
     Application_Model_Decorator::removeAllDecorator($formFilter);
 }
 public function indexAction()
 {
     $formFilter = new Application_Form_Frmsearch();
     $this->view->formFilter = $formFilter;
     Application_Model_Decorator::removeAllDecorator($formFilter);
     $list = new Application_Form_Frmlist();
     $db = new Application_Model_DbTable_DbGlobal();
     $vendor_sql = "SELECT p.order_id, p.order, p.date_order, p.status, v.v_name, p.all_total,p.paid,p.balance\n\t\t\t\t\t\tFROM tb_purchase_order AS p INNER JOIN tb_vendor AS v ON v.vendor_id=p.vendor_id ";
     if ($this->getRequest()->isPost()) {
         $post = $this->getRequest()->getPost();
         //echo $post["order"];
         if ($post['order'] != '') {
             $vendor_sql .= " AND p.order LIKE '%" . $post['order'] . "%'";
         }
         if ($post['vendor_name'] != '') {
             $vendor_sql .= " AND v.vendor_id =" . $post['vendor_name'];
         }
         if ($post['phone'] != '') {
             $vendor_sql .= " AND v.phone LIKE '%" . $post['phone'] . "%'";
         }
         if ($post['status'] != '') {
             $vendor_sql .= " AND p.status =" . $post['status'];
         }
         $start_date = $post['search_start_date'];
         $end_date = $post['search_end_date'];
         if ($start_date != "" && $end_date != "" && strtotime($end_date) >= strtotime($start_date)) {
             $vendor_sql .= " AND p.date_order BETWEEN '{$start_date}' AND '{$end_date}'";
         }
     }
     $vendor_sql .= " ORDER BY p.timestamp DESC";
     $rows = $db->getGlobalDb($vendor_sql);
     $glClass = new Application_Model_GlobalClass();
     $rows = $glClass->getStatusType($rows, BASE_URL, true);
     $columns = array("PURCHASE_ORDER_CAP", "ORDER_DATE_CAP", "STATUS_CAP", "VENDOR_NAME_CAP", "TOTAL_CAP_DOLLAR", "PAID_DOLLAR_CAP", "BALANCE_CAP");
     $link = array('module' => 'purchase', 'controller' => 'index', 'action' => 'detail-purchase-order');
     $urlEdit = BASE_URL . "/purchase/index/update-purchase-order";
     $this->view->list = $list->getCheckList(1, $columns, $rows, array('order' => $link), $urlEdit);
 }
 public function indexAction()
 {
     $formFilter = new Application_Form_Frmsearch();
     $frmfillter = $formFilter->customerSearch();
     Application_Model_Decorator::removeAllDecorator($frmfillter);
     $this->view->formFilter = $frmfillter;
     $list = new Application_Form_Frmlist();
     Application_Model_Decorator::removeAllDecorator($formFilter);
     $db = new Application_Model_DbTable_DbGlobal();
     $vendorSql = "SELECT c.customer_id, c.cust_name,c.contact_name, c.phone, c.email, c.website,\n\t\ttp.price_type_name ,c.is_active\n\t\tFROM tb_customer AS c,tb_price_type as tp\n\t\tWHERE tp.type_id=c.type_price AND c.cust_name!='' ";
     if ($this->getRequest()->isPost()) {
         $post = $this->getRequest()->getPost();
         if ($post['name'] != '') {
             $vendorSql .= " AND c.cust_name LIKE '%" . trim($post['name']) . "%'";
         }
         if ($post['phone'] != '') {
             $vendorSql .= " AND ( c.contact_name LIKE '%" . trim($post['phone']) . "%'";
             $vendorSql .= " OR c.phone LIKE '%" . trim($post['phone']) . "%')";
         }
         if ($post['email'] != '') {
             $vendorSql .= " AND c.email LIKE '%" . trim($post['email']) . "%'";
             $vendorSql .= " OR c.website LIKE '%" . trim($post['email']) . "%'";
         }
         if ($post['type_price'] != '' and $post['type_price'] != 0) {
             $vendorSql .= " AND tp.type_id = " . trim($post['type_price']);
         }
     }
     $vendorSql .= " ORDER BY c.cust_name,c.is_active ";
     $rows = $db->getGlobalDb($vendorSql);
     $glClass = new Application_Model_GlobalClass();
     $rows = $glClass->getImgActive($rows, BASE_URL, true);
     $columns = array("CUSTOMER_NAME_CAP", "CON_NAME_CAP", "CONTACT_NUM_CAP", "EMAIL_CAP", "WEBSITE_CAP", "TYPE_PRICE", "STATUS_CAP");
     $link = array('module' => 'sales', 'controller' => 'customer', 'action' => 'update-customer');
     $urlEdit = BASE_URL . "/sales/customer/update-customer";
     $this->view->list = $list->getCheckList(1, $columns, $rows, array('c.v_name' => $link, 'c.cust_name' => $link), $urlEdit);
 }
 public function indexAction()
 {
     $formFilter = new Application_Form_Frmsearch();
     $this->view->formFilter = $formFilter;
     Application_Model_Decorator::removeAllDecorator($formFilter);
     $list = new Application_Form_Frmlist();
     $db = new Application_Model_DbTable_DbGlobal();
     $vendorSql = "SELECT v.vendor_id, v.v_name,v.contact_name, v.phone, v.email, v.website,v.add_name\n\t\tFROM tb_vendor AS v WHERE 1 ";
     /*$vendorSql = "SELECT v.vendor_id, v.v_name,v.contact_name, v.phone, v.email, v.website,v.add_name,
     		CONCAT(cur.Description, ' ', cur.Symbol) AS currency FROM tb_vendor AS v
     		INNER JOIN tb_currency AS cur ON cur.CurrencyId=v.CurrencyId ";*/
     if ($this->getRequest()->isPost()) {
         $post = $this->getRequest()->getPost();
         //echo $post["order"];
         if ($post['name'] != '') {
             $vendorSql .= " AND v.v_name LIKE '%" . trim($post['name']) . "%'";
         }
         if ($post['phone'] != '') {
             $vendorSql .= " AND v.phone LIKE '%" . trim($post['phone']) . "%'";
             $vendorSql .= " OR v.contact_name LIKE '%" . trim($post['phone']) . "%'";
         }
         if ($post['email'] != '') {
             $vendorSql .= " AND v.email LIKE '%" . trim($post['email']) . "%'";
             $vendorSql .= " OR v.website LIKE '%" . trim($post['email']) . "%'";
         }
         if ($post['address'] != '') {
             $vendorSql .= " AND v.add_name LIKE '%" . trim($post['address']) . "%'";
         }
     }
     $vendorSql .= " ORDER BY v.vendor_id DESC";
     $rows = $db->getGlobalDb($vendorSql);
     $columns = array("VENDOR_NAME_CAP", "CON_NAME_CAP", "CONTACT_NUM_CAP", "EMAIL_CAP", "WEBSITE_CAP", "ADDRESS_CAP");
     $link = array('module' => 'purchase', 'controller' => 'vendor', 'action' => 'update-vendor');
     $urlEdit = BASE_URL . "/purchase/vendor/update-vendor";
     $this->view->list = $list->getCheckList(1, $columns, $rows, array('v_name' => $link, 'contact_name' => $link), $urlEdit);
 }
 public function itemalertAction()
 {
     $formFilter = new Product_Form_FrmProductFilter();
     $this->view->formFilter = $formFilter;
     Application_Model_Decorator::removeAllDecorator($formFilter);
     $list = new Application_Form_Frmlist();
     $db = new Application_Model_DbTable_DbGlobal();
     $request = $this->getRequest();
     $id = $request->getParam("id", NULL);
     $sql = " SELECT p.pro_id, p.item_name, p.item_code,pm.min_qty,pm.message\n\t\tFROM tb_product AS p,tb_qty_setting AS pm\n\t\tWHERE p.pro_id = pm.pro_id ";
     if ($this->getRequest()->isPost()) {
         $post = $this->getRequest()->getPost();
         if ($post['pro_id'] != '' and $post['pro_id'] != 0) {
             $sql .= " AND p.pro_id =" . trim($post['pro_id']);
         }
         if ($post['category_id'] != '' and $post['category_id'] != 0) {
             $sql .= " AND p.cate_id = " . trim($post['category_id']);
         }
     }
     $sql .= " ORDER BY p.pro_id";
     $rows = $db->getGlobalDb($sql);
     // 		$glClass = new Application_Model_GlobalClass();
     // 		$rows = $glClass->getpublic($rows, BASE_URL, true);
     $columns = array("ITEM_NAME_CAP", "item_code", "MIN_QTY_ALERT_CAP", "MSM_ALERT_CAP");
     $link = array('module' => 'product', 'controller' => 'index', 'action' => 'update-itemalert');
     $urlEdit = BASE_URL . "/product/index/update-itemalert";
     $this->view->list = $list->getCheckList(1, $columns, $rows, array('item_name' => $link, 'Name' => $link), $urlEdit);
     Application_Model_Decorator::removeAllDecorator($formFilter);
 }
 public function typePriceAction()
 {
     $formFilter = new Product_Form_FrmItemPrice();
     $frmsearch = $formFilter->searchPriceType(null);
     Application_Model_Decorator::removeAllDecorator($frmsearch);
     $this->view->formFilter = $frmsearch;
     $list = new Application_Form_Frmlist();
     $db = new Application_Model_DbTable_DbGlobal();
     $request = $this->getRequest();
     $id = $request->getParam("id", NULL);
     $sql = "SELECT type_id,price_type_name,pt.desc,public\n\t\tFROM tb_price_type AS pt\n\t\tWHERE price_type_name !='' ";
     if ($this->getRequest()->isPost()) {
         $post = $this->getRequest()->getPost();
         if ($post['price_type'] != '') {
             $sql .= " AND price_type_name LIKE '%" . trim($post['price_type']) . "%'";
         }
         if ($post['status'] != '') {
             $sql .= " AND public =" . trim($post['status']);
         }
     }
     // 		//echo $sql;exit();
     // 		$sql .= " GROUP BY p.pro_id,pt.type_id";
     //echo $sql;
     $rows = $db->getGlobalDb($sql);
     $glClass = new Application_Model_GlobalClass();
     $rows = $glClass->getpublic($rows, BASE_URL, true);
     $columns = array("TYPE_PRICE", "DESC_CAP", "ACTIVE", "DEACTIVE");
     $link = array('module' => 'product', 'controller' => 'adjust-stock', 'action' => 'add-type-price');
     $urlEdit = BASE_URL . "/product/adjust-stock/add-type-price";
     $this->view->list = $list->getCheckList(1, $columns, $rows, array('item_name' => $link, 'Name' => $link), $urlEdit);
     Application_Model_Decorator::removeAllDecorator($formFilter);
 }
 public function returnInAction()
 {
     $formFilter = new purchase_Form_FrmSearch();
     $this->view->formFilter = $formFilter->frmRetrunIn();
     Application_Model_Decorator::removeAllDecorator($formFilter);
     $list = new Application_Form_Frmlist();
     $db = new Application_Model_DbTable_DbGlobal();
     $vendor_sql = "SELECT ri.returnin_id, ro.return_no, ri.returnin_no, ri.date_return_in,  ri.all_total\n\t\tFROM tb_return_vendor_in AS ri,tb_return AS ro WHERE ri.returnout_id= ro.return_id ";
     // 		$user = $this->GetuserInfoAction();
     // 		$str_condition = "INNER JOIN tb_return_vendor_item  As rv ON r.return_id = rv.return_id WHERE rv.location_id" ;
     // 		$vendor_sql .= $db->getAccessPermission($user["level"], $str_condition, $user["location_id"]);
     if ($this->getRequest()->isPost()) {
         $post = $this->getRequest()->getPost();
         //echo $post["order"];
         if ($post['invoice_in'] != '') {
             $vendor_sql .= " AND ri.returnin_no LIKE '%" . trim($post['invoice_in']) . "%'";
         }
         if ($post['invoice_out'] != '') {
             $vendor_sql .= " AND ro.return_no LIKE '%" . trim($post['invoice_out']) . "%'";
         }
         $start_date = trim($post['search_start_date']);
         $end_date = trim($post['search_end_date']);
         if ($start_date != "" && $end_date != "" && strtotime($end_date) >= strtotime($start_date)) {
             $vendor_sql .= " AND ri.date_return BETWEEN '{$start_date}' AND '{$end_date}'";
         }
     }
     $vendor_sql .= " ORDER BY ri.returnin_id DESC";
     $rows = $db->getGlobalDb($vendor_sql);
     $columns = array("RETURN_NO", "INVOICE_NO", "RETURN_DATE_CAP", "TOTAL_CAP_DOLLAR");
     $link = array('module' => 'purchase', 'controller' => 'return', 'action' => 'detail-return-itemin');
     $urlEdit = BASE_URL . "/purchase/return/update-return-item-in";
     $this->view->list = $list->getCheckList(1, $columns, $rows, array('returnin_no' => $link), $urlEdit);
 }
 public function editUserAccessAction()
 {
     $id = $this->getRequest()->getParam('id');
     if (!$id) {
         $id = 0;
     }
     $session = new Zend_Session_Namespace('auth');
     $session->user_type_id = $id;
     $session->lock();
     $form = new RsvAcl_Form_FrmUserAccess();
     //echo "it works"; exit;
     $db = new RsvAcl_Model_DbTable_DbUserAccess();
     $sql = "select user_type_id, user_type  from rms_acl_user_type where user_type_id=" . $id;
     $rs = $db->getUserAccessInfo($sql);
     //print_r($rs); 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'];
     //print $usernotparentid; exit;
     if ($id == 1) {
         $sql_acl = "select acl.acl_id,CONCAT(acl.module,'/', acl.controller,'/', acl.action) AS user_access from rms_acl_acl as acl";
     }
     if (!$usernotparentid) {
         $sql_acl = "SELECT acl.acl_id, CONCAT(acl.module,'/', acl.controller,'/', acl.action) AS user_access, acl.status FROM rms_acl_user_access AS ua \n\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\tINNER JOIN rms_acl_acl AS acl ON (acl.acl_id = ua.acl_id) WHERE ua.user_type_id =" . $id;
     } else {
         $sql_acl = "SELECT acl.acl_id, CONCAT(acl.module,'/', acl.controller,'/', acl.action) AS user_access, acl.status FROM rms_acl_user_access AS ua \n\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\tINNER JOIN rms_acl_acl AS acl ON (acl.acl_id = ua.acl_id) WHERE ua.user_type_id =" . $id;
     }
     //print $sql_acl; exit;
     $acl_name = $db_acl->getGlobalDb($sql_acl);
     //print_r($acl_name); exit;
     if ($acl_name != '') {
         $form->setAcl($acl_name);
     }
     Application_Model_Decorator::setForm($form, $rs);
     $this->view->form = $form;
     $rows = array();
     for ($i = 1; $i <= $form->getPlus(); $i++) {
         $rows[] = array($i, $form->getElement('acl_id_' . $i)->getLabel(), $form->getElement('acl_id_' . $i));
     }
     $list = new Application_Form_Frmlist();
     $tr = Application_Form_FrmLanguages::getCurrentlanguage();
     $columns = array($tr->translate('URL'), $tr->translate('STATUS'));
     $this->view->form_layout = $list->getCheckList('radio', $columns, $rows);
     $this->view->id = $id;
     if ($this->getRequest()->isPost()) {
         $post = $this->getRequest()->getPost();
         //if($rs[0]['']==$post['username']){
         $db_user = new RsvAcl_Model_DbTable_DbUserType();
         print_r($post);
         exit;
         //print $rs[0]['user_type_id']; exit;
         $db_user->updateUserTypeAccess($post['user_type'], $rs[0]['user_type_id']);
         $db->assignAcl($post, $rs[0]['user_type_id'], $form->getPlus());
         //write log file
         $userLog = new Application_Model_Log();
         $userLog->writeUserLog($id);
         //End write log file
         //Application_Form_FrmMessage::message('One row affected!');
         Application_Form_FrmMessage::redirector('/rmsAcl/user-access/index');
         /*}else{
         			if(!$db->isUserExist($post['username'])){
         				$db->updateUser($post,$rs[0]['user_id']);
         				 //write log file 
         			        //$userLog= new RsvLogging_Model_RsvLogging();
         			    	//$userLog->writeUserLog($user_id);
         			     //End write log file
         				Application_Form_FrmMessage::message('One row affected!');
         				Application_Form_FrmMessage::redirector('/rmsAcl/user/index');						
         			}else {
         				Application_Form_FrmMessage::message('User had existed already');
         			}
         		}*/
     }
 }
 public function returnOutAction()
 {
     $formFilter = new sales_Form_FrmSearch();
     $frmFilter = $formFilter->FrmSearchFromCustomer();
     $this->view->formFilter = $frmFilter;
     Application_Model_Decorator::removeAllDecorator($frmFilter);
     $list = new Application_Form_Frmlist();
     $db = new Application_Model_DbTable_DbGlobal();
     $sql = "SELECT ro.returnout_id, ro.returnout_no, ri.return_no, ro.date_return, ro.all_total\n\t\tFROM tb_return_customer_in AS ri,tb_return_customer_out AS ro \n\t\tWHERE ri.return_id = ro.returnin_id ";
     $user = $this->GetuserInfoAction();
     $str_condition = " AND ro.location_id";
     $sql .= $db->getAccessPermission($user["level"], $str_condition, $user["location_id"]);
     if ($this->getRequest()->isPost()) {
         $post = $this->getRequest()->getPost();
         if ($post['order'] != '') {
             $sql .= " AND ro.returnout_no LIKE '%" . trim($post['order']) . "%'";
         }
         if ($post['return_in'] != '') {
             $sql .= " AND ri.return_no LIKE '%" . trim($post['return_in']) . "%'";
         }
         $start_date = trim($post['search_start_date']);
         $end_date = trim($post['search_end_date']);
         if ($start_date != "" && $end_date != "" && strtotime($end_date) >= strtotime($start_date)) {
             $sql .= " AND r.date_return BETWEEN '{$start_date}' AND '{$end_date}'";
         }
     }
     $sql .= " ORDER BY ro.returnout_id DESC";
     $rows = $db->getGlobalDb($sql);
     $columns = array("RETURN_OUT_CAP", "RETURN_IN_CAP", "RETURN_DATE_CAP", "TOTAL_CAP_DOLLAR");
     $link = array('module' => 'sales', 'controller' => 'return', 'action' => 'detail-return-itemout');
     $urlEdit = BASE_URL . "/sales/return/detail-return-itemout";
     $this->view->list = $list->getCheckList(1, $columns, $rows, array('returnout_no' => $link), $urlEdit);
 }