File manager - Edit - /home/autoph/public_html/pms_v1/pdfViewer/ops_pdfAutohubView.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, 30,10, 'PNG','wwww.autohubgroup.com'); } /* function Footer(){ $this->SetY(-25); $this->Image('../images/ahg_logo.png'); } */ } $compID = $_GET['compID']; $recordID = $_GET['recordID']; include_once("../../../cfg/conn.php"); include ("../functions/users.php"); if(isset($_GET['compID'])){ $sourceID = $_GET['source']; $opsIDpdf = $_GET['compID']; //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){ include '../accessDenied.php'; exit(); }else{ while($uow=mysqli_fetch_array($qCU)){ $uowaccStat = $uow['account_status']; $uowdeleted = $uow['deleted']; $uFName = $uow['first_name']; $uLName = $uow['last_name']; } } $userFName = $uFName . " " . $uLName; if($uowaccStat == 0){ include '../accessDenied.php'; exit(); } if($uowdeleted == 1){ include '../accessDenied.php'; exit(); } //==========CHECK IF EMPLOYEE EXIST IN RECORD AND MATCH ALL INFORMATION IN THE LICNK ========= $chkPoint = "SELECT `ops_name`,`coverage_year`, `record_id`,`description` FROM `ops_company_level` WHERE `id`='$opsIDpdf'"; $qChk=mysqli_query($conn,$chkPoint); $ckhRow = mysqli_num_rows($qChk); If($ckhRow > 0){ while($row=mysqli_fetch_array($qChk)){ $deptID = $row['record_id']; $opsName = $row['ops_name']; $opsYear = $row['coverage_year']; $opsDesc = $row['description']; } }else{ include '../accessDenied.php'; exit(); } $periodText ="OPERATIONAL PLAN FOR (".$opsYear.")"; //echo $deptID ."-". $opsIDpdf; //END OF CHECKPOINT=============================================================================== //END OF CHECKPOINT=============================================================================== } $getName = "SELECT * FROM pms_group_tbl WHERE id = $sourceID LIMIT 1"; $getMyName = mysqli_query($conn,$getName); while($nRow = mysqli_fetch_array($getMyName)){ $compName=$nRow['name']; } //$sql ="SELECT * FROM `kra_position_tbl` WHERE `pms_unit_id`='$unitID' AND `deleted`=0 ORDER BY `kra_name` ASC"; $sql = "SELECT * FROM `ops_data_autohub` WHERE `deleted`=0 AND `ops_title_id` ='$sourceID' ORDER BY `ops_kra` ASC"; $pdf = new PDF('L','mm',array(350,230)); //$pdf = new FPDF('L','mm',array(350,230)); //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,70,70,15,15,60,45,15,30); //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,3,'',0,0,true); $pdf->MultiCell(0,4,$compName,0,0,true); $pdf->SetFont('Arial','',7); $pdf->MultiCell(0,4,$periodText,0,0,true); $pdf->MultiCell(0,5,$opsDesc,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[0],6,'NO',1,0,'C',true); $pdf->Cell($width_cell[1],6,'KRA NAME',1,0,'L',true); $pdf->Cell($width_cell[2],6,'KPI NAME',1,0,'L',true); $pdf->Cell($width_cell[3],6,'WEIGHT',1,0,'C',true); $pdf->Cell($width_cell[4],6,'B.MARK',1,0,'C',true); $pdf->Cell($width_cell[5],6,'TARGET (%) /DESCRIPTION',1,0,'C',true); $pdf->Cell($width_cell[6],6,'STRATEGY / MAJOR ACTIVITIES',1,0,'C',true); $pdf->Cell($width_cell[7],6,'TIMELINE',1,0,'C',true); $pdf->Cell($width_cell[8],6,'RESPONSIBILITY',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){ while($drow = mysqli_fetch_array($getData)){ //$pcpID= $drow['id']; $kraID = $drow['ops_kra']; $kpiID = $drow['ops_kpi']; $kraWeight = getAutohubKRAName($kraID)[1]; $kraExWeight = explode("%",$kraWeight); $kraWeightPercentage = $kraExWeight[0] / 100; $kraAVGWP = ''; $pdf->MultiCell(0,6,"",0,'P',false); //setup row padding if($kraTitle == $kraID){ $pdf->Cell($width_cell[0],6,"",1,0,'C',$fill); $kraAVGWP=''; }else{ $count = $count + 1; $kraAVGWP = $drow['ops_weight']; $pdf->Cell($width_cell[0],6,$count,1,0,'C',$fill); } $targetAndDesc = $drow['ops_target'] . " ". $drow['ops_target_desc']; $pdf->Cell($width_cell[1],6,getAutohubKRAName($kraID)[0],1,0,'L',$fill); $pdf->Cell($width_cell[2],6,getAutohubKPIName($kpiID)[0],1,0,'L',$fill); $pdf->Cell($width_cell[3],6,$kraAVGWP,1,0,'C',$fill); $pdf->Cell($width_cell[4],6,$drow['ops_benchmark'],1,0,'C',$fill); $pdf->Cell($width_cell[5],6,$targetAndDesc,1,0,'C',$fill); $pdf->Cell($width_cell[6],6,$drow['ops_strategy'],1,0,'C',$fill); $pdf->Cell($width_cell[7],6,$drow['ops_timeline_to'],1,0,'C',$fill); $pdf->Cell($width_cell[8],6,$drow['ops_responsibility'],1,0,'C',$fill); $fill =!$fill; // use code to put alternate color between rows $kraTitle=$kraID; } $pdf->MultiCell(1,20,"",0,0,'L',false); //setup row padding (border, padding top,) $pdf->Cell(100,0,"_____________________________",0,1,'L',false); $pdf->Cell(100,8,$userFName.' / '. $prfDateX ,0,0,'L',false); } $pdf->Output('my_file.php','I'); ?>
| ver. 1.4 |
.
| PHP 7.3.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings