-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsatisAnaliz.php
411 lines (296 loc) · 12.8 KB
/
satisAnaliz.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
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
<?php
require_once "config.php";
// En çok satış yapan kullanıcıyı bulma sorgusu
$sql1 = "SELECT employee_id, COUNT(*) as hasilat FROM satis GROUP BY employee_id ORDER BY hasilat DESC LIMIT 1";
$result1 = $conn->query($sql1);
session_start();
if ($result1->num_rows > 0) {
// En çok satış yapan kullanıcı bilgilerri
$row = $result1->fetch_assoc();
$kullanici_id = $row['employee_id'];
$satis_sayisi = $row['hasilat'];
$sql = "SELECT * FROM users WHERE id='$kullanici_id'";
//sorguyu gönder
$cevap = mysqli_query($conn,$sql);
//kontrol
if(!$cevap )
{
echo '<br>Hata:' . mysqli_error($baglanti);
}
$i = 0;
$data = array();
while($gelen=mysqli_fetch_array($cevap))
{
// bilgileri alttaki html de scriptler halinda kullanacagiz
// $img = $gelen['img'];
$name =$gelen['name'];
$surname =$gelen['surname'];
$email =$gelen['email'];
$tel =$gelen['tel'];
$type = $gelen['type'];
$img = $gelen['img'];
$adres = $gelen['adres'];
$job = $gelen['job'];
$country = $gelen['country'];
$sube = $gelen['sube'];
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<title>Satış Analizi</title>
<meta content="" name="description">
<meta content="" name="keywords">
<!-- Favicons -->
<link href="assets2/img/favicon.png" rel="icon">
<link href="assets2/img/apple-touch-icon.png" rel="apple-touch-icon">
<!-- Google Fonts -->
<link href="https://fonts.gstatic.com" rel="preconnect">
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i|Nunito:300,300i,400,400i,600,600i,700,700i|Poppins:300,300i,400,400i,500,500i,600,600i,700,700i" rel="stylesheet">
<!-- Vendor CSS Files -->
<link href="assets2/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="assets2/vendor/bootstrap-icons/bootstrap-icons.css" rel="stylesheet">
<link href="assets2/vendor/boxicons/css/boxicons.min.css" rel="stylesheet">
<link href="assets2/vendor/quill/quill.snow.css" rel="stylesheet">
<link href="assets2/vendor/quill/quill.bubble.css" rel="stylesheet">
<link href="assets2/vendor/remixicon/remixicon.css" rel="stylesheet">
<link href="assets2/vendor/simple-datatables/style.css" rel="stylesheet">
<!-- Template Main CSS File -->
<link href="assets2/css/style.css" rel="stylesheet">
<!-- =======================================================
* Template Name: NiceAdmin
* Updated: Mar 09 2023 with Bootstrap v5.2.3
* Template URL: https://bootstrapmade.com/nice-admin-bootstrap-admin-html-template/
* Author: BootstrapMade.com
* License: https://bootstrapmade.com/license/
======================================================== -->
</head>
<body>
<!-- ======= Header ======= -->
<header id="header" class="header fixed-top d-flex align-items-center">
<div class="d-flex align-items-center justify-content-between">
<a href="index.html" class="logo d-flex align-items-center">
<span class="d-none d-lg-block">Henry</span>
</a>
<i class="bi bi-list toggle-sidebar-btn"></i>
</div><!-- End Logo -->
<div class="search-bar">
<form class="search-form d-flex align-items-center" method="POST" action="#">
<input type="text" name="query" placeholder="Search" title="Enter search keyword">
<button type="submit" title="Search"><i class="bi bi-search"></i></button>
</form>
</div><!-- End Search Bar -->
<nav class="header-nav ms-auto">
<ul class="d-flex align-items-center">
<li class="nav-item d-block d-lg-none">
<a class="nav-link nav-icon search-bar-toggle " href="#">
<i class="bi bi-search"></i>
</a>
</li><!-- End Search Icon-->
<li class="nav-item dropdown pe-3">
<a class="nav-link nav-profile d-flex align-items-center pe-0" href="#" data-bs-toggle="dropdown">
<img src=<?php echo $img;?> alt="Profile" class="rounded-circle">
<span class="d-none d-md-block dropdown-toggle ps-2"><?php echo $_SESSION['user']; ?></span>
</a><!-- End Profile Iamge Icon -->
<ul class="dropdown-menu dropdown-menu-end dropdown-menu-arrow profile">
<li class="dropdown-header">
<h6><?php echo $name?></h6>
<span><?php echo $type?></span>
</li>
<li>
<hr class="dropdown-divider">
</li>
<li>
<a class="dropdown-item d-flex align-items-center" href="users-profile.html">
<i class="bi bi-person"></i>
<span>My Profile</span>
</a>
</li>
<li>
<hr class="dropdown-divider">
</li>
<li>
<a class="dropdown-item d-flex align-items-center" href="users-profile.html">
<i class="bi bi-gear"></i>
<span>Account Settings</span>
</a>
</li>
<li>
<hr class="dropdown-divider">
</li>
<li>
<a class="dropdown-item d-flex align-items-center" href="pages-faq.html">
<i class="bi bi-question-circle"></i>
<span>Need Help?</span>
</a>
</li>
<li>
<hr class="dropdown-divider">
</li>
<li>
<a class="dropdown-item d-flex align-items-center" href="#">
<i class="bi bi-box-arrow-right"></i>
<span>Sign Out</span>
</a>
</li>
</ul><!-- End Profile Dropdown Items -->
</li><!-- End Profile Nav -->
</ul>
</nav><!-- End Icons Navigation -->
</header><!-- End Header -->
<div class="pagetitle">
<h1>Profile</h1>
<nav>
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="index.php">Home</a></li>
<li class="breadcrumb-item"><?php echo $_SESSION['user']?></li>
<li class="breadcrumb-item active">Profile</li>
</ol>
</nav>
</div><!-- End Page Title -->
<section class="section profile">
<div class="row">
<div class="col-xl-4">
<div class="card">
<div class="card-body profile-card pt-4 d-flex flex-column align-items-center">
<img src=<?php echo $img;?> alt="Profile" class="rounded-circle">
<h2><?php echo $name?></h2>
<h3><?php echo $type?></h3>
</div>
</div>
</div>
<div class="col-xl-8">
<div class="card">
<div class="card-body pt-3">
<div class="tab-content pt-2">
<div class="tab-pane fade show active profile-overview" id="profile-overview">
<h5 class="card-title">About</h5>
<p class="small fst-italic">Yapılan analiz sonucu en çok satış yapan çalışanımız.</p>
<h5 class="card-title">Profile Details</h5>
<div class="row">
<div class="col-lg-3 col-md-4 label ">Name</div>
<div class="col-lg-9 col-md-8"><?php echo $name;?></div>
</div>
<div class="row">
<div class="col-lg-3 col-md-4 label ">Surname</div>
<div class="col-lg-9 col-md-8"><?php echo $surname; ?></div>
</div>
<div class="row">
<div class="col-lg-3 col-md-4 label">Şube</div>
<div class="col-lg-9 col-md-8"><?php echo $sube; ?></div>
</div>
<div class="row">
<div class="col-lg-3 col-md-4 label">Job</div>
<div class="col-lg-9 col-md-8"><?php echo $job; ?></div>
</div>
<div class="row">
<div class="col-lg-3 col-md-4 label">Country</div>
<div class="col-lg-9 col-md-8"><?php echo $country; ?></div>
</div>
<div class="row">
<div class="col-lg-3 col-md-4 label">Adres</div>
<div class="col-lg-9 col-md-8"><?php echo $adres; ?></div>
</div>
<div class="row">
<div class="col-lg-3 col-md-4 label">Phone</div>
<div class="col-lg-9 col-md-8"><?php echo $tel; ?></div>
</div>
<div class="row">
<div class="col-lg-3 col-md-4 label">Email</div>
<div class="col-lg-9 col-md-8"><?php echo $email; ?></div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</main><!-- End #main -->
<!-- Vendor JS Files -->
<script src="assets2/vendor/apexcharts/apexcharts.min.js"></script>
<script src="assets2/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="assets2/vendor/chart.js/chart.umd.js"></script>
<script src="assets2/vendor/echarts/echarts.min.js"></script>
<script src="assets2/vendor/quill/quill.min.js"></script>
<script src="assets2/vendor/simple-datatables/simple-datatables.js"></script>
<script src="assets2/vendor/tinymce/tinymce.min.js"></script>
<script src="assets2/vendor/php-email-form/validate.js"></script>
<!-- Template Main JS File -->
<script src="assets2/js/main.js"></script>
</body>
</html>
<?php
}
}
// bu kod ise en cok satis yapan urunu sorgular
$sql5 = "SELECT urun_id, COUNT(*) as adet FROM satis GROUP BY urun_id ORDER BY adet DESC LIMIT 1";
$result5 = $conn->query($sql5);
if ($result5->num_rows > 0) {
// En çok satan urun
$row = $result5->fetch_assoc();
$urun_id = $row['urun_id'];
$satis_mik = $row['adet'];
//belirlenen urunun bilgilerini cek
$sql6 = "SELECT * FROM products WHERE id='$urun_id'";
//sorguyu veritabanina gönderiyoruz.
$cevap = mysqli_query($conn,$sql6);
//eger cevap FALSE ise hata yazdiriyoruz.
if(!$cevap )
{
echo '<br>Hata:' . mysqli_error($baglanti);
}
$i = 0;
$data = array();
while($gelen=mysqli_fetch_array($cevap))
{
// bu bilgiler script ler halind ealttaki html formda kullanilacak
// $img = $gelen['img'];
$urun =$gelen['urun'];
$model =$gelen['model'];
$kategori =$gelen['kategori'];
$img =$gelen['img'];
}
?>
<section class="section profile">
<div class="row">
<div class="col-xl-4">
<div class="card">
<div class="card-body profile-card pt-4 d-flex flex-column align-items-center">
<img src=<?php echo $img?> alt="Profile" class="rounded-circle">
<h2><?php echo $urun?></h2>
<h3><?php echo $model?></h3>
</div>
</div>
</div>
<div class="col-xl-8">
<div class="card">
<div class="card-body pt-3">
<div class="tab-content pt-2">
<div class="tab-pane fade show active profile-overview" id="profile-overview">
<h5 class="card-title">About</h5>
<p class="small fst-italic">Yapılan analiz sonucu en çok satılan yapan ürünümüz.</p>
<h5 class="card-title">Profile Details</h5>
<div class="row">
<div class="col-lg-3 col-md-4 label ">Ürün</div>
<div class="col-lg-9 col-md-8"><?php echo $urun?></div>
</div>
<div class="row">
<div class="col-lg-3 col-md-4 label ">Model</div>
<div class="col-lg-9 col-md-8"><?php echo $model?></div>
</div>
<div class="row">
<div class="col-lg-3 col-md-4 label">Kategori</div>
<div class="col-lg-9 col-md-8"><?php echo $kategori?></div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<?php
}
// Veritabanı bağlantısını kapatma
$conn->close();
?>