File manager - Edit - /home/autoph/public_html/pms_v1/pdfViewer/mar_employeeview.php
Back
<link rel="stylesheet" type="text/css" href="./css/sidebarmain.css?v=<?php echo time(); ?>"/> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Poppins:300,400,500,600,700,800,900"> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"> <?php ob_start(); $prfDateX = date_create() ->format("Y-m-d"); //https://www.youtube.com/watch?v=gNH6NNyhJLk //https://www.youtube.com/watch?v=EYYZFRRdR6A PDF with MySQL database $count = 0; require ('./fpdf.php'); class PDF extends FPDF{ function Header(){ $this->Image('../images/ahg_logo.png',10,5, 30,10, 'PNG','wwww.autohubgroup.com'); } /* function Footer(){ $this->SetY(-25); $this->Image('../images/ahg_logo.png'); } */ } include_once("../../../cfg/conn.php"); include ("../functions/users.php"); if(isset($_GET['pcpIDpdf'])){ $sourceID = $_GET['source']; $marIDpdf = $_GET['pcpIDpdf']; //START OF CHECKPOINT=============================================================================== //START OF CHECKPOINT=============================================================================== //==========CHECK IF USER EXIST IN THE RECORD AND MATCH ALL INFORMATION IN THE LICNK ========= $chkUser = "SELECT * FROM `pms_employee_data` WHERE `id`='$sourceID' AND `deleted` = 0"; $qCU=mysqli_query($conn,$chkUser); $countUser = mysqli_num_rows($qCU); if($countUser == 0){ echo " <center><img src='../images/locked_out_icon.png' width='100' style='margin-top:100px'><img>"; echo "<h4 class='text-center text-danger align-middle pt-5'> Access Denied </h4>"; echo "<p class='display-5 text-center text-danger'> Sorry, you are not authorized to access this page. <br>Please contact your system support for assistance. <br><br>Thank you! <br><br> </p></center> "; exit(); }else{ while($uow=mysqli_fetch_array($qCU)){ $uowaccStat = $uow['account_status']; $uowdeleted = $uow['deleted']; } } if($uowaccStat == 0){ echo " <center><img src='../images/locked_out_icon.png' width='100' style='margin-top:100px'><img>"; echo "<h4 class='text-center text-danger align-middle pt-5'> Access Denied </h4>"; echo "<p class='display-5 text-center text-danger'> Sorry, you are not authorized to access this page. <br>Please contact your system support for assistance. <br><br>Thank you! <br><br> </p></center> "; exit(); } if($uowdeleted == 1){ echo " <center><img src='../images/locked_out_icon.png' width='100' style='margin-top:100px'><img>"; echo "<h4 class='text-center text-danger align-middle pt-5'> Access Denied </h4>"; echo "<p class='display-5 text-center text-danger'> Sorry, you are not authorized to access this page. <br>Please contact your system support for assistance. <br><br>Thank you! <br><br> </p></center> "; exit(); } //==========CHECK IF EMPLOYEE EXIST IN RECORD AND MATCH ALL INFORMATION IN THE LICNK ========= $chkPoint = "SELECT `employee_id`,`year`,`period`,`pcp_name` FROM `pcp_headers` WHERE `id`='$marIDpdf'"; $qChk=mysqli_query($conn,$chkPoint); $ckhRow = mysqli_num_rows($qChk); If($ckhRow > 0){ while($row=mysqli_fetch_array($qChk)){ $employeeID = $row['employee_id']; $period = $row['period']; $pcpYear = $row['year']; } }else{ echo " <center><img src='../images/locked_out_icon.png' width='100' style='margin-top:100px'><img>"; echo "<h4 class='text-center text-danger align-middle pt-5'> Access Denied </h4>"; echo "<p class='display-5 text-center text-danger'> Sorry, you are not authorized to access this page. <br>Please contact your system support for assistance. <br><br>Thank you! <br><br> </p></center> "; exit(); } if($employeeID != $marIDpdf){ echo " <center><img src='../images/locked_out_icon.png' width='100' style='margin-top:100px'><img>"; echo "<h4 class='text-center text-danger align-middle pt-5'> Access Denied </h4>"; echo "<p class='display-5 text-center text-danger'> Sorry, you are not authorized to access this page. <br>Please contact your system support for assistance. <br><br>Thank you! <br><br> </p></center> "; exit(); } //END OF CHECKPOINT=============================================================================== //END OF CHECKPOINT=============================================================================== } $getName = "SELECT * FROM pms_employee_data WHERE id = $sourceID LIMIT 1"; $getMyName = mysqli_query($conn,$getName); while($nRow = mysqli_fetch_array($getMyName)){ $fname=$nRow['first_name']; $lname=$nRow['last_name']; $employeeName = $fname ." ". $lname; } //$sql ="SELECT * FROM `kra_position_tbl` WHERE `pms_unit_id`='$unitID' AND `deleted`=0 ORDER BY `kra_name` ASC"; $sql ="SELECT * FROM `mar_emp_data` WHERE `mar_header_id`='$marIDpdf' AND `deleted`=0 GROUP BY `kra_id` ASC"; $marQ = mysqli_query($conn,$sql); while($mar = mysqli_fetch_array($marQ)){ $marMotnh = $mar['mar_month_data']; } //$sql ="SELECT * FROM `kra_position_tbl` WHERE `pms_unit_id`='$unitID' AND `deleted`=0 ORDER BY `kra_name` ASC"; $sqlM ="SELECT * FROM `mar_emp_header` WHERE `id`='$marIDpdf'"; $marM = mysqli_query($conn,$sqlM); while($mam = mysqli_fetch_array($marM)){ $approvedByID = $mam['mar_approved_by']; $approvedDate = $mam['mar_approved_date']; $marEmpID = $mam['emp_id']; $marAgreeDate = $mam['date_confirmed']; } $periodText ="MONTHLY ACCOMPLISHMENT REPORT (Period: " . $marMotnh. " / ". $pcpYear .")"; $pdf = new PDF(); //set margins $pdf->SetMargins(10,20,10); $pdf->AddPage('L'); //L = Land Scape, P = Portrait //set column size in array format $width_cell = array(120,15,15,15,15,55,20,20); $height_cell = 7; //set Image //$pdf->Image('../images/ahg_logo.png',10,5, 25,10, 'PNG','wwww.autohubgroup.com'); //background color $pdf->SetFillColor(255,255,255); //use for report title bgcolor $pdf->SetFont('Arial','B',11); $pdf->MultiCell(0,2,'',0,0,true); $pdf->MultiCell(0,4,$employeeName,0,0,true); $pdf->SetFont('Arial','',8); $pdf->MultiCell(0,5,$periodText,0,0,true); $pdf->SetLineWidth(0); $pdf->SetDrawColor(0,0,25); //header start $pdf->SetFillColor(70, 70, 68 ,0); //use for header bgcolor $pdf->SetTextColor(255,255,255,90); $pdf->MultiCell(0,$height_cell,"",0,'P',false); //setup row padding $pdf->Cell(150,$height_cell,"PERFORMANCE TARGET",1,0,'C',true); $pdf->Cell(125,$height_cell,"ACTUAL OUTPUT / ACCOMPLISHMENTS",1,0,'C',true); $pdf->SetFillColor(223, 222, 218,0); //use for header bgcolor $pdf->SetTextColor(0,0,0,90); $pdf->MultiCell(0,$height_cell,"",0,'P',false); //setup row padding $pdf->Cell($width_cell[0],$height_cell,'KRA NAME',1,0,'L',true); $pdf->Cell($width_cell[1],$height_cell,'WEIGHT',1,0,'c',true); $pdf->Cell($width_cell[2],$height_cell,'TARGET',1,0,'C',true); $pdf->Cell($width_cell[3],$height_cell,'ACTUAL',1,0,'C',true); $pdf->Cell($width_cell[4],$height_cell,'SCORE',1,0,'C',true); $pdf->Cell($width_cell[5],$height_cell,'VARIANCE',1,0,'C',true); $pdf->Cell($width_cell[6],$height_cell,'N.RATING',1,0,'C',true); $pdf->Cell($width_cell[7],$height_cell,'W.POINT',1,0,'C',true); $pdf->SetFillColor(255,255,255); //use for body bgcolor $fill=false; //$pdf->Cell(400,200,'Hello Arnel'); $getData = mysqli_query($conn,$sql); $statRow = mysqli_num_rows($getData); $kraTitle = ''; $count=0; if($statRow > 0){ $lastKRAid = 0; $totalWPPointPartOne=0; while($drow = mysqli_fetch_array($getData)){ $pcpID= $drow['pcp_id']; $kraID = $drow['kra_id']; $kpiID = $drow['kpi_id']; $approverName = getEmployeeEmpInformationB($approvedByID)[3]. " " .getEmployeeEmpInformationB($approvedByID)[2]. " ".$approvedDate; $confirmByName = getEmployeeEmpInformationB($marEmpID)[3]. " " .getEmployeeEmpInformationB($marEmpID)[2]. " ".$marAgreeDate; $As=0; $Bs=0; $weightedPoints=0; $wp=0; $wpoint=0; $myActualData=0; $MyKPIScore=0; $kraAvgScore=''; $kraAvgScoreX=''; $kraWeightPrint=''; $kraWeight =getPositionKRAName($kraID)[1]; $kraExWeight = explode("%",$kraWeight); $kraWeightPercentage = $kraExWeight[0] / 100; //getPositionKPIName($kpiID)[0] //getPositionKRAName($kraID)[0] $pdf->MultiCell(0,$height_cell,"",0,'P',false); //setup row padding if($kraID!= $lastKRAid){ $pdf->Cell($width_cell[0],$height_cell,getPositionKRAName($kraID)[0],1,0,'L',$fill); $pdf->Cell($width_cell[1],$height_cell,$kraWeight,1,0,'C',$fill); $pdf->Cell($width_cell[2],$height_cell,"",1,0,'C',$fill); $pdf->Cell($width_cell[3],$height_cell,"",1,0,'L',$fill); $pdf->Cell($width_cell[4],$height_cell,"",1,0,'L',$fill); $pdf->Cell($width_cell[5],$height_cell,"",1,0,'L',$fill); $pdf->Cell($width_cell[6],$height_cell,number_format((getMARDataByPosKRAID($kraID,$pcpID,$kraWeight,$marMotnh)[1]),3,'.',''),1,0,'C',$fill); $pdf->Cell($width_cell[7],$height_cell,number_format((getMARDataByPosKRAID($kraID,$pcpID,$kraWeight,$marMotnh)[0]),3,'.',''),1,0,'C',$fill); $sqlKpi ="SELECT * FROM `mar_emp_data` WHERE `mar_header_id`='$marIDpdf' AND `kra_id`='$kraID' AND `deleted`=0 ORDER BY `kra_id` ASC"; $sqlKPIQ = mysqli_query($conn,$sqlKpi); while($kpi = mysqli_fetch_array($sqlKPIQ)){ $marKPIB=$kpi['kpi_id']; $marPCPid=$kpi['pcp_id']; $marKRAid=$kpi['kra_id']; $pckKPIid=$kpi['kpi_id']; $pdf->MultiCell(0,$height_cell,"",0,'P',false); //setup row padding $pdf->Cell($width_cell[0],$height_cell,getPositionKPIName($marKPIB)[0],1,0,'R',$fill); $pdf->Cell($width_cell[1],$height_cell,getPCPTargetAndWeight($marPCPid,$marKRAid,$pckKPIid)[0],1,0,'C',$fill); $pdf->Cell($width_cell[2],$height_cell,getPCPTargetAndWeight($marPCPid,$marKRAid,$pckKPIid)[1],1,0,'C',$fill); $pdf->Cell($width_cell[3],$height_cell,getPCPTargetAndWeight($marPCPid,$marKRAid,$pckKPIid)[2],1,0,'C',$fill); $pdf->Cell($width_cell[4],$height_cell,getPCPTargetAndWeight($marPCPid,$marKRAid,$pckKPIid)[3],1,0,'C',$fill); $pdf->Cell($width_cell[5],$height_cell,getPCPTargetAndWeight($marPCPid,$marKRAid,$pckKPIid)[4],1,0,'C',$fill); $pdf->Cell($width_cell[6],$height_cell,getPCPTargetAndWeight($marPCPid,$marKRAid,$pckKPIid)[5],1,0,'C',$fill); $pdf->Cell($width_cell[7],$height_cell,getPCPTargetAndWeight($marPCPid,$marKRAid,$pckKPIid)[6],1,0,'C',$fill); $totalWPPointPartOne =$totalWPPointPartOne + getPCPTargetAndWeight($marPCPid,$marKRAid,$pckKPIid)[6]; } $lastKRAid = $kraID; } $fill =!$fill; // use code to put alternate color between rows } $pdf->SetFillColor(223, 222, 218,0); //use for header bgcolor $pdf->SetTextColor(0,0,0,90); $pdf->MultiCell(0,$height_cell,"",0,'P',false); //setup row padding $pdf->Cell(235,$height_cell,"PERFORMANCE RATING (sum of weighted points)",1,0,'R',true); $pdf->Cell(40,$height_cell,$totalWPPointPartOne,1,0,'C',true); $pdf->MultiCell(0,$height_cell,"",0,'P',false); //setup row padding $pdf->Cell(235,$height_cell,"PERCENTILE EQUIVALENT",1,0,'R',true); $perCentile = (($totalWPPointPartOne/5)*0.5) + 0.5; $perCentileX = $perCentile * 100; $pdf->Cell(40,$height_cell,$perCentileX."%",1,0,'C',true); $adjE = "SELECT * FROM `gps_adjectival_eq` WHERE $perCentileX BETWEEN eq_percentage_from AND eq_percentage_to"; $getAdj = mysqli_query($conn,$adjE); while($nm = mysqli_fetch_array($getAdj)){ $eqAdjectival = $nm['eq_adjectival']; } $pdf->MultiCell(0,$height_cell,"",0,'P',false); //setup row padding $pdf->Cell(235,$height_cell,"ADJECTIVAL EQUIVALENT",1,0,'R',true); $pdf->Cell(40,$height_cell,$eqAdjectival,1,0,'C',true); //PART II https://webprogramming.ninja/2015/12/28/fpdf-and-the-check-mark/ //$check = "4"; else $check = ""; check N=shaded box, O=Empty box //$pdf->SetFont('ZapfDingbats','', 10); 275 $pdf->SetFillColor(70, 70, 68 ,0); //use for header bgcolor $pdf->SetTextColor(255,255,255,90); $pdf->MultiCell(0,$height_cell,"",0,'P',false); //setup row padding $pdf->MultiCell(0,$height_cell,"",0,'P',false); //setup row paddingf $pdf->Cell(275,$height_cell,"OVERALL MONTHLY ASSESSMENT / ACTION TO BE TAKEN",1,0,'C',true); $pdf->SetFillColor(223, 222, 218,0); //use for header bgcolor $pdf->SetTextColor(0,0,0,90); $pdf->MultiCell(0,$height_cell,"",0,'P',false); //setup row padding $pdf->Cell(175,$height_cell,"A. ACTION / MEASURE TO BE TAKEN",1,0,'L',true); $pdf->Cell(50,$height_cell,"TARGET DATE",1,0,'C',true); $pdf->Cell(50,$height_cell,"RESPONSIBILITY",1,0,'C',true); $pdf->SetFillColor(255, 255, 255,90); //use for header bgcolor $pdf->SetTextColor(0,0,0,90); $act = "SELECT * FROM `mar_actions` WHERE `deleted`=0 ORDER BY `id` ASC"; $qAct = mysqli_query($conn,$act); while($row = mysqli_fetch_array($qAct)){ $actionID = $row['id']; $pdf->MultiCell(0,$height_cell,"",0,'P',false); //setup row padding $actData ="SELECT * FROM `mar_actions_data` WHERE `mar_header_id`='$marIDpdf' AND `action_id`='$actionID' AND `deleted`=0 LIMIT 1"; $qData = mysqli_query($conn,$actData); $actionValue=""; while($ad = mysqli_fetch_array($qData)){ $actionValue = $ad['action_value']; $actionDate = $ad['action_date']; $resPerson= $ad['action_person']; } if($actionValue ==="checked"){ $chkBox = "x"; //check N=shaded box, O=Empty box }else{ $chkBox = ""; //check N=shaded box, O=Empty box } $pdf->Cell(10,$height_cell,$chkBox,1,0,'C',true); $pdf->Cell(165,$height_cell,$row['action_item'],1,0,'L',true); $pdf->Cell(50,$height_cell,$actionDate,1,0,'C',true); $pdf->Cell(50,$height_cell,$resPerson,1,0,'C',true); } $hrdData ="SELECT * FROM `mar_emp_header` WHERE `id`='$marIDpdf' AND `deleted`=0 LIMIT 1"; $qHDR = mysqli_query($conn,$hrdData); while($rt = mysqli_fetch_array($qHDR)){ $resComment = $rt['ratee_notes']; $resAgreement = $rt['ratee_agreement']; } if($resAgreement ==1){ $ratee="Agree"; }else if ($resAgreement ==1){ $ratee="Partially Agree"; }else{ $ratee="DisAgree"; } $pdf->SetFillColor(223, 222, 218,0); //use for header bgcolor $pdf->SetTextColor(0,0,0,90); $pdf->MultiCell(0,$height_cell,"",0,'P',false); //setup row padding $pdf->MultiCell(0,$height_cell,"",0,'P',false); //setup row padding $pdf->Cell(275,$height_cell,"B. COMMENT BY THE EMPLOYEE - RATEE:",1,0,'L',true); $pdf->SetFillColor(255, 255, 255,0); //use for header bgcolor $pdf->SetTextColor(0,0,0,90); $pdf->MultiCell(0,$height_cell,"",0,'P',false); //setup row padding $pdf->Cell(50,$height_cell,$ratee,1,0,'L',true); $pdf->Cell(225,$height_cell,$resComment,1,0,'L',true); $pdf->SetFillColor(240, 240, 240,90); //use for header bgcolor $pdf->SetTextColor(0,0,0,90); $pdf->MultiCell(1,20,"",0,'L',false); //setup row padding (border, padding top,) $pdf->Cell(45,6,$employeeName .' '. $prfDateX,'B,B',1,'L',false); $pdf->Cell(100,6,"Prepared by:",0,'L',false); $pdf->MultiCell(1,12,"",0,'L',false); //setup row padding (border, padding top,) $pdf->Cell(45,6,$confirmByName,'B,B',1,'L',false); $pdf->Cell(100,6,"Confirmed By (date/time)",0,'L',false); $pdf->MultiCell(1,12,"",0,'L',false); //setup row padding (border, padding top,) $pdf->Cell(45,6,$approverName,'B,B',1,'L',false); $pdf->Cell(100,6,"Approved BY (date/time)",0,'L',false); } $pdf->Output('my_file.php','I'); ?>
| ver. 1.4 |
.
| PHP 7.3.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings