-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharve.php
294 lines (252 loc) · 12.5 KB
/
arve.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
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
<?php
if (!isset($_SESSION)) {
session_start();
}
include("partials/connect.php");
//Kui kasutaja on sisse logitud, määra sessioonimuutuja
if (isset($_SESSION['email'])) {
$userLoggedIn = $_SESSION['email']; //Email of user
//Get user details from db
$user_details_query = mysqli_query($connect, "SELECT * FROM customers WHERE username='$userLoggedIn'");
$admin_query = mysqli_query($connect, "SELECT * FROM admins WHERE username='$userLoggedIn'");
//Kontrolli kas sisselogitud kasutaja on admin
if (mysqli_num_rows($admin_query) == 0) {
$user = mysqli_fetch_array($user_details_query); //return array from db (info about the logged in user)
} else {
$user = mysqli_fetch_array($admin_query); //return array from db (info about the logged in user)
}
}
if (isset($_GET['order_id'])) {
$order_id = $_GET['order_id'];
$shipping = 3;
//==============================
$sql = "SELECT O.*, C.username FROM Orders O INNER JOIN Customers C ON O.customer_id=C.id WHERE O.id='$order_id'";
$result = mysqli_query($connect, $sql);
$tellimus = mysqli_fetch_array($result); //Tellimuse rida
//==============================
$sql2 = "SELECT order_id, product_id, quantity, P.name AS prod_name, P.price, P.picture, P.description, C.name AS cat_name FROM order_details O INNER JOIN products P ON O.product_id=P.id INNER JOIN categories C ON category_id=C.id WHERE O.order_id=$order_id";
$result2 = mysqli_query($connect, $sql2);
// $tooteandmed = mysqli_fetch_array($result2); //Tooteandmed
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Täname ostu eest! - Tellimuse #<?php echo $order_id; ?> andmed</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!--===============================================================================================-->
<link rel="icon" type="image/png" href="images/icons/favicon.png" />
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="assets/bootstrap/css/bootstrap.min.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="fonts/font-awesome-4.7.0/css/font-awesome.min.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="fonts/iconic/css/material-design-iconic-font.min.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="fonts/linearicons-v1.0.0/icon-font.min.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="assets/animate/animate.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="assets/css-hamburgers/hamburgers.min.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="assets/animsition/css/animsition.min.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="assets/select2/select2.min.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="assets/daterangepicker/daterangepicker.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="assets/slick/slick.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="assets/MagnificPopup/magnific-popup.css">
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="assets/perfect-scrollbar/perfect-scrollbar.css">
<!--===============================================================================================-->
<!-- Ionicons -->
<link rel="stylesheet" href="admin/bower_components/Ionicons/css/ionicons.min.css">
<!-- Theme style -->
<link rel="stylesheet" href="admin/dist/css/AdminLTE.min.css">
<!-- ============================================================================================= -->
<link rel="stylesheet" type="text/css" href="css/util.css">
<link rel="stylesheet" type="text/css" href="css/main.css">
<!--===============================================================================================-->
</head>
<body class="animsition">
<header class="header-v4">
<?php
//Header template
include("partials/header.php");
?>
</header>
<?php include("partials/cartmodal.php"); ?>
<!-- breadcrumb -->
<!-- <div class="container">
<div class="bread-crumb flex-w p-l-25 p-r-15 p-t-30 p-lr-0-lg">
<a href="index.html" class="stext-109 cl8 hov-cl1 trans-04">
Home
<i class="fa fa-angle-right m-l-9 m-r-10" aria-hidden="true"></i>
</a>
<span class="stext-109 cl4">
Shoping Cart
</span>
</div>
</div> -->
<div class="container">
<!-- Content Wrapper. Contains page content -->
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
Täname tellimuse eest!
<small>Arve tellimusele #<?php echo $order_id ?></small>
</h1>
</section>
<!-- Main content -->
<section class="invoice">
<!-- title row -->
<div class="row">
<div class="col-xs-12">
<h2 class="page-header">
<img src="images/icons/logo.png" width="80px" alt="IMG-LOGO">
<small class="pull-right"> Kuupäev: <?php echo $tellimus['created_at'] ?></small>
</h2>
</div>
<!-- /.col -->
</div>
<!-- info row -->
<div class="row invoice-info">
<div class="col-sm-4 invoice-col">
Müüja
<address>
<strong><?php echo $andmed['firmanimi']; ?></strong><br>
<?php echo $andmed['aadress']; ?><br>
<?php echo $andmed['regnr']; ?><br>
Telefon: <?php echo $andmed['telefon']; ?><br>
E-post: <?php echo $andmed['email']; ?>
</address>
</div>
<!-- /.col -->
<div class="col-sm-4 invoice-col">
Klient
<address>
<strong><?php echo $tellimus['nimi']; ?></strong><br>
<?php echo $tellimus['pakiautomaat']; ?><br>
Telefon: <?php echo $tellimus['phone']; ?><br>
Email: <?php echo $tellimus['username']; ?>
</address>
</div>
<!-- /.col -->
<div class="col-sm-4 invoice-col">
<b>Arve nr #<?php echo $order_id; ?></b><br>
<br>
<b>Tellimuse ID:</b> <?php echo $order_id; ?><br>
<b>Maksekuupäev:</b> <?php echo $tellimus['created_at']; ?><br>
<b>Makseviis:</b>
<?php
//Pildi loogika
if ($tellimus['payment_method'] == "paypal") {
echo "Paypal ";
echo '<img width="30px" src="admin/dist/img/credit/paypal2.png" alt="Paypal">';
} else {
echo "Pangaülekanne";
}
?>
</div>
<!-- /.col -->
</div>
<!-- /.row -->
<!-- Table row -->
<div class="row">
<div class="col-xs-12 table-responsive">
<hr>
<table class="table table-striped">
<thead>
<tr>
<th>Kogus</th>
<th>Toode</th>
<th>Nimi</th>
<th>Kirjeldus</th>
<th>Kategooria</th>
<th>Hind</th>
</tr>
</thead>
<tbody>
<?php
// Loopis väljasta ostetud tooted
while ($tooteandmed = mysqli_fetch_array($result2)) { ?>
<tr>
<td><?php echo $tooteandmed['quantity']; ?></td>
<td><img src="<?php echo $tooteandmed['picture']; ?>" width="40px" alt="<?php echo $tooteandmed['prod_name']; ?>"></td>
<td><?php echo $tooteandmed['prod_name']; ?></td>
<td><?php echo $tooteandmed['description']; ?></td>
<td><?php echo $tooteandmed['cat_name']; ?></td>
<td><?php echo $tooteandmed['price']; ?> €</td>
</tr>
<?php } ?>
</tbody>
</table>
<hr>
</div>
<!-- /.col -->
</div>
<!-- /.row -->
<div class="row">
<!-- accepted payments column -->
<!-- <div class="col-xs-6">
<p class="lead">Maksemeetod:</p>
<p class="text-muted well well-sm no-shadow" style="margin-top: 10px;">
Etsy doostang zoodles disqus groupon greplin oooj voxy zoodles, weebly ning heekya handango imeem plugg
dopplr jibjab, movity jajah plickers sifteo edmodo ifttt zimbra.
</p>
</div> -->
<!-- /.col -->
<div class="col-sm-6">
<p class="lead">Tehingukuupäev <?php echo $tellimus['created_at']; ?></p>
<div class="table-responsive">
<table class="table">
<tr>
<th style="width:50%">Kokku:</th>
<td><?php echo $tellimus['total'] - $shipping; ?> €</td>
</tr>
<tr>
<th>Transport:</th>
<td><?php echo $shipping ?> €</td>
</tr>
<tr>
<th>Kogusumma:</th>
<td><?php echo $tellimus['total']; ?> €</td>
</tr>
</table>
<hr>
</div>
</div>
<!-- /.col -->
<div class="col-sm-6">
<p class="text-muted well well-sm no-shadow" style="margin-top: 10px;">
Täname, et tellisite meie e-poest. Külastage meid jälle!
</p><br>
</div>
</div>
<!-- /.row -->
<!-- this row will not appear when printing -->
<div class="row no-print">
<div class="col-xs-12">
<a href="arve-prindi.php?order_id=<?php echo $order_id ?>" target="_blank" class="btn btn-default"><i class="fa fa-print"></i> Prindi</a>
</div>
</div>
</section>
<!-- /.content -->
<div class="clearfix"></div>
<div class="pad margin no-print">
<div class="callout callout-info" style="margin-bottom: 0!important;">
<h4><i class="fa fa-info"></i> Märkus:</h4>
See leht on kujundatud printimiseks. Soovi korral vajutage nuppu "Prindi" arve printimiseks.
</div>
</div>
</div>
<!-- Footer -->
<?php
//Footer template
include("partials/footer.php");
?>
</body>
</html>