-
Notifications
You must be signed in to change notification settings - Fork 0
/
chart_distype_obt.php
555 lines (494 loc) · 23.3 KB
/
chart_distype_obt.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
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
<?php
session_start();
if($_SESSION["levelx"] == "") {
header("Location: page-login.php");
}
include('server.php');
include('connectDB.php');
$provinces = $_SESSION['province_opt'];
// echo "p=$provinces";
$sql_chart1 = "select cd.disatype as label, count(c.cid) as y
from cdisatype as cd
left outer join caseDis as c on cd.disatype = c.disType and c.tambol like '$provinces%'
group by cd.disatype";
$result_chart1 = $mysqli->query($sql_chart1);
$array_data1 = array();
while ($row_chart1 = mysqli_fetch_array($result_chart1)) {
array_push($array_data1, $row_chart1);
}
$query = "SELECT * FROM provinces WHERE code = $provinces";
// $sqlp = "SELECT * FROM amphures where code like '$provinces%' ";
// $query10 = mysqli_query($conn, $sqlp);
// $q1 = "SELECT COUNT(disType) as disType1 FROM caseDis
// where disType = 'ทางการเห็น' AND tambol like '$provinces%'";
// $result1 = $mysqli->query($q1); $rs1=$result1->fetch_object();
// $disType1=$rs1->disType1;
// $q2 = "SELECT COUNT(disType) as disType2 FROM caseDis
// where disType = 'ทางการได้ยินหรือการสื่อความหมาย' AND tambol like '$provinces%'";
// $result2 = $mysqli->query($q2); $rs2=$result2->fetch_object();
// $disType2=$rs2->disType2;
// $q3 = "SELECT COUNT(disType) as disType3 FROM caseDis
// where disType = 'ทางการเคลื่อนไหวหรือทางร่างกาย' AND tambol like '$provinces%'";
// $result3 = $mysqli->query($q3); $rs3=$result3->fetch_object();
// $disType3=$rs3->disType3;
// $q4 = "SELECT COUNT(disType) as disType4 FROM caseDis
// where disType = 'ทางจิตใจหรือพฤติกรรม' AND tambol like '$provinces%'";
// $result4 = $mysqli->query($q4); $rs4=$result4->fetch_object();
// $disType4=$rs4->disType4;
// $q5 = "SELECT COUNT(disType) as disType5 FROM caseDis
// where disType = 'ทางสติปัญญา' AND tambol like '$provinces%'";
// $result5 = $mysqli->query($q5); $rs5=$result5->fetch_object();
// $disType5=$rs5->disType5;
// $q6 = "SELECT COUNT(disType) as disType6 FROM caseDis
// where disType = 'ทางการเรียนรู้' AND tambol like '$provinces%'";
// $result6 = $mysqli->query($q6); $rs6=$result6->fetch_object();
// $disType6=$rs6->disType6;
// $q7 = "SELECT COUNT(disType) as disType7 FROM caseDis
// where disType = 'ทางออทิสติก' AND tambol like '$provinces%'";
// $result7 = $mysqli->query($q7); $rs7=$result7->fetch_object();
// $disType7=$rs7->disType7;
// $dataPoints = array(
// array("label"=>"ทางการเห็น", "y"=>$disType1),
// array("label"=>"ทางการได้ยินหรือการสื่อความหมาย", "y"=>$disType2),
// array("label"=>"ทางการเคลื่อนไหวหรือทางร่างกาย", "y"=>$disType3),
// array("label"=>"ทางจิตใจหรือพฤติกรรม", "y"=>$disType4),
// array("label"=>"ทางสติปัญญา", "y"=>$disType5),
// array("label"=>"ทางการเรียนรู้", "y"=>$disType6),
// array("label"=>"ทางออทิสติก", "y"=>$disType7)
// )
?>
<?php
if ($_REQUEST["act"] == 2) {
// session_start();
// include ("connectDB.php");
$amphures = $_REQUEST["amphure_id"];
// $provinces = $_SESSION['province_opt'];
// echo "pp=$amphures";
$q1 = "SELECT COUNT(disType) as disType1 FROM caseDis
where disType = 'ทางการเห็น' AND amper = '$amphures'";
$result1 = $mysqli->query($q1); $rs1=$result1->fetch_object();
$disType1=$rs1->disType1;
$q2 = "SELECT COUNT(disType) as disType2 FROM caseDis
where disType = 'ทางการได้ยินหรือการสื่อความหมาย' AND amper = '$amphures'";
$result2 = $mysqli->query($q2); $rs2=$result2->fetch_object();
$disType2=$rs2->disType2;
$q3 = "SELECT COUNT(disType) as disType3 FROM caseDis
where disType = 'ทางการเคลื่อนไหวหรือทางร่างกาย' AND amper = '$amphures'";
$result3 = $mysqli->query($q3); $rs3=$result3->fetch_object();
$disType3=$rs3->disType3;
$q4 = "SELECT COUNT(disType) as disType4 FROM caseDis
where disType = 'ทางจิตใจหรือพฤติกรรม' AND amper = '$amphures'";
$result4 = $mysqli->query($q4); $rs4=$result4->fetch_object();
$disType4=$rs4->disType4;
$q5 = "SELECT COUNT(disType) as disType5 FROM caseDis
where disType = 'ทางสติปัญญา' AND amper = '$amphures'";
$result5 = $mysqli->query($q5); $rs5=$result5->fetch_object();
$disType5=$rs5->disType5;
$q6 = "SELECT COUNT(disType) as disType6 FROM caseDis
where disType = 'ทางการเรียนรู้' AND amper = '$amphures'";
$result6 = $mysqli->query($q6); $rs6=$result6->fetch_object();
$disType6=$rs6->disType6;
$q7 = "SELECT COUNT(disType) as disType7 FROM caseDis
where disType = 'ทางออทิสติก' AND amper = '$amphures'";
$result7 = $mysqli->query($q7); $rs7=$result7->fetch_object();
$disType7=$rs7->disType7;
}
?>
<?php
// @session_start();
include('server.php');
// include('connectDB.php');
//echo $_SESSION['pcu'];
$d = $_SESSION['level'];
// $query = "SELECT * FROM office WHERE off_id_new = $d LIMIT 1";
// $result = mysqli_query($conn, $query);
// $row = mysqli_fetch_array($result);
// $pcu = $row['off_name'];
// $obt='05390601';
$query = "SELECT * FROM tesaban WHERE tcode = $d LIMIT 1";
$result = mysqli_query($conn, $query);
$row = mysqli_fetch_array($result);
$opt = $row['hospname'];
// $obt = $row['tcode'];
// $resultx = $mysqli->query("SELECT * from caseDis WHERE statusCase='PMJ' and obt='$obt'");
// $countPMJ=mysqli_num_rows($resultx);
// $resultx = $mysqli->query("SELECT * from caseDis WHERE statusCase='OBT' and obt='$d'");
// $countOBT=mysqli_num_rows($resultx);
// $resultx = $mysqli->query("SELECT * from caseDis WHERE statusCase='DOC' and infoFrom='OBT' and obt='$d'");
// $countDOC=mysqli_num_rows($resultx);
// $resultx = $mysqli->query("SELECT * from caseDis WHERE statusCase='OK' and obt='$d'");
// $countOK=mysqli_num_rows($resultx);
?>
<?php
if ($_REQUEST['act'] == 1) {
session_destroy();
$_SESSION["levelx"] = '';
header("Location: page-login.php");
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>R8:NDS</title>
<link rel='stylesheet' href='https://codepen.io/2kool2/pen/ZOmJqq.css'>
<link rel="stylesheet" href="./style.css">
<!-- Favicon icon -->
<link rel="icon" type="image/png" sizes="16x16" href="images/disLogo.png">
<!-- Pignose Calender -->
<link href="./plugins/pg-calendar/css/pignose.calendar.min.css" rel="stylesheet">
<!-- Chartist -->
<link rel="stylesheet" href="./plugins/chartist/css/chartist.min.css">
<link rel="stylesheet" href="./plugins/chartist-plugin-tooltips/css/chartist-plugin-tooltip.css">
<!-- Custom Stylesheet -->
<link href="css/style.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<script type="text/javascript" src="js/show123.js"></script>
<link href='https://fonts.googleapis.com/css?family=Kanit:400,300&subset=thai,latin' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
body { font-family: 'Kanit', sans-serif; }
h1,h2,h3,h4,h5,h6 { font-family: 'Kanit', sans-serif; }
</style>
<style type="text/css">.bgimg { background-image: url('../images/disLogo.png'); } </style>
<style>
.highcharts-figure,
.highcharts-data-table table {
min-width: 320px;
max-width: 660px;
margin: 1em auto;
}
.highcharts-data-table table {
font-family: Verdana, sans-serif;
border-collapse: collapse;
border: 1px solid #ebebeb;
margin: 10px auto;
text-align: center;
width: 100%;
max-width: 500px;
}
.highcharts-data-table caption {
padding: 1em 0;
font-size: 1.2em;
color: #555;
}
.highcharts-data-table th {
font-weight: 600;
padding: 0.5em;
}
.highcharts-data-table td,
.highcharts-data-table th,
.highcharts-data-table caption {
padding: 0.5em;
}
.highcharts-data-table thead tr,
.highcharts-data-table tr:nth-child(even) {
background: #f8f8f8;
}
.highcharts-data-table tr:hover {
background: #f1f7ff;
}
</style>
<script>
window.onload = function() {
var chart = new CanvasJS.Chart("chartContainer", {
animationEnabled: true,
title: {
text: "ประเภทคนพิการที่ลงทะเบียน ภาพรวมจังหวัด"
},
subtitles: [{
text: ""
}],
data: [{
type: "pie",
yValueFormatString: "#,##0\"\"",
indexLabel: "{label} ({y})",
dataPoints: <?php echo json_encode($array_data1, JSON_NUMERIC_CHECK); ?>
}]
});
chart.render();
}
</script>
</head>
<body>
<!--*******************
Preloader start
********************-->
<div id="preloader">
<div class="loader">
<svg class="circular" viewBox="25 25 50 50">
<circle class="path" cx="50" cy="50" r="20" fill="none" stroke-width="3" stroke-miterlimit="10" />
</svg>
</div>
</div>
<!--******************* Preloader end ********************-->
<!--********************************** Main wrapper start ***********************************-->
<div id="main-wrapper">
<!--********************************** Nav header start ***********************************-->
<div class="nav-header">
<div>
<a href="page3.php">
<span>
<img src="images/rds2.png" alt="">
</span>
</a>
</div>
</div>
<!--********************************** Nav header end ***********************************-->
<!--********************************** Header start ***********************************-->
<div class="header">
<div class="header-content clearfix ">
<div class="nav-control ">
<div class="hamburger ">
<span class="toggle-icon"><i class="icon-menu"></i></span>
</div>
</div>
<div class="header-left">
<br><h3 class="text-green"> ระบบบริการข้อมูลคนพิการ <font color="gray" size="2"> Nongbualamphu Disability Data Center</font></h3><h5> หน่วยงาน: <?php echo $opt;?></h5>
</div>
<div class="header-right">
<ul class="clearfix">
<li class="icons dropdown">
<div class="user-img c-pointer position-relative" data-toggle="dropdown">
<span class="activity active"></span>
<img src="images/user/1.png" height="40" width="40" alt="">
</div>
<div class="drop-down dropdown-profile animated fadeIn dropdown-menu">
<div class="dropdown-content-body">
<ul>
<li>
<a href="app-profile.html"><i class="icon-user"></i> <span>Profile</span></a>
</li>
<li><a href="page3.php?act=1"><i class="icon-key"></i> <span>ออกจากระบบ</span></a></li>
</ul>
</div>
</div>
</li>
</ul>
</div>
</div>
</div>
<!--********************************** Header end ti-comment-alt ***********************************-->
<!--********************************** Sidebar start ***********************************-->
<div class="nk-sidebar bg-light text-white">
<div class="nk-nav-scroll bg-light text-white">
<ul class="metismenu bg-light text-white" id="menu">
<!-- <li>
<a class="has-arrow" href="javascript:void()" aria-expanded="false">
<i class="icon-speedometer menu-icon"></i><span class="nav-text">Dashboard</span>
</a>
<ul aria-expanded="false">
<li><a href="./page3.php">Home</a></li>
</ul>
</li> -->
<li>
<a class="has-arrow" href="javascript:void()" aria-expanded="false">
<i class="icon-chart menu-icon"></i><span class="nav-text">รายงาน</span>
</a>
<ul aria-expanded="false">
<li><a href="./chart_distype_obt.php">- ประเภทคนพิการ</a></li>
<li><a href="./chart_distype_regis_obt.php">- จำนวนคนพิการ</a></li>
</ul>
</li>
<li>
<a class="has-arrow" href="javascript:void()" aria-expanded="false">
<i class="icon-settings menu-icon"></i><span class="nav-text">ตั้งค่า</span>
</a>
<ul aria-expanded="false">
<li><a href="#">ตั้งค่า1</a></li>
</ul>
</li>
</ul>
</div>
</div>
<!--********************************** Sidebar end ***********************************-->
<!--********************************** Content body start ***********************************-->
<div class="content-body">
<br>
<div class="container-fluid mt-3">
<div class="row">
<div id="chartContainer" style="height: 370px; width: 100%;"></div>
<script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
</div>
<!-- #/ container -->
</div>
<div align="center">
<form name="form1" class="form-inline" action='?act=2' method='post' enctype='multipart/form-data'>
<div class="container-fluid mt-3">
<div >
<span>ดูรายงานแยกรายอำเภอ : </span>
<select name="amphure_id" id="amphure" required>
<option value="">-เลือกอำเภอ-</option>
<?php
$sql_amphur = "SELECT * FROM amphures where code like '$provinces%'";
$result_amphur = $mysqli->query($sql_amphur);
while($r_amphur = mysqli_fetch_array($result_amphur)) {
if ($amphures == $r_amphur["id"]) {
echo "<option value='$r_amphur[id]' selected>$r_amphur[name_th]</option>";
} else {
echo "<option value='$r_amphur[id]'>$r_amphur[name_th]</option>";
}
}
?>
</select>
<button type="submit" class="btn btn-primary" name="report">ตกลง</button>
</div>
</div>
</form>
</div>
<!-- //กราฟ -->
<div align="center">
<canvas id="myChart" style="width:100%;max-width:600px;"></canvas>
</div>
<div class="container-fluid mt-3">
<DIV id="showdis">
<img src="./images/bgImg.png" alt="Nature" style="width:100%;">
</DIV>
</div>
<!--**********************************
Content body end
***********************************-->
<!--**********************************
Footer start
***********************************-->
<div class="footer">
<div class="copyright">
<!-- <p>Copyright © Designed & Developed by <a href="https://themeforest.net/user/quixlab">Quixlab</a> 2018</p> -->
</div>
</div>
<!--********************************** Footer end ***********************************-->
</div>
<!--********************************** Main wrapper end ***********************************-->
<!--********************************** Scripts ***********************************-->
<script src="plugins/common/common.min.js"></script>
<script src="js/custom.min.js"></script>
<script src="js/settings.js"></script>
<script src="js/gleek.js"></script>
<script src="js/styleSwitcher.js"></script>
<!-- Chartjs -->
<script src="./plugins/chart.js/Chart.bundle.min.js"></script>
<!-- Circle progress -->
<script src="./plugins/circle-progress/circle-progress.min.js"></script>
<!-- Datamap -->
<script src="./plugins/d3v3/index.js"></script>
<script src="./plugins/topojson/topojson.min.js"></script>
<script src="./plugins/datamaps/datamaps.world.min.js"></script>
<!-- Morrisjs -->
<script src="./plugins/raphael/raphael.min.js"></script>
<script src="./plugins/morris/morris.min.js"></script>
<!-- Pignose Calender -->
<script src="./plugins/moment/moment.min.js"></script>
<script src="./plugins/pg-calendar/js/pignose.calendar.min.js"></script>
<!-- ChartistJS -->
<script src="./plugins/chartist/js/chartist.min.js"></script>
<script src="./plugins/chartist-plugin-tooltips/js/chartist-plugin-tooltip.min.js"></script>
<script src="./js/dashboard/dashboard-1.js"></script>
<script src="assets/script.js"></script>
<script src="assets/script0.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/export-data.js"></script>
<script src="https://code.highcharts.com/modules/accessibility.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.4/Chart.js"></script>
<script>
var a = <?=$disType1;?>;
var b = <?=$disType2;?>;
var c = <?=$disType3;?>;
var d = <?=$disType4;?>;
var e = <?=$disType5;?>;
var f = <?=$disType6;?>;
var g = <?=$disType7;?>;
var am = <?=$amphures;?>;
var xValues = ["ทางการเห็น", "ทางการได้ยินหรือการสื่อความหมาย", "ทางการเคลื่อนไหวหรือทางร่างกาย", "ทางจิตใจหรือพฤติกรรม", "ทางสติปัญญา","ทางการเรียนรู้","ทางออทิสติก"];
var yValues = [a, b, c, d,e,f,g];
var barColors = [
"#b91d47",
"#00aba9",
"#2b5797",
"#e8c3b9",
"#1e7145",
"#CC33FF",
"#99FF99"
];
new Chart("myChart", {
type: "pie",
data: {
labels: xValues,
datasets: [{
backgroundColor: barColors,
data: yValues
}]
},
options: {
title: {
display: true,
text:"ประเภทคนพิการที่ลงทะเบียนอำเภอ"
}
}
});
</script>
<script>
// Data retrieved from https://netmarketshare.com/
// Radialize the colors
Highcharts.setOptions({
colors: Highcharts.map(Highcharts.getOptions().colors, function (color) {
return {
radialGradient: {
cx: 0.5,
cy: 0.3,
r: 0.7
},
stops: [
[0, color],
[1, Highcharts.color(color).brighten(-0.3).get('rgb')] // darken
]
};
})
});
// Build the chart
// Highcharts.chart('container', {
// chart: {
// plotBackgroundColor: null,
// plotBorderWidth: null,
// plotShadow: false,
// type: 'pie'
// },
// title: {
// text: 'Browser market shares in April, 2022'
// },
// tooltip: {
// pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
// },
// accessibility: {
// point: {
// valueSuffix: '%'
// }
// },
// plotOptions: {
// pie: {
// allowPointSelect: true,
// cursor: 'pointer',
// dataLabels: {
// enabled: true,
// format: '<b>{point.name}</b>: {point.percentage:.1f} %',
// connectorColor: 'silver'
// }
// }
// },
// series: [{
// name: 'Share',
// data: [
// { name: 'ทางการเห็น', y: 73.24 },
// { name: 'Edge', y: 12.93 },
// { name: 'Firefox', y: 4.73 },
// { name: 'Safari', y: 2.50 },
// { name: 'Internet Explorer', y: 1.65 },
// { name: 'Other', y: 4.93 }
// ]
// }]
// });
</script>
</body>
</html>