????JFIF??x?x????'
Server IP : 79.136.114.73 / Your IP : 18.227.72.114 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/appsrv.astacus.se/energicontrol/meo/app/ |
Upload File : |
<?php include '../setup.php'; $mysqli = new mysqli("www.astacus.se", "carlhoffstedt", "Astacus2020!", "ostenssons_skanninge"); if($_GET['day'] == ""){ $day = 0; $show_date = date("Y-m-d"); }else{ $day = $_GET['day']; $show_date = date("Y-m-d", strtotime("$day days")); } if($_GET['day'] == ""){ $day1 = -1; $day2 = +1; }else{ $day1 = $_GET['day']-1; $day2 = $_GET['day']+1; } ?> <!doctype html> <html> <head> <meta charset="utf-8"> <title>Namnlöst dokument</title> <script src="https://cdn.jsdelivr.net/npm/chart.js"></script> <script src="js/package/dist/utils.js"></script> <style> table, th, td { font-family: 'Gill Sans', 'Gill Sans MT', 'Myriad Pro', 'DejaVu Sans Condensed', 'Helvetica', 'Arial', 'sans-serif'; font-size: 8px; border-collapse: collapse; } </style> </head> <body> <center> <a href="?day=<?php echo($day1);?>"><-- <?php echo(date("Y-m-d",strtotime(($day-1)." day")));?></a> | <strong><?php echo($show_date);?></strong> | <a href="?day=<?php echo($day2);?>"><?php echo(date("Y-m-d",strtotime(($day+1)." day")));?> --></a> </center> <div align="center"> <br> <canvas id="myChart" width="100%"></canvas> </div> <div align="center"> <br> <canvas id="myChart2" width="100%"></canvas> </div> <?php $from = date("Y-m-d",strtotime("$day1 days"))." 00:00:00"; $to = date("Y-m-d",strtotime("$day2 days"))." 24:00:00"; $array = array(); $Variable1 = strtotime($from); $Variable2 = strtotime($to); $json_labels_t = "["; $Lables = array(); $json_data_t1_array = array(); for ($currentDate = $Variable1; $currentDate <= $Variable2; $currentDate += (15*60)) { $Store = date('Y-m-d H:i:s', $currentDate); $json_labels_t = $json_labels_t . "'". $Store ."',"; $Lables[] = $Store; $json_data_t1_array[] = 0; } $json_labels_t = $json_labels_t . "]"; $sql = "SELECT CAREL_DEVICES.type as Type, AVG(CAREL_DEVICES_DATA.value) as Air_off_temperature, CAREL_DEVICES_DATA.Timestamp as Timestamp FROM CAREL_DEVICES_DATA, CAREL_DEVICES WHERE CAREL_DEVICES_DATA.deviceId = CAREL_DEVICES.deviceId and CAREL_DEVICES_DATA.name = 'Air off temperature (Sm)' group by CAREL_DEVICES.type, CAREL_DEVICES_DATA.Timestamp"; $result = $mysqli->query($sql); $t1_array = array(); while($obj = $result->fetch_object()){ $t1_array[] = [$obj->Timestamp,$obj->Type,$obj->Air_off_temperature]; } $json_data_t1 = "data : ["; $json_data_t2 = "data : ["; $json_data_t3 = "data : ["; foreach ($Lables as &$lable) { $found = false; foreach ($t1_array as &$t1) { if($t1[0] == $lable){ if( $t1[1] == 'Frys'){ $json_data_t1 = $json_data_t1 . $t1[2].","; $found = true; } if( $t1[1] == 'Kyl'){ $json_data_t2 = $json_data_t2 . $t1[2].","; $found = true; } if( $t1[1] == 'Kylvagga'){ $json_data_t3 = $json_data_t3 . $t1[2].","; $found = true; } } } if($found == false){ $json_data_t1 = $json_data_t1 . ","; $json_data_t2 = $json_data_t2 . ","; $json_data_t3 = $json_data_t3 . ","; } } $json_data_t1 = $json_data_t1 . "]"; $json_data_t2 = $json_data_t2 . "]"; $json_data_t3 = $json_data_t3 . "]"; $sql = "SELECT * FROM CAREL WHERE Timestamp >= '".$from."' order by Timestamp asc"; $result = $mysqli->query($sql); $carel_array = array(); while($obj = $result->fetch_object()){ $carel_array[] = [$obj->Timestamp,$obj->GasCoolerpressure,$obj->L1Externaltemperature]; } $json_data_t4 = "data : ["; $json_data_t6 = "data : ["; foreach ($Lables as &$lable) { $found = false; foreach ($carel_array as &$t1) { if($t1[0] == $lable){ $json_data_t4 = $json_data_t4 . $t1[1].","; $json_data_t6 = $json_data_t6 . $t1[2].","; $found = true; } } if($found == false){ $json_data_t4 = $json_data_t4 . ","; $json_data_t6 = $json_data_t6 . ","; } } $json_data_t4 = $json_data_t4 . "]"; $json_data_t6 = $json_data_t6 . "]"; $sql = "SELECT * FROM VS11_LOG WHERE Timestamp >= '".$from."' order by Timestamp asc"; $result = $mysqli->query($sql); $carel_array = array(); while($obj = $result->fetch_object()){ $VS11_array[] = [$obj->Timestamp,$obj->PowerKM, $obj->MEDELGT41GT42]; } $PowerKM_old = 0; $json_data_t5 = "data : ["; $json_data_t7 = "data : ["; foreach ($Lables as &$lable) { $found = false; foreach ($VS11_array as &$t1) { if($t1[0] == $lable){ $json_data_t5 = $json_data_t5 . $t1[1].","; $json_data_t7 = $json_data_t7 . $t1[2].","; $found = true; } } if($found == false){ $json_data_t5 = $json_data_t5 . ","; $json_data_t7 = $json_data_t7 . ","; } } $json_data_t5 = $json_data_t5 . "]"; $json_data_t7 = $json_data_t7 . "]"; ?> <script> const labels = <?php echo($json_labels_t);?>; const data = { labels: labels, datasets: [ { label: 'FRYS: Air Off Temperature', <?php echo($json_data_t1);?>, borderColor: '#1e00ff', backgroundColor: '#1e00ff', stepped: false, fill: false, yAxisID: 'y1' }, { label: 'KYL: Air Off Temperature', <?php echo($json_data_t2);?>, borderColor: '#00c0ff', backgroundColor: '#00c0ff', stepped: false, fill: false, yAxisID: 'y2' }, { label: 'KYLVAGGA: Air Off Temperature', <?php echo($json_data_t3);?>, borderColor: '#00fff6', backgroundColor: '#00fff6', stepped: false, fill: false, yAxisID: 'y2' }, { label: 'KM External Temperature', <?php echo($json_data_t6);?>, borderColor: '#afbf00', backgroundColor: '#afbf00', stepped: false, fill: false, yAxisID: 'y2' }, { label: 'Indoor Temp', <?php echo($json_data_t7);?>, borderColor: '#666c23', backgroundColor: '#666c23', stepped: false, fill: false, yAxisID: 'y2' }, { label: 'Gas Cooler Presure', <?php echo($json_data_t4);?>, borderColor: '#ff0000', backgroundColor: '#ff0000', stepped: false, fill: false, yAxisID: 'y3' }, { label: 'Strömförbrukning KM', <?php echo($json_data_t5);?>, borderColor: '#0dbf00', backgroundColor: '#0dbf00', stepped: false, fill: false, yAxisID: 'y4' } ] }; <?php $json_labels2_t = "["; $list=array(); $month = substr($show_date,5,2); $year = date("Y"); for($d=1; $d<=31; $d++) { $time=mktime(12, 0, 0, $month, $d, $year); if (date('m', $time)==$month){ $json_labels2_t = $json_labels2_t . "'". date('Y-m-d', $time) ."',"; $list[] = date('Y-m-d', $time); } } $json_labels2_t = $json_labels2_t . "]"; $from = $list[0]." 00:00:00"; $to = $list[count($list)-1]." 24:00:00"; $sql = "SELECT PowerKM, Timestamp FROM VS11_LOG WHERE Timestamp >= '".$from."' and Timestamp <= '".$to."' order by Timestamp asc"; //echo($sql); $result = $mysqli->query($sql); $KM_array = array(); while($obj = $result->fetch_object()){ $KM_array[] = [$obj->Timestamp,$obj->PowerKM]; } $json_data2_t1 = "data : ["; $R =array(); foreach ($list as &$lable) { $found = false; $start = ""; $start_date = ""; $stop_date = ""; foreach ($KM_array as &$t1) { //echo(substr($t1[0],0,10)." - ".$lable." #"); if($lable == substr($t1[0],0,10)){ if($t1[0]== $lable ." 00:00:00"){ // FOUND START! $start = $t1[1]; $start_date = $t1[0]; } if($t1[0]== $lable ." 23:45:00"){ // FOUND START! $stop = $t1[1]; $stop_date = $t1[0]; if($start == ""){ $found = false; }else{ $found = true; $R[] = "start: ".$start_date . " stop: ".$stop_date." | ".$start ." # ".$stop ." = ".($stop - $start); } } } } if($found == true){ $json_data2_t1 = $json_data2_t1 .($stop - $start) .","; }elseif($found == false){ $json_data2_t1 = $json_data2_t1 . ","; } } $json_data2_t1 = $json_data2_t1 . "]"; ?> const config = { maintainAspectRatio: true, type: 'line', data: data, options: { responsive: true, plugins: { title: { display: true, text: 'Östenssons Skänninge', }, }, scales: { y1: { type: 'linear', position: 'left', stack: 'demo', stackWeight: 1, }, y2: { type: 'linear', position: 'left', stack: 'demo', stackWeight: 2, }, y3: { type: 'linear', position: 'left', stack: 'demo', stackWeight: 2, }, y4: { type: 'linear', position: 'left', stack: 'demo', stackWeight: 2, } } }, }; const labels2 = <?php echo($json_labels2_t);?>; const data2 = { labels: labels2, datasets: [ { label: 'KM Elförbrukning', <?php echo($json_data2_t1);?>, borderColor: '#1e00ff', backgroundColor: '#1e00ff', stepped: true, fill: true, yAxisID: 'y1' } ] }; const config2 = { maintainAspectRatio: true, type: 'line', data: data2, options: { responsive: true, plugins: { title: { display: true, text: 'Elförbrukning per dag', }, }, scales: { y1: { type: 'linear', position: 'left', stack: 'demo', stackWeight: 1, } } }, }; const myChart = new Chart( document.getElementById('myChart'), config ); const myChart2 = new Chart( document.getElementById('myChart2'), config2 ); </script> </td> </tr> </tbody> </table> <div style="font-family: 'Gill Sans', 'Gill Sans MT', 'Myriad Pro', 'DejaVu Sans Condensed', Helvetica, Arial, 'sans-serif';"> <center> <?php var_dump($R); ?> </center> </div> <center>ASTACUS AB</center> </body> </html>