-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinvoice.php
60 lines (49 loc) · 2.19 KB
/
invoice.php
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
<?php
session_start();
include('connect.php');
require('vendor/autoload.php');
$order_id = $_GET['order_id'];
$html = ' <div class="myaccount-table table-responsive text-center">
<table class="table table-bordered">
<thead class="thead-light">
<tr>
<th>Order ID</th>
<th>Product ID</th>
<th>Quantity</th>
<th>Price</th>
<th>Pay mode</th>
<th>Order date</th>
</tr>
</thead>
<tbody>';
$query = "SELECT * from order_items WHERE email = '".$_SESSION['email']."' AND order_id = '".$order_id."'";
$grand_total = 0;
$result = mysqli_query($connect,$query);
while($row=mysqli_fetch_array($result)){
$productid = $row['product_id'];
$grand_total = $row['grand_total'];
$ccc = "SELECT name from products WHERE id='".$productid."'";
$ddd = mysqli_query($connect,$ccc);
while($row1 = mysqli_fetch_assoc($ddd)){
$proname = $row1["name"];
}
$html.='<tr>
<td>'.$row['order_id'].'</td>
<td>'.$proname.'</td>
<td>'.$row['qty'].'</td>
<td>'.$row['price']*$row['qty'].'</td>
<td>'.$row['pmode'].'</td>
<td>'.$row['order_on'].'</td>
</tr>';
}
$html.='<tr> <td>Grand total is:- '.$grand_total.'</td></tr>';
$html.='</tbody>
</table>
</div>';
$mpdf=new \Mpdf\Mpdf();
$mpdf->WriteHTML($html);
$file=time().'.pdf';
$mpdf->output($file,'D');
?>
<link rel="stylesheet" href="assets/css/bootstrap.min.css" />
<link rel="stylesheet" href="assets/css/style.min.css" />