File manager - Edit - /home/autoph/public_html/voc/home/CL_DASHBOARD_001.php
Back
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script src="https://canvasjs.com/assets/script/jquery-1.11.1.min.js"></script> <script src="https://canvasjs.com/assets/script/jquery.canvasjs.min.js"></script> <?php include 'core/database/connect.php'; //$connect_error = 'Sorry, we\'re experiencing connection problem. Please try again later... Thank you!'; //mysql_connect('localhost','root','aee1024') or die ($connect_error); //mysql_select_db('db_vts') or die($connect_error); error_reporting(0); $compID= $_GET['secondPassComID']; $dateTime = $myDate . " ".$toTime; $myEmpID = $user_data['u_id']; $toDate = date_create() ->format("Y/m/d"); if(isset($_POST['done'])){ $SearchTextEnd = mysql_escape_string($_POST['SearchTextEnd']); $compID = mysql_escape_string($_POST['secondPassComID']); $SearchTextStart = mysql_escape_string($_POST['SearchTextStart']); if($SearchTextEnd == '' || $SearchTextStart ==''){ echo "<p style='font-family:Yu Gothic Light;font-size:16px;font-weight:normal;color:black;padding:30px;margin-top:100px;text-align:center'>--Unable to query database. Date field is empty--</p>"; exit(); }else{ $companyName = mysql_result(mysql_query("SELECT `comp_name` FROM `vts_company` WHERE `comp_id`='$compID'"),0); $myLabel = $companyName; $getData = mysql_query("SELECT * FROM `cl_clearance_header` WHERE `cl_h_date_created` BETWEEN '$SearchTextStart' AND '$SearchTextEnd' AND `cl_status`= 1 AND `cl_h_comp_id`='$compID'"); while($row=mysql_fetch_array($getData)){ $olddate = $row['cl_sla_start']; $endDate = $row['cl_sla_end']; if($endDate != ""){ $myEndDate = strtotime($endDate); }else{ $myEndDate = time(); } $slaStart = strtotime($olddate); $datediff = $myEndDate - $slaStart; $totalCount = round($datediff / (60 * 60 * 24)); $totalCount= round($datediff / (60 * 60 * 24)); if($totalCount < 31){ $green = $green + 1; } if ($totalCount > 31 && $totalCount < 36){ $orange = $orange + 1; } if ($totalCount > 35 ){ $red = $red + 1; } $total = $green + $orange + $red; } $EarlyCount = number_format(($green / $total * 100),2,'.',','); $MidCount = number_format(($orange / $total * 100),2,'.',','); $LateCount = number_format(($red / $total * 100),2,'.',','); $getNew = mysql_result(mysql_query("SELECT COUNT(h_id) FROM `cl_clearance_header` WHERE `cl_h_date_created` BETWEEN '$SearchTextStart' AND '$SearchTextEnd' AND `hdr_status` = 1"),0); $getApproval = mysql_result(mysql_query("SELECT COUNT(h_id) FROM `cl_clearance_header` WHERE `cl_h_date_created` BETWEEN '$SearchTextStart' AND '$SearchTextEnd' AND `hdr_status` = 2 || `cl_h_date_created` BETWEEN '$SearchTextStart' AND '$SearchTextEnd' AND`hdr_status` = 3 "),0); $getFinal = mysql_result(mysql_query("SELECT COUNT(h_id) FROM `cl_clearance_header` WHERE `cl_h_date_created` BETWEEN '$SearchTextStart' AND '$SearchTextEnd' AND `hdr_status` = 4"),0); } }else{ //GROUP WIDE $companyName = mysql_result(mysql_query("SELECT `comp_name` FROM `vts_company` WHERE `comp_id`='$compID'"),0); $myLabel = $companyName; $getData = mysql_query("SELECT * FROM `cl_clearance_header` WHERE `cl_status`= 1 AND `cl_h_comp_id`='$compID'"); while($row=mysql_fetch_array($getData)){ $olddate = $row['cl_sla_start']; $endDate = $row['cl_sla_end']; if($endDate != ""){ $myEndDate = strtotime($endDate); }else{ $myEndDate = time(); } $slaStart = strtotime($olddate); $datediff = $myEndDate - $slaStart; $totalCount = round($datediff / (60 * 60 * 24)); $totalCount= round($datediff / (60 * 60 * 24)); if($totalCount < 31){ $green = $green + 1; } if ($totalCount > 31 && $totalCount < 36){ $orange = $orange + 1; } if ($totalCount > 35 ){ $red = $red + 1; } $total = $green + $orange + $red; } $EarlyCount = number_format(($green / $total * 100),2,'.',','); $MidCount = number_format(($orange / $total * 100),2,'.',','); $LateCount = number_format(($red / $total * 100),2,'.',','); $getNew = mysql_result(mysql_query("SELECT COUNT(h_id) FROM `cl_clearance_header` WHERE `cl_h_comp_id`='$compID' AND `hdr_status` = 1"),0); $getApproval = mysql_result(mysql_query("SELECT COUNT(h_id) FROM `cl_clearance_header` WHERE `cl_h_comp_id`='$compID' AND `hdr_status` = 2 || `hdr_status` = 3 "),0); $getFinal = mysql_result(mysql_query("SELECT COUNT(h_id) FROM `cl_clearance_header` WHERE `cl_h_comp_id`='$compID' AND `hdr_status` = 4"),0); } ?> <script> //window.onload = function (){ //alert('test'); //LoadGraph(); //StopLoadGraph(); //} var idVar = setInterval(() => { LoadGraph(); }, 400); function StopLoadGraph() { clearInterval(idVar); } function LoadGraph() { CanvasJS.addColorSet("greenShades", [//colorSet Array "#20ea4b", //green "#f29c2d", //orange "#f19197" // red ]); CanvasJS.addColorSet("greenShadesB", [//colorSet Array "#05c80b", //green "#ef990b", //orange "#f19197", // red "#816ff2", // purple "#5fe4bc", // purple "#f37f05", // purple "#f30f92", // purple "#f1b2db", // purple "#ef220b", //orange "#ef9c5b", //orange "#55c05b", //green "#e84b8e", // red "#f5d823", // yellow "#f3d284", // yellow "#f9b5db", // purple "#f9c5ba", // purple "#93b0f9", //lightblue "#33b4f1" //lightblue ]); var options = { colorSet: "greenShadesB", title: { text: "ACTIVE CLEARANCE", fontFamily: "Yu Gothic", fontSize:24, fontWeight: "bold" }, subtitles: [{ fontFamily: "Yu Gothic Light", fontSize:16, text:"By Status" }], animationEnabled: false, animationDuration: 100, data: [{ type: "doughnut", startAngle: 40, toolTipContent: "<b>{label}</b>: {y}", showInLegend: "true", legendText: "{label}", indexLabelFontSize: 16, indexLabel: "{label} - {y}", dataPoints: [ { y: <?php echo $getNew;?>, label: "ON-GOING"}, { y: <?php echo $getApproval;?>, label: "FINAL APPROVAL"}, { y: <?php echo $getFinal;?>, label: "LAST PAY"}, ] }] }; $("#activeSLA").CanvasJSChart(options); //================================= //================================= var options = { colorSet: "greenShades", title: { text: "COMPLIANCE RATE", fontFamily: "Yu Gothic", fontSize:24, fontWeight: "bold" }, subtitles: [{ fontFamily: "Yu Gothic Light", fontSize:16, text:"As per SLA (30 days max)" }], animationEnabled: false, animationDuration: 1500, backgroundColor: "#fff", data: [{ type: "stackedBar", startAngle: 40, toolTipContent: "<b>{label}</b>: {y}", showInLegend: "true", legendText: "AUTOHUB WIDE", indexLabelFontSize: 16, indexLabel: "{label} - {y}%", dataPoints: [ { y: <?php echo $EarlyCount;?>, label: "WITHIN SLA"}, { y: <?php echo $MidCount;?>, label: "FAIR SLA" }, { y: <?php echo $LateCount;?>, label: "FAILED SLA" }, ] }] }; $("#slaAnalysis").CanvasJSChart(options); //STOCK INVENTORY ANALYSIS BY MODEL var options = { colorSet: "greenShadesB", animationEnabled: false, animationDuration: 2000, backgroundColor: "#fff", title: { text: "EMPLOYEE CLEARANCE SUMMARY", fontFamily: "Yu Gothic", fontSize:24, fontWeight: "bold" }, subtitles: [{ fontFamily: "Yu Gothic Light", fontSize:16, text:"By Company" }], data: [ { // Change type to "doughnut", "line", "splineArea", etc. area, stepLine,scatter, bubble , stackedColumn, stackedBar, stackedArea,stackedColumn100,doughnut type: "stackedColumn", toolTipContent: "{label}", showInLegend: "true", legendText: "COMPANY", indexLabelFontSize: 10, indexLabel: "{y}", dataPoints: [ <?php if(isset($_POST['done'])){ $SearchTextEnd = mysql_escape_string($_POST['SearchTextEnd']); $SearchTextStart = mysql_escape_string($_POST['SearchTextStart']); $getDataA = mysql_query("SELECT * FROM `vts_company` WHERE 1 ORDER BY `comp_code` ASC"); while($row=mysql_fetch_array($getDataA)){ $clCompID = $row['comp_id']; $countBrand = mysql_result(mysql_query("SELECT COUNT(h_id) FROM `cl_clearance_header` WHERE `cl_h_date_created` BETWEEN '$SearchTextStart' AND '$SearchTextEnd' AND `cl_status`='1' AND `cl_h_comp_id`='$clCompID'"),0); echo "{ label: \"".$row['comp_code']."\", y: ".$countBrand."},"; } }else{ $getDataA = mysql_query("SELECT * FROM `vts_company` WHERE 1 ORDER BY `comp_code` ASC"); while($row=mysql_fetch_array($getDataA)){ $clCompID = $row['comp_id']; $countBrand = mysql_result(mysql_query("SELECT COUNT(h_id) FROM `cl_clearance_header` WHERE `cl_status`='1' AND `cl_h_comp_id`='$clCompID'"),0); echo "{ label: \"".$row['comp_code']."\", y: ".$countBrand."},"; } } ?> //<?php echo "{ label: \"apple\", y: 10 },";?> //{ label: "orange", y: 15 }, //{ label: "banana", y: 25 }, //{ label: "mango", y: 30 }, //{ label: "grape", y: 28 } ] } ] }; //================================= $("#slaCount").CanvasJSChart(options); StopLoadGraph(); }; </script> </head> <body> <BR> <div style='border:0px solid red;width:99%;height:815px;min-height:600px;float:left;margin:5px;min-width:600px;background:white'> <div style='vertical-align:top;height:55px;margin:0px;width:100%;border-bottom:1px solid gray;padding:5px;font-family:Yu Gothic;font-weight:normal;color:gray;font-size:30px;text-align:center'> <?php echo "EMPLOYEE CLEARANCE ANALYSIS - ".strtoupper($myLabel);?><br><br> <div style='float:right;font-family:Verdana;font-size:15px;'> <a href=' ' class='hideClick hidden' > ♲ </a><!--REFRESH/RELOAD WINDOW--> <a href=' ' class='hideClick hidden' > ✉ </a> <!--EXTRACT LIST OF COMPANY AND EXPORT TO EXCEL--> <a href='autohub.php?id=x&d=x' class='hideClick hidden' style='font-weight:bold'> ✕ </a> </div> </div> <div id="activeSLA" style="height: 370px; width: 40%;margin:5px;border:0px solid gray;float:left;border-bottom:1px solid gray"></div> <div id="slaAnalysis" style="height: 370px; width: 40%;margin:5px;border:0px solid gray;float:right;border-bottom:1px solid gray"></div> <div id="slaCount" style="height: 400px; width: 100%;margin:5px;margin-top:100px;margin-bottom:50px;border:0px solid gray;float:left;border-bottom:1px solid gray"></div> </div> </body> </html>
| ver. 1.4 |
.
| PHP 7.3.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings