001.
<?php
require_once
(
'function/Thaidate.php'
); ?>
002.
<?php
require_once
(
'function/thaidate-functions.php'
); ?>
003.
<?php date_default_timezone_set(
'Asia/Bangkok'
);?>
004.
005.
<?php
006.
session_start();
007.
008.
009.
010.
include
(
'connects/conuser.php'
);
011.
$m_id
=
$_SESSION
[
'm_id'
];
012.
$m_level
=
$_SESSION
[
'm_level'
];
013.
if
(
$m_level
!=
'2'
){
014.
Header(
"Location: logout.php"
);
015.
}
016.
017.
$queryemp
=
"SELECT * FROM user_emp WHERE m_id=$m_id"
;
018.
$resultm
= mysqli_query(
$con
,
$queryemp
)
or
die
(
"Error in query: $queryemp "
. mysqli_error(
$con
));
019.
$rowm
= mysqli_fetch_array(
$resultm
);
020.
021.
$timenow
=
date
(
'H:i:s'
);
022.
$datenow
=
date
(
'Y-m-d'
);
023.
024.
025.
026.
027.
028.
?>
029.
030.
<?php
031.
include
(
'connects/connect.php'
);
032.
$conn
= mysqli_connect(
"localhost"
,
"root"
,
""
,
"mmtc_bookout64"
)
033.
or
die
(
"Error: "
. mysqli_error(
$conn
));
034.
mysqli_query(
$conn
,
"SET NAMES 'utf8' "
);
035.
036.
$query
=mysqli_query(
$conn
,
"SELECT COUNT(*) FROM bookout_2565 WHERE bookID ORDER BY bookID DESC"
);
037.
$row
= mysqli_fetch_row(
$query
);
038.
039.
$rows
=
$row
[0];
040.
041.
$page_rows
= 10;
042.
043.
$last
=
ceil
(
$rows
/
$page_rows
);
044.
045.
if
(
$last
< 1){
046.
$last
= 1;
047.
}
048.
049.
$pagenum
= 1;
050.
051.
if
(isset(
$_GET
[
'pn'
])){
052.
$pagenum
= preg_replace(
'#[^0-9]#'
,
''
,
$_GET
[
'pn'
]);
053.
}
054.
055.
if
(
$pagenum
< 1) {
056.
$pagenum
= 1;
057.
}
058.
else
if
(
$pagenum
>
$last
) {
059.
$pagenum
=
$last
;
060.
}
061.
062.
$limit
=
'LIMIT '
.(
$pagenum
- 1) *
$page_rows
.
','
.
$page_rows
;
063.
064.
065.
066.
$nquery
=mysqli_query(
$conn
,
"SELECT bookID, datebk, Numberbk, Sudbk, NameFrom, NameTo from bookout_2565 ORDER BY bookID DESC $limit"
);
067.
068.
069.
070.
$paginationCtrls
=
''
;
071.
072.
if
(
$last
!= 1){
073.
074.
if
(
$pagenum
> 1) {
075.
$previous
=
$pagenum
- 1;
076.
$paginationCtrls
.=
'<a href="'
.
$_SERVER
[
'PHP_SELF'
].
'?pn='
.
$previous
.
'" class="btn btn-info">Previous</a> '
;
077.
078.
for
(
$i
=
$pagenum
-4;
$i
<
$pagenum
;
$i
++){
079.
if
(
$i
> 0){
080.
$paginationCtrls
.=
'<a href="'
.
$_SERVER
[
'PHP_SELF'
].
'?pn='
.
$i
.
'" class="btn btn-primary">'
.
$i
.
'</a> '
;
081.
}
082.
}
083.
}
084.
085.
$paginationCtrls
.=
''
.
$pagenum
.
' '
;
086.
087.
for
(
$i
=
$pagenum
+1;
$i
<=
$last
;
$i
++){
088.
$paginationCtrls
.=
'<a href="'
.
$_SERVER
[
'PHP_SELF'
].
'?pn='
.
$i
.
'" class="btn btn-primary">'
.
$i
.
'</a> '
;
089.
if
(
$i
>=
$pagenum
+4){
090.
break
;
091.
}
092.
}
093.
094.
if
(
$pagenum
!=
$last
) {
095.
$next
=
$pagenum
+ 1;
096.
$paginationCtrls
.=
' <a href="'
.
$_SERVER
[
'PHP_SELF'
].
'?pn='
.
$next
.
'" class="btn btn-info">Next</a> '
;
097.
}
098.
}
099.
?>
100.
101.
102.
<!DOCTYPE html>
103.
<html lang=
"en"
>
104.
<head>
105.
<meta charset=
"UTF-8"
>
106.
<meta http-equiv=
"X-UA-Compatible"
content=
"IE=edge"
>
107.
<meta name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
108.
<link href=
"https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/css/bootstrap.min.css"
rel=
"stylesheet"
integrity=
"sha384-F3w7mX95PdgyTmZZMECAngseQB83DfGTowi0iMjiWaeVhAn4FJkqJByhZMI3AhiU"
crossorigin=
"anonymous"
>
109.
<title>ระบบขอเลขหนังสือออก</title>
110.
111.
<!--style manu-->
112.
<style>
113.
body {
114.
margin: 0;
115.
background-color:#fff;
116.
}
117.
118.
ul {
119.
list-style-type: none;
120.
margin: 0;
121.
padding: 0;
122.
width: 8%;
123.
background-color: ;
124.
position: fixed;
125.
height: 100%;
126.
overflow: auto;
127.
}
128.
129.
li a {
130.
display: block;
131.
color: #000;
132.
padding: 8px 0 8px 14px;
133.
text-decoration: none;
134.
}
135.
136.
li a.active {
137.
background-color: #4CAF50;
138.
color: white;
139.
}
140.
141.
li a:hover:not(.active) {
142.
background-color: #555 ;
143.
color: white;
144.
}
145.
</style>
146.
</head>
147.
<body>
148.
<div
class
=
"container"
>
149.
<div
class
=
"row"
>
150.
<div
class
=
"col col-sm-12"
>
151.
<div
class
=
"่jumbotron"
style=
"background-image:url('img/head1.png');color:#fff;height:180px ;"
>
152.
</div>
153.
</div>
154.
</div>
155.
<div
class
=
"container"
>
156.
<div
class
=
"row"
>
157.
158.
<div
class
=
"col col-sm-2"
>
159.
<br>
160.
<br>
161.
<center><img src=
"img/<?php echo $rowm['m_img'];?>"
width=
'30%'
></center>
162.
163.
<br>
164.
<b>
165.
<center><?php
echo
$rowm
[
'm_name'
].
' '
.
$rowm
[
'm_lastname'
];?></center>
166.
<br>
167.
<center>ตำแหน่ง : <?php
echo
$rowm
[
'm_position'
];?></center>
168.
</b>
169.
<br>
170.
<center><a href=
"listname.php"
class
=
"btn btn-warning"
>รายชื่อสมาชิก </a></center>
171.
<br>
172.
<center><a href=
"formRegister.php"
class
=
"btn btn-info"
>+ เพิ่มสมาชิก </a></center>
173.
<br>
174.
<center><a href=
"logout.php"
class
=
"btn btn-danger"
> logout </a></center>
175.
</div>
176.
177.
178.
<div
class
=
"col-lg-10"
style=
"background-color:#fff;padding:1px 18px;height:1000px;"
>
179.
<br>
180.
<h3>รายชื่อหนังสือ <a href=
"aformAdd.php"
class
=
"btn btn-info"
>+ ขอเลขหนังสือออก </a></h3>
181.
<h4><?php
echo
thaidate(
'วันlที่ j F Y'
); ?></h4>
182.
<form action=
"show.php"
method=
"GET"
class
=
"form-horizontal"
>
183.
<div
class
=
"form-group row"
>
184.
<div
class
=
"col col-sm-5"
>
185.
<input type=
"text"
name=
"q"
class
=
"form-control"
required placeholder=
"ค้นหาข้อมูล"
>
186.
</div>
187.
<div
class
=
"col col-sm-3"
>
188.
<button type=
"submit"
class
=
"btn btn-primary"
>ค้นหา </button>
189.
</div>
190.
</div>
191.
192.
<font color=
"FF0000"
><pre>**ใส่เลขที่หนังสือหรือวันที่ขอเลขหนังสือ เช่น 111/2564, 22 มกราคม 2564</pre></font>
193.
<table
class
=
"table table-striped table-hover table-responsive table-bordered"
>
194.
<thead>
195.
<tr>
196.
<th width=
"3%"
>ลำดับ</th>
197.
<th width=
"15%"
>วันที่ขอเลขหนังสือ</th>
198.
<th width=
"10%"
>เลขที่หนังสือ</th>
199.
<th width=
"15%"
>เรื่อง</th>
200.
<th width=
"20%"
>จาก</th>
201.
<th width=
"20%"
>ถึง</th>
202.
<th width=
"5%"
>แก้ไข</th>
203.
<th width=
"5%"
>ลบ</th>
204.
205.
</tr>
206.
</thead>
207.
208.
<tbody>
209.
210.
211.
<?php
212.
while
(
$crow
= mysqli_fetch_array(
$nquery
)){
213.
?>
214.
<tr>
215.
<td><?php
echo
$crow
[
'bookID'
]; ?></td>
216.
<td><?php
echo
$crow
[
'datebk'
] ;?></td>
217.
<td><?php
echo
$crow
[
'Numberbk'
];?><?php
echo
thaidate(
'/ Y'
); ?></td>
218.
<td><?php
echo
$crow
[
'Sudbk'
]; ?></td>
219.
<td><?php
echo
$crow
[
'NameFrom'
]; ?></td>
220.
<td><?php
echo
$crow
[
'NameTo'
]; ?></td>
221.
222.
<td><a href=
"aformEdit.php?bookID=<?php echo $crow['bookID'];?>"
class
=
"btn btn-warning btn-sm"
>แก้ไข</a></td>
223.
<td><a href=
"adel.php?bookID=<?php echo $crow['bookID'];?>"
class
=
"btn btn-danger btn-sm"
onclick=
"return confirm('ยืนยันการลบข้อมูล !!');"
>ลบ</a></td>
224.
</tr>
225.
<?php } ?>
226.
</tbody>
227.
</table>
228.
<div
class
=
"col col-sm-5"
><div id=
"pagination_controls"
><?php
echo
$paginationCtrls
; ?></div>
229.
</div>
230.
</div>
231.
</div>
232.
</div>
233.
</div> </form>
234.
236.
<script src=
"/bootstrap/js/bootstrap.min.js"
></script>
237.
</form>
238.
239.
</div>
240.
</div>
241.
</div>
243.
<script src=
"https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"
integrity=
"sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo"
crossorigin=
"anonymous"
></script>
245.
246.
</body>
247.
</html>