File manager - Edit - /home/autoph/public_html/pms_v1/pdfViewer/compliance_cardBranchLevel.php
Back
<?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, 25,10, 'PNG','wwww.autohubgroup.com'); } /* function Footer(){ $this->SetY(-25); $this->Image('../images/ahg_logo.png'); } */ } $myUID = $_GET['userID']; $unitID = $_GET['unitID']; $sourceID = $_GET['userID']; $sem = $_GET['sem']; $unitName = $_GET['unitName']; $rptYear = $_GET['year']; if($sem == 1){ $semester = "1st Semester"; }else if($sem == 2){ $semester = "2nd Semester"; }else{ $semester = "1st & 2nd Semester"; } $unitName = $unitName . " - MAR Compliance Report" ." (". $rptYear .")"; include_once("../../../cfg/conn.php"); include ("../functions/users.php"); $roleID=0; if(isset($_GET['s'])){ //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 `last_name`, `first_name`,`account_status`,`deleted` FROM `pms_employee_data` WHERE `id`='$empID'"; $qChk=mysqli_query($conn,$chkPoint); $ckhRow = mysqli_num_rows($qChk); If($ckhRow > 0){ while($row=mysqli_fetch_array($qChk)){ $lastName = $row['last_name']; $firstName = $row['first_name']; $accStat = $row['account_status']; $deleted = $row['deleted']; } }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(); } //END OF CHECKPOINT=============================================================================== //END OF CHECKPOINT=============================================================================== } $getName = "SELECT * FROM pms_employee_data WHERE id = $myUID LIMIT 1"; $getMyName = mysqli_query($conn,$getName); while($nRow = mysqli_fetch_array($getMyName)){ $fname=$nRow['first_name']; $lname=$nRow['last_name']; $compID=$nRow['comp_id']; $myFName = $fname ." ". $lname; } $compName = getCompanyNameSub($compID)[0]; $sql ="SELECT * FROM `pms_employee_data` WHERE `branch_id`='$unitID' AND `deleted`=0 ORDER BY `last_name` 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(10,50,17,17,17,17,17,17,17,17,17,17,17,17,15); //275 $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',10 ); $pdf->MultiCell(0,5,$compName,0,1,0,true); $pdf->SetFont('Arial','',10 ); $pdf->MultiCell(0,5,$unitName,0,1,0,true); $pdf->MultiCell(0,5,"",0,0,true); $pdf->SetFont('Arial','',8); $pdf->SetFillColor(0,0,0,90); //use for header bgcolor $pdf->SetTextColor(255,255,255,90); $pdf->SetLineWidth(0); $pdf->SetDrawColor(0,0,25); //header start $pdf->Cell($width_cell[0],$height_cell,'NO',1,0,'L',true); $pdf->Cell($width_cell[1],$height_cell,'EMPLOYEE NAME',1,0,'L',true); $pdf->Cell($width_cell[2],$height_cell,'JAN',1,0,'C',true); $pdf->Cell($width_cell[3],$height_cell,'FEB',1,0,'C',true); $pdf->Cell($width_cell[4],$height_cell,'MAR',1,0,'C',true); $pdf->Cell($width_cell[5],$height_cell,'APR',1,0,'C',true); $pdf->Cell($width_cell[6],$height_cell,'MAY',1,0,'C',true); $pdf->Cell($width_cell[7],$height_cell,'JUN',1,0,'C',true); $pdf->Cell($width_cell[8],$height_cell,'JUL',1,0,'C',true); $pdf->Cell($width_cell[9],$height_cell,'AUG',1,0,'C',true); $pdf->Cell($width_cell[10],$height_cell,'SEP',1,0,'C',true); $pdf->Cell($width_cell[11],$height_cell,'OCT',1,0,'C',true); $pdf->Cell($width_cell[12],$height_cell,'NOV',1,0,'C',true); $pdf->Cell($width_cell[13],$height_cell,'DEC',1,0,'C',true); $pdf->Cell($width_cell[14],$height_cell,'RATING',1,0,'C',true); $pdf->SetFillColor(255,255,255,0); //use for header bgcolor $pdf->SetTextColor(0,0,0,90); $fill=false; //$pdf->Cell(400,200,'Hello Arnel'); $getData = mysqli_query($conn,$sql); $statRow = mysqli_num_rows($getData); $kraCode = 0; $kpiCount = 0; $count = 0; $achvRateTotal=0; $wPointTotal =0; $kraWeightTotal=0; $kraWeightT=0; while($row = mysqli_fetch_array($getData)){ $marCount = 0; $janMarData=""; $count = $count + 1; $pdf->MultiCell(0,$height_cell,"",0,'P',false); //setup row padding $activeEmp = $row['id']; $pdf->Cell($width_cell[0],$height_cell,$count,1,0,'C',$fill); $pdf->Cell($width_cell[1],$height_cell,strtoupper($row['last_name']).", ".strtoupper($row['first_name']),1,0,'L',$fill); //getEmployeeKRAName($kraID)[0] for($x = 01; $x <=12; $x++){ $myNewX = str_pad($x, 2, "0", STR_PAD_LEFT); $mJan = "SELECT `mar_posted_date` FROM `mar_emp_header` WHERE `mar_year`='$rptYear' AND `emp_id`='$activeEmp' AND `mar_month`='$myNewX' AND `mar_posted`=1 LIMIT 1"; $qMjan = mysqli_query($conn,$mJan); $qRow = mysqli_num_rows($qMjan); if($qRow > 0){ $marCount = $marCount + 1; while($mar = mysqli_fetch_array($qMjan)){ $janMar = explode(" ",$mar['mar_posted_date']); $janMarData = $janMar[0]; $pdf->Cell($width_cell[3],$height_cell,$janMarData,1,0,'C',$fill); } }else{ $pdf->Cell($width_cell[3],$height_cell,"-",1,0,'C',$fill); } } $rating = number_format(($marCount / 12 * 100),2,'.','')."%"; $pdf->Cell($width_cell[14],$height_cell,$rating,1,0,'C',$fill); /* $pdf->Cell($width_cell[4],$height_cell,"D",1,0,'C',$fill); $pdf->Cell($width_cell[5],$height_cell,"E",1,0,'C',$fill); $pdf->Cell($width_cell[6],$height_cell,"F",1,0,'C',$fill); $pdf->Cell($width_cell[7],$height_cell,"G",1,0,'C',$fill); $pdf->Cell($width_cell[8],$height_cell,"H",1,0,'C',$fill); $pdf->Cell($width_cell[9],$height_cell,"G",1,0,'C',$fill); $pdf->Cell($width_cell[10],$height_cell,"H",1,0,'C',$fill); $pdf->Cell($width_cell[11],$height_cell,"G",1,0,'C',$fill); $pdf->Cell($width_cell[12],$height_cell,"H",1,0,'C',$fill); $pdf->Cell($width_cell[13],$height_cell,"G",1,0,'C',$fill); **/ } $pdf->SetFillColor(255,255,255,10); //use for header bgcolor $pdf->SetTextColor(0,0,0,90); $pdf->MultiCell(1,25,"",0,'L',false); //setup row padding $pdf->Cell(100,0,"_____________________________",0,1,'L',false); $pdf->Cell(100,8,$myFName .' / '. $prfDateX ,0,0,'L',false); $pdf->Output('MARCompliance_'.$unitName.'.pdf','I'); ?>
| ver. 1.4 |
.
| PHP 7.3.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings