-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgeneratePdf.php
More file actions
95 lines (77 loc) · 2.48 KB
/
generatePdf.php
File metadata and controls
95 lines (77 loc) · 2.48 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?php
require('fpdf.php');
session_start();
/*$conect = mysql_connect("localhost", "root", "");
mysql_select_db("db_name", $conect);
$sql = "INSERT INTO table_name (name, email, mobile, comment) VALUES ('".$_POST["name"]."', '".$_POST["email"]."', '".$_POST["mobile"]."', '".$_POST["comment"]."');";
mysql_query($sql);*/
if(empty($_SESSION["item_number"]))
{
header('Location:index.php');
exit();
}
class PDF extends FPDF
{
// Page header
function Header()
{
// Logo
$this->Image('pic.png',10,6,30);
// Arial bold 15
$this->SetFont('Arial','B',10);
// Move to the right
$this->Cell(80);
// Title
$this->Cell(60,10,'BUY2 Online Purchase Invoice','C');
// Line break
$this->Ln(20);
}
// Page footer
function Footer()
{
// Position at 1.5 cm from bottom
$this->SetFont('Arial','I',8);
$this->SetY(-45);
$this->Cell(0,10,'__________________________________________________________________________________________','C');
$this->SetY(-40);
$this->Cell(0,10,'This is a company generated invoice and doesnot need any verification These Online Shopping Terms and Conditions, the use of this website and any ','C');
$this->SetY(-35);
$this->Cell(0,10,'order or purchase made through the facilities of this website shall be governed by the laws of the province of the South Tyrol and the laws of the Italy ','C');
$this->SetY(-30);
$this->Cell(0,10,'applicable therein.','C');
// Arial italic 8
$this->SetFont('Arial','I',8);
// Page number
$this->SetY(-15);
$this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
}
}
// Instanciation of inherited class
$pdf = new PDF();
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetFont('Times','',12);
$it="Confirmed";
$name=$_SESSION["customer_new"][0];
$address=$_SESSION["customer_new"][2];
$email=$_SESSION["customer_new"][6];
$phone=$_SESSION["customer_new"][7];
$pdf->Cell(0,10,'',0,1);
$pdf->Cell(0,10,'Name : '.$name,0,1);
$pdf->Cell(0,10,'Email : '.$email,0,1);
$pdf->Cell(0,10,'Address : '.$address,0,1);
$pdf->Cell(0,10,'Phone : '.$phone,0,1);
foreach ($_SESSION["cart_item"] as $item)
{
$pdf->Cell(0,10,'',0,1);
$pdf->Cell(0,10,'Item : '.$item["name"],0,1);
$pdf->Cell(0,10,'Qauntity : '.$item["qauntity"],0,1);
$pdf->Cell(0,10,'Price/Item : '.$item["price"],0,1);
$pdf->Cell(0,10,'Total Bill : '.$item["bill"],0,1);
$pdf->Cell(0,10,'STATUS : '.$it,0,1);
}
$pdf->Output();
//unset($_SESSION["cart_item"]);
unset($_SESSION["customer_new"]);
unset($_SESSION["item_number"]);
?>