public function getList($id = "", $pg)
 {
     $purl = array();
     if (isset($_GET['url'])) {
         $purl = $_GET['url'];
         $purl = rtrim($purl);
         $purl = explode('/', $_GET['url']);
     } else {
         $purl = null;
     }
     if (!isset($purl['2'])) {
         $pn = 1;
     } else {
         $pn = $purl['2'];
     }
     global $database;
     $resultUser = $database->db_query("SELECT * FROM users_client");
     $pagin = new Pagination();
     $pagin->nr = $database->dbNumRows($resultUser);
     $pagin->itemsPerPage = 20;
     $users = User::find_by_sql("SELECT * FROM users_client WHERE company_id=" . $_SESSION['client_ident'] . " " . $pagin->pgLimit($pn));
     $index_array = array("myusers" => $users, "mypagin" => $pagin->render($pg));
     return $index_array;
     return $index_array;
 }
 /**
  * the getList method is used to 
  * pupolate the listing table 
  */
 public function getList($id = "", $pg)
 {
     $purl = array();
     if (isset($_GET['url'])) {
         $purl = $_GET['url'];
         $purl = rtrim($purl);
         $purl = explode('/', $_GET['url']);
     } else {
         $purl = null;
     }
     if (!isset($purl['2'])) {
         $pn = 1;
     } else {
         $pn = $purl['2'];
     }
     global $database;
     $resultEmployee = $database->db_query("SELECT * FROM vendors");
     $pagin = new Pagination();
     //create the pagination object;
     $pagin->nr = $database->dbNumRows($resultEmployee);
     $pagin->itemsPerPage = 20;
     $myitems = Vendor::find_by_sql("SELECT * FROM vendors " . $pagin->pgLimit($pn));
     $index_array = array("vendors" => $myitems, "mypagin" => $pagin->render($pg));
     return $index_array;
     return $index_array;
 }
 /**
  * the getList method is used to 
  * pupolate the listing table 
  */
 public function getList($id = "", $pg)
 {
     $purl = array();
     if (isset($_GET['url'])) {
         $purl = $_GET['url'];
         $purl = rtrim($purl);
         $purl = explode('/', $_GET['url']);
     } else {
         $purl = null;
     }
     if (!isset($purl['2'])) {
         $pn = 1;
     } else {
         $pn = $purl['2'];
     }
     $prodname = "";
     $clientname = "";
     $areaname = "";
     $regionname = "";
     $atmtype = "";
     $clientid = "";
     /**
      * of all the filter fields if only one field is set
      */
     $filterResult = "";
     if (isset($_REQUEST['prodname']) && !empty($_REQUEST['prodname'])) {
         $prodname .= " AND prod_name = '" . $_REQUEST['prodname'] . "' ";
     }
     if (isset($_REQUEST['prodname']) && !empty($_REQUEST['prodname'])) {
         $prodname .= " AND prod_name = '" . $_REQUEST['prodname'] . "' ";
     }
     if (isset($_REQUEST['clientid']) && !empty($_REQUEST['clientid'])) {
         $clientid .= " AND client_id ='" . $_REQUEST['clientid'] . "'";
     }
     if (isset($_REQUEST['clientname']) && !empty($_REQUEST['clientname'])) {
         $clientname .= " AND client_name='" . $_REQUEST['clientname'] . "' ";
     }
     if (isset($_REQUEST['areaname']) && !empty($_REQUEST['areaname'])) {
         $areaname .= " AND install_area='" . $_REQUEST['areaname'] . "' ";
     }
     if (isset($_REQUEST['location']) && !empty($_REQUEST['location'])) {
         $regionname .= " AND (install_city LIKE '%" . $_REQUEST['location'] . "%' OR install_address LIKE '%" . $_REQUEST['location'] . "%') ";
     }
     if (isset($_REQUEST['machine']) && !empty($_REQUEST['machine'])) {
         $atmtype .= " AND atm_type='" . $_REQUEST['machine'] . "' ";
     }
     $filterResult .= " WHERE id !='' " . $prodname . $clientname . $areaname . $regionname . $atmtype . $clientid;
     print_r($filterResult);
     global $database;
     $result = $database->db_query("SELECT * FROM client_product ");
     $resultEmployee = $database->db_query("SELECT * FROM client_product " . $filterResult);
     $pagin = new Pagination();
     //create the pagination object;
     $pagin->nr = $database->dbNumRows($resultEmployee);
     $pagin->itemsPerPage = 20;
     $pagin->totalRec = $database->dbNumRows($result);
     $myitems = Cproduct::find_by_sql("SELECT * FROM client_product " . $filterResult . " ORDER BY id DESC " . $pagin->pgLimit($pn));
     $index_array = array("clientproduct" => $myitems, "mypagin" => $pagin->render($pg));
     return $index_array;
 }
 /**
  * the getList method is used to 
  * pupolate the listing table 
  */
 public function getList($id = "", $pg)
 {
     $purl = array();
     if (isset($_GET['url'])) {
         $purl = $_GET['url'];
         $purl = rtrim($purl);
         $purl = explode('/', $_GET['url']);
     } else {
         $purl = null;
     }
     if (!isset($purl['2'])) {
         $pn = 1;
     } else {
         $pn = $purl['2'];
     }
     $itemnamefield = "";
     $descfield = "";
     $condifield = "";
     print_r($_POST['condi']);
     /**
      * of all the filter fields if only one field is set
      */
     $filterResult = "";
     if (isset($_POST['itemname']) && !empty($_POST['itemname'])) {
         $itemnamefield .= " AND item_name = '" . $_POST['itemname'] . "' ";
     }
     if (isset($_POST['descript']) && !empty($_POST['descript'])) {
         $descfield .= " AND item_description LIKE '%" . $_POST['descript'] . "%' ";
     }
     if (!empty($_POST['price']) && !empty($_POST['condi'])) {
         $condifield .= " AND item_cost " . $_POST['condi'] . " " . $_POST["price"];
     }
     if (!empty($_POST['fdate']) && !empty($_POST['tdate'])) {
         $datefield .= " AND datecreated BETWEEN  '" . $_POST['fdate'] . "' AND '" . $_POST['tdate'] . "' ";
     }
     if (empty($_POST['fdate']) && !empty($_POST['tdate'])) {
         $datefield .= " AND datecreated < '" . $_POST['tdate'] . "' ";
     }
     if (!empty($_POST['fdate']) && empty($_POST['tdate'])) {
         $datefield .= " AND datecreated >  '" . $_POST['fdate'] . "'  ";
     }
     $filterResult .= " WHERE id !='' " . $itemnamefield . $descfield . $condifield;
     global $database;
     $resultEmployee = $database->db_query("SELECT * FROM items " . $filterResult);
     $pagin = new Pagination();
     //create the pagination object;
     $pagin->nr = $database->dbNumRows($resultEmployee);
     $pagin->itemsPerPage = 20;
     $myitems = Items::find_by_sql("SELECT * FROM items " . $filterResult . " " . $pagin->pgLimit($pn));
     $index_array = array("items" => $myitems, "mypagin" => $pagin->render($pg));
     return $index_array;
 }
 public function getScheduleList($id = "", $pg)
 {
     $purl = array();
     if (isset($_GET['url'])) {
         $purl = $_GET['url'];
         $purl = rtrim($purl);
         $purl = explode('/', $_GET['url']);
     } else {
         $purl = null;
     }
     if (!isset($purl['2'])) {
         $pn = 1;
     } else {
         $pn = $purl['2'];
     }
     global $database;
     $resultSchedule = $database->db_query("SELECT * FROM schedule ");
     $pagin = new Pagination();
     //create the pagination object;
     $pagin->nr = $database->dbNumRows($resultWorksheet);
     $pagin->itemsPerPage = 20;
     $AllSchedule = Schedule::find_by_sql("SELECT * FROM schedule " . $pagin->pgLimit($pn));
     $index_array = array("schedules" => $AllSchedule, "mypagin" => $pagin->render($pg));
     return $index_array;
     return $index_array;
 }
 public function ActivationList($id = "", $pg)
 {
     $purl = array();
     if (isset($_GET['url'])) {
         $purl = $_GET['url'];
         $purl = rtrim($purl);
         $purl = explode('/', $_GET['url']);
     } else {
         $purl = null;
     }
     if (!isset($purl['2'])) {
         $pn = 1;
     } else {
         $pn = $purl['2'];
     }
     $statusfield = "";
     $clientidfield = "";
     $prodnamefield = "";
     $issuefield = "";
     $locationfield = "";
     $datefield = "";
     /**
      * of all the filter fields if only one field is set
      */
     $filterResult = "";
     if (isset($_REQUEST['status']) && !empty($_REQUEST['status'])) {
         if (strtolower($_REQUEST['status']) == "pending") {
             $statusfield .= " AND status = 'Admin Reply' OR status ='Customer Reply'";
         } else {
             $statusfield .= " AND status = '" . $_REQUEST['status'] . "' ";
         }
     }
     if (isset($_REQUEST['clientid']) && !empty($_REQUEST['clientid'])) {
         $clientidfield .= " AND client_id='" . $_REQUEST['clientid'] . "' ";
     }
     if (isset($_REQUEST['prodid']) && !empty($_REQUEST['prodid'])) {
         $prodnamefield .= " AND prod_id = '" . $_REQUEST['prodid'] . "' ";
     }
     if (isset($_REQUEST['location']) && !empty($_REQUEST['location'])) {
         $locationfield .= " AND location LIKE '%" . $_REQUEST['location'] . "%' ";
     }
     if (isset($_REQUEST['issue']) && !empty($_REQUEST['issue'])) {
         $issuefield .= " AND issue LIKE '%" . $_REQUEST['issue'] . "%' ";
     }
     if (!empty($_REQUEST['fdate']) && !empty($_REQUEST['tdate'])) {
         $datefield .= " AND datecreated BETWEEN  '" . $_REQUEST['fdate'] . "' AND '" . $_REQUEST['tdate'] . "' ";
     }
     if (empty($_REQUEST['fdate']) && !empty($_REQUEST['tdate'])) {
         $datefield .= " AND datecreated < '" . $_REQUEST['tdate'] . "' ";
     }
     if (!empty($_REQUEST['fdate']) && empty($_REQUEST['tdate'])) {
         $datefield .= " AND datecreated >  '" . $_REQUEST['fdate'] . "'  ";
     }
     $filterResult .= " WHERE id !=''" . $statusfield . $clientidfield . $prodnamefield . $locationfield . $issuefield . $datefield;
     global $database;
     $resultEmployee = $database->db_query("SELECT * FROM activation ");
     $pagin = new Pagination();
     //create the pagination object;
     $pagin->nr = $database->dbNumRows($resultEmployee);
     $pagin->itemsPerPage = 20;
     $myitems = Activation::find_by_sql("SELECT * FROM activation " . $filterResult . " ORDER BY id DESC " . $pagin->pgLimit($pn));
     //print_r($myitems);
     $index_array = array("activations" => $myitems, "mypagin" => $pagin->render($pg, "ticketlist"));
     return $index_array;
 }
 public function getListActivation($id = "", $pg)
 {
     $purl = array();
     if (isset($_GET['url'])) {
         $purl = $_GET['url'];
         $purl = rtrim($purl);
         $purl = explode('/', $_GET['url']);
     } else {
         $purl = null;
     }
     if (!isset($purl['2'])) {
         $pn = 1;
     } else {
         $pn = $purl['2'];
     }
     $statusfield = "";
     /**
      * of all the filter fields if only one field is set
      */
     $filterResult = "";
     if (isset($_REQUEST['status']) && !empty($_REQUEST['status'])) {
         if ($_REQUEST['status'] != "Pending") {
             $statusfield .= " AND status = '" . $_REQUEST['status'] . "' ";
         } else {
             $statusfield .= " AND status = 'Admin Reply' OR status = 'Customer Reply'";
         }
     }
     $filterResult .= " WHERE client_id ='" . $_SESSION['client_ident'] . "' " . $statusfield;
     global $database;
     $resultEmployee = $database->db_query("SELECT * FROM activation WHERE client_id='" . $_SESSION["client_ident"] . "'");
     $pagin = new Pagination();
     //create the pagination object;
     $pagin->nr = $database->dbNumRows($resultEmployee);
     $pagin->itemsPerPage = 20;
     $myitems = Activation::find_by_sql("SELECT * FROM activation " . $filterResult . "  ORDER BY id DESC " . $pagin->pgLimit($pn) . "");
     $index_array = array("supportticket" => $myitems, "mypagin" => $pagin->render($pg));
     return $index_array;
     return $index_array;
 }