File manager - Edit - /home/autoph/public_html/pms_v1/reports/loadDataReportB.php
Back
<?php include_once("../../../cfg/conn.php"); //error_reporting(0); if(isset($_POST['lDat'])){ $pcpID=0; $activeKRAID=0; $pTile = 0; $totalWP = 0; $adjVal = ""; $kraCount = 0; $plusFactorPTS=0; $multiplierPTS=0; $marWPATotal=0; $ndCount=0; $stCount=0; $stNR = 0; $ndNR = 0; $rptYear=$_POST['rptYear']; $rptSemester=$_POST['rptSemester']; $empName=$_POST['empName']; $empPosition=$_POST['empPosition']; $unitID=$_POST['unitID']; $searchID=$_POST['searchID']; $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{ echo '<div class="alert alert-danger Display-5" role="alert" size-14> There is no record to display. Please check if PCP or KRA\'s has been created. </div>'; exit(); } $getPCPdata = "SELECT * FROM `kra_unit_tbl` WHERE `unit_id`='$searchID' AND `deleted`=0 ORDER BY `id` ASC"; $qKRA = mysqli_query($conn,$getPCPdata); $ckhResult = mysqli_num_rows($qKRA); echo "<center><table class='col-lg-12 col-md-12' style='width:100%'>"; echo "<thead>"; echo "<th>KRA DESCKRIPTION</th>"; echo "<th>WEIGHT </th>"; echo "<th>TARGET</th>"; echo "<th>AVG. ACTUAL</th>"; echo "<th>AVG. SCORE</th>"; echo "<th>AVE. NR</th>"; echo "<th>AVE. WP</th>"; echo "</thead>"; while($row = mysqli_fetch_array($qKRA)){ $kraCount = $kraCount + 1; $count = 0; $marActual=0; $marScore=0; $marNRAVG=0; $marWPAVG=0; $marNR =0; $avgMarActual = 0; $avgMarScore = 0; $avgMarNR = 0; $avgMarVariance = 0; $unitKRAID = $row['id']; $kraWeight = $row['weight']; $myWeight =str_replace("%","",$kraWeight); echo "<tr>"; echo "<td class='col-lg-6 text-left'>".$row['kra_name']."</td>"; echo "<td class='col-lg-1 text-center'>".$row['weight']."</td>"; echo "<td class='col-lg-1 text-center'></td>"; echo "<td class='col-lg-1 text-center'>"; $gUnitActual = "SELECT mar_emp_data.id, kra_unit_tbl.id AS unitKRAID, 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_variance_no, mar_emp_data.mar_numerical_rating, mar_emp_data.deleted, mar_emp_data.kpi_id, mar_emp_data.unit_id 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 =$unitKRAID AND kra_unit_tbl.deleted=0"; $qMar = mysqli_query($conn,$gUnitActual); $tRow = mysqli_num_rows($qMar); if($tRow > 0){ $marKPIID=0; while($row = mysqli_fetch_array($qMar)){ $count = $count + 1; $marActual =$marActual + $row['mar_actual']; $marScore =$marScore + $row['my_score']; $marNR =$marNR + $row['mar_numerical_rating']; $marKPIID = $row['kpi_id']; } $marActualAVG =number_format(($marActual / $count),3,'.',''); $marScoreAVG =number_format(($marScore / $count),3,'.',''); $marNRAVG =number_format(($marNR / $count),3,'.',''); $marWPCounter =$marNRAVG * ($myWeight/100); $marWPATotal= $marWPATotal + $marWPCounter; //Global Accumulation $marWPAVG=number_format($marWPCounter,3,'.',''); }else{ $marActualAVG ='0.000'; $marScoreAVG ='0.000'; $marNRAVG ='0.000'; $marWPAVG ='0.000'; } echo $marActualAVG; //echo $myActual; echo "</td>"; echo "<td class='col-lg-1 text-center'>".$marScoreAVG."</td>"; echo "<td class='col-lg-1 text-center'>".$marNRAVG."</td>"; echo "<td class='col-lg-1 text-center'>".$marWPAVG."</td>"; echo "</tr>"; echo "<tr>"; echo "<td colspan=1 class='text-left text-primary' style='padding-left:50px;'>"; $getUniKraKpi = "SELECT * FROM kpi_unit WHERE kra_id='$unitKRAID'"; $qkPosK = mysqli_query($conn,$getUniKraKpi); while($uni=mysqli_fetch_array($qkPosK)){ echo "<i>".$uni['kpi_name']."</i>"; // unit KPI ID $activeUnitKPIID = $uni['id']; } echo "</td>"; $kpiScore = "SELECT AVG(mar_emp_data.my_score) AS myKPIScore, AVG(mar_emp_data.mar_actual) AS myKPImarActual, AVG(mar_emp_data.mar_numerical_rating) AS myKPINumerical, AVG(mar_emp_data.mar_variance_no) AS myKPIVarianceNO, kpi_unit.id AS UnitKPIID, kpi_unit.kpi_target AS unitTarget, kpi_unit.kpi_name, kpi_unit.kpi_weight, kpi_position.id AS posID, kpi_position.top_kpi_id AS unitPostLinkID, kpi_position.kpi_target AS posTarget, kpi_employee.top_kpi_id AS postEmpLinkID, kpi_employee.id AS empKPIID, kpi_employee.kpi_target AS empTarget, mar_emp_data.kpi_id AS marEmpLinkID, mar_emp_data.mar_weight, mar_emp_data.mar_actual, mar_emp_data.my_score, mar_emp_data.mar_variance_no, mar_emp_data.mar_numerical_rating, mar_emp_data.mar_year_data FROM mar_emp_data JOIN kpi_employee ON kpi_employee.id = mar_emp_data.kpi_id JOIN kpi_position ON kpi_position.id = kpi_employee.top_kpi_id JOIN kpi_unit ON kpi_unit.id = kpi_position.top_kpi_id WHERE mar_emp_data.deleted = 0 AND mar_emp_data.mar_year_data=$rptYear AND kpi_unit.id = $activeUnitKPIID"; $qKpi = mysqli_query($conn,$kpiScore); $kpiRow = mysqli_num_rows($qKpi); if($kpiRow > 0){ while($kp = mysqli_fetch_array($qKpi)){ $avgMarActual = number_format($kp['myKPImarActual'],3,'.',''); $avgMarScore = number_format($kp['myKPIScore'],3,'.',''); $avgMarNR = number_format($kp['myKPINumerical'],3,'.',''); $avgMarVariance = number_format($kp['myKPIVarianceNO'],3,'.',''); $unitTaret = $kp['unitTarget']; $unitWeight = $kp['kpi_weight']; } } $unitWeightCounter = str_replace("%","",$unitWeight); echo "<td class='text-center text-primary'><i>".$unitWeight."</i></td>"; echo "<td class='text-center text-primary'><i>".$unitTaret."</i></td>"; echo "<td class='text-center text-primary'><i>".$avgMarActual."</i></td>"; echo "<td class='text-center text-primary'><i>".$avgMarScore."</i></td>"; echo "<td class='text-center text-primary'><i>".$avgMarNR."</i></td>"; echo "<td class='text-center text-primary'>"; $kpiWP =$avgMarNR * ($unitWeightCounter / 100); echo "<i>". number_format($kpiWP,3,'.','')."</i>"; //echo $unitWeightCounter; echo "</td>"; echo "</tr>"; } if($kraCount==0){ $perCentile = 0; }else{ $perCentile = ((($marWPATotal / $kraCount) * $multiplierPTS) + $plusFactorPTS) * 100; } $gP = "SELECT * FROM `gps_adjectival_eq` WHERE $perCentile BETWEEN eq_percentage_from AND eq_percentage_to "; $gpA = mysqli_query($conn,$gP); while($row=mysqli_fetch_array($gpA)){ $partOneAdju= $row['eq_adjectival']; } echo "<tr><td colspan=7 style='background:white;border:0px solid white;height:50px'>"; // KPI Analysis ================================================================== // echo " <h5 class='content text-left color-blue' style='margin-top:50px;padding:10px;background:#FDEFD2'>KPI Analysis</h5> // <table class='col-lg-12 col-md-12' style='width:100%'>"; // echo "<thead>"; // echo "<th>KPI DESCKRIPTION</th>"; // echo "<th class='col text-center'>WEIGHT</th>"; // echo "<th class='col text-center'>TARGET </th>"; // echo "<th class='col text-center'>ACTUAL </th>"; // echo "<th class='col text-center'>SCORE (YTD)</th>"; // echo "<th class='col text-center'>N.RATING</th>"; // echo "<th class='col text-center'>W.POINTS</th>"; // echo "</thead>"; // echo "</table>"; echo "<tr><td colspan=6 style='background:white;border:0px solid white;height:50px'></td></tr>"; echo "<tr>"; echo "<td colspan=5 style='text-align:right;background:#eeeeee;font-size:16px;font-weight:bold'>PERFORMANCE RATING (sum of weighted points)</td>"; echo "<td colspan=2 style='text-align:right;background:#eeeeee;font-size:16px;font-weight:bold'>".$marWPATotal."</td>"; echo "</tr>"; echo "<tr>"; echo "<td colspan=5 style='text-align:right;background:#eeeeee;font-size:16px;font-weight:bold'>PERCENTILE EQUIVALENT</td>"; echo "<td colspan=2 style='text-align:right;background:#eeeeee;font-size:16px;font-weight:bold'>"; if($kraCount==0){ $perCentile=0; }else{ $perCentile = ((($marWPATotal / 5) * $multiplierPTS) + $plusFactorPTS) * 100; } echo number_format($perCentile,3,'.','') ."%"; echo "</td>"; echo "</tr>"; echo "<tr>"; echo "<td colspan=5 style='text-align:right;background:#eeeeee;font-size:16px;font-weight:bold'>ADJECTIVAL EQUIVALENT</td>"; echo "<td colspan=2 style='text-align:right;background:#eeeeee;font-size:16px;font-weight:bold'>"; $gP = "SELECT * FROM `gps_adjectival_eq` WHERE $perCentile BETWEEN eq_percentage_from AND eq_percentage_to "; $gpA = mysqli_query($conn,$gP); while($row=mysqli_fetch_array($gpA)){ $partOneAdju= $row['eq_adjectival']; } echo $partOneAdju; echo "</td>"; echo "</tr>"; // echo "<tr>"; // echo "<td colspan=2 style='height:120px;color:#FA2508;background:#F9F0C8;padding:20px'> // <div class='col-lg-4 col-md-6 col-sm-12 float-right text-center'> // <h6>Adjectival Equivalent </h6> // <h4 class='text-center p-4'> $partOneAdju</h4> // </div> // </td>"; // echo "<td colspan=2 style='height:150px;color:#FA2508;background:#F6FCD6;padding:20px'> // <h6>Weighted Points </h6> // <h4 class='text-center p-4'>".$marWPATotal."</h4></td>"; // echo "<td colspan=2 style='height:150px;color:#FA2508;background:#D6FCF8;padding:20px'> // <h6>Numerical Rating </h6> // <h4 class='text-center p-4'>"; // echo number_format($perCentile,3,'.','') ."%"; // echo "</h4></td>"; // echo "</tr>"; echo "</table></center>"; } //$conn->close(); ?>
| ver. 1.4 |
.
| PHP 8.1.32 | Generation time: 0 |
proxy
|
phpinfo
|
Settings