diff --git a/api/v0/get/application.php b/api/v0/get/application.php index d1da30e..ada4860 100644 --- a/api/v0/get/application.php +++ b/api/v0/get/application.php @@ -198,7 +198,12 @@ case 'getQuestions': case 'final': $arrayQuestions = $arrayQuestions_finalize; break; - } + + case 'cartest': + include './settings/systemcartest.php'; + $arrayQuestions = $arrayQuestions_cartest; + break; + } //Return JSON echo json_encode($arrayQuestions); } diff --git a/api/v0/post/application.php b/api/v0/post/application.php index ab38242..0fb0adb 100644 --- a/api/v0/post/application.php +++ b/api/v0/post/application.php @@ -53,7 +53,7 @@ if (!empty($post_content['sn']) && !empty($post_content['testdetails'])) { $historyUpdate_type = 0; //update type of history $updateObject_visual = 0; //update visual inspection object $sendServiceReport = 0; //send service report via email - + $transfercartest = 0; //Update cartest table with incoming data // +++++++++++++++++++++++++++++++++++++++++++++++++++++++ //SET DEFAULT PARAMETERS // +++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -154,6 +154,7 @@ if (!empty($post_content['sn']) && !empty($post_content['testdetails'])) { case 11: //car_test $historytype = 'CarTest'; $equipmentCreate = 1; + $transfercartest = 1; break; case 'firmware': //update from Portal @@ -341,7 +342,13 @@ if (!empty($post_content['sn']) && !empty($post_content['testdetails'])) { $servicereport = serviceReport($result, 'email'); generatedPDF($servicereport,$last_id,$useremail); } - } + } + // +++++++++++++++++++++++++++++++++++++++++++++++++++++++ + // transfer to cartest table ++++++++++++++++++++++++++ + // +++++++++++++++++++++++++++++++++++++++++++++++++++++++ + if ($transfercartest == 1){ + convertCartest(); + } } else { diff --git a/api/v1/get/cartests.php b/api/v1/get/cartests.php index 84c05ab..ff8ece3 100644 --- a/api/v1/get/cartests.php +++ b/api/v1/get/cartests.php @@ -10,17 +10,9 @@ $pdo = dbConnect($dbname); //NEW ARRAY $criterias = []; -$whereclause = 'WHERE type="cartest"'; +$whereclause = ''; $clause = ''; - //FILTER FOR GROUPBY FILTERS on CAR - $filter1 = '"CarBrand": "'; - $filter2 = '"CarType": "'; - $filter3 = '"CarVIN": "'; - - $car_brand = 'SUBSTRING_INDEX(SUBSTRING_INDEX(description, "'.$filter1.'", -1),"'.$filter2.'",1)'; - $car_type = 'SUBSTRING_INDEX(SUBSTRING_INDEX(description, "'.$filter2.'", -1),"'.$filter3.'",1)'; - //Check for $_GET variables and build up clause if(isset($get_content) && $get_content!=''){ //GET VARIABLES FROM URL @@ -31,12 +23,12 @@ if(isset($get_content) && $get_content!=''){ //INCLUDE VARIABLES IN ARRAY $criterias[$v[0]] = $v[1]; - if ($v[0] == 'page' || $v[0] =='p' || $v[0] =='totals' || $v[0] =='list'|| $v[0] =='success_msg'){ + if ($v[0] == 'page' || $v[0] =='p' || $v[0] =='totals' || $v[0] =='download' || $v[0] =='list'|| $v[0] =='success_msg'){ //do nothing } elseif ($v[0] == 'search') { //build up search - $clause .= ' AND '.$car_brand.' like :'.$v[0]; + $clause .= ' AND (carbrand like :'.$v[0].' OR createdby like :'.$v[0].')'; } else {//create clause $clause .= ' AND '.$v[0].' = :'.$v[0]; @@ -51,15 +43,23 @@ if(isset($get_content) && $get_content!=''){ //Define Query if(isset($criterias['totals']) && $criterias['totals'] ==''){ //Request for total rows - $sql = 'SELECT count(*) as count FROM history '.$whereclause; + $sql = 'SELECT count(*) as count FROM cartest '.$whereclause; } -elseif(isset($criterias['list']) && $criterias['list'] ==''){ +elseif(isset($criterias['list']) && $criterias['list'] =='brand'){ //Request for total rows - $sql = 'SELECT distinct('.$car_brand.') FROM history '.$whereclause; - } + $sql = 'SELECT distinct(carbrand) FROM cartest '.$whereclause; +} +elseif(isset($criterias['list']) && $criterias['list'] =='type'){ + //Request for total rows + $sql = 'SELECT distinct(cartype) FROM cartest '.$whereclause; +} +elseif(isset($criterias['download']) && $criterias['download'] ==''){ + //Request for total rows + $sql = 'SELECT * FROM cartest '.$whereclause; +} else { //SQL for Paging - $sql = "SELECT *, SUBSTRING_INDEX(SUBSTRING_INDEX(description, '$filter1', -1),'$filter2',1) as carbrand from history $whereclause group by SUBSTRING_INDEX(SUBSTRING_INDEX(description, '$filter1', -1),'$filter2',1), SUBSTRING_INDEX(SUBSTRING_INDEX(description, '$filter2', -1),'$filter3',1) ORDER BY carbrand DESC LIMIT :page,:num_products"; + $sql = "SELECT * from cartest $whereclause ORDER BY carbrand, cartype DESC LIMIT :page,:num_products"; } $stmt = $pdo->prepare($sql); @@ -84,13 +84,21 @@ if (!empty($criterias)){ } } +//------------------------------------------ +// Debuglog +//------------------------------------------ +if (debug){ + $message = $date.';'.$sql.';'.$username; + debuglog($message); +} + //Add paging details if(isset($criterias['totals']) && $criterias['totals']==''){ $stmt->execute(); $messages = $stmt->fetch(); $messages = $messages[0]; } -elseif(isset($criterias['list']) && $criterias['list']==''){ +elseif ((isset($criterias['list']) && $criterias['list']!='') || (isset($criterias['download']) && $criterias['download'] =='')){ //Excute Query $stmt->execute(); //Get results diff --git a/api/v1/post/cartests.php b/api/v1/post/cartests.php new file mode 100644 index 0000000..3b5e984 --- /dev/null +++ b/api/v1/post/cartests.php @@ -0,0 +1,76 @@ + $var){ + if ($key == 'submit' || $key == 'delete' || $key == 'rowID'){ + //do nothing + } + else { + $criterias[$key] = $var; + $clause .= ' , '.$key.' = ?'; + $clause_insert .= ' , '.$key.''; + $input_insert .= ', ?'; // ? for each insert item + $execute_input[]= $var; // Build array for input + } + } +} + +//CLEAN UP INPUT +$clause = substr($clause, 2); //Clean clause - remove first comma +$clause_insert = substr($clause_insert, 2); //Clean clause - remove first comma +$input_insert = substr($input_insert, 1); //Clean clause - remove first comma + +//QUERY AND VERIFY ALLOWED +if ($command == 'update' && isAllowed('cartest_manage',$profile,$permission,'U') === 1){ + $sql = 'UPDATE cartest SET '.$clause.' WHERE rowID = ? '.$whereclause.''; + $execute_input[] = $id; + $stmt = $pdo->prepare($sql); + $stmt->execute($execute_input); +} +elseif ($command == 'insert' && isAllowed('cartest_manage',$profile,$permission,'C') === 1){ + $sql = 'INSERT INTO cartest ('.$clause_insert.') VALUES ('.$input_insert.')'; + $stmt = $pdo->prepare($sql); + $stmt->execute($execute_input); +} +elseif ($command == 'delete' && isAllowed('cartest_manage',$profile,$permission,'D') === 1){ + $stmt = $pdo->prepare('DELETE FROM cartest WHERE rowID = ? '.$whereclause.''); + $stmt->execute([ $id ]); + + //Add deletion to changelog + changelog($dbname,'cartest',$id,'Delete','Delete',$username); +} else +{ + //do nothing +} + +?> \ No newline at end of file diff --git a/assets/functions.php b/assets/functions.php index cd8a377..be48e54 100644 --- a/assets/functions.php +++ b/assets/functions.php @@ -2048,4 +2048,47 @@ function getQuestions($type){ $view .= ''; } } +} +// +++++++++++++++++++++++++++++++++++++++++++++++++++++++ +// convert cartest from history to cartest table +// +++++++++++++++++++++++++++++++++++++++++++++++++++++++ +function convertCartest(){ + +include dirname(__FILE__,2).'/settings/settings.php'; + +//GET CARTEST FROM HISTORY TABLE +$pdo = dbConnect($dbname); +$sql = 'SELECT * FROM history WHERE type="cartest"'; +$stmt = $pdo->prepare($sql); +//Excute Query +$stmt->execute(); +//Get results +$messages = $stmt->fetchAll(PDO::FETCH_ASSOC); + +//FOR EACH CARTEST TRANSFER TO CARTEST TABLE + foreach ($messages as $message){ + //GET VARIABLES + $cartest = json_decode($message['description'],true); + $carbrand = ucfirst($cartest["CarBrand"]); + $cartype = ucfirst($cartest["CarType"]); + $questions = json_encode($cartest["Questions"] ??''); + $datapoints = json_encode($cartest["plugDataPoints"] ?? ''); + + //get header data only + unset($cartest["Questions"]); + unset($cartest["plugDataPoints"]); + $header = json_encode($cartest); + + //INSERT INTO CARTEST + $sql = 'INSERT INTO cartest (carbrand, cartype,header,questions,datapoints,createdby) VALUES (?,?,?,?,?,?)'; + $stmt = $pdo->prepare($sql); + //Excute Query + $stmt->execute([$carbrand,$cartype,$header,$questions,$datapoints,$cartest["NameTester"]]); + + //MARK HISTORY ITEM FOR DELETATION + $sql = 'UPDATE history SET type = "delete" WHERE rowID = '.$message['rowID']; + $stmt = $pdo->prepare($sql); + //Excute Query + $stmt->execute(); + } } \ No newline at end of file diff --git a/assets/readdevice.js b/assets/readdevice.js index 3346194..b648312 100644 --- a/assets/readdevice.js +++ b/assets/readdevice.js @@ -235,10 +235,18 @@ async function listenToPort() { } const serialResultsDiv = document.getElementById("serialResults"); +const plug_data = document.getElementById("plug_data"); async function appendToTerminal(newStuff) { serialResultsDiv.innerHTML += newStuff; - serialOutput +=newStuff + //vcp_data.value +=newStuff + if (typeof plug_data !== "undefined"){ + var plugdata = {"VCP":{VCP}, "VPP1":{VPP1},"VPP2":{VPP2},"VBAT":{VBAT}, "PWM":{PWM},"STATE":{STATE}, "xChart":{xChart}} + plug_data.value = JSON.stringify(plugdata); + } + + serialOutput +=newStuff; + } @@ -374,6 +382,37 @@ async function closePort(){ window.location.reload(); } +async function closePortCarTest(){ + + reader.cancel(); + await readableStreamClosed.catch(() => { /* Ignore the error */ }); + writer.close(); + await writableStreamClosed + console.log(maintenanceRun); + await port.close(); + + //Check for errors maintenanceRun = 999 + if (maintenanceRun != 999){ + serialResultsDiv.innerHTML = ''; + + if (maintenanceRun !=0){ + if (value != 33){//Include the correct ROWID of the Productrecord + progressBar("100", "Ready", "#04AA6D"); + } + else{ + progressBar("100", "Ready => Warning: Product requires TESLA adapter", "#ff6666"); + } + + } + else { + progressBar("100", "Ready", "#04AA6D"); + } + } + + maintenanceRun = 0; // reset maintenanceRun + +} + async function updateHistory(){ var data = document.getElementById("servicetoken").innerHTML; //get ServiceID diff --git a/cartest.php b/cartest.php index 9d3161f..15397d0 100644 --- a/cartest.php +++ b/cartest.php @@ -9,6 +9,7 @@ if (debug && debug_id == $_SESSION['id']){ include_once './assets/functions.php'; include_once './settings/settings.php'; +include_once './settings/systemcartest.php'; $page = 'cartest'; //Check if allowed @@ -28,8 +29,13 @@ $cartest = ioServer($api_url,''); //Decode Payload if (!empty($cartest)){$cartest = decode_payload($cartest);}else{$cartest = null;} $cartest = $cartest[0]; + +//CHECK FOR CARTEST APP OR PORTAL +$version = str_contains($cartest->questions,'GoToP')?0:1; //GET TEST DETAILS -$cartest_details = json_decode($cartest->description,true); +$cartest_header = json_decode($cartest->header,true) ?? ''; +$cartest_questions = json_decode($cartest->questions,true) ?? ''; +$cartest_datapoints = json_decode($cartest->datapoints,true) ?? ''; // Handle success messages if (isset($_GET['success_msg'])) { @@ -44,6 +50,10 @@ if (isset($_GET['success_msg'])) { } } +if (isset($_GET['download'])){ + downloadToExcel('cartests',$cartest); +} + template_header('Cartest', 'cartest', 'view'); $view = '
@@ -51,6 +61,10 @@ $view = ' '.$button_cancel.' '; +if ($update_allowed === 1 && $version != 0){ + $view .= 'Edit'; +} + $view .= '
'; if (isset($success_msg)){ @@ -71,15 +85,15 @@ $view .= '

'.$cartest_carbrand.'

-

'.$cartest_details['CarBrand'].'

+

'.$cartest->carbrand.'

'.$cartest_cartype.'

-

'.$cartest_details['CarType'].'

+

'.$cartest->cartype.'

'.$cartest_carvin.'

-

'.$cartest_details['CarVIN'].'

+

'.$cartest_header['CarVIN'].'

'; @@ -94,44 +108,97 @@ $view .='

'.$cartest_tester.'

-

'.$cartest_details['NameTester'].'

+

'.$cartest_header['NameTester'].'

'.$cartest_device.'

-

'.$cartest_details['SN'].'

+

'.$cartest_header['SN'].'

'.$cartest_device_hw.'

-

'.$cartest_details['HW'].'

+

'.$cartest_header['HW'].'

'.$cartest_device_sw.'

-

'.$cartest_details['FW'].'

+

'.$cartest_header['FW'].'

'; $view .= ''; $view .= '
- '.$cartest_questions.' + '.$cartest_questions_text.'
'; - //Retrieve questions and anwers - foreach ($cartest_details['Questions'] as $key => $value){ - $view .= ' - - - '; - } + //Retrieve questions and awnsers + + if ($version == 0){ + + foreach ($cartest_questions as $key => $value){ + $view .= ' + + + '; + } + } else { + //CREATE OUTPUT BASED ON ARRAY + $view .= '
'; + foreach($arrayQuestions_cartest as $group){ + if ($group['Group_sequence'] == 1){ + $view .= ''.$group['Group'].''; + } else { + $view .= ''.$group['Group'].''; + } + } + $view .= '
'; + + foreach($arrayQuestions_cartest as $group){ + + if ($group['Group_sequence'] == 1){ + $view .= '
+
'; + } else { + $view .= '
+
'; + } + + foreach($group['Questions_in_group'] as $question){ + + //SHOW QUESTION FROM ARRAY + $view .= ''; + + //GET RESPONSE FROM DATABASE + foreach ($cartest_questions as $key => $value){ + + if ($question['QuestionID'] == $key){ + + switch ($question['Type']) { + case 'dropdown': + $view .= '

'.((!empty($value) || $value !="")?${'cartest_allowed_label'.$value}:$not_specified).'

'; + break; + + case 'textarea': + $view .= '

'.((!empty($value) || $value !="")?$value:$not_specified).'

'; + break; + } + + } + } + } + $view .= '
+
'; + } + + } $view .= '
'.$key.''.((!empty($value)|| $value !='')?$value:$not_specified).'
'.$key.''.((!empty($value)|| $value !='')?$value:$not_specified).'
'; -if (isset($cartest_details['plugDataPoints']) && $cartest_details['plugDataPoints'] !=''){ +if (isset($cartest_datapoints) && $cartest_datapoints !=''){ $view .= '
'.$cartest_charts.''; @@ -145,30 +212,41 @@ $view .= '
$STATE= []; //for state values $xaxis= []; //values for xaxis $x = 0; - foreach ($cartest_details['plugDataPoints'] as $datapoint){ - $VCP[] = $datapoint['vcp']; - $VPP1[] = $datapoint['vpp1']; - $VPP2[] = $datapoint['vpp2']; - $VBAT[] = $datapoint['vbat']; - $PWM[] = $datapoint['pwm']; - switch ($datapoint['state']) { - case 'FULL_CONNECT': - $STATE[] = 5; - break; - case 'REACTIVATE': - $STATE[] = 3; - break; - case 'DISCONNECTED': - $STATE[] = 0; - break; + if ($version == 0){ + foreach ($cartest_datapoints as $datapoint){ + $VCP[] = $datapoint['vcp']; + $VPP1[] = $datapoint['vpp1']; + $VPP2[] = $datapoint['vpp2']; + $VBAT[] = $datapoint['vbat']; + $PWM[] = $datapoint['pwm']; + + switch ($datapoint['state']) { + case 'FULL_CONNECT': + $STATE[] = 5; + break; + case 'REACTIVATE': + $STATE[] = 3; + break; + case 'DISCONNECTED': + $STATE[] = 0; + break; + } + + + //Add to x-axis + $xaxis[] = $x; + $x++; } - - - //Add to x-axis - $xaxis[] = $x; - $x++; - } + } else { + $VCP = $cartest_datapoints['VCP']['VCP']; + $VPP1 = $cartest_datapoints['VPP1']['VPP1']; + $VPP2 = $cartest_datapoints['VPP2']['VPP2']; + $VBAT = $cartest_datapoints['VBAT']['VBAT']; + $PWM = $cartest_datapoints['PWM']['PWM']; + $STATE = $cartest_datapoints['STATE']['STATE']; + $xaxis = $cartest_datapoints['xChart']['xChart']; + } $view.= '
diff --git a/cartest_manage.php b/cartest_manage.php index 128b6ca..96e6dba 100644 --- a/cartest_manage.php +++ b/cartest_manage.php @@ -9,6 +9,7 @@ if (debug && debug_id == $_SESSION['id']){ include_once './assets/functions.php'; include_once './settings/settings.php'; +include_once './settings/systemcartest.php'; $page = 'cartest_manage'; //Check if allowed @@ -23,34 +24,232 @@ $create_allowed = isAllowed($page ,$_SESSION['profile'],$_SESSION['permission'], $bearertoken = createCommunicationToken($_SESSION['userkey']); -//GET PRODUCTS FROM DB -$pdo = dbConnect($dbname); -$sql = 'SELECT rowID, productcode, productname, product_category,sn from products where status = "1" and build = "1"'; -$stmt = $pdo->prepare($sql); -//Excute Query -$stmt->execute(); -//Get results -$messages = $stmt->fetchAll(PDO::FETCH_ASSOC); +$rowID = $_GET['rowID'] ?? ''; -template_header('Buildtool', 'buildtool','view'); +if ($rowID !=''){ + $url = 'index.php?page=cartest&rowID='.$rowID.''; +} else { + $url = 'index.php?page=cartests'; +} -$view = ' -
-
- -
-

'.$buildtool_h2 .'

-

'.$buildtool_p.'

-
-
-
'; +// Default input product values +$cartest = [ + 'rowID' => '', + 'carbrand' => '', + 'cartype' => '', + 'header' => [ + 'CarVIN' => '', + 'NameTester'=> $_SESSION['username'], + 'SN' =>'', + 'HW' =>'', + 'FW' =>'' + ], + 'questions' => [], + 'datapoints' => [], + 'created' => '' +]; -$view .= ' - +if (isset($_GET['rowID'])) { + // ID param exists, edit an existing product + //CALL TO API + $api_url = '/v1/cartests/rowID='.$_GET['rowID']; + $responses = ioServer($api_url,''); + //Decode Payload + if (!empty($responses)){$responses = decode_payload($responses);}else{$responses = null;} + + $cartest = json_decode(json_encode($responses[0]), true); + + $cartest['header'] = (is_string($cartest['header']))? json_decode($cartest['header'],true) : ''; + $cartest['questions'] = (is_string($cartest['questions']))? json_decode($cartest['questions'],true) : ''; + $cartest['datapoints'] = (is_string($cartest['datapoints']))? json_decode($cartest['datapoints'],true) : ''; + + if ($update_allowed === 1){ + if (isset($_POST['submit'])) { + //ARRAY convert to JSON + $_POST['header'] = json_encode($_POST['header'], JSON_UNESCAPED_UNICODE); + $_POST['questions'] = json_encode($_POST['questions'], JSON_UNESCAPED_UNICODE); + + //CHECK IF DATAPOINTS IS NOT EMPTY THEN UPDATE IF NOT REMOVE EMPTY ARRAY FROM POST + if (!empty($_POST['datapoints']) || $_POST['datapoints'] !="") { + $_POST['datapoints'] = json_encode($_POST['datapoints'], JSON_UNESCAPED_UNICODE); + } + else { + unset($_POST['datapoints']); + } + + //GET ALL POST DATA + $data = json_encode($_POST, JSON_UNESCAPED_UNICODE); + //Secure data + $payload = generate_payload($data); + //API call + $responses = ioServer('/v1/cartests', $payload); + if ($responses === 'NOK'){ + + } else { + header('Location: index.php?page=cartest&rowID='.$_GET['rowID'].'&success_msg=2'); + exit; + } + } + } + + if ($delete_allowed === 1){ + if (isset($_POST['delete'])) { + //GET ALL POST DATA + $data = json_encode($_POST , JSON_UNESCAPED_UNICODE); + //Secure data + $payload = generate_payload($data); + //API call + $responses = ioServer('/v1/cartests', $payload); + // Redirect and delete equipment + if ($responses === 'NOK'){ + + } else { + header('Location: index.php?page=cartests&success_msg=3'); + exit; + } + } + } + +} else { + // Create a new equipment + if (isset($_POST['submit'])) { + //ARRAY convert to JSON + $_POST['header'] = json_encode($_POST['header'], JSON_UNESCAPED_UNICODE); + $_POST['questions'] = json_encode($_POST['questions'], JSON_UNESCAPED_UNICODE); + $_POST['datapoints'] = json_encode($_POST['datapoints'], JSON_UNESCAPED_UNICODE); + //GET ALL POST DATA + $data = json_encode($_POST, JSON_UNESCAPED_UNICODE); + //Secure data + $payload = generate_payload($data); + //API call + $responses = ioServer('/v1/cartests', $payload); + if ($responses === 'NOK'){ + + } else { + header('Location: index.php?page=cartests&success_msg=1'); + exit; + } + } +} + +template_header('Cartesttool', 'cartesttool','manage'); + +$view =' +
+
+

'.$cartest_h2.'

+ '.$button_cancel.' + '; + +if ($delete_allowed === 1){ + $view .= ''; +} +if ($update_allowed === 1){ + $view .= ''; +} + +$view .= '
'; +$view .= '
'; +$view .= '
+
+ '.$cartest_information.' +
+
+

'.$cartest_carbrand.'

+

+ +

+
+
+

'.$cartest_cartype.'

+

+
+
+

'.$cartest_carvin.'

+

+
+
'; +$view .='
+
+ '.$cartest_details_text.' +
+
+

'.$cartest_created.'

+

'.$cartest['created'].'

+
+
+

'.$cartest_tester.'

+

+
+
+

'.$cartest_device.'

+

+
+
+

'.$cartest_device_hw.'

+

+
+
+

'.$cartest_device_sw.'

+

+
+
'; +$view .= '
'; +// ------------------------------- +//BUILD TO INPUT FORM BASED ON ARRAY +// ------------------------------ + +$view .= '
'; +foreach($arrayQuestions_cartest as $group){ + + if ($group['Group_sequence'] == 1){ + $view .= ''.$group['Group'].''; + } else { + $view .= ''.$group['Group'].''; + } +} +$view .= '
'; + +foreach($arrayQuestions_cartest as $group){ + + if ($group['Group_sequence'] == 1){ + $view .= '
+
'; + } else { + $view .= '
+
'; + } + + foreach($group['Questions_in_group'] as $question){ + + switch ($question['Type']) { + case 'dropdown': + $view .= ''; + $view .= ''; + break; + + case 'textarea': + $view .= ''; + $view .= ''; + break; + } + } + $view .= '
+
'; +} +//CAPTURE DATA FROM PLUG + +$view .= ''; + +$view .= ''; + $view .= '
25:00 @@ -60,7 +259,7 @@ $view .= '
- +
diff --git a/cartests.php b/cartests.php index b5cab59..58f72c5 100644 --- a/cartests.php +++ b/cartests.php @@ -54,6 +54,10 @@ if (isset($_GET['success_msg'])) { } } +if (isset($_GET['download'])){ + downloadToExcel('cartests',$responses); +} + template_header('Cartests', 'cartests' ,'view'); $view = '
@@ -91,8 +95,14 @@ $view .= '
-
- '; +//SHOW DOWNLOAD TO EXCELL OPTION ONLY TO ADMIN USERS +if ($_SESSION['permission'] == 3 || $_SESSION['permission'] == 4){ + $view .='
+ +
'; +} +$view .= '