Linux host2.homegym.sg 4.18.0-553.8.1.el8_10.x86_64 #1 SMP Tue Jul 2 07:26:33 EDT 2024 x86_64
Apache
Server IP : 159.223.38.192 & Your IP : 159.223.38.192
Domains : 20 Domain
User : eachadea
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Lock Shell
Lock File++
Readme
/
home /
eachadea /
public_html /
maintenance /
pdf /
Delete
Unzip
Name
Size
Permission
Date
Action
font
[ DIR ]
drwxr-xr-x
2016-03-28 13:10
makefont
[ DIR ]
drwxr-xr-x
2016-03-28 13:10
createPDF.php
1.61
KB
-rw-r--r--
2016-03-31 12:38
error_log
154.73
KB
-rw-r--r--
2024-05-30 22:09
fpdf.css
1.31
KB
-rw-r--r--
2016-03-28 13:10
fpdf.php
48.88
KB
-rw-r--r--
2016-03-28 12:54
html2pdf.php
14.84
KB
-rw-r--r--
2019-10-15 12:31
Save
Rename
<?php /***************************/ /* Radek HULAN */ /* http://hulan.info/blog/ */ /***************************/ require('fpdf.php'); // Stream handler to read from global variables class VariableStream { private $varname; private $position; function stream_open($path, $mode, $options, &$opened_path) { $url = parse_url($path); $this->varname = $url['host']; if(!isset($GLOBALS[$this->varname])) { trigger_error('Global variable '.$this->varname.' does not exist', E_USER_WARNING); return false; } $this->position = 0; return true; } function stream_read($count) { $ret = substr($GLOBALS[$this->varname], $this->position, $count); $this->position += strlen($ret); return $ret; } function stream_eof() { return $this->position >= strlen($GLOBALS[$this->varname]); } function stream_tell() { return $this->position; } function stream_seek($offset, $whence) { if($whence==SEEK_SET) { $this->position = $offset; return true; } return false; } function stream_stat() { return array(); } } /************************************/ /* class PDF */ /************************************/ class PDF extends FPDF { var $fontList; var $issetfont; var $issetcolor; var $customer_id; var $maintenance_data_id; var $date; var $conn; var $remarks; var $updated_by; var $modified; var $acknowledgement; var $technician_sign; function PDF($orientation='P',$unit='mm',$format='A4', $customer_id, $maintenance_data_id, $conn) { $this->__construct($orientation,$unit,$format); // Register var stream protocol stream_wrapper_register('var', 'VariableStream'); $this->SetFont('Times','',12); $this->fontlist=array("Times","Courier"); $this->issetfont=false; $this->issetcolor=false; $this->AliasNbPages(); $this->customer_id = $customer_id; $this->maintenance_data_id = $maintenance_data_id; $this->conn = $conn; $sql = "SELECT * FROM maintenance_data where id=".$this->maintenance_data_id." and customer_id=".$this->customer_id; $result = mysqli_query($this->conn, $sql); while($row = mysqli_fetch_assoc($result)) { $this->remarks = $row['remarks']; $this->date = $row['created_date']; $this->modified = $row['modified_date']; $sql = "SELECT * FROM technician where id=".$row['updated_by']; $result2 = mysqli_query($this->conn, $sql); if ($result2) { while($row2 = mysqli_fetch_assoc($result2)) { $this->updated_by = $row2['name']; $this->technician_sign = $row2['signature']; } } $this->acknowledgement = $row['acknowledgement']; } } function MemImage($data, $x=null, $y=null, $w=0, $h=0, $link='') { // Display the image contained in $data $v = 'img'.md5($data); $GLOBALS[$v] = $data; $a = getimagesize('var://'.$v); if(!$a) $this->Error('Invalid image data'); $type = substr(strstr($a['mime'],'/'),1); $this->Image('var://'.$v, $x, $y, $w, $h, $type, $link); unset($GLOBALS[$v]); } function GDImage($im, $x=null, $y=null, $w=0, $h=0, $link='') { // Display the GD image associated with $im ob_start(); imagepng($im); $data = ob_get_clean(); $this->MemImage($data, $x, $y, $w, $h, $link); } function Footer() { //Go to 1.5 cm from bottom $this->SetY(-15); //Select Arial italic 8 $this->SetFont('Times','',8); //Print centered page number $this->SetTextColor(0,0,0); $this->Cell(0,4,'Page '.$this->PageNo().'/{nb}',0,1,'C'); $this->SetTextColor(0,0,180); } function Header() { //Select Arial bold 15 $this->SetTextColor(0,0,0); $this->SetFont('Times','',20); $this->Cell(0,10,"GYM AND FITNESS LLP"); $this->Ln(); $this->SetFont('Times','',12); $this->Cell(0,5,"11 Yishun Industrial St 1 #04-98", 0); $this->Ln(); $this->Cell(0,5,"Singapore 768089", 0); $this->Ln(); $this->Cell(0,5,"Tel: 67105787", 0); $this->Ln(); $this->Cell(0,5,"Email: contactus@homegym.sg", 0); $this->Ln(); $this->Cell(0,5,"Website: https://homegym.sg", 0); //Top table $this->SetXY(0, 10); $this->SetTextColor(53,93,144); $this->SetFont('Times','B',25); $this->Cell(0,10,"MAINTENANCE", 0, 1, "R"); $this->Ln(12); $header = array("Report #", "Date"); $data = array( array($this->maintenance_data_id, $this->date)); $this->FancyTable($header, $data); $this->SetY(50); } // Colored table function FancyTable($header, $data) { $align = 120; $this->SetX($align); // Colors, line width and bold font $this->SetFillColor(53,93,144); $this->SetTextColor(255); $this->SetDrawColor(0,0,0); $this->SetLineWidth(.2); $this->SetFont('','B', 12); // Header $w = array(40, 40); for($i=0;$i<count($header);$i++) $this->Cell($w[$i],7,$header[$i],1,0,'C',true); $this->Ln(); // Color and font restoration $this->SetFillColor(224,235,255); $this->SetTextColor(0); $this->SetFont(''); // Data $fill = false; foreach($data as $row) { $this->SetX($align); $this->Cell($w[0],6,$row[0],'LR',0,'C',$fill); $this->Cell($w[1],6,$row[1],'LR',0,'C',$fill); $this->Ln(); $fill = !$fill; } // Closing line $this->SetX($align); $this->Cell(array_sum($w),0,'','T'); } // Colored table function FancyTable2($header, $data) { $align = $this->GetX(); $cellHeight = 6; $this->SetX($align); // Colors, line width and bold font $this->SetFillColor(53,93,144); $this->SetTextColor(255); $this->SetDrawColor(0,0,0); $this->SetLineWidth(.2); $this->SetFont('','B', 12); // Header $w = array(90, 10, 90); //test max page height if ($this->GetPageHeight() < sizeof($data)+60+ $this->GetY()) $this->AddPage(); $this->Cell($w[0],$cellHeight+1,$header[0],"TBL",0,'L',true); $this->Cell($w[1],$cellHeight+1,"","TB",0,'C',true); $this->Cell($w[2],$cellHeight+1,$header[2],"TBR",0,'L',true); $this->Ln(); // Color and font restoration $this->SetFillColor(224,235,255); $this->SetTextColor(0); $this->SetFont('', '', 10); // Data $fill = false; foreach($data as $row) { $break1 = wordwrap($row[0], 60); $break1 = explode("\n", $break1); $break2 = wordwrap($row[2], 60); $break2 = explode("\n", $break2); if (sizeof($break1) > sizeof($break2)) $break = sizeof($break1); else $break = sizeof($break2); for ($x = 0; $x < $break; $x++) { $this->SetX($align); $this->Cell($w[0],$cellHeight," ".$break1[$x],'L',0,'L',$fill); $this->Cell($w[1],$cellHeight,"",0,0,'C',$fill); if ($x == 0) $this->print_checkbox( $this->GetX()-$w[1]/2, $this->GetY(), $cellHeight, $row[1] ? true : false ); $this->Cell($w[2],$cellHeight,$break2[$x],"R",0,'L',$fill); $this->Ln(); } $fill = !$fill; } // Closing line $this->SetX($align); $this->Cell(array_sum($w),0,'','T'); } function FancyTable3($header, $data, $width) { $align = $this->GetX(); $this->SetX($align); // Colors, line width and bold font $this->SetFillColor(53,93,144); $this->SetTextColor(255); $this->SetDrawColor(0,0,0); $this->SetLineWidth(.2); $this->SetFont('','B', 12); // Header //$w = array(90, 90, 10); for($i=0;$i<count($header);$i++) $this->Cell($width[$i],7,$header[$i],1,0,'C',true); $this->Ln(); // Color and font restoration $this->SetFillColor(224,235,255); $this->SetTextColor(0); $this->SetFont('', '', 10); // Data $fill = false; foreach($data as $row) { $this->SetX($align); for ($w = 0; $w < sizeof($width); $w++) $this->Cell($width[$w],6,$row[$w],'LR',0,'C',$fill); $this->Ln(); $fill = !$fill; } // Closing line $this->SetX($align); $this->Cell(array_sum($width),0,'','T'); } function FancyTable4($header, $data) { $align = $this->GetX(); $this->SetX($align); // Colors, line width and bold font $this->SetFillColor(53,93,144); $this->SetTextColor(255); $this->SetDrawColor(0,0,0); $this->SetLineWidth(.2); $this->SetFont('','B', 12); for($i=0;$i<count($header);$i++) $this->Cell(0,7,$header[$i],1,0,'C',true); $this->Ln(); // Color and font restoration $this->SetFillColor(224,235,255); $this->SetTextColor(0); $this->SetFont('', '', 10); // Data $fill = false; foreach($data as $row) { $this->SetX($align); $this->MultiCell(0,6,$row[0],'LR','L',$fill); $this->MultiCell(0,3," ",'LRB','L',$fill); $fill = !$fill; } } function WriteBody() { $sql = "SELECT * FROM customer WHERE id=".$this->customer_id; $result = mysqli_query($this->conn, $sql); while($row = mysqli_fetch_assoc($result)) { //To $this->SetFont('',"B"); $this->Cell(0,5,"To:", 0, 1); $this->SetFont(''); $this->Cell(0,5,$row['name'], 0, 1); $this->Cell(0,5,$row['address'], 0, 1); $this->Cell(0,5,'Attn: '.$row['contact_person'].' ('.$row['phone'].')', 0, 1); $this->Ln(8); } $sql = "SELECT * FROM equipment_data where maintenance_data_id=".$this->maintenance_data_id." order by id ASC"; $result = mysqli_query($this->conn, $sql); $countEquipment = 1; while($row = mysqli_fetch_assoc($result)) { $sql = "SELECT * FROM equipment_own WHERE id=".$row['equipment_own_id']." ORDER BY position ASC"; $result2 = mysqli_query($this->conn, $sql); while($row2 = mysqli_fetch_assoc($result2)) { $name = $row2['name']; $serial = $row2['serial']; } if ($serial) $name = $name." (#".$serial.")"; $summaryAll[] = array($countEquipment++, $name, $row['status']); } for ($a=0;$a<sizeof($summaryAll);$a+=2) { if ($summaryAll[$a+1] == NULL) $summaryAll[$a+1] = array('','',''); $summary[] = array_merge($summaryAll[$a], $summaryAll[$a+1]); } $this->Cell(0,6,"Technician's Report: ", 0, 1, "L"); if (count($summaryAll) > 14) { $this->FancyTable3(array(" ", "Equipment", "Status"," ", "Equipment", "Status"), $summary, array(10, 65, 20, 10, 65, 20)); } else { $this->FancyTable3(array(" ", "Equipment", "Status"), $summaryAll, array(10, 160, 20)); } $this->Ln(5); $this->FancyTable4(array("Special Notes and Instructions"), array(array($this->remarks))); $this->Ln(1); $this->Cell(0,6,"*For safety reason, equipment or facility concerned should not be used for urgent status proposed.", 0, 1, "L"); $this->Ln(5); /* $this->Cell(0,6,"Parts Replacment: ", 0, 1, "L"); $this->FancyTable3(array("Equipment Serial #", "Part changed/replaced", "Part #", "Qty"), array(array("", "", "", "")), array(50, 80, 50, 10)); $this->Ln(10); */ if ($this->GetPageHeight() > 80 + $this->GetY()) { $this->Ln(5); $this->SetFontSize(12); $this->Cell(0,6,"More details are covered in the following page(s).", 0, 1, "L"); $this->SetFontSize(10); $this->Ln(5); } if ($this->GetPageHeight() < 65+ $this->GetY()) $this->AddPage(); else $this->SetY(230); $newY = $this->GetY(); $this->Cell(30,6,"Techician name: ", 0, 0, "L"); $this->Cell(45,6,$this->updated_by, "B", 1); $this->Cell(30,6,"Date and Time: ", 0, 0, "L"); $this->Cell(45,6,$this->modified, "B", 0); $this->SetY($newY); $this->SetX(120); $this->SetFontSize(10); if ($this->acknowledgement != NULL && $this->acknowledgement != '') $this->MultiCell(80,6,"I/ We acknowledge that the above service has been promptly completed to my/ our full satisfaction.", 0, "L"); else $this->Ln(12); $this->SetFontSize(12); $this->Ln(20); if ($this->acknowledgement != NULL && $this->acknowledgement != '') { // Load an image into a variable $image = explode(",", $this->acknowledgement); // Output it $logo = base64_decode($image[1]); $this->MemImage($logo, 150, $this->GetY()-18, 30, 20); } if ($this->technician_sign != NULL && $this->technician_sign != '') { // Load an image into a variable $image = explode(",", $this->technician_sign); // Output it $logo = base64_decode($image[1]); $this->MemImage($logo, 20, $this->GetY()-18, 30, 20); } $this->Cell(60,6,"", "B", 0); $this->SetX(130); if ($this->acknowledgement != NULL && $this->acknowledgement != '') $this->Cell(60,6,"", "B", 1); else $this->Ln(); $this->Cell(60,6,"Signature", 0, 0, "C"); $this->SetX(130); if ($this->acknowledgement != NULL && $this->acknowledgement != '') $this->Cell(60,6,"Signature", 0, 0, "C"); $this->AddPage(); $sql = "SELECT * FROM checklist_data where maintenance_data_id=".$this->maintenance_data_id." ORDER BY equipment_own_id ASC"; $result = mysqli_query($this->conn, $sql); $old_equipment_id = 0; $count=1; $increment = 1; if (mysqli_num_rows($result) > 0) { while($row = mysqli_fetch_assoc($result)) { if ($old_equipment_id != $row['equipment_own_id']) { if ($old_equipment_id != 0) { $this->FancyTable2($header, $data); $data = array(); $this->Ln(5); $increment = 1; } $old_equipment_id = $row['equipment_own_id']; $sql = "SELECT * FROM equipment_own where id=".$row['equipment_own_id']; $result2 = mysqli_query($this->conn, $sql); while($row2 = mysqli_fetch_assoc($result2)) { $equipment_name = $row2['name']; $serial = $row2['serial']; } //$this->Cell(0,5,$equipment_name.' (Serial: '.$serial.')', 0, 1); if ($serial) $equipment_name = $equipment_name.' (#'.$serial.')'; $header = array($count++.') '.$equipment_name, "", ''); } //$this->Cell(0,5,$increment++.") ".$row['value'], 0, 1); $data[] = array($row['value'], $row['checked'], $row['remarks']); } $this->FancyTable2($header, $data); } $this->AddPage(); $this->Ln(10); $this->SetFont('','B', 15); $this->Cell(0,15,"SCOPE AND LIMITATION", 0, 0, "C"); $this->SetFont('','', 15); $this->Ln(20); $this->MultiCell(0,7,"1. During the maintenance, we will try to identify common issues, but due to limited time allocated per equipment, we are not able to do extensive testing. Thus if there is any issue before the maintenance, it is recommended to update us so that we can try to reproduce the problem and further diagnose it.", 0, 1); $this->Ln(10); $this->MultiCell(0,7,"2. Repair works are not performed during general preventive maintenance. A follow-up appointment will be required and the estimated costing will also be advised if the equipment is not covered under warranty.", 0, 1); } function print_checkbox( $x, $y, $size, $checked= true ) { $size /= 2; $x = $x - $size/2; $y = $y + $size/2; $this->Rect( $x, $y, $size, $size ); if ( $checked) { $this->Line( $x + $size*0.125, $y + $size*0.5, $x + $size*0.375, $y + $size*0.875); $this->Line( $x + $size*0.375, $y + $size*0.875, $x + $size*0.875, $y + $size*0.2); } } } // class PDF ?>