File manager - Edit - /home/autoph/public_html/pms_v1/pdfViewer/pcp_employeeview.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'); } */ } $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=============================================================================== //END OF CHECKPOINT=============================================================================== //==========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']; } } $periodText ="PERFORMANCE COMMITMENT PLAN FOR (" . $period. " Semester of ". $pcpYear .")"; } $getRPTName = "SELECT * FROM pms_employee_data WHERE id = $employeeID LIMIT 1"; $getMyNameRPT = mysqli_query($conn,$getRPTName); while($nRow = mysqli_fetch_array($getMyNameRPT)){ $fname=$nRow['first_name']; $lname=$nRow['last_name']; $employeeNameRPT = $fname ." ". $lname; } $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 pcp_headers.`approved_head_a`, pcp_headers.`approved_head_a_date`, pcp_headers.`approved_head_b`, pcp_headers.`approved_head_b_date`, pcp_headers.`id`, pcp_headers.`employee_id`, pcp_headers.`year`, pcp_headers.`deleted`, pcp_employee_data.`pcp_header_id`, pcp_employee_data.`pcp_kra_id`, pcp_employee_data.`pcp_kpi_id`, pcp_employee_data.`pcp_weight`, pcp_employee_data.`pcp_target`, pcp_employee_data.`pcp_timeline`, pcp_employee_data.`deleted` FROM pcp_employee_data JOIN pcp_headers ON pcp_headers.`id`=pcp_employee_data.`pcp_header_id` WHERE pcp_headers.`deleted`=0 AND pcp_employee_data.`deleted`=0 AND pcp_headers.`id`='$pcpIDpdf'"; $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,90,20,85,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,$employeeNameRPT,0,0,'L',true); $pdf->SetFont('Arial','',8); $pdf->MultiCell(0,5,$periodText,0,0,'L',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],$height_cell,'NO',1,0,'C',true); $pdf->Cell($width_cell[1],$height_cell,'KRA NAME',1,0,'L',true); $pdf->Cell($width_cell[2],$height_cell,'WEIGHT',1,0,'C',true); $pdf->Cell($width_cell[3],$height_cell,'KPI NAME',1,0,'L',true); $pdf->Cell($width_cell[4],$height_cell,'WEIGHT',1,0,'C',true); $pdf->Cell($width_cell[5],$height_cell,'TARGET',1,0,'C',true); $pdf->Cell($width_cell[6],$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){ while($drow = mysqli_fetch_array($getData)){ $immediateHead = getEmployeeEmpInformationB($drow['approved_head_a'])[3]. " " .getEmployeeEmpInformationB($drow['approved_head_a'])[2]. " ".$drow['approved_head_a_date']; $NextHigherHead = getEmployeeEmpInformationB($drow['approved_head_b'])[3]. " " .getEmployeeEmpInformationB($drow['approved_head_b'])[2]. " ".$drow['approved_head_b_date']; $pcpID= $drow['id']; $kraID = $drow['pcp_kra_id']; $kpiID = $drow['pcp_kpi_id']; $As=0; $Bs=0; $weightedPoints=0; $wp=0; $wpoint=0; $myActualData=0; $kraAvgScore=''; $kraAvgScoreX=''; $kraWeightPrint=''; $kraWeight =getEmployeeKRAName($kraID)[1]; $kraExWeight = explode("%",$kraWeight); //$kraWeightPercentage = $kraExWeight[0] / 100; $kraAVGWP = ''; $pdf->MultiCell(0,$height_cell,"",0,'P',false); //setup row padding if($kraTitle == $kraID){ $pdf->Cell($width_cell[0],$height_cell,"",1,0,'C',$fill); $pdf->Cell($width_cell[1],$height_cell,"",1,0,'L',$fill); $pdf->Cell($width_cell[2],$height_cell,"",1,0,'C',$fill); $empKraWeight = ""; }else{ $empKraWeight = getEmployeeKRAName($kraID)[1]; $count = $count + 1; $pdf->Cell($width_cell[0],$height_cell,$count,1,0,'C',$fill); $pdf->Cell($width_cell[1],$height_cell,strtoupper(getEmployeeKRAName($kraID)[0]),1,0,'L',$fill); $pdf->Cell($width_cell[2],$height_cell,$empKraWeight,1,0,'C',$fill); } $pdf->Cell($width_cell[3],$height_cell,strtoupper(getEmployeeKPIName($kpiID)[0]),1,0,'L',$fill); $pdf->Cell($width_cell[4],$height_cell,getEmployeeKPIName($kpiID)[1],1,0,'C',$fill); $pdf->Cell($width_cell[5],$height_cell,$drow['pcp_target'],1,0,'C',$fill); $pdf->Cell($width_cell[6],$height_cell,$drow['pcp_timeline'],1,0,'C',$fill); $fill =!$fill; // use code to put alternate color between rows $kraTitle=$kraID; } $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,$immediateHead,'B,B',1,'L',false); $pdf->Cell(100,6,"Immediate Head (date/time)",0,'L',false); $pdf->MultiCell(1,12,"",0,'L',false); //setup row padding (border, padding top,) $pdf->Cell(45,6,$NextHigherHead,'B,B',1,'L',false); $pdf->Cell(100,6,"Next Higher Head (date/time)",0,'L',false); } $pdf->Output('my_file.php','I'); ?>
| ver. 1.4 |
.
| PHP 7.3.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings