File manager - Edit - /home/autoph/public_html/pms_v1/pdfViewer/samplepdfmar.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'); } */ } $pcpIDpdf = $_GET['pcpIDpdf']; include_once("../../../cfg/conn.php"); include ("../functions/users.php"); if(isset($_GET['pcpIDpdf'])){ $sourceID = $_GET['source']; $pcpIDpdf = $_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`='$pcpIDpdf'"; $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(); } $periodText ="PERFORMANCE COMMITMENT PLAN FOR (" . $period. " Semester of ". $pcpYear .")"; if($employeeID != $pcpIDpdf){ 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`='$pcpIDpdf' AND `deleted`=0 ORDER BY `kra_id` ASC"; $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(15,95,100,20,20,25); $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->SetFillColor(240, 240, 240,90); //use for header bgcolor $pdf->SetTextColor(0,0,0,90); $pdf->SetLineWidth(0); $pdf->SetDrawColor(0,0,25); //header start $pdf->Cell($width_cell[1],$height_cell,'KRA NAME',1,0,'L',true); $pdf->Cell($width_cell[2],$height_cell,'KPI NAME',1,0,'L',true); $pdf->Cell($width_cell[3],$height_cell,'WEIGHT',1,0,'C',true); $pdf->Cell($width_cell[4],$height_cell,'TARGET',1,0,'C',true); $pdf->Cell($width_cell[5],$height_cell,'TIMELINE',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; while($drow = mysqli_fetch_array($getData)){ $pcpID= $drow['id']; $kraID = $drow['kra_id']; $kpiID = $drow['kpi_id']; $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; $pdf->MultiCell(0,$height_cell,"",0,'P',false); //setup row padding if($kraID == $lastKRAid){ $pdf->Cell($width_cell[1],$height_cell,"","L,B",0,0,'L',$fill); }else{ $pdf->Cell($width_cell[1],$height_cell,getPositionKRAName($kraID)[0],'L,L',0,'L',$fill); } $pdf->Cell($width_cell[2],$height_cell,getPositionKPIName($kpiID)[0],1,0,'L',$fill); $pdf->Cell($width_cell[3],$height_cell,$kraWeight,1,0,'C',$fill); $pdf->Cell($width_cell[4],$height_cell,"A",1,0,'C',$fill); $pdf->Cell($width_cell[5],$height_cell,"A",1,0,'C',$fill); $fill =!$fill; // use code to put alternate color between rows $kraTitle=$kraID; $lastKRAid = $kraID; } $pdf->MultiCell(1,20,"",0,'L',false); //setup row padding (border, padding top,) $pdf->Cell(100,0,"_____________________________",0,1,'L',false); $pdf->Cell(100,8,$employeeName .' / '. $prfDateX ,0,0,'L',false); } $pdf->Output('my_file.php','I'); ?>
| ver. 1.4 |
.
| PHP 7.3.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings