diff --git a/api/v1/get/equipments.php b/api/v1/get/equipments.php index 842ba02..24d3f66 100644 --- a/api/v1/get/equipments.php +++ b/api/v1/get/equipments.php @@ -51,7 +51,7 @@ if(isset($get_content) && $get_content!=''){ $v = explode("=", $y); //INCLUDE VARIABLES IN ARRAY $criterias[$v[0]] = $v[1]; - if ($v[0] == 'page' || $v[0] =='p' || $v[0] =='totals' || $v[0] =='history' || $v[0] =='success_msg' || $v[0] =='download' || $v[0] =='sort'){ + if ($v[0] == 'page' || $v[0] =='p' || $v[0] =='products' || $v[0] =='totals' || $v[0] =='history' || $v[0] =='success_msg' || $v[0] =='download' || $v[0] =='sort'){ //do nothing } elseif ($v[0] == 'equipmentid') { @@ -114,6 +114,10 @@ $sql = 'SELECT e.rowID as equipmentID, e.*, p.productcode, p.productname from eq elseif (isset($criterias['totals']) && $criterias['totals'] =='' && !isset($criterias['type'])){ //Request for total rows $sql = 'SELECT count(*) as count from equipment e LEFT JOIN products p ON e.productrowid = p.rowID '.$whereclause.''; +} +elseif (isset($criterias['products']) && $criterias['products'] ==''){ + //Request for all products in equipment view + $sql = 'SELECT distinct(p.productcode), p.productname from equipment e LEFT JOIN products p ON e.productrowid = p.rowID '.$whereclause.' ORDER BY p.productcode'; } elseif (isset($criterias['totals']) && $criterias['totals'] =='' && isset($criterias['type'])){ //Request for total rows for history reports @@ -239,7 +243,7 @@ if(isset($criterias['totals']) && $criterias['totals']==''){ $messages = $stmt->fetch(); $messages = $messages[0]; } -elseif ((isset($criterias['history']) && $criterias['history'] !='') || (isset($criterias['download']) && $criterias['download'] =='')){ +elseif ((isset($criterias['history']) && $criterias['history'] !='') || (isset($criterias['products']) && $criterias['products'] =='') || (isset($criterias['download']) && $criterias['download'] =='')){ //Excute Query $stmt->execute(); //Get results diff --git a/equipments.php b/equipments.php index 0d6e630..4e43b27 100644 --- a/equipments.php +++ b/equipments.php @@ -36,13 +36,13 @@ $software = $_SESSION['firmware'] = isset($_GET['firmware']) ? '&firmware='.$_GE $servicedate = $_SESSION['servicedate'] = isset($_GET['servicedate']) ? '&servicedate='.$_GET['servicedate'] : ''; $warrantydate = $_SESSION['warrantydate'] = isset($_GET['warrantydate']) ? '&warrantydate='.$_GET['warrantydate'] : ''; $partnerid = $_SESSION['partnerid'] = isset($_GET['partnerid']) ? '&partnerid='.$_GET['partnerid'] : ''; - +$productselected = $_SESSION['productcode'] = isset($_GET['productcode']) ? '&productcode='.$_GET['productcode'] : ''; //GET PARAMETERS FOR FILTERS $filter = urlGETdetailsFilter($_GET) ?? ''; // Determine the URL -$url = 'index.php?page=equipments'.$status.$search.$software.$servicedate.$warrantydate.$partnerid.$sort; +$url = 'index.php?page=equipments'.$status.$search.$software.$servicedate.$warrantydate.$partnerid.$sort.$productselected; //GET Details from URL $GET_VALUES = urlGETdetails($_GET) ?? ''; //CALL TO API @@ -57,6 +57,25 @@ $query_total = ioServer($api_url,''); //Decode Payload if (!empty($query_total)){$query_total = decode_payload($query_total);}else{$query_total = null;} +//Get Products related to assets +$api_url = '/v1/equipments/'.$GET_VALUES.'&products='; +$query_products = ioServer($api_url,''); +//Decode Payload +if (!empty($query_products)){$query_products = decode_payload($query_products);}else{$query_products = null;} + +//BUILD LIST OF PRODUCTS +$product_list = ''; + +if ($query_products != null){ + $product_list = ' + '; +} + // Handle success messages if (isset($_GET['success_msg'])) { if ($_GET['success_msg'] == 1) { @@ -110,7 +129,7 @@ $view .= '