-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathorders-summary.php
More file actions
188 lines (171 loc) · 11.4 KB
/
Copy pathorders-summary.php
File metadata and controls
188 lines (171 loc) · 11.4 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
<?php
include('user/includes1/header.php');
if (!isset($_SESSION['productItems'])) {
echo '<script> window.location.href = "orders-create.php"; </script>';
}
?>
<!-- Modals -->
<div class="modal fade" id="orderSuccessModal" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<!-- <div class="modal-header">
<h1 class="modal-title fs-5" id="exampleModalLabel">Order Placed Successfully</h1>
</div> -->
<div class="modal-body">
<div class="mb-3 p-4">
<h5 id="orderPlaceSuccessMessage"></h5>
</div>
<a href="orders.php" class="btn btn-secondary">Close</a>
<a href="terminal_payment.php" class="btn btn-info">Payment</a>
<button type="button" onclick="printMyBillingArea()" class="btn btn-danger">Print</button>
<button type="button" onclick="downloadPDF('<?= $_SESSION['invoice_no']; ?>')" class="btn btn-warning">Download PDF</button>
</div>
</div>
</div>
</div>
<div class="container-fluid px-4">
<div class="row">
<div class="col-md-12">
<div class="card mt-4">
<div class="card-header" style="display: flex; align-items: center; justify-content: space-between;">
<h4 class="mb-0" style="margin-right: 10px;">Order Summary</h4>
<a href="orders-create.php" class="btn btn-danger float-end">Back to create order</a>
</div>
<div class="card-body">
<!-- Billing Section -->
<div id="myBillingArea">
<?php
if (isset($_SESSION['cphone'])) {
$phone = validate($_SESSION['cphone']);
$invoiceNo = validate($_SESSION['invoice_no']);
$customerQuery = mysqli_query($conn, "SELECT * FROM customers WHERE phone='$phone' LIMIT 1");
if ($customerQuery) {
if (mysqli_num_rows($customerQuery) > 0) {
$cRowData = mysqli_fetch_assoc($customerQuery);
?>
<table style="width: 100%; margin-bottom: 20px;">
<tbody>
<tr>
<td style="text-align: center;" colspan="2">
<h4 style="font-size: 23px; line-height: 30px; margin: 2px; padding: 0;">Bitquark Technologies</h4>
<p style="font-size: 16px; line-height: 24px; margin: 2px; padding: 0;">3015 5 Avenue NE Calgary AB T2A 6C9</p>
<p style="font-size: 16px; line-height: 24px; margin: 2px; padding: 0;">Bitquark Technologies Pvt. Ltd.</p>
</td>
</tr>
<tr>
<td>
<h5 style="font-size: 20px; line-height: 30px; margin: 0px; padding: 0;">Customer Details</h5>
<p style="font-size: 14px; line-height: 20px; margin: 0; padding: 0;">Customer Name: <?= $cRowData['name'] ?> </p>
<p style="font-size: 14px; line-height: 20px; margin: 0; padding: 0;">Customer Phone No.: <?= $cRowData['phone'] ?> </p>
<p style="font-size: 14px; line-height: 20px; margin: 0; padding: 0;">Customer Email Id: <?= $cRowData['email'] ?> </p>
</td>
<td style="text-align: right;">
<h5 style="font-size: 20px; line-height: 30px; margin: 0px; padding: 0;">Invoice Details</h5>
<p style="font-size: 14px; line-height: 20px; margin: 0; padding: 0;">Invoice No: <?= $invoiceNo; ?> </p>
<p style="font-size: 14px; line-height: 20px; margin: 0; padding: 0;">Invoice Date: <?= date('d M Y'); ?> </p>
<p style="font-size: 14px; line-height: 20px; margin: 0; padding: 0;">Address: 3015 5 Ave NE, Calgary, AB T2A 6K4, Canada </p>
</td>
</tr>
</tbody>
</table>
<?php
} else {
echo "<h5>No Customer Found</h5>";
return;
}
}
}
?>
<?php
if (isset($_SESSION['productItems'])) {
$sessionProducts = $_SESSION['productItems'];
?>
<div class="table-responsive mb-3">
<table style="width: 100%;" cellpadding="5">
<thead>
<tr>
<th align="start" style="border-bottom: 1px solid #ccc;" width="5%">ID</th>
<th align="start" style="border-bottom: 1px solid #ccc;">Product Name</th>
<th align="start" style="border-bottom: 1px solid #ccc;">Barcode</th>
<th align="start" style="border-bottom: 1px solid #ccc;" width="10%">Price</th>
<th align="start" style="border-bottom: 1px solid #ccc;" width="10%">Quantity</th>
<th align="start" style="border-bottom: 1px solid #ccc;" width="15%">Total Price</th>
</tr>
</thead>
<tbody>
<?php
$i = 1;
$totalAmount = 0;
foreach ($sessionProducts as $key => $row) :
$totalAmount += $row['price'] * $row['quantity']
?>
<tr>
<td style="border-bottom: 1px solid #ccc"><?= $i++; ?></td>
<td style="border-bottom: 1px solid #ccc"><?= $row['name']; ?></td>
<td style="border-bottom: 1px solid #ccc"><?= $row['barcode']; ?></td>
<td style="border-bottom: 1px solid #ccc"><?= number_format($row['price'], 0) ?></td>
<td style="border-bottom: 1px solid #ccc"><?= $row['quantity'] ?></td>
<td style="border-bottom: 1px solid #ccc" class="fw-bold">
<?= number_format($row['price'] * $row['quantity'], 0) ?>
</td>
</tr>
<?php endforeach; ?>
<!-- <tr>
<td colspan="4" style="font-weight: bold; text-align:right;">Grand Total</td>
<td colspan="1" style="font-weight: bold;"><?= number_format($totalAmount, 0) ?></td>
</tr>
<tr>
<td colspan="4" style="font-weight: bold; text-align:right;">Grand Total</td>
<td colspan="1" style="font-weight: bold;"><?= number_format($totalAmount, 0) ?></td>
</tr>
<tr>
<td colspan="5">Payment Mode: <?= $_SESSION['payment_mode']; ?></td>
</tr> -->
<tr>
<td colspan="4" style="font-weight: bold; text-align:right;">Total Amount</td>
<td colspan="1" style="font-weight:bold; ">$<?= number_format($totalAmount, 0) ?></td>
</tr>
<?php
// Calculate GST (18%)
$provience = $cRowData['city'];
$taxRate = getTaxRateByProvince($provience);
$gstAmount = ($totalAmount * $taxRate) / 100;
$grandTotal = $totalAmount + $gstAmount;
?>
<tr>
<td colspan="4" style="font-weight: bold; text-align:right;">Total Tax</td>
<td colspan="1" style="font-weight: bold;">$<?= number_format($gstAmount, 0) ?></td>
</tr>
<tr>
<td colspan="4" style="font-weight: bold; text-align:right;">Grand Total</td>
<td colspan="1" style="font-weight: bold;">$<?= number_format($grandTotal, 0) ?></td>
</tr>
<tr>
<td colspan="5">Payment Mode: <?= $_SESSION['payment_mode']; ?></td>
</tr>
</tbody>
</table>
<?php
$order_id = $invoiceNo;;
echo "<img src='https://barcode.tec-it.com/barcode.ashx?data=$order_id&code=Code128' style='margin-right: 50px;' /> ";
?>
</div>
<?php
} else {
echo '<h5 class="text-center">No Items Added</h5>';
}
?>
</div>
<?php if (isset($_SESSION['productItems'])) : ?>
<div class="mt-4 text-end">
<button type="button" class="btn btn-primary px-4 mx-1" id="saveOrder">Save</button>
<button class="btn btn-info px-4 mx-1" onclick="printMyBillingArea()">Print</button>
<button class="btn btn-warning px-4 mx-1" onclick="downloadPDF('<?= $_SESSION['invoice_no']; ?>')">Download Pdf</button>
</div>
<?php endif; ?>
</div>
</div>
</div>
</div>
</div>
<?php include('user/includes1/footer.php') ?>