-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrough
More file actions
449 lines (401 loc) · 15.5 KB
/
Copy pathrough
File metadata and controls
449 lines (401 loc) · 15.5 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
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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
<?php include('includes/header.php'); ?>
<style>
/* Print-specific styles */
@media print {
.no-print {
display: none !important;
}
.receipt-container {
margin: 0 !important;
padding: 0 !important;
box-shadow: none !important;
}
body {
background: white !important;
}
}
/* Receipt styling */
.receipt-container {
max-width: 800px;
margin: 20px auto;
background: white;
box-shadow: 0 0 20px rgba(0,0,0,0.1);
border-radius: 8px;
overflow: hidden;
}
.receipt-header {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 30px;
text-align: center;
}
.company-name {
font-size: 28px;
font-weight: bold;
margin-bottom: 5px;
text-transform: uppercase;
letter-spacing: 2px;
}
.company-address {
font-size: 14px;
opacity: 0.9;
margin-bottom: 5px;
}
.receipt-body {
padding: 30px;
}
.receipt-info {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 30px;
margin-bottom: 30px;
padding-bottom: 20px;
border-bottom: 2px dashed #e0e0e0;
}
.info-section h3 {
color: #333;
font-size: 18px;
font-weight: 600;
margin-bottom: 15px;
text-transform: uppercase;
letter-spacing: 1px;
}
.info-item {
margin-bottom: 8px;
font-size: 14px;
color: #555;
}
.info-label {
font-weight: 600;
color: #333;
}
.products-table {
width: 100%;
border-collapse: collapse;
margin-bottom: 30px;
}
.products-table th {
background: #f8f9fa;
color: #333;
font-weight: 600;
text-align: left;
padding: 15px 10px;
border-bottom: 2px solid #dee2e6;
text-transform: uppercase;
font-size: 12px;
letter-spacing: 1px;
}
.products-table td {
padding: 12px 10px;
border-bottom: 1px solid #e9ecef;
font-size: 14px;
}
.products-table tr:hover {
background-color: #f8f9fa;
}
.total-section {
margin-top: 30px;
padding-top: 20px;
border-top: 2px dashed #e0e0e0;
}
.total-row {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 10px;
font-size: 16px;
}
.total-label {
font-weight: 600;
color: #333;
}
.total-amount {
font-weight: bold;
color: #333;
}
.grand-total {
font-size: 20px;
color: #28a745;
border-top: 2px solid #28a745;
padding-top: 10px;
margin-top: 10px;
}
.payment-mode {
margin-top: 20px;
padding: 15px;
background: #f8f9fa;
border-radius: 5px;
text-align: center;
font-weight: 600;
color: #333;
}
.barcode-section {
text-align: center;
margin-top: 30px;
padding-top: 20px;
border-top: 2px dashed #e0e0e0;
}
.barcode-container {
display: flex;
justify-content: space-around;
align-items: center;
margin-top: 15px;
}
.barcode-item {
text-align: center;
}
.barcode-item img {
max-width: 200px;
height: auto;
}
.barcode-text {
margin-top: 5px;
font-size: 12px;
color: #666;
font-weight: 600;
}
.action-buttons {
text-align: center;
margin-top: 30px;
padding: 20px;
background: #f8f9fa;
border-radius: 8px;
}
.btn-print {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
border: none;
padding: 12px 30px;
border-radius: 25px;
font-weight: 600;
margin: 0 10px;
transition: all 0.3s ease;
}
.btn-print:hover {
transform: translateY(-2px);
box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}
.btn-download {
background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
color: white;
border: none;
padding: 12px 30px;
border-radius: 25px;
font-weight: 600;
margin: 0 10px;
transition: all 0.3s ease;
}
.btn-download:hover {
transform: translateY(-2px);
box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}
.btn-back {
background: #dc3545;
color: white;
border: none;
padding: 12px 30px;
border-radius: 25px;
font-weight: 600;
margin: 0 10px;
transition: all 0.3s ease;
}
.btn-back:hover {
background: #c82333;
transform: translateY(-2px);
box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}
.error-message {
text-align: center;
padding: 50px;
color: #dc3545;
}
.error-message h5 {
margin-bottom: 20px;
font-size: 20px;
}
</style>
<div class="container-fluid px-4">
<div class="receipt-container">
<div id="myBillingArea">
<?php
if (isset($_GET['track'])) {
$trackingNo = validate($_GET['track']);
if ($trackingNo == '') {
?>
<div class="error-message">
<h5>⚠️ Please Provide Tracking Number</h5>
<div>
<a href="orders-vendor.php" class="btn btn-back">Go Back To Orders</a>
</div>
</div>
<?php
} else {
$orderQuery = "SELECT o.*, v.* FROM vendor_orders o, vendors v
WHERE v.id=o.vendor_id AND tracking_no='$trackingNo' LIMIT 1";
$orderQueryRes = mysqli_query($conn, $orderQuery);
if (!$orderQueryRes) {
echo "<div class='error-message'><h5>❌ Something Went Wrong</h5></div>";
return false;
}
if (mysqli_num_rows($orderQueryRes) > 0) {
$orderDataRow = mysqli_fetch_assoc($orderQueryRes);
?>
<!-- Receipt Header -->
<div class="receipt-header">
<div class="company-name">Bitquark Technologies</div>
<div class="company-address">3015 5 Avenue NE Calgary AB T2A 6C9</div>
<div class="company-address">Bitquark Technologies Pvt. Ltd.</div>
</div>
<!-- Receipt Body -->
<div class="receipt-body">
<!-- Customer and Invoice Information -->
<div class="receipt-info">
<div class="info-section">
<h3>Customer Details</h3>
<div class="info-item">
<span class="info-label">Customer Name:</span> <?= $orderDataRow['name'] ?>
</div>
<div class="info-item">
<span class="info-label">Phone Number:</span> <?= $orderDataRow['phone'] ?>
</div>
<div class="info-item">
<span class="info-label">Email Address:</span> <?= $orderDataRow['email'] ?>
</div>
</div>
<div class="info-section">
<h3>Invoice Details</h3>
<div class="info-item">
<span class="info-label">Invoice No:</span> <?= $orderDataRow['invoice_no']; ?>
</div>
<div class="info-item">
<span class="info-label">Tracking No:</span> <?= $orderDataRow['tracking_no']; ?>
</div>
<div class="info-item">
<span class="info-label">Invoice Date:</span> <?= date('d M Y'); ?>
</div>
<div class="info-item">
<span class="info-label">Address:</span> 3015 5 Ave NE, Calgary, AB T2A 6K4, Canada
</div>
</div>
</div>
<?php
$orderItemQuery = "SELECT oi.quantity as orderItemQuantity, oi.price as orderItemPrice, o.*, oi.*, p.*
FROM vendor_orders o, vendor_order_items oi, products p
WHERE oi.order_id = o.id AND p.id = oi.product_id AND o.tracking_no = '$trackingNo'";
$orderItemQueryRes = mysqli_query($conn, $orderItemQuery);
if ($orderItemQueryRes && mysqli_num_rows($orderItemQueryRes) > 0) {
$totalAmount = 0;
$totalTax = 0;
$grandTotal = 0;
?>
<!-- Products Table -->
<table class="products-table">
<thead>
<tr>
<th width="5%">ID</th>
<th>Product Name</th>
<th>Barcode</th>
<th width="10%">Price</th>
<th width="10%">Quantity</th>
<th width="15%">Total Price</th>
</tr>
</thead>
<tbody>
<?php
$i = 1;
foreach ($orderItemQueryRes as $key => $row) :
$itemTotal = $row['orderItemPrice'] * $row['orderItemQuantity'];
$totalAmount += $itemTotal;
?>
<tr>
<td><?= $i++; ?></td>
<td><?= $row['name']; ?></td>
<td><?= $row['barcode']; ?></td>
<td>$<?= number_format($row['orderItemPrice'], 2) ?></td>
<td><?= $row['orderItemQuantity'] ?></td>
<td class="fw-bold">$<?= number_format($itemTotal, 2) ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<!-- Totals Section -->
<div class="total-section">
<div class="total-row">
<span class="total-label">Total Amount:</span>
<span class="total-amount">$<?= number_format($totalAmount, 2) ?></span>
</div>
<div class="total-row">
<span class="total-label">Total Tax:</span>
<span class="total-amount">$<?= number_format($row['gst_amount'], 2) ?></span>
</div>
<div class="total-row grand-total">
<span class="total-label">Grand Total:</span>
<span class="total-amount">$<?= number_format($row['grand_total'], 2) ?></span>
</div>
</div>
<!-- Payment Mode -->
<div class="payment-mode">
Payment Mode: <?= $row['payment_mode']; ?>
</div>
<!-- Barcode Section -->
<div class="barcode-section">
<div class="barcode-container">
<div class="barcode-item">
<img src="https://barcode.tec-it.com/barcode.ashx?data=<?= $orderDataRow['invoice_no'] ?>&code=Code128" alt="Invoice Barcode" />
<div class="barcode-text"><?= $orderDataRow['invoice_no'] ?></div>
</div>
<div class="barcode-item">
<img src="https://barcode.tec-it.com/barcode.ashx?data=<?= $orderDataRow['tracking_no'] ?>&code=Code128" alt="Tracking Barcode" />
<div class="barcode-text"><?= $orderDataRow['tracking_no'] ?></div>
</div>
</div>
</div>
<?php
} else {
echo "<div class='error-message'><h5>❌ No Order Items Found</h5></div>";
return false;
}
?>
</div>
<?php
} else {
echo "<div class='error-message'><h5>❌ No Data Found</h5></div>";
return false;
}
}
} else {
?>
<div class="error-message">
<h5>⚠️ No Tracking Number Parameter Found</h5>
<div>
<a href="orders-vendor.php" class="btn btn-back">Go Back To Orders</a>
</div>
</div>
<?php
}
?>
</div>
<!-- Action Buttons -->
<div class="action-buttons no-print">
<button class="btn-print" onclick="printMyBillingArea()">
<i class="fas fa-print"></i> Print Receipt
</button>
<button class="btn-download" onclick="downloadPDF('<?= isset($orderDataRow) ? $orderDataRow['invoice_no'] : '' ?>')">
<i class="fas fa-download"></i> Download PDF
</button>
<a href="orders-vendor.php" class="btn btn-back">
<i class="fas fa-arrow-left"></i> Back to Orders
</a>
</div>
</div>
</div>
<script>
function printMyBillingArea() {
window.print();
}
function downloadPDF(invoiceNo) {
// Implementation for PDF download
alert('PDF download functionality will be implemented here for invoice: ' + invoiceNo);
}
</script>
<?php include('includes/footer.php') ?>