-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinvoice.php
204 lines (163 loc) · 9.64 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
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Invoice | Gimmck</title>
<link rel="stylesheet" href="bootstrap.css" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css">
<link rel="stylesheet" href="style.css" />
<link rel="icon" href="resources/logos/logo.gif" />
</head>
<body class="mt-2" style="background-color: #f7f7ff;">
<div class="container-fluid">
<div class="row">
<?php
if (isset($_SESSION["u"])) {
$umail = $_SESSION["u"]["email"];
$oid = $_GET["id"];
?>
<div class="col-12">
<hr />
</div>
<div class="col-12 btn-toolbar justify-content-end">
<button class="btn btn-dark me-2"><i class="bi bi-printer-fill" onclick="printInvoice();"></i> Print</button>
<button class="btn btn-danger me-2"><i class="bi bi-filetype-pdf"></i> Export as PDF</button>
</div>
<div class="col-12">
<hr />
</div>
<div class="col-12" id="page">
<div class="row">
<div class="col-6">
<div class="ms-5 invoiceHeaderImage"></div>
</div>
<div class="col-6">
<div class="row">
<div class="col-12 text-primary text-decoration-underline text-end">
<h2>Gimmck</h2>
</div>
<div class="col-12 fw-bold text-end">
<span>Maradana, Colombo 10, Sri Lanka.</span><br />
<span>+94112 555448</span><br />
<span>[email protected]</span>
</div>
</div>
</div>
<div class="col-12">
<hr class="border border-1 border-primary" />
</div>
<div class="col-12 mb-4">
<div class="row">
<?php
$address_rs = Database::search("SELECT * FROM `user_has_address` WHERE `user_email`='".$umail."'");
$address_data =$address_rs->fetch_assoc();
?>
<div class="col-6">
<h5 class="fw-bold">INVOICE TO :</h5>
<h2><?php echo $_SESSION["u"]["fname"]." ".$_SESSION["u"]["lname"]; ?></h2>
<span><?php echo $address_data["line1"]." ".$address_data["line2"]; ?></span><br />
<span><?php echo $umail; ?></span>
</div>
<?php
$invoice_rs = Database::search("SELECT * FROM `invoice` WHERE `order_id`='".$oid."'");
$invoice_data = $invoice_rs->fetch_assoc();
?>
<div class="col-6 text-end mt-4">
<h1 class="text-primary">INVOICE <?php echo $invoice_data["id"]; ?></h1>
<span class="fw-bold">Data & Time of Invoice : </span>
<span class="fw-bold"><?php echo $invoice_data["date"]; ?></span>
</div>
</div>
</div>
<div class="col-12">
<table class="table">
<thead>
<tr class="border border-1 border-secondary">
<th>#</th>
<th>Order ID & Product</th>
<th class="text-end">Unit Price</th>
<th class="text-end">Quantity</th>
<th class="text-end">Total</th>
</tr>
</thead>
<tbody>
<tr style="height: 72px;">
<td class="bg-primary text-white fs-3"><?php echo $invoice_data["id"]; ?></td>
<td>
<span class="fw-bold text-primary text-decoration-underline p-2"><?php echo $oid; ?></span><br />
<?php
$product_rs = Database::search("SELECT * FROM `product` WHERE `id`='".$invoice_data["product_id"]."'");
$product_data = $product_rs->fetch_assoc();
?>
<span class="fw-bold text-primary fs-3 p-2"><?php echo $product_data["title"]; ?></span>
</td>
<td class="fw-bold fs-6 text-end pt-3 bg-secondary text-white">Rs. <?php echo $product_data["price"]; ?> .00</td>
<td class="fw-bold fs-6 text-end pt-3"><?php echo $invoice_data["qty"]; ?></td>
<td class="fw-bold fs-6 text-end pt-3 bg-secondary text-white">Rs. <?php echo $invoice_data["total"]; ?> .00</td>
</tr>
</tbody>
<tfoot>
<?php
$city_rs = Database::search("SELECT * FROM `city` WHERE `id`='".$address_data["city_id"]."'");
$city_data = $city_rs->fetch_assoc();
$delivery = 0;
if($city_data["district_id"] == 4){
$delivery = $product_data["delivery_fee_colombo"];
}else{
$delivery = $product_data["delivery_fee_other"];
}
$t = $invoice_data["total"];
$g = $t - $delivery;
?>
<tr>
<td colspan="3" class="border-0"></td>
<td class="fs-5 text-end fw-bold">SUBTOTAL</td>
<td class="text-end">Rs. <?php echo $g; ?> .00</td>
</tr>
<tr>
<td colspan="3" class="border-0"></td>
<td class="fs-5 text-end fw-bold border-primary">Delivery Fee</td>
<td class="text-end border-primary">Rs. <?php echo $delivery; ?> .00</td>
</tr>
<tr>
<td colspan="3" class="border-0"></td>
<td class="fs-5 text-end fw-bold border-primary text-primary">GRAND TOTAL</td>
<td class="fs-5 text-end fw-bold border-primary text-primary">Rs. <?php echo $t; ?> .00</td>
</tr>
</tfoot>
</table>
</div>
<div class="col-4 text-center" style="margin-top: -100px;">
<span class="fs-1 fw-bold text-success">Thank You !</span>
</div>
<div class="col-12 mt-3 mb-3 border-0 border-start border-5 border-primary rounded" style="background-color: #e7f2ff;">
<div class="row">
<div class="col-12 mt-3 mb-3">
<label class="form-label fs-5 fw-bold">NOTICE : </label>
<br />
<label class="form-label fs-6">Purchased items can return befor 7 days of Delivery.</label>
</div>
</div>
</div>
<div class="col-12">
<hr class="border border-1 border-primary" />
</div>
<div class="col-12 text-center mb-3">
<label class="form-label fs-5 text-black-50 fw-bold">
Invoice was created on a computer and is valid without the Signature and Seal.
</label>
</div>
</div>
</div>
<?php
include "footer.php";
}
?>
<?php ?>
</div>
</div>
<script src="bootstrap.bundle.js"></script>
<script src="script.js"></script>
</body>
</html>