-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathW_pdf.php
More file actions
55 lines (51 loc) · 1.59 KB
/
Copy pathW_pdf.php
File metadata and controls
55 lines (51 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
//include connection file
include_once("W_connection.php");
include_once("W_fpdf.php");
class PDF extends FPDF
{
// Page header
function Header()
{
// Logo
//$this->Image('logo.png',10,-1,70);
$this->SetFont('Arial','B',12);
// Move to the right
$this->Cell(1);
// Title
$this->Cell(190,10,'Bill',1,0,'C');
// Line break
$this->Ln(20);
}
// Page footer
function Footer()
{
// Position at 1.5 cm from bottom
$this->SetY(-15);
// Arial italic 8
$this->SetFont('Arial','I',8);
// Page number
$this->Cell(10,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
}
}
$mysqli = new dbObj();
$connString = $mysqli->getConnstring();
$display_heading = array('user' => 'User', 'billid'=>'ID', 'orderid'=> 'OrderID', 'vehicletype'=> 'Vehical','goods'=> 'Goods', 'orderquantity'=>'OrderQuantity', 'rate' => 'Rate', 'amount' => 'Amount', 'taxes' => 'Taxes', 'totalamount' => 'TotalAmount');
$result = mysqli_query($connString, "SELECT user, billid, orderid, vehicletype, goods, orderquantity, rate, amount, taxes, totalamount FROM billinfo order by billid desc limit 1") or die("database error:". mysqli_error($connString));
$header = mysqli_query($connString, "SHOW columns FROM billinfo");
$pdf = new PDF();
//header
$pdf->AddPage();
//foter page
$pdf->AliasNbPages();
$pdf->SetFont('Arial','I',7);
foreach($header as $heading) {
$pdf->Cell(20,20,$display_heading[$heading['Field']],0,"center");
}
foreach($result as $row) {
$pdf->Ln();
foreach($row as $column)
$pdf->Cell(20,20,$column,0,0,'center');
}
$pdf->Output();
?>