-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcartExplorer.php
More file actions
575 lines (483 loc) · 30.2 KB
/
cartExplorer.php
File metadata and controls
575 lines (483 loc) · 30.2 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
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<?php
session_start();
include './_functions.php';
include './_itemService.php';
?>
<html>
<head>
<title>SMS</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="" />
<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
<!-- Bootstrap Core CSS -->
<link href="css/bootstrap.min.css" rel='stylesheet' type='text/css' />
<!-- Custom CSS -->
<link href="css/style.css" rel='stylesheet' type='text/css' />
<!-- Graph CSS -->
<link href="css/font-awesome.css" rel="stylesheet">
<!-- jQuery -->
<!-- lined-icons -->
<link rel="stylesheet" href="css/icon-font.min.css" type='text/css' />
<!-- //lined-icons -->
<!--datatable-->
<script src="js/jquery-1.12.4.js" type="text/javascript"></script>
<script src="js/jquery.dataTables.min.js" type="text/javascript"></script>
<link href="css/jquery.dataTables.min.css" rel="stylesheet" type="text/css"/>
<script src="js/JsBarcode.ean-upc.min.js" type="text/javascript"></script>
<style type="text/css">
body,td,th {
font-family: Roboto, sans-serif;
font-size: small;
}
</style>
<script type="text/javascript">
$(document).ready(function () {
$('#example').DataTable();
JsBarcode(".barcode").init();
$("#chequeDiv").hide();
$("#c").click(function () {
$("#chequeDiv").hide();
});
$("#q").click(function () {
$("#chequeDiv").show();
});
});
</script>
<script>
function popupItemDetails(id) {
// window.open("itemView.php");
window.open("cartItemView.php?id=" + id, "_blank", "toolbar=yes,scrollbars=yes,resizable=yes,top=100,left=100,width=500,height=500");
}
</script>
<script>
</script>
</head>
<body>
<div class="page-container">
<!--/content-inner-->
<div class="left-content">
<div class="inner-content">
<!-- header-starts -->
<div class="header-section">
</div>
<!-- //header-ends -->
<div class="outter-wp" id="containerDiv">
<div class="row">
<table border="0" width='100%'>
<tbody>
<tr>
<td ><h3>Item Cart Explorer</h3><hr></td>
</tr>
</tbody>
</table>
</div>
<a href="cartEmplty.php">Empty Cart</a>
<hr>
<?php
if (!isset($_SESSION['cart_items'])) {
echo 'No Cart item found';
} else {
?>
<form action="salePaymant.php" method="post">
<table width="100%">
<tr><td width="50%" valign="top">
<table width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td><strong>Name</strong></td>
<td><strong>Qty</strong></td>
<td><strong>Price</strong></td>
<td><strong>Total</strong></td>
<td> </td>
</tr>
<?php
$itemArray = $_SESSION['cart_items'];
$itemArraylength = count($itemArray);
for ($x = 0; $x < $itemArraylength; $x++) {
?>
<tr>
<td><?php echo $itemArray[$x]["name"]; ?></td>
<td><?php echo $itemArray[$x]["qty"]; ?></td>
<td><?php echo $itemArray[$x]["price"]; ?></td>
<td><?php echo $itemArray[$x]["price"] * $itemArray[$x]["qty"]; ?></td>
<td><a href="cartItemRemove.php?id=<?php echo $x; ?>">remove</a></td>
</tr>
<?php
}
?>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td>Subtotal</td>
<td><?php
echo $_SESSION['total_price'];
?></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td></td>
<td> </td>
</tr>
</table>
</td><td width="50%" valign="top"><table width="100%" border="0">
<tr>
<td>Customer Name :
<input type="text" name="customerName" id="customerName" required></td>
</tr>
<tr>
<td><input type="radio" name="mode" id="c" value="CASH" checked>
Cash
<input type="radio" name="mode" id="q" value="CHEQUE">
Cheque</td>
</tr>
<tr>
<td><div id="chequeDiv">Cheque Details
<table width="100%" border="0">
<tr>
<td width="31%">Cheque No</td>
<td width="69%"><input type="text" name="chequeNo" id="chequeNo"></td>
</tr>
<tr>
<td>Realize Date</td>
<td><input type="date" name="realizeDate" /></td>
</tr>
<tr>
<td>Bank Branch </td>
<td><input type="text" name="bankBranch" id="bankBranch"></td>
</tr>
</table>
</div></td>
</tr>
</table>
<input type="submit" name="btnPayment" id="btnPayment" value="Proceed To Bill Payment">
</td></tr>
</table>
</form>
<?php
}
?>
<hr>
<div class="row">
<table width="100%" border="0">
<tr>
<td width="50%" valign="top">
<form name="form1" method="post" action="">
<table width="100%" border="0">
<tr>
<td width="50%" align="right"><strong>Category (Item Name)</strong></td>
<td width="50%"><select name="category_id" id="category_id">
<option value="">--select--</option>
<?php
// get category list
// Create connection
$conn = getDBConnection();
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$sql = "SELECT * FROM category";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
// output data of each row
while ($row = mysqli_fetch_assoc($result)) {
?>
<option value="<?php echo $row["id"] ?>"><?php echo $row["description"] ?></option>
<?php
}
} else {
echo "0 results";
}
?>
</select></td>
</tr>
<tr>
<td align="right"><strong>Brand</strong></td>
<td><select name="brand_id" id="brand_id">
<option value="">--select--</option>
<?php
// get category list
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$sql = "SELECT * FROM brand";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
// output data of each row
while ($row = mysqli_fetch_assoc($result)) {
?>
<option value="<?php echo $row["id"] ?>"><?php echo $row["description"] ?></option>
<?php
}
} else {
echo "0 results";
}
?>
</select></td>
</tr>
<tr>
<td align="right"><strong>Store Area</strong></td>
<td><select name="store_area" id="store_area">
<option value="">--select--</option>
<?php
// get category list
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$sql = "SELECT * FROM store_area";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
// output data of each row
while ($row = mysqli_fetch_assoc($result)) {
?>
<option value="<?php echo $row["id"] ?>"><?php echo $row["description"] ?></option>
<?php
}
} else {
echo "0 results";
}
?>
</select></td>
</tr>
<tr>
<td align="right"><strong>Model</strong></td>
<td><input type="text" name="model" id="model"></td>
</tr>
<tr>
<td align="right"> </td>
<td><input type="submit" name="btnSearchExplo" id="btnSearchExplo" value="Search"></td>
</tr>
</table>
</form>
<form method="post" action="">
<table width="100%" border="0">
<tr>
<td width="50%">Search By Barcode </td>
<td width="50%"><input type="text" name="bcn" id="bcn"></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="btnBCNSearch" id="btnBCNSearch" value="Search"></td>
</tr>
</table>
</form>
</td>
<td width="50%" valign="top">
<?php
if (isset($_GET['cartItemID'])) {
// echo 'ready';
$item_id = $_GET['cartItemID'];
$result = getItemByID($item_id);
if (mysqli_num_rows($result) > 0) {
// output data of each row
$index = 0;
while ($row = mysqli_fetch_assoc($result)) {
// echo "brand: ";
// echo $row["brand"] . " - model: " . $row["model"] . "<br>";
?>
<form action="cartAdd.php" method="post">
<table width="100%" border="0">
<tr>
<td width="50%" align="right"><strong>Category (Item Name)</strong></td>
<td width="50%"><?php echo $row["category"]; ?></td>
</tr>
<tr>
<td align="right"><strong>Brand</strong></td>
<td><?php echo $row["brand"]; ?></td>
</tr>
<tr>
<td align="right"><strong>Model</strong></td>
<td><?php echo $row["model"]; ?></td>
</tr>
<tr>
<td align="right"><strong>Selling Price</strong></td>
<td><?php echo $row["selling_price"]; ?></td>
</tr>
<tr>
<td align="right"><strong>Min Price</strong></td>
<td><?php echo $row["min_price"]; ?></td>
</tr>
<tr>
<td align="right"><strong>Store Area</strong></td>
<td><?php echo $row["description"]; ?></td>
</tr>
<tr>
<td align="right"><strong>Description </strong></td>
<td><?php echo $row["itmdescription"]; ?></td>
</tr>
<tr>
<td><svg class="barcode"
jsbarcode-format="ean13"
jsbarcode-value="<?php echo $row["bcn"]; ?>"
jsbarcode-textmargin="0"
jsbarcode-fontoptions="bold">
</svg></td>
<td><img src="item_images/<?php echo $row["image_path"]; ?>" width="150" height="150" /> </td>
</tr>
<tr>
<td colspan="2">
<table width="50%" border="0" align="center">
<tr><input type="hidden" name="id" value="<?php echo $_GET['id'] ?>" /> <input type="hidden" name="itemID" value="<?php echo $row["id"]; ?>" />
<td width="50%" align="right">Qty</td>
<td width="50%"><input type="number" required name="qty" max="<?php echo $row["stock"]; ?>" placeholder="Available <?php echo $row["stock"]; ?>" /></td>
</tr>
<tr>
<td align="right">Model Name </td>
<td><input type="text" name="itemName" value="<?php echo $row["model"]; ?>" readonly/></td>
</tr>
<tr>
<td align="right">Price</td>
<td><input type="number" name="price" value="<?php echo $row["selling_price"]; ?>" min="<?php echo $row["min_price"]; ?>" placeholder="Min Value <?php echo $row["min_price"]; ?>"/></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" value="Add To Bill " /></td>
</tr>
</table>
<br>
</td>
</tr>
</table>
</form>
<?php
$index++;
}
} else {
echo "0 results";
}
}
?>
</td>
</tr>
</table>
</div>
<div class="row">
<table id="example" class="display" cellspacing="0" width="100%" border="1">
<thead>
<tr>
<th>Item ID</th>
<th>Category (Item Name)</th>
<th>Brand</th>
<th>Model</th>
<th>Selling Price</th>
<th>Store Area</th>
<th></th>
</tr>
</thead>
<tfoot>
<tr>
<th>Item ID</th>
<th>Category (Item Name)</th>
<th>Brand</th>
<th>Model</th>
<th>Selling Price</th>
<th>Store Area</th>
<th></th>
</tr>
</tfoot>
<tbody>
<?php
if (isset($_POST['btnSearchExplo'])) {
$result2 = itemSearchExplorer();
} if (isset($_POST['btnBCNSearch'])) {
$result2 = itemBCNSearchExplorer();
} else {
$result2 = getAllItem();
}
if (mysqli_num_rows($result2) > 0) {
// output data of each row
$index = 0;
while ($row = mysqli_fetch_assoc($result2)) {
?>
<tr>
<td><?php echo $row['id']; ?></td>
<td><?php echo $row['category']; ?></td>
<td><?php echo $row['brand']; ?></td>
<td><?php echo $row['model']; ?></td>
<td><?php echo $row['selling_price']; ?></td>
<td><?php echo $row['description']; ?></td>
<td>
<?php
if ($row['stock'] > 0) {
?>
<a href="cartExplorer.php?id=<?php echo $index; ?>&cartItemID=<?php echo $row['id']; ?>" >Add to bill</a>
<?php
} else {
echo '<span class="bg-danger">Out of stock</span>';
}
?>
</td>
</tr>
<?php
$index++;
}
}
?>
</tbody>
</table>
</div>
<!--//outer-wp-->
</div>
<!--footer section start-->
<footer>
<p> © 2017 SMS. All Rights Reserved | Design for <a href="#" target="_blank">SMS </a></p>
</footer>
<!--footer section end-->
</div>
</div>
<!--//content-inner-->
<!--/sidebar-menu-->
<div class="sidebar-menu">
<header class="logo">
<a href="#" class="sidebar-icon"> <span class="fa fa-bars"></span> </a> <a href="index.html"> <span id="logo"> <h1> <img src="images/sms_logo.jpg" width="50" height="50" >SMS</h1></span>
<!--<img id="logo" src="" alt="Logo"/>-->
</a>
</header>
<div style="border-top:1px solid rgba(69, 74, 84, 0.7)"></div>
<!--/down-->
<div class="down">
<?php include './profile.php'; ?>
</div>
<!--//down-->
<div class="menu">
<?php include './menu.php'; ?>
</div>
</div>
<div class="clearfix"></div>
</div>
<script>
var toggle = true;
$(".sidebar-icon").click(function () {
if (toggle)
{
$(".page-container").addClass("sidebar-collapsed").removeClass("sidebar-collapsed-back");
$("#menu span").css({"position": "absolute"});
} else
{
$(".page-container").removeClass("sidebar-collapsed").addClass("sidebar-collapsed-back");
setTimeout(function () {
$("#menu span").css({"position": "relative"});
}, 400);
}
toggle = !toggle;
});
</script>
<!-- Bootstrap Core JavaScript -->
<script src="js/bootstrap.min.js"></script>
<style type="text/css">
#containerDiv{
margin-left: 20px;
}
</style>
</body>
</html>