File manager - Edit - /home/autoph/public_html/pms_v1/reports/chartA.php
Back
<?php include_once("../../../cfg/conn.php"); //error_reporting(0); if(isset($_POST['lDat'])){ $searchID = $_POST['searchID']; $empID = $_POST['empID']; //employee number not record ID $rptYear = $_POST['rptYear']; $rptSemester = $_POST['rptSemester']; $empName = $_POST['empName']; $empPosition = $_POST['empPosition']; //INITIALIZING VARIABLES $janCount = 0; $jan = 0; $janT = 0; $janTotal=0; $janTotal=0; $febTotalT =0; $febTotal=0; $feb =0; $febT =0; $febCount =0; $marTotalT=0; $marTotal=0; $mar =0; $marT =0; $marCount =0; $aprTotalT=0; $aprTotal=0; $apr =0; $aprT =0; $aprCount =0; $mayTotalT=0; $mayTotal=0; $may =0; $mayT =0; $mayCount =0; $junTotalT=0; $junTotal=0; $jun =0; $junT =0; $junCount =0; $julTotalT=0; $julTotal=0; $jul =0; $julT =0; $julCount =0; $augTotalT=0; $augTotal=0; $aug =0; $augT =0; $augCount =0; $sepTotalT=0; $sepTotal=0; $sep =0; $sepT =0; $sepCount =0; $octTotalT=0; $octTotal=0; $oct =0; $octT =0; $octCount =0; $novTotalT=0; $novTotal=0; $nov =0; $novT =0; $novCount =0; $decTotalT=0; $decTotal=0; $dec =0; $decT =0; $decCount =0; //QUERY PCP HEADER BASED ON SEARCH DATA $getPCPHeaderID = "SELECT * FROM `pcp_headers` WHERE `employee_id`='$searchID' AND `year`='$rptYear' AND `deleted`=0 LIMIT 1"; $qPCP = mysqli_query($conn,$getPCPHeaderID); $ckhResult = mysqli_num_rows($qPCP); if($ckhResult > 0){ while($prow = mysqli_fetch_array($qPCP)){ $pcpID = $prow['id']; } //get Formula for later use $pi = "SELECT * FROM `pms_formula` WHERE deleted = 0 LIMIT 1"; $qPi = mysqli_query($conn,$pi); while($row = mysqli_fetch_array($qPi)){ $multiplierPTS = $row['multiplier_pts']; $plusFactorPTS = $row['plus_factor_pts']; } }else{ exit(); } } ?> <!DOCTYPE HTML> <html> <head> <script> var idVarA = setInterval(() => { loadChartA(); }, 800); function StopLoadGraph() { clearInterval(idVarA); } function loadChartA(){ StopLoadGraph(); clearInterval(idVarA); CanvasJS.addColorSet("greenShades", [//colorSet Array "#FB7B58", // lightred "#13B903", //green family "#FB5E09", // Orange mild "#17B2C8", // nice blue "#02B4A6", // light blur green "#F7053C", // bloody red "#AC87F7", // purple "#0B91F4", // blue light "#FD9FCA", // Elephant pink "#F78F58", // Orange light "#ef9c5b", //orange "#29A154", //green "#FA598F", // red pink "#6168FF", // blue violet "#F3EF08", // yellow "#8F5AF8", // purple "#88B809", //faded green "#FE671B" //sunset ]); CanvasJS.addColorSet("greenShadesB", [//colorSet Array "#17B2C8", // nice blue "#FD9FCA", // Elephant pink "#FA598F", // red pink "#6168FF", // blue violet "#F3EF08", // yellow "#8F5AF8", // purple "#88B809", //faded green "#FB7B58", // lightred "#ef9c5b", //orange "#29A154", //green "#AC87F7", // purple "#0B91F4", // blue light "#13B903", //green family "#FB5E09", // Orange mild "#02B4A6", // light blur green "#F7053C", // bloody red "#F78F58", // Orange light "#FE671B" //sunset ]); var options = { animationEnabled: true, theme: "light1", colorSet: "greenShades", title: { text: "Performance Rating by KRA - <?php echo $rptYear;?> " }, axisY: { title: "Average KRA Scores", suffix: "%" }, axisX: { title: "Employee's KRA" }, data: [ { // Change type to "doughnut", "line", "splineArea", etc. type: "column", indexLabel: "{y}", //showInLegend: true, dataPoints: [ <?php //QUERY EMPLOYEE KRA TO BE LOADED IN CHART A $chartKRA = "SELECT * FROM `pcp_employee_data` WHERE `pcp_header_id`='$pcpID' AND `deleted`=0 GROUP BY `pcp_kra_id` ORDER BY `id` ASC"; $cKRA = mysqli_query($conn,$chartKRA); while($row = mysqli_fetch_array($cKRA)){ $kraID =$row['pcp_kra_id']; $actKRA = "SELECT * FROM `kra_employee_tbl` WHERE `id`='$kraID'"; $qAct = mysqli_query($conn,$actKRA); while($krow = mysqli_fetch_array($qAct)){ $kCode = $krow['kra_code']; } $kScores = "SELECT AVG(`my_score`) AS myScore FROM `mar_emp_data` WHERE `kra_id`='$kraID' AND `pcp_id`='$pcpID' AND `mar_year_data`='$rptYear' AND `deleted`=0 AND `emp_rec_id`='$searchID' GROUP BY `kra_id`"; $qScores = mysqli_query($conn,$kScores); while($sRow = mysqli_fetch_array($qScores)){ $score = $sRow['myScore']; } $scores = number_format($score,3,'.',''); echo "{ label: '".$kCode."', y: ".$scores." },"; } ?> ] } ] }; $("#MyChartA").CanvasJSChart(options); //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ var chart = new CanvasJS.Chart("MyChartB", { animationEnabled: true, theme: "greenShadesB", // "light1", "light2", "dark1", "dark2" colorSet: "greenShades", title: { //fontSize:22, text: "Monthly Performance - <?php echo $rptYear;?>" }, axisY: { title: "Average Monthly Scores", labelAutoFit: true, //true by default. //fontSize: 14, suffix: "%" }, axisX: { //fontSize: 18, //labelAngle: 90, title: "Months" }, data: [{ type: "line", indexLabel: "{y}", //showInLegend: true, //yValueFormatString: "#,##0.0#\"%\"", markerType: "circle", yValueFormatString: "", labelWrap: true, //labelMaxWidth: 70, interval: 1, dataPoints: [ <?php for ($x = 1; $x <=12; $x++){ $myMonthly = 0; switch($x){ case '1': $months = "Jan"; break; case '2': $months = "Feb"; break; case '3': $months = "Mar"; break; case '4': $months = "Apr"; break; case '5': $months = "May"; break; case '6': $months = "Jun"; break; case '7': $months = "Jul"; break; case '8': $months = "Aug"; break; case '9': $months = "Sep"; break; case '10': $months = "Oct"; break; case '11': $months = "Nov"; break; case '12': $months = "Dec"; break; } $marSC = "SELECT AVG(`my_score`) AS myMScore FROM `mar_emp_data` WHERE `emp_rec_id`='$searchID' AND `mar_month_data`='$x' AND `mar_year_data`='$rptYear' AND deleted = 0 GROUP BY `mar_month_data`"; $qScores = mysqli_query($conn,$marSC); while($sc = mysqli_fetch_array($qScores)){ $myMonthly = number_format($sc['myMScore'],3,'.',''); } //$myMonthlySC = number_format($myMonthly,3,'.',''); echo "{ label: '".$months."', y: $myMonthly },"; } ?> ] }] }); chart.render(); //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ var chart = new CanvasJS.Chart("MyChartC", { animationEnabled: true, theme: "greenShadesB", // "light1", "light2", "dark1", "dark2" colorSet: "greenShades", title:{ text: "Target vs Actual" }, axisX:{ valueFormatString: "DD MMM", crosshair: { enabled: true, snapToDataPoint: true } }, axisY: { title: "Unit KRA Target vs Actual", includeZero: true, crosshair: { enabled: true } }, toolTip:{ shared:true }, legend:{ cursor:"pointer", verticalAlign: "bottom", horizontalAlign: "left", dockInsidePlotArea: true, itemclick: toogleDataSeries }, data: [{ type: "line", showInLegend: true, name: "Actual", indexLabel: "{y}", markerType: "square", xValueFormatString: "DD MMM, YYYY", color: "#F08080", showInLegend: true, dataPoints: [ <?php //QUERY EMPLOYEE KRA TO BE LOADED IN CHART A $chartKRA = "SELECT mar_emp_data.id, kra_unit_tbl.id AS unitKRAID, kra_unit_tbl.kra_code, kra_unit_tbl.unit_id AS unitKRAID, kra_unit_tbl.deleted AS UnitDeleted, kra_employee_tbl.id AS empKRAID, kra_employee_tbl.weight AS empKRAWeight, kra_employee_tbl.unit_kra_id AS kraUnitID, mar_emp_data.kra_id, mar_emp_data.mar_actual, mar_emp_data.my_score, mar_emp_data.mar_target, mar_emp_data.mar_variance_no, mar_emp_data.mar_numerical_rating, mar_emp_data.deleted, mar_emp_data.emp_rec_id, mar_emp_data.mar_year_data, mar_emp_data.mar_month_data, mar_emp_data.mar_semester_data, mar_emp_data.unit_id, mar_emp_data.id AS marID FROM kra_unit_tbl JOIN kra_employee_tbl ON kra_employee_tbl.unit_kra_id = kra_unit_tbl.id JOIN mar_emp_data ON mar_emp_data.kra_id = kra_employee_tbl.id WHERE kra_unit_tbl.unit_id = mar_emp_data.unit_id AND kra_employee_tbl.unit_kra_id =kra_unit_tbl.id AND kra_unit_tbl.deleted=0 AND mar_emp_data.mar_year_data=$rptYear AND mar_emp_data.emp_rec_id='$searchID'"; $cKRA = mysqli_query($conn,$chartKRA); while($row = mysqli_fetch_array($cKRA)){ $target = 0; $x = $row['mar_month_data']; $target = str_replace("%","",$row['mar_target']); switch($x){ case '1': $janCount = $janCount + 1; $jan = ($jan + $row['my_score']) / $janCount; $janT = ($janT + $target) / $janCount; $janTotalT = number_format($janT,3,'.',''); $janTotal = number_format($jan,3,'.',''); break; case '2': $febCount = $febCount + 1; $feb = ($feb + $row['my_score']) / $febCount; $febTotal = number_format($feb,3,'.',''); $febT = ($febT + $target) / $febCount; $febTotalT = number_format($febT,3,'.',''); break; case '3': $marCount = $marCount + 1; $mar = ($mar + $row['my_score']) / $marCount; $marTotal = number_format($mar,3,'.',''); $marT = ($marT + $target) / $marCount; $marTotalT = number_format($marT,3,'.',''); break; case '4': $aprCount = $aprCount + 1; $apr = ($apr + $row['my_score']) / $aprCount; $aprTotal = number_format($apr,3,'.',''); $aprT = ($aprT + $target) / $aprCount; $aprTotalT = number_format($aprT,3,'.',''); break; case '5': $mayCount = $mayCount + 1; $may = ($may + $row['my_score']) / $mayCount; $mayTotal = number_format($may,3,'.',''); $mayT = ($mayT + $target) / $mayCount; $mayTotalT = number_format($mayT,3,'.',''); break; case '6': $junCount = $junCount + 1; $jun = ($jun + $row['my_score']) / $junCount; $junTotal = number_format($jun,3,'.',''); $junT = ($junT + $target) / $junCount; $junTotalT = number_format($junT,3,'.',''); break; case '7': $julCount = $julCount + 1; $jul = ($jul + $row['my_score']) / $julCount; $julTotal = number_format($jul,3,'.',''); $julT = ($julT + $target) / $julCount; $julTotalT = number_format($julT,3,'.',''); break; case '8': $augCount = $augCount + 1; $aug = ($aug + $row['my_score']) / $augCount; $augTotal = number_format($aug,3,'.',''); $augT = ($augT + $target) / $augCount; $augTotalT = number_format($augT,3,'.',''); break; case '9': $sepCount = $sepCount + 1; $sep = ($sep + $row['my_score']) / $sepCount; $sepTotal = number_format($sep,3,'.',''); $sepT = ($sepT + $target) / $sepCount; $sepTotalT = number_format($sepT,3,'.',''); break; case '10': $octCount = $octCount + 1; $oct = ($oct + $row['my_score']) / $octCount; $octTotal = number_format($oct,3,'.',''); $octT = ($octT + $target) / $octCount; $octTotalT = number_format($octT,3,'.',''); break; case '11': $novCount = $novCount + 1; $nov = ($nov + $row['my_score']) / $novCount; $novTotal = number_format($nov,3,'.',''); $novT = ($novT + $target) / $novCount; $novTotalT = number_format($novT,3,'.',''); break; case '12': $decCount = $decCount + 1; $dec = ($dec + $row['my_score']) / $decCount; $decTotal = number_format($dec,3,'.',''); $decT = ($decT + $target) / $decCount; $decTotalT = number_format($decT,3,'.',''); break; } } echo "{ label: 'Jan', y: ".$janTotal." },"; echo "{ label: 'Feb', y: ".$febTotal." },"; echo "{ label: 'Mar', y: ".$marTotal." },"; echo "{ label: 'Apr', y: ".$aprTotal." },"; echo "{ label: 'May', y: ".$mayTotal." },"; echo "{ label: 'Jun', y: ".$junTotal." },"; echo "{ label: 'Jul', y: ".$julTotal." },"; echo "{ label: 'Aug', y: ".$augTotal." },"; echo "{ label: 'Sep', y: ".$sepTotal." },"; echo "{ label: 'Oct', y: ".$octTotal." },"; echo "{ label: 'Nov', y: ".$novTotal." },"; echo "{ label: 'Dec', y: ".$decTotal." },"; ?> ] }, { type: "line", showInLegend: true, name: "Target", lineDashType: "dash", indexLabel: "{y}", dataPoints: [ <?php echo "{ label: 'Jan', y: ".$janTotalT." },"; echo "{ label: 'Feb', y: ".$febTotalT." },"; echo "{ label: 'Mar', y: ".$marTotalT." },"; echo "{ label: 'Apr', y: ".$aprTotalT." },"; echo "{ label: 'May', y: ".$mayTotalT." },"; echo "{ label: 'Jun', y: ".$junTotalT." },"; echo "{ label: 'Jul', y: ".$julTotalT." },"; echo "{ label: 'Aug', y: ".$augTotalT." },"; echo "{ label: 'Sep', y: ".$sepTotalT." },"; echo "{ label: 'Oct', y: ".$octTotalT." },"; echo "{ label: 'Nov', y: ".$novTotalT." },"; echo "{ label: 'Dec', y: ".$decTotalT." },"; ?> ] }] }); chart.render(); function toogleDataSeries(e){ if (typeof(e.dataSeries.visible) === "undefined" || e.dataSeries.visible) { e.dataSeries.visible = false; } else{ e.dataSeries.visible = true; } chart.render(); } } //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ </script> </head> <body> <center> <div id="MyChartA" class="col-xl-6 col-lg-12 col-md-6 col-sm-12 p-2 mt-5" style="float:left;height: 360px;margin-bottom:50px"></div> <div id="MyChartB" class="col-xl-6 col-lg-12 col-md-6 col-sm-12 p-2 mt-5" style="float:left;height: 360px;margin-bottom:50px"></div> <div id="MyChartC" class="col-xl-12 col-lg-12 col-md-12 col-sm-12 p-2 mt-5" style="float:left;height: 360px;margin-bottom:50px"></div> </center><!-- <script type="text/javascript" src="https://canvasjs.com/assets/script/jquery-1.11.1.min.js"></script> <script type="text/javascript" src="https://cdn.canvasjs.com/jquery.canvasjs.min.js"></script> --> </body> </html>
| ver. 1.4 |
.
| PHP 7.3.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings