public function SelectItem() { $db = $this->getAdapter(); $user_info = new Application_Model_DbTable_DbGetUserInfo(); $result = $user_info->getUserInfo(); $db = new Application_Model_DbTable_DbGlobal(); $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"; return $rows = $db_rs->fetchAll($productSql); }
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() { $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(); $user = $this->GetuserInfoAction(); $_status = " p.is_active=1 "; if ($user["level"] == 1 or $user["level"] == 2) { $productSql = "SELECT p.pro_id, p.item_name,p.item_code, cg.Name As cate_name,b.Name, p.qty_onhand,p.qty_onorder,p.qty_onsold, p.is_avaliable\n \tFROM tb_product as p\n \tINNER JOIN tb_branch as b ON b.branch_id = p.brand_id\n \tINNER JOIN tb_category as cg ON cg.CategoryId = p.cate_id\n \t"; } else { $productSql = " SELECT p.pro_id, p.item_name, p.item_code, cg.Name As cate_name,b.Name, pl.qty,pl.qty_onorder,pl.qty_onsold, p.is_avaliable\n\t\t\t\t\t\t\tFROM tb_product AS p\n\t\t\t\t\t\t\tINNER JOIN tb_category AS cg ON cg.CategoryId = p.cate_id\n \t\t\t\t\tINNER JOIN tb_branch as b ON b.branch_id = p.brand_id "; } $str_condition = "INNER JOIN tb_prolocation As pl ON p.pro_id = pl.pro_id WHERE LocationId "; $productSql .= $db->getAccessPermission($user["level"], $str_condition, $user["location_id"]); if ($this->getRequest()->isPost()) { $post = $this->getRequest()->getPost(); if ($post['p_code'] != '') { $productSql .= " AND p.item_code LIKE '%" . trim($post['item_code']) . "%'"; } if ($post['p_name'] != '') { $productSql .= " AND p.item_name LIKE '%" . trim($post['p_name']) . "%'"; } if ($post['category_id'] != '' and $post['category_id'] != 0) { $productSql .= " AND cg.CategoryId =" . trim($post['category_id']); } if ($post['branch_id'] != '' and $post['branch_id'] != 0) { $productSql .= " AND b.branch_id = " . trim($post['branch_id']); } if ($post['status'] != "") { $productSql .= " AND p.is_avaliable=1 = " . trim($post['status']); } } $this->view->level = $user["level"]; $productSql .= " ORDER BY p.item_name,b.branch_id "; //echo $productSql; $rows = $db->getGlobalDb($productSql); $glClass = new Application_Model_GlobalClass(); // $rows = $glClass->getStockType($rows, BASE_URL, true); $rows = $glClass->getImgActive($rows, BASE_URL, true); $columns = array("ITEM_NAME_CAP", "ITEM_CODE", "CATEGORY_CAP", "BRAND_CAP", "QTY_HAND_CAP", "QTY_ON_ORDER", "QTY_ON_SOLD", "STATUS_CAP"); $link = array('module' => 'product', 'controller' => 'index', 'action' => 'product-detail'); //print_r($rs);exit(); $urlEdit = BASE_URL . "/product/index/update"; $this->view->list = $list->getCheckList(1, $columns, $rows, array('item_name' => $link, 'Name' => $link), $urlEdit); }
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 r.return_id, r.return_no, r.date_return, v.v_name, r.all_total,r.paid,r.balance\n\t\t\t\t\t\tFROM tb_return AS r INNER JOIN tb_vendor AS v ON v.vendor_id=r.vendor_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['order'] != '') { $vendor_sql .= " AND r.return_no LIKE '%" . trim($post['order']) . "%'"; } if ($post['vendor_name'] != '' and $post['vendor_name'] != 0) { $vendor_sql .= " AND v.vendor_id =" . trim($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 r.date_return BETWEEN '{$start_date}' AND '{$end_date}'"; } } $vendor_sql .= " ORDER BY r.return_id DESC"; $rows = $db->getGlobalDb($vendor_sql); $columns = array("RETURN_NO", "RETURN_DATE_CAP", "VENDOR_NAME_CAP", "TOTAL_CAP_DOLLAR", "PAID_DOLLAR_CAP", "BALANCE_CAP"); $link = array('module' => 'purchase', 'controller' => 'return', 'action' => 'detail-return-item'); $urlEdit = BASE_URL . "/purchase/return/update-return-item"; $this->view->list = $list->getCheckList(1, $columns, $rows, array('return_no' => $link), $urlEdit); }
public function indexAction() { $formFilter = new Application_Form_Frmsearch(); $this->view->formFilter = $formFilter; $list = new Application_Form_Frmlist(); $db = new Application_Model_DbTable_DbGlobal(); $transfer_sql = "SELECT t.transfer_id, t.invoice_num, t.transfer_date,\n\t\t\t\t\t\t(SELECT lo.Name FROM tb_sublocation AS lo WHERE lo.LocationId=t.from_location) AS `From_Location`,\n\t\t\t\t\t\t(SELECT lo.Name FROM tb_sublocation AS lo WHERE lo.LocationId=t.to_location) AS `To_Location`,t.remark,\n\t\t\t\t\t\t(SELECT u.`fullname` FROM rsv_acl_user AS u WHERE u.user_id = t.user_id) AS fullname \n\t\t\t\t\t\tFROM tb_stocktransfer AS t WHERE transfer_id "; $user = $this->GetuserInfoAction(); $str_condition = " AND t.to_location"; $transfer_sql .= $db->getAccessPermission($user["level"], $str_condition, $user["location_id"]); if ($this->getRequest()->isPost()) { $post = $this->getRequest()->getPost(); if (!$post["order"] == "" and $post['order']) { $transfer_sql .= " AND t.invoice_num LIKE '%" . addslashes(trim($post['order'])) . "%'"; } if ($post['LocationId'] != '' and $post['LocationId'] != 0) { $transfer_sql .= " AND t.to_location = " . trim($post['LocationId']); } $start_date = $post['search_start_date']; $end_date = $post['search_end_date']; if ($start_date != "" && $end_date != "" && strtotime($end_date) >= strtotime($start_date)) { $transfer_sql .= " AND t.transfer_date BETWEEN '{$start_date}' AND '{$end_date}'"; } } $transfer_sql .= " ORDER BY t.transfer_id DESC"; $rows = $db->getGlobalDb($transfer_sql); $columns = array("INVOICE_NUM", "DATE_TRANSFER", "FROM_LOCATION", "TO_LOCATION", "REMARK", "BY_USER"); if ($user["level"] != 1 and $user["level"] != 2) { $link = array('module' => 'product', 'controller' => 'adjust-stock', 'action' => 'view-transfer'); $urlEdit = BASE_URL . "/product/adjust-stock/view-transfer"; } else { $link = array('module' => 'product', 'controller' => 'adjust-stock', 'action' => 'transfer-update'); $urlEdit = BASE_URL . "/product/adjust-stock/transfer-update"; } $this->view->list = $list->getCheckList(1, $columns, $rows, array('invoice_num' => $link), $urlEdit); Application_Model_Decorator::removeAllDecorator($formFilter); }
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); }