-
Notifications
You must be signed in to change notification settings - Fork 0
/
newCase.php
949 lines (907 loc) · 49.2 KB
/
newCase.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
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
<?php
session_start();
if ($_SESSION["levelx"] == "") {
header("Location: page-login.php");
}
?>
<?php
// @session_start();
include('server.php');
include('connectDB.php');
$id_line = $_SESSION['id_line'];
$province = $_SESSION['province'];
// echo "p=$province";
$d = $_SESSION['pcu'];
$query = "SELECT * FROM chkfile WHERE province = '$province'";
$result = mysqli_query($conn, $query);
$row = mysqli_fetch_array($result);
$dscard = $row['dscard'];
if($dscard=='y'){
$dscard = 'required';
}
$consent = $row['consent'];
if($consent=='y'){
$consent = 'required';
}
$book = $row['book'];
if($book=='y'){
$book = 'required';
}
$idcard = $row['idcard'];
if($idcard=='y'){
$idcard = 'required';
}
$home = $row['home'];
if($home=='y'){
$home = 'required';
}
$card2 = $row['card2'];
if($card2=='y'){
$card2 = 'required';
}
$home2 = $row['home2'];
if($home2=='y'){
$home2 = 'required';
}
$face = $row['face'];
if($face=='y'){
$face = 'required';
}
$pict = $row['pict'];
if($pict=='y'){
$pict = 'required';
}
$bank = $row['bank'];
if($bank=='y'){
$bank = 'required';
}
$caregiver = $row['caregiver'];
if($caregiver=='y'){
$caregiver = 'required';
}
$caregiverchange = $row['caregiverchange'];
if($caregiverchange=='y'){
$caregiverchange = 'required';
}
$authorize = $row['authorize'];
if($authorize=='y'){
$authorize = 'required';
}
$delivery = $row['delivery'];
if($delivery=='y'){
$delivery = 'required';
}
$requestmoney = $row['requestmoney'];
if($requestmoney=='y'){
$requestmoney = 'required';
}
$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'];
$hospcode = $_REQUEST["hospcode"];
// $hospcode=23367;
?>
<!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>
<!-- 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="jquery.datetimepicker.css"> -->
<!-- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<link rel="stylesheet" href="dist/css/bootstrap-select.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<!-- <script src="dist/js/bootstrap-select.js"></script> -->
<!-- Datepicker -->
<link href="assets/datepicker/css/datepicker.css" rel="stylesheet" media="screen">
</head>
<script language="javascript">
function checkID(id) {
if(id.length != 13) return false;
for(i=0, sum=0; i < 12; i++)
sum += parseFloat(id.charAt(i))*(13-i); if((11-sum%11)%10!=parseFloat(id.charAt(12)))
return false;
return true;
}
function checkForm() { if(!checkID(document.form1.cid.value))
document.form1.cid.value='';
// alert('รหัสประชาชนไม่ถูกต้อง');
}
function chktsb(a) {
document.getElementById('ok').innerHTML = '';
document.getElementById('ok').innerHTML = "<center>loading</center>";
if (window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
} else {
xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
}
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById('ok').innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open('GET', 'chktsb.php?pop='+a+'&moo='+document.getElementById('birth_month').value, true);
xmlhttp.send();
}
function closeWin() {
myWindow.close();
}
</script>
<script language="javascript">
function CheckNum() {
if (event.keyCode < 48 || event.keyCode > 57) {
event.returnValue = false;
}
}
</script>
<script language="javascript">
function confirmAdd() {
return confirm('ต้องการเพิ่มรายการนี้? / โปรดยืนยัน!');
}
function reload_view(t) {
window.opener.location.reload();
setTimeout("self.close()", (t * 10000));
}
</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>
<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 class="brand-logo">
<a href="page1.php">
<b class="logo-abbr"><img src="images/disLogo.png" alt=""> </b>
<span class="logo-compact"><img src="./images/disLogoText.png" alt=""></span>
<span class="brand-title">
<img src="images/disLogoText.png" alt="">
</span>
</a>
</div>
</div> -->
<div class="nav-header">
<div >
<a href="page1.php">
<span >
<img src="images/rds3.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"> One-stop Service for Disabilities</font></h3><h5> หน่วยงาน: <?php echo $pcu;?></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="page-login.php"><i class="icon-key"></i> <span>Logout</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="./page1.php">- หน้าหลัก</a></li>
</ul>
</li> -->
<li>
<a class="has-arrow" href="javascript:void()" aria-expanded="false">
<i class="icon-user menu-icon"></i><span class="nav-text">ทะเบียนคนพิการ</span>
</a>
<ul aria-expanded="false">
<li><a href="./newCase.php?hospcode=<?=$d?>">- เพิ่มรายใหม่</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.php">- ประเภทผู้พิการ</a></li>
<li><a href="./chart_distype_regis.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="#">- อยู่ระหว่างจัดทำ.</a></li>
</ul>
</li>
</ul>
</div>
</div>
<!--********************************** Sidebar end ***********************************-->
<!--********************************** Content body start ***********************************-->
<div class="content-body">
<?php
if ($_REQUEST["act"] == 1) {
include ("connectDB.php");
include ("connect.php");
$hospcode = $_REQUEST["hospcode"];
$q1 = "SELECT off_name FROM office where off_id = '$hospcode'";
$result1 = $mysqli->query($q1);
$rs1 = $result1->fetch_object();
$off_name = $rs1->off_name;
$cid = $_REQUEST["cid"];
$fname = $_REQUEST["fname"];
$lname = $_REQUEST["lname"];
$sex = $_REQUEST["sex"];
$birth = $_REQUEST["birth"];
$y_th1 = substr($birth, 6, 4);
$y_en1 = $y_th1-543;
$d_th1 = substr($birth, 0, 2);
$m_th1 = substr($birth, 3, 2);
$birth = $y_en1."-".$m_th1."-".$d_th1;
$disType = $_REQUEST["disType"];
$homeNo = $_REQUEST["homeNo"];
$mu = $_REQUEST["mu"];
$tambol = $_REQUEST["district_id"];
$amper = $_REQUEST["amphure_id"];
$tel = $_REQUEST["tel"];
$obt = $_REQUEST["obt"];
$pcu = $_REQUEST["pcu"];
if ($cid != "") {
//upload file
if ($_FILES['fileDSCard']['name'] != "") {
$output_dir = "temp/";
$sur = strrchr($_FILES['fileDSCard']['name'], "."); //ตัดนามสกุลไฟล์เก็บไว้
$fileDSCard = ('DSCard'.$cid.$sur); //ชื่อไฟล์ตาม id
move_uploaded_file($_FILES["fileDSCard"]["tmp_name"], $output_dir.$fileDSCard);
}
if ($_FILES['fileIdCard']['name'] != "") {
$output_dir = "temp/";
$sur = strrchr($_FILES['fileIdCard']['name'], "."); //ตัดนามสกุลไฟล์เก็บไว้
$fileIdCard = ('Idcard'.$cid.$sur); //ชื่อไฟล์ตาม id
move_uploaded_file($_FILES["fileIdCard"]["tmp_name"], $output_dir.$fileIdCard);
}
if ($_FILES['fileHome']['name'] != "") {
$output_dir = "temp/";
$sur = strrchr($_FILES['fileHome']['name'], "."); //ตัดนามสกุลไฟล์เก็บไว้
$fileHome = ('Home'.$cid.$sur); //ชื่อไฟล์ตาม id
move_uploaded_file($_FILES["fileHome"]["tmp_name"], $output_dir.$fileHome);
}
if ($_FILES['fileFace']['name'] != "") {
$output_dir = "temp/";
$sur = strrchr($_FILES['fileFace']['name'], "."); //ตัดนามสกุลไฟล์เก็บไว้
$fileFace = ('Face'.$cid.$sur); //ชื่อไฟล์ตาม id
move_uploaded_file($_FILES["fileFace"]["tmp_name"], $output_dir.$fileFace);
}
if ($_FILES['fileBook']['name'] != "") {
$output_dir = "temp/";
$sur = strrchr($_FILES['fileBook']['name'], "."); //ตัดนามสกุลไฟล์เก็บไว้
$fileBook = ('Book'.$cid.$sur); //ชื่อไฟล์ตาม id
move_uploaded_file($_FILES["fileBook"]["tmp_name"], $output_dir.$fileBook);
}
if ($_FILES['filePict']['name'] != "") {
$output_dir = "temp/";
$sur = strrchr($_FILES['filePict']['name'], "."); //ตัดนามสกุลไฟล์เก็บไว้
$filePict = ('Pict'.$cid.$sur); //ชื่อไฟล์ตาม id
move_uploaded_file($_FILES["filePict"]["tmp_name"], $output_dir.$filePict);
}
if ($_FILES['fileBank']['name'] != "") {
$output_dir = "temp/";
$sur = strrchr($_FILES['fileBank']['name'], "."); //ตัดนามสกุลไฟล์เก็บไว้
$fileBank = ('Bank'.$cid.$sur); //ชื่อไฟล์ตาม id
move_uploaded_file($_FILES["fileBank"]["tmp_name"], $output_dir.$fileBank);
}
if ($_FILES['fileIdCard2']['name'] != "") {
$output_dir = "temp/";
$sur = strrchr($_FILES['fileIdCard2']['name'], "."); //ตัดนามสกุลไฟล์เก็บไว้
$fileIdCard2 = ('IdCard2'.$cid.$sur); //ชื่อไฟล์ตาม id
move_uploaded_file($_FILES["fileIdCard2"]["tmp_name"], $output_dir.$fileIdCard2);
}
if ($_FILES['fileHome2']['name'] != "") {
$output_dir = "temp/";
$sur = strrchr($_FILES['fileHome2']['name'], "."); //ตัดนามสกุลไฟล์เก็บไว้
$fileHome2 = ('Home2'.$cid.$sur); //ชื่อไฟล์ตาม id
move_uploaded_file($_FILES["fileHome2"]["tmp_name"], $output_dir.$fileHome2);
}
if ($_FILES['fileConsent']['name'] != "") {
$output_dir = "temp/";
$sur = strrchr($_FILES['fileConsent']['name'], "."); //ตัดนามสกุลไฟล์เก็บไว้
$fileConsent = ('Consent'.$cid.$sur); //ชื่อไฟล์ตาม id
move_uploaded_file($_FILES["fileConsent"]["tmp_name"], $output_dir.$fileConsent);
}
if ($_FILES['fileCaregiver']['name'] != "") {
$output_dir = "temp/";
$sur = strrchr($_FILES['fileCaregiver']['name'], "."); //ตัดนามสกุลไฟล์เก็บไว้
$fileCaregiver = ('Caregiver'.$cid.$sur); //ชื่อไฟล์ตาม id
move_uploaded_file($_FILES["fileCaregiver"]["tmp_name"], $output_dir.$fileCaregiver);
}
if ($_FILES['fileCaregiverChange']['name'] != "") {
$output_dir = "temp/";
$sur = strrchr($_FILES['fileCaregiverChange']['name'], "."); //ตัดนามสกุลไฟล์เก็บไว้
$fileCaregiverChange = ('CaregiverChange'.$cid.$sur); //ชื่อไฟล์ตาม id
move_uploaded_file($_FILES["fileCaregiverChange"]["tmp_name"], $output_dir.$fileCaregiverChange);
}
if ($_FILES['fileAuthorize']['name'] != "") {
$output_dir = "temp/";
$sur = strrchr($_FILES['fileAuthorize']['name'], "."); //ตัดนามสกุลไฟล์เก็บไว้
$fileAuthorize = ('Authorize'.$cid.$sur); //ชื่อไฟล์ตาม id
move_uploaded_file($_FILES["fileAuthorize"]["tmp_name"], $output_dir.$fileAuthorize);
}
if ($_FILES['fileDelivery']['name'] != "") {
$output_dir = "temp/";
$sur = strrchr($_FILES['fileDelivery']['name'], "."); //ตัดนามสกุลไฟล์เก็บไว้
$fileDelivery = ('Delivery'.$cid.$sur); //ชื่อไฟล์ตาม id
move_uploaded_file($_FILES["fileDelivery"]["tmp_name"], $output_dir.$fileDelivery);
}
if ($_FILES['fileRequestMoney']['name'] != "") {
$output_dir = "temp/";
$sur = strrchr($_FILES['fileRequestMoney']['name'], "."); //ตัดนามสกุลไฟล์เก็บไว้
$fileRequestMoney = ('RequestMoney'.$cid.$sur); //ชื่อไฟล์ตาม id
move_uploaded_file($_FILES["fileRequestMoney"]["tmp_name"], $output_dir.$fileRequestMoney);
}
if ($_FILES['fileVDO']['name'] != "") {
$output_dir = "temp/";
$sur = strrchr($_FILES['fileVDO']['name'], "."); //ตัดนามสกุลไฟล์เก็บไว้
$fileVDO = ('VdoConsent'.$cid.$sur); //ชื่อไฟล์ตาม id
move_uploaded_file($_FILES["fileVDO"]["tmp_name"], $output_dir.$fileVDO);
}
$sql = "INSERT INTO caseDis(hospcode, cid, fname, lname, sex, birth, disType, homeNo, mu, tambol, amper, tel, obt, pcucode, statusCase, fileIdCard, fileHome, fileFace, fileBook, filePict, fileBank, fileIdCard2, fileHome2, fileConsent, fileCaregiver, fileCaregiverChange, fileAuthorize, fileDSCard,fileDelivery,fileRequestMoney, dateREG, idSend)
VALUES ('$hospcode', '$cid', '$fname', '$lname', '$sex', '$birth', '$disType', '$homeNo', '$mu', '$tambol', '$amper', '$tel', '$obt', '$pcu', 'PMJ', '$fileIdCard', '$fileHome', '$fileFace', '$fileBook', '$filePict', '$fileBank', '$fileIdCard2', '$fileHome2', '$fileConsent', '$fileCaregiver', '$fileCaregiverChange', '$fileAuthorize', '$fileDSCard','$fileDelivery','$fileRequestMoney', now(), '$id_line')";
$result_newcase = $mysqli->query($sql);
if ($result_newcase) {
echo "<center><h3>ลงทะเบียนเรียบร้อยแล้ว</h3>";
//-----------แจ้ง Line พมจ.
$sql0 = "SELECT * FROM member WHERE `level` = 'pmj' and provinces_pmj = '$province' and id_line is not null";
$query0 = mysqli_query($conn, $sql0);
while ($result0 = mysqli_fetch_assoc($query0)) {
$id_line = $result0['id_line'];
// echo "$id_line <br>";
// Access Token
// $access_token = 'eNQ1Evl9snf9RLTTYTSYMoF1BkKVRFatm33B/ZdQmuPhjb913O+RT8l8t+2Ujxew3NtjmTbL8JYET5YGgGh0d5LY8eiq/JAAmbZVFmBuM7ZWekaas7LgtQ3Vl5KtuW0JSgFfq4h4XUGQ4Vuu+0s9sQdB04t89/1O/w1cDnyilFU=';
// User ID
// $userId = 'U80b248f7031744090346ea54c520a1b2';
$userId = $id_line;
// ข้อความที่ต้องการส่ง
$messages = array(
'type' => 'text',
'text' => 'พมจ. โปรดตรวจสอบผู้ขอขึ้นทะเบียนรายใหม่ @จากหน่วยงาน :'.$off_name.'คลิ๊ก>> https://datacenter-r8way.moph.go.th/r8nds/page2.php',
);
$post = json_encode(array(
'to' => array($userId),
'messages' => array($messages),
));
// URL ของบริการ Replies สำหรับการตอบกลับด้วยข้อความอัตโนมัติ
$url = 'https://api.line.me/v2/bot/message/multicast';
$headers = array('Content-Type: application/json', 'Authorization: Bearer '.$access_token);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$result = curl_exec($ch);
echo $result;
} //ปิด while ค้นหา line _id
//-----------แจ้ง Line อปท.
$sql02 = "SELECT * FROM member WHERE `level` = 'opt' and provinces_opt = '39' and id_line is not null and idMeet is not null";
$query02 = mysqli_query($conn, $sql02);
while ($result02 = mysqli_fetch_assoc($query02)) {
$id_line = $result02['id_line'];
$idMeet = $result02['idMeet'];
// echo "$id_line <br>";
// Access Token
// $access_token = 'eNQ1Evl9snf9RLTTYTSYMoF1BkKVRFatm33B/ZdQmuPhjb913O+RT8l8t+2Ujxew3NtjmTbL8JYET5YGgGh0d5LY8eiq/JAAmbZVFmBuM7ZWekaas7LgtQ3Vl5KtuW0JSgFfq4h4XUGQ4Vuu+0s9sQdB04t89/1O/w1cDnyilFU=';
// User ID
// $userId = 'U80b248f7031744090346ea54c520a1b2';
$userId = $id_line;
// ข้อความที่ต้องการส่ง
$messages = array(
'type' => 'text',
'text' => 'อปท. โปรด VDO Call เพื่อยืนยันคำขอรับเบี้ยความพิการ @จากหน่วยงาน :'.$off_name.'คลิ๊ก>> <a href="<?=$idMeet?>" target="_blank" class="btn btn-primary btn-lg" role="button"><i class="fa fa-video-camera"></i></a>',
);
$post = json_encode(array(
'to' => array($userId),
'messages' => array($messages),
));
// URL ของบริการ Replies สำหรับการตอบกลับด้วยข้อความอัตโนมัติ
$url = 'https://api.line.me/v2/bot/message/multicast';
$headers = array('Content-Type: application/json', 'Authorization: Bearer '.$access_token);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$result = curl_exec($ch);
echo $result;
} //ปิด while ค้นหา line _id
//-----------แจ้ง Line รพ.สต.
$sql01 = "SELECT * FROM member WHERE `level` = 'pcu2' and provinces_pcu2 = '$province' and id_line is not null";
$query01 = mysqli_query($conn, $sql01);
while ($result01 = mysqli_fetch_assoc($query01)) {
$id_line = $result01['id_line'];
$userId = $id_line;
// ข้อความที่ต้องการส่ง
$messages = array(
'type' => 'text',
'text' => 'รพ.สต. โปรดตรวจสอบข้อมูลคนพิการ คลิ๊ก>> https://datacenter-r8way.moph.go.th/r8nds/pcu2.php',
);
$post = json_encode(array(
'to' => array($userId),
'messages' => array($messages),
));
// URL ของบริการ Replies สำหรับการตอบกลับด้วยข้อความอัตโนมัติ
$url = 'https://api.line.me/v2/bot/message/multicast';
$headers = array('Content-Type: application/json', 'Authorization: Bearer '.$access_token);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$result = curl_exec($ch);
echo $result;
} //ปิด while ค้นหา line _id
echo "<meta http-equiv='refresh' content='0;url=./page1.php'>";
} else {
echo "ไม่สามารถบันทึกข้อมูลได้!!!<br>";
echo $sql;
}
} else {
echo "ไม่พบ CID";
}
?>
<!-- <META HTTP-EQUIV="Refresh" CONTENT="0;URL=./page1.php"> -->
<?php
// ปิด add
} else {
?>
<div class="container">
<form name="form1" class="form-inline" action='newCase.php?act=1&hospcode=<?=$hospcode?>' method='post' enctype='multipart/form-data' autocomplete="off">
<div class="container">
<div class="input-group mb-3 input-group-sm">
<?php
include('connect.php');
$sql = "SELECT * FROM amphures where code like '$province%' ";
$query = mysqli_query($conn, $sql);
?>
<div class="container my-5">
<div class="card">
<div class="card-header">
<!-- <div class="card-body"> -->
<h5>เพิ่มข้อมูลคนพิการรายใหม่</h5>
<div class="input-group mb-3 input-group">
<div class="input-group-prepend"><span class="input-group-text">เลขประชาชน : </span></div>
<input type="text" class="form-control" name="cid" onfocusout="checkForm()" placeholder="ระบุเลข13หลัก ไม่ต้องมีเครื่องหมายขีดคั่น" onblur="get_person(this.value)" required>
</div>
<div class="input-group mb-3 input-group">
<div class="input-group-prepend">
<span class="input-group-text">ชื่อ :</span>
</div>
<input type="text" class="form-control" name="fname" required>
</div>
<div class="input-group mb-3 input-group">
<div class="input-group-prepend">
<span class="input-group-text">สกุล :</span>
</div>
<input type="text" class="form-control" name="lname" required>
</div>
<div class="input-group mb-3 input-group">
<div class="input-group-prepend">
<span class="input-group-text">เพศ :</span>
</div>
<select class="form-control" id="sex" name="sex" required>
<option value="">-เลือก-</option>
<option value="ชาย">ชาย</option>
<option value="หญิง">หญิง</option>
</select>
</div>
<div class="input-group mb-3 input-group">
<div class="input-group-prepend">
<span class="input-group-text">วันเดือนปีเกิด :</span>
</div>
<input type="text" class="form-control" name="birth" id="datepicker" data-date-language="th-th" required>
<!-- <input type="text" class="form-control" name="birth" id="birth" value="" required> -->
</div>
<div class="input-group mb-3 input-group">
<div class="input-group-prepend">
<span class="input-group-text">ประเภทความพิการ</span>
</div>
<select class="form-control" id="disType" name="disType" required>
<option value="">-เลือกประเภทความพิการ-</option>
<?php
include('connect.php');
$sql0 = "SELECT * FROM cdisatype";
$query0 = mysqli_query($conn, $sql0);
while($result0 = mysqli_fetch_assoc($query0)): ?>
<option value="<?=$result0['disatype']?>"><?=$result0['disatype']?></option>
<?php endwhile; ?>
</select>
</div>
</div>
</div>
<div class="card bg-light">
<div class="card-header">
<h5>ข้อมูลที่อยู่</h5>
<div class="input-group mb-3 input-group">
<div class="input-group-prepend">
<span class="input-group-text">บ้านเลขที่ :</span>
</div>
<input type="text" class="form-control" name="homeNo">
</div>
<div class="input-group mb-3 input-group">
<div class="input-group-prepend">
<span class="input-group-text">หมู่ที่ :</span>
</div>
<input type="text" class="form-control" size="10" name="mu" required>
<!-- <select class="form-control" id="birth_month" name="mu" required>
<option value="">-เลือก-</option>
<option value="00">0</option>
<option value="01">1</option>
<option value="02">2</option>
<option value="03">3</option>
<option value="04">4</option>
<option value="05">5</option>
<option value="06">6</option>
<option value="07">7</option>
<option value="08">8</option>
<option value="09">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
</select> -->
</div>
<div class="input-group mb-3 input-group">
<div class="input-group-prepend">
<span class="input-group-text">อำเภอ : </span>
</div>
<select name="amphure_id" id="amphure" class="form-control" required>
<option value="">-เลือกอำเภอ-</option>
<?php while($result = mysqli_fetch_assoc($query)): ?>
<option value="<?=$result['id']?>" ><?=$result['name_th']?></option>
<?php endwhile; ?>
</select>
</div>
<div class="input-group mb-3 input-group">
<div class="input-group-prepend">
<span class="input-group-text">ตำบล : </span>
</div>
<select name="district_id" id="district" class="form-control" required>
<option value="">-เลือกตำบล-</option>
</select>
</div>
<div class="input-group mb-3 input-group">
<div class="input-group-prepend">
<span class="input-group-text">โทรศัพท์มือถือ : </span>
</div>
<input type="text" class="form-control" name="tel" required>
</div>
<div class="input-group mb-3 input-group">
<div class="input-group-prepend">
<span class="input-group-text">อยูในเขตเทศบาล/อบต.</span>
</div>
<select id="select-testing" class="selectpicker" data-live-search="true" title="กรุณาเลือก" name="obt" required>
<!-- <select class="form-control" id="obt" name="obt" required> -->
<option value="">-เลือกหน่วยงาน-</option>
<?php
// include('connect.php');
$sql0 = "SELECT * FROM tesaban WHERE province='$province' group by tcode";
$query0 = mysqli_query($conn, $sql0);
while ($result0 = mysqli_fetch_assoc($query0)):
$obtx = $result0['tcode'];
if ($tcode == $obtx) { $obt0 = 'selected'; } else { $obt0 = ''; }
?>
<option value="<?=$result0['tcode']?>" <?=$obt0?>><?php echo "[".$result0['ampname']."] ".$result0['hospname']; ?></option>
<?php endwhile; ?>
</select>
</div>
<div class="input-group mb-3 input-group">
<div class="input-group-prepend">
<span class="input-group-text">อยูในเขตรพ.สต.</span>
</div>
<select id="select-testing" class="selectpicker" data-live-search="true" title="กรุณาเลือก" name="pcu">
<option value="">-เลือกหน่วยงาน-</option>
<?php
// include('connect.php');
$sql0 = "SELECT * FROM office WHERE provid='$province' and off_type IN('03', '04', '06', '07','08', '09')";
$query0 = mysqli_query($conn, $sql0);
while ($result0 = mysqli_fetch_assoc($query0)):
$pcux = $result0['off_id'];
if ($off_id == $pcux) { $pcu0 = 'selected'; } else { $pcu0 = ''; }
?>
<option value="<?=$result0['off_id']?>" <?=$pcu0?>><?php echo "[".$result0['distid']."] ".$result0['off_name']; ?></option>
<?php endwhile; ?>
</select>
</div>
</div>
<div class="card">
<div class="card-header">
<h5>ข้อมูลเอกสาร</h5>
<div>
<div class="input-group mb-3 input-group">
<div class="input-group-prepend">
<span class="input-group-text">แบบคำขอมีบัตรประจำตัวคนพิการ : </span>
</div>
<input type="file" class="form-control" name="fileDSCard" <?=$dscard?>>
</div>
</div>
<div class="input-group mb-3 input-group">
<div class="input-group-prepend">
<span class="input-group-text">หนังสือให้คำยินยอม : </span>
</div>
<input type="file" class="form-control bg-info" name="fileConsent" <?=$consent?>>
</div>
<div class="input-group mb-3 input-group">
<div class="input-group-prepend">
<span class="input-group-text">เอกสารรับรองความพิการ : </span>
</div>
<input type="file" class="form-control bg-info" name="fileBook" <?=$book?>>
</div>
<div class="input-group mb-3 input-group">
<div class="input-group-prepend">
<span class="input-group-text">สำเนาบัตรประชาชนคนพิการ : </span>
</div>
<input type="file" class="form-control" name="fileIdCard" <?=$idcard?>>
</div>
<div class="input-group mb-3 input-group">
<div class="input-group-prepend">
<span class="input-group-text">สำเนาทะเบียนบ้านคนพิการ : </span>
</div>
<input type="file" class="form-control" name="fileHome" <?=$home?>>
</div>
<div class="input-group mb-3 input-group">
<div class="input-group-prepend">
<span class="input-group-text">สำเนาบัตรประชาชนผู้ดูแล : </span>
</div>
<input type="file" class="form-control" name="fileIdCard2" <?=$idcard2?>>
</div>
<div class="input-group mb-3 input-group">
<div class="input-group-prepend">
<span class="input-group-text">สำเนาทะเบียนบ้านผู้ดูแล : </span>
</div>
<input type="file" class="form-control" name="fileHome2" <?=$home2?>>
</div>
<div class="input-group mb-3 input-group">
<div class="input-group-prepend">
<span class="input-group-text">รูปถ่ายหน้าตรง สำหรับติดบัตรคนพิการ : </span>
</div>
<input type="file" class="form-control" name="fileFace" <?=$face?>>
</div>
<div class="input-group mb-3 input-group">
<div class="input-group-prepend">
<span class="input-group-text">รูปถ่ายเต็มตัว คนพิการ : </span>
</div>
<input type="file" class="form-control" name="filePict" <?=$pict?>>
</div>
<div class="input-group mb-3 input-group">
<div class="input-group-prepend">
<span class="input-group-text">รูปถ่ายหน้าบัญชีธนาคาร : </span>
</div>
<input type="file" class="form-control" name="fileBank" <?=$bank?>>
</div>
<div class="input-group mb-3 input-group">
<div class="input-group-prepend">
<span class="input-group-text">หนังสือรับรองการเป็นผู้ดูแลคนพิการ : </span>
</div>
<input type="file" class="form-control" name="fileCaregiver" <?=$caregiver?>>
</div>
<div class="input-group mb-3 input-group">
<div class="input-group-prepend">
<span class="input-group-text">หนังสือยินยอมให้เพิ่มหรือเปลี่ยนแปลงผู้ดูแลคนพิการ : </span>
</div>
<input type="file" class="form-control" name="fileCaregiverChange" <?=$caregiverchange?>>
</div>
<div class="input-group mb-3 input-group">
<div class="input-group-prepend">
<span class="input-group-text">หนังสือมอบอำนาจ : </span>
</div>
<input type="file" class="form-control" name="fileAuthorize" <?=$authorize?>>
</div>
<div class="input-group mb-3 input-group">
<div class="input-group-prepend">
<span class="input-group-text">หนังสือนำส่ง : </span>
</div>
<input type="file" class="form-control" name="fileDelivery" <?=$delivery?>>
</div>
<div class="input-group mb-3 input-group">
<div class="input-group-prepend">
<span class="input-group-text">คำขอรับเบี้ยความพิการ : </span>
</div>
<input type="file" class="form-control" name="fileRequestMoney" <?=$requestmoney?>>
</div>
<div class="input-group mb-3 input-group">
<div class="input-group-prepend">
<span class="input-group-text">หลักฐานเซ็นให้คำยินยอมขอรับเบี้ยความพิการ : </span>
</div>
<input type="file" class="form-control" name="fileVDO" >
</div>
</div>
<button type="submit" class="btn btn-success"><span class="glyphicon glyphicon-save"></span>เพิ่มข้อมูล</button>
</div>
<!-- <button onclick="window.close()" class="btn btn-danger btn-sm">ปิด</button> -->
</div>
</div>
</div>
<script src="assets/script.js"></script>
<script src="assets/script0.js"></script>
</div>
</div>
</form>
<?php
}
?>
</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="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="jquery.datetimepicker.full.js"></script> -->
<script type="text/javascript">
// $(function() {
// $.datetimepicker.setLocale('th'); // ต้องกำหนดเสมอถ้าใช้ภาษาไทย และ เป็นปี พ.ศ.
// // กรณีใช้แบบ input
// $("#birth").datetimepicker({
// timepicker:false,
// //defaultDate: '01/07/1922',
// //yearStart: 1922, ดูค่าในเจเอสไฟล์เป็นหลัก
// //yearEnd: 2022,
// format:'d-m-Y', // กำหนดรูปแบบวันที่ ที่ใช้ เป็น 00-00-0000
// //defaultDate: '31/12/2022',
// maxDate: new Date('31/12/2565'),
// //minDate: new Date('2017-12-5'),
// //yearRange: '-200:+0', // last hundred years or
// yearRange: '1950:2025', // specifying a hard coded year range
// lang:'th', // ต้องกำหนดเสมอถ้าใช้ภาษาไทย และ เป็นปี พ.ศ.
// onSelectDate:function(dp,$input){
// var yearT=new Date(dp).getFullYear()-0;
// var yearTH=yearT+543;
// var fulldate=$input.val();
// //var fulldateTH=fulldate.replace(yearT,yearTH);
// var fulldateTH=fulldate.replace(yearT,yearTH);
// $input.val(fulldateTH);
// },
// });
// // กรณีใช้กับ input ต้องกำหนดส่วนนี้ด้วยเสมอ เพื่อปรับปีให้เป็น ค.ศ. ก่อนแสดงปฏิทิน
// $("#birth").on("mouseenter mouseleave",function(e){
// var dateValue=$(this).val();
// if(dateValue!=""){
// var arr_date=dateValue.split("-"); // ถ้าใช้ตัวแบ่งรูปแบบอื่น ให้เปลี่ยนเป็นตามรูปแบบนั้น
// // ในที่นี้อยู่ในรูปแบบ 00-00-0000 เป็น d-m-Y แบ่งด่วย - ดังนั้น ตัวแปรที่เป็นปี จะอยู่ใน array
// // ตัวที่สอง arr_date[2] โดยเริ่มนับจาก 0
// if(e.type=="mouseenter"){
// var yearT=arr_date[2]-543;
// }
// if(e.type=="mouseleave"){
// var yearT=parseInt(arr_date[2])+543;
// }
// dateValue=dateValue.replace(arr_date[2],yearT);
// $(this).val(dateValue);
// }
// });
// });
</script>
<script src="assets/datepicker/js/jquery.js"></script>
<script src="assets/datepicker/js/bootstrap-datepicker.js"></script>
<script src="assets/datepicker/js/bootstrap-datepicker-thai.js"></script>
<script src="assets/datepicker/js/locales/bootstrap-datepicker.th.js"></script>
<script type="text/javascript">
$(function() {
$('#datepicker').datepicker({
format: 'dd-mm-yyyy',
autoclose: true
});
});
</script>
</body>
</html>
<script>
async function get_person(cid) {
// var api_person = md5("https://cloud1-r8way.moph.go.th:3111/api/people/findOne?filter=%7B%22where%22%3A%20%7B%22cid%22%3A%20%22" + cid + "%22%7D%7D&access_token=FpU6RQ0pCrxmgZiU8exsNt2fSDnyOCFe1pRy7kxviShzgv7qRoirNr6lMOwoNTBI");
// const response = await fetch(api_person);
// var data = await response.json();
// console.log(data.fname);
}
</script>