-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathorderNow.php
243 lines (201 loc) · 6.14 KB
/
orderNow.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
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
<?php
require_once('session.php');
require_once('newOrder.php');
require_once('ordered.php');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>PC Solutions - Order Now</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="utf-8">
<meta name="description" content="Lakeside Books">
<meta name="keywords" content="books, lakeside, cork, shop, online">
<link rel="shortcut icon" href="favicon.ico">
<link rel="stylesheet" href="css/reset.css">
<link rel="stylesheet" href="css/global.css">
<link rel="stylesheet" href="css/menu.css" />
<script src="js/modernizr.custom.js"></script>
<style>@import url(http://fonts.googleapis.com/css?family=Raleway:400,700);
table {
width: 100%;
}
table th {
padding: 10px;
background-color: #48577D;
color: #fff;
text-align: left;
}
table td {
padding: 5px;
}
table tr {
background-color: #d3dcf2;
}
</style>
</head>
<body id="top" style="font-size: 62.5%;">
<!-- BEGIN Header -->
<header id="header-wrapper">
<div id="top-bar" class="clearfix">
<div id="top-bar-inner">
<!-- Search Bar by http://www.paulund.co.uk/create-a-slide-out-search-box -->
<div class="search_form">
<form action="customer-search.php" method="post">
<input type="text" name="search_box" id="search_box" placeholder="Search for a customer...">
</form>
</div>
<!-- Search Bar by http://www.paulund.co.uk/create-a-slide-out-search-box -->
<div class="topbar-right clearfix">
<ul class="clearfix">
<li class="login-user">
<a title="<?php echo $login_session; ?>" href="#">
<span class="icon"><i aria-hidden="true" class="icon-user"></i></span>
<?php echo $login_session; ?>
</a>
</li>
</ul>
<div class="log-out">
<!-- <p><a title="Sign out" href="#">Sign out</a></p> -->
<p>
<a href="logout.php" title="Sign out">
<span>Sign-out</span>
<span class="icon">
<i aria-hidden="true" class="icon-exit"></i>
</span>
</a>
</p>
</div>
</div>
</div>
</div>
<div class="full-shadow"></div>
</header>
<!-- END Header -->
<div class="main clearfix">
<!-- START OF NAVIGATION -->
<nav id="menu" class="nav">
<ul>
<li>
<a href="dashboard.php">
<span class="icon">
<i aria-hidden="true" class="icon-home"></i>
</span>
<span>Home</span>
</a>
</li>
<li>
<a href="customer.php">
<span class="icon">
<i aria-hidden="true" class="icon-users"></i>
</span>
<span>Customers</span>
</a>
</li>
<li>
<a href="repairs.php">
<span class="icon">
<i aria-hidden="true" class="icon-hammer"></i>
</span>
<span>Repairs</span>
</a>
</li>
<li class="active">
<a href="estimates.php">
<span class="icon">
<i aria-hidden="true" class="icon-sigma"></i>
</span>
<span>Estimates</span>
</a>
</li>
<li>
<a href="inventory.php">
<span class="icon">
<i aria-hidden="true" class="icon-barcode"></i>
</span>
<span>Inventory</span>
</a>
</li>
<li>
<a href="account.php">
<span class="icon">
<i aria-hidden="true" class="icon-user"></i>
</span>
<span>Account</span>
</a>
</li>
</ul>
</nav>
<!-- END OF NAVIGATION -->
<!--Breadcrumb -->
<div class="bread dash">
<div class="submenu">
<ul>
<li><a href="##" onClick="history.go(-1); return false;">Go Back</a></li>
</ul>
</div>
<h3><a style="text-decoration: none;" href="estimatse.php">Estimates</a></h3> <span style="font-size: 1.2em; font-weight: 500">\ Order Now</span>
</div>
<!--Breadcrumb -->
<div class="floats">
<div class="full-widget">
<span id="msg">
<?php
echo $success;
echo $error;
?>
</span>
<form class="form-4" action="" method="post">
Repair ID: <input type="text" name="rep_id" placeholder="Repair ID Isn't valid, redirecting..." value="<?php echo $repair; ?>" readonly>
<table>
<tr>
<th>Stock#</th>
<th>Quantity</th>
<th>Price</th>
<th>Items Price</th>
</tr>
<?php
$conn= mysqli_connect("localhost", "root", "", "compsys");
$sql="SELECT * FROM stock WHERE stock_id IN (";
foreach($_SESSION['cart'] as $id => $value) {
$sql .= $id .",";
}
//$sql[37] = ' ';
$sql=substr($sql, 0, -1) .") ORDER BY stock_id ASC";
//$query=mysql_query($sql);
$res = mysqli_query($conn, $sql);
if (!$res) {
printf("Nothing in the basket: %s\n", "Go back");
exit();
}
$totalprice=0;
while($row = mysqli_fetch_array($res)){
$subtotal = $_SESSION['cart'][$row['stock_id']]['quantity']*$row['price'];
$totalprice += $subtotal;
?>
<tr>
<td><?php echo $row['description'] ?></td>
<td><input type="text" name="quantity[<?php echo $row['stock_id'] ?>]" size="5" value="<?php echo $_SESSION['cart'][$row['stock_id']]['quantity'] ?>" readonly /></td>
<td><?php echo '€' .$row['price'] ?></td>
<td><?php echo '€' .$_SESSION['cart'][$row['stock_id']]['quantity']*$row['price'] ?></td>
</tr>
<?php
}
?>
<tr>
<td colspan="4"><h4>Total Price: <?php echo '€'. $totalprice ?></h3></td>
</tr>
</table>
<input type="submit" name="order" value="Confirm Order">
</form>
</div>
</div>
<!-- END OF FLOATS-->
</div>
<!-- END OF MAIN-->
<!-- SCRIPT FOR THE MENU -->
<script src="js/menu.js"></script>
<!-- SCRIPT FOR THE MENU -->
</body>
</html>