←':''; //Check if allowed if (isAllowed($page,$_SESSION['authorization']['permissions'],$_SESSION['authorization']['permission'],'R') === 0){ header('location: index.php'); exit; } //GET PARAMETERS && STORE in SESSION for FURTHER USE/NAVIGATION $pagination_page = $_SESSION['p'] = isset($_GET['p']) ? $_GET['p'] : 1; $status = $_SESSION['status'] = isset($_GET['status']) ? '&status='.$_GET['status'] : ''; $sort = $_SESSION['sort'] = isset($_GET['sort']) ? '&sort='.$_GET['sort'] : ''; $search = $_SESSION['search'] = isset($_GET['search']) ? '&search='.$_GET['search'] : ''; $software = $_SESSION['firmware'] = isset($_GET['firmware']) ? '&firmware='.$_GET['firmware'] : ''; $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'] : ''; $serialnumber_input = $_SESSION['serialnumber'] = isset($_GET['serialnumber']) ? '&serialnumber='.$_GET['serialnumber'] : ''; //GET PARAMETERS FOR FILTERS $filter = urlGETdetailsFilter($_GET) ?? ''; // Determine the URL $url = 'index.php?page=report_healthindex'.$status.$search.$software.$servicedate.$warrantydate.$partnerid.$sort.$productselected.$serialnumber_input; //GET Details from URL $GET_VALUES = urlGETdetails($_GET) ?? ''; //CALL TO API $api_url = '/v2/equipment_healthindex/'.$GET_VALUES; $responses = ioServer($api_url,''); //Decode Payload if (!empty($responses)){$responses = json_decode($responses);}else{$responses = null;} //Return QueryTotal from API $api_url = '/v2/equipment_healthindex/'.$GET_VALUES.'&totals='; $query_total = ioServer($api_url,''); //Decode Payload if (!empty($query_total)){$query_total = $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 = ' '; } if (isset($_GET['download'])){ downloadToExcel('equipment_healthindex',$responses); } template_header('Healthindex', 'healthindex','view'); $view = '

'.$view_asset_data_ranking.' ('.$query_total.')

'.$back_btn_orgin.'
'; $view .= '
'; $view .= '
'.$filter.'
'.$general_filters.'
'.$product_list.' '.$general_filters_clear.'
'.$general_sort.'
'; //SHOW DOWNLOAD TO EXCELL OPTION ONLY TO ADMIN USERS if ($_SESSION['authorization']['permission'] == 3 || $_SESSION['authorization']['permission'] == 4){ $view .='
'; } $view .= '
'; $view .= '
'; if (empty($responses)){ $view .= ' '; } foreach ($responses as $response){ //Translate status INT to STR $status_text = 'status'.$response->status.'_text'; //GetPartnerDetails $partner_data = json_decode($response->accounthierarchy); $soldto = getPartnerName($partner_data->soldto) ?? $not_specified; $shipto = getPartnerName($partner_data->shipto) ?? $not_specified; //Additional items $picture = glob("./assets/images/products/".$response->productcode.".{jpg,jpeg,png,gif}", GLOB_BRACE); $indicators = overviewIndicators($response->warranty_date,$response->service_date,$response->sw_version,$response->hw_version); $view .= ''; $view .= ' '; } $view .= '
'.$view_asset_data_ranking.' '.$equipment_label1.' '.$equipment_label2.' '.$equipment_label3.' '.$equipment_label4.' '.$general_soldto.' '.$general_shipto.'
'.$message_no_assets.'
'.$response->healthindex.' '.$indicators.' '.$response->serialnumber.' '.$$status_text.' '.$response->productcode.'-'.(${$response->productname} ?? $response->productname).''; if (!empty($picture)){ $view .=' '; } $view .= ' '.$soldto.' '.$shipto.'
'; $view.=''; //OUTPUT echo $view; template_footer(); ?>