001.
<?
include
(
"sess.php"
);
002.
if
(
$id_sent
){
003.
$sql
=
"select * from tbl_member where id ='$id_sent' "
;
004.
$re
=mysql_query(
$sql
);
005.
$data
=mysql_fetch_array(
$re
);
006.
$sql_type
=mysql_query(
"select * from type_program where id='$data[depart]' "
);
007.
$data_type
=mysql_fetch_array(
$sql_type
);
008.
}
009.
if
(
$id_sent2
){
010.
$sql2
=
"select * from tbl_book where id ='$id_sent2' "
;
011.
012.
$re2
=mysql_query(
$sql2
);
013.
$data2
=mysql_fetch_array(
$re2
);
014.
$sql2_type
=mysql_query(
"select * from type_book where id='$data2[book_type]' "
);
015.
016.
$data2_type
=mysql_fetch_array(
$sql2_type
);
017.
$sql
=
"select * from tbl_member where id ='$id_sent2_' "
;
018.
$re
=mysql_query(
$sql
);
019.
$data
=mysql_fetch_array(
$re
);
020.
$sql_type
=mysql_query(
"select * from type_program where id='$data[depart]' "
);
021.
$data_type
=mysql_fetch_array(
$sql_type
);
022.
}
023.
?><meta http-equiv=
"Content-Type"
content=
"text/html; charset=windows-874"
/>
024.
<link rel=
"stylesheet"
type=
"text/css"
href=
"../style.css"
>
025.
<style type=
"text/css"
>
026.
<!--
027.
#Layer1 {
028.
position:absolute;
029.
left:13px;
030.
top:48px;
031.
width:87px;
032.
height:28px;
033.
z-index:1;
034.
}
035.
#Layer2 {
036.
position:absolute;
037.
left:11px;
038.
top:67px;
039.
width:715px;
040.
height:159px;
041.
z-index:1;
042.
}
043.
.style4 {color: #006600}
044.
.style41 {
045.
font-family:
"Microsoft Sans Serif"
;
046.
font-size: 14px;
047.
font-weight: normal;
048.
color: #000000;
049.
background-color: #FFFFFF;
050.
text-align: center;
051.
}
052.
.style42 {color: #FF0000}
053.
-->
054.
</style>
055.
056.
<table width=
"800"
border=
"0"
align=
"center"
>
057.
<tr>
058.
<td height=
"102"
><fieldset>
059.
<legend
class
=
"textstyle3"
>ข้อมูลนักเรียน</legend>
060.
<table width=
"800"
border=
"0"
>
061.
<tr>
062.
<td width=
"166"
height=
"38"
class
=
"text1"
><div align=
"right"
class
=
"style4"
><span
class
=
"style41"
>รหัสนักเรียน</span> :</div></td>
063.
<td width=
"236"
><div align=
"left"
>
064.
<form id=
"form1"
name=
"form1"
method=
"post"
action=
"index.php?module=BookBorow"
>
065.
<label>
066.
<input name=
"id_sent"
type=
"text"
id=
"id_sent"
value=
"<?=$data[no_id]?>"
readonly=
"readonly"
/>
067.
</label>
068.
<?
if
(
$sent_id
!=
""
){?>
069.
<label>
070.
<input type=
"submit"
class
=
"menuclick2"
name=
"submit"
value=
"5"
id=
"submit"
/>
071.
</label>
072.
<? }?>
073.
<a href=
"javascript:NewWindow('<? echo"
search_member.php
";?>','newpopup','600','300','center','front');"
><span
class
=
"menuclick"
> ค้นหา </span></a>
074.
</form>
075.
<label></label>
076.
</div></td>
077.
<td width=
"89"
class
=
"text1"
><div align=
"right"
><span
class
=
"style41"
>ชื่อ - สกุล</span> :</div></td>
078.
<td width=
"291"
><div align=
"left"
>
079.
<input name=
"name"
type=
"text"
disabled=
"disabled"
id=
"name"
value=
"<? echo "
$data
[intro]
$data
[name]
";?>"
/>
080.
</div></td>
081.
</tr>
082.
<tr>
083.
084.
<td
class
=
"text1"
><div align=
"right"
><span
class
=
"style41"
>สถานะ</span> :</div></td>
085.
<td><div align=
"left"
>
086.
<input name=
"textfield3"
type=
"text"
disabled=
"disabled"
id=
"textfield3"
value=
"<?=$data[status_]?>"
/>
087.
</div></td>
088.
</tr>
089.
</table>
090.
</fieldset></td>
091.
</tr>
092.
<tr>
093.
<td></td>
094.
</tr>
095.
<tr>
096.
<td>
097.
<?
098.
function
DateDiff(
$strDate1
,
$strDate2
)
099.
{
100.
return
(
strtotime
(
$strDate2
) -
strtotime
(
$strDate1
))/ ( 60 * 60 * 24 );
101.
}
102.
$num_ber
=1;
103.
$se
=
"select * from bookborow where member_id= '$id_sent' and (status_borrow='1' or status_borrow='2') "
;
104.
105.
$se_
=mysql_query(
$se
);
106.
$d_d
=
date
(
"d-m-Y"
);
107.
while
(
$be_
=mysql_fetch_array(
$se_
)){
108.
109.
$date_cal
= DateDiff(
"$be_[date_sent]"
,
"$d_d"
);
110.
if
(
$date_cal
> 0 ){
111.
$a1
=1;
112.
$num_cal
+=
$date_cal
;
113.
$date_cal_
+=
$date_cal
* 5;
114.
}
115.
}
if
(
$a1
!=1){?>
116.
117.
<fieldset>
118.
<legend
class
=
"textstyle3"
>ข้อมูลหนังสือ</legend>
119.
<table width=
"800"
border=
"0"
>
120.
<tr>
121.
<td width=
"165"
height=
"32"
class
=
"text1"
><div align=
"right"
><span
class
=
"style41"
>เลข ISBN</span> :</div></td>
122.
<td width=
"245"
><div align=
"left"
>
123.
<form id=
"form2"
name=
"form2"
method=
"post"
action=
"index.php?module=BookBorow"
>
124.
<label>
125.
<input type=
"hidden"
name=
"id_sent2_"
id=
"id_sent2_"
value=
"<?=$id_sent2_?>"
/>
126.
<input name=
"id_sent2"
type=
"text"
class
=
"style41"
id=
"id_sent2"
value=
"<?=$data2[no_id]?>"
readonly=
"readonly"
/>
127.
</label>
128.
<?
if
(
$sent_id2
!=
""
){?>
129.
<label>
130.
131.
<input type=
"submit"
class
=
"menuclick2"
value=
" "
/>
132.
</label>
133.
<? }?>
134.
135.
<?
if
(
$id_sent
!=
""
or
$id_sent2
!=
""
){
136.
if
(
$id_sent
){
137.
$bb
=
"search_book.php?id_sent1=$id_sent"
;}
138.
if
(
$id_sent2_
){
139.
$bb
=
"search_book.php?id_sent1=$id_sent2_"
;}
140.
?>
141.
<a href=
"javascript:NewWindow('<? echo $bb;?>','newpopup','600','300','center','front');"
><span
class
=
"menuclick"
> ค้นหา </span></a><? }?>
142.
</form>
143.
<label></label>
144.
</div></td>
145.
<td width=
"83"
class
=
"text1"
><div align=
"right"
><span
class
=
"style41"
>ชื่อหนังสือ</span> :</div></td>
146.
<td width=
"289"
><div align=
"left"
>
147.
<input name=
"name2"
type=
"text"
disabled=
"disabled"
class
=
"style41"
id=
"name2"
value=
"<? echo "
$data2
[book_name]
";?>"
/>
148.
</div></td>
149.
</tr>
150.
<tr>
151.
<td height=
"38"
class
=
"text1"
><div align=
"right"
><span
class
=
"style41"
>ประเภทหนังสือ</span> :</div></td>
152.
<td><div align=
"left"
>
153.
<input name=
"textfield4"
type=
"text"
disabled=
"disabled"
class
=
"style41"
id=
"textfield4"
value=
"<?=$data2_type[name]?>"
/>
154.
</div></td>
155.
<td
class
=
"text1"
><div align=
"right"
><span
class
=
"style41"
>ผู้แต่ง</span> :</div></td>
156.
<td><div align=
"left"
>
157.
<input name=
"name3"
type=
"text"
disabled=
"disabled"
class
=
"style41"
id=
"name3"
value=
"<? echo "
$data2
[book_author]
";?>"
/>
158.
</div></td>
159.
</tr>
160.
<tr>
161.
<td height=
"34"
class
=
"text1"
><div align=
"right"
><span
class
=
"style41"
>จำนวน</span> :</div></td>
162.
<td><div align=
"left"
>
163.
<input name=
"name5"
type=
"text"
disabled=
"disabled"
class
=
"style41"
id=
"name5"
value=
"<? echo "
$data2
[book_num]
";?>"
size=
"10"
/>
164.
</div></td>
165.
<td
class
=
"text1"
><div align=
"right"
><span
class
=
"style41"
>กำหนดคืน</span> :</div></td>
166.
<td><div align=
"left"
>
167.
<?
168.
169.
$d
=
date
(
"d-m-Y"
);
170.
$dd
=
date
(
"D"
);
171.
if
(
$dd
==
"Thu"
){
172.
$daydiff
=
"+4 day"
;
173.
}
else
{
174.
$daydiff
=
"+3 day"
;
175.
}
176.
177.
178.
if
(
$id_sent2
){
$d
=
date
(
'd-m-Y'
,
strtotime
(
$daydiff
));}
179.
?>
180.
<input name=
"date_sent"
type=
"text"
disabled=
"disabled"
class
=
"style41"
id=
"date_sent"
value=
"<?=$d ;?>"
/>
181.
</div></td>
182.
</tr>
183.
<tr>
184.
<td height=
"31"
class
=
"text1"
></td>
185.
<td colspan=
"2"
>
186.
<form id=
"form3"
name=
"form3"
method=
"post"
action=
""
>
187.
<div align=
"left"
>
188.
<input type=
"hidden"
name=
"but"
value=
"1"
/>
189.
<input type=
"hidden"
name=
"id1"
value=
"<?=$id_sent2_;?>"
/>
190.
<input type=
"hidden"
name=
"id2"
value=
"<?=$id_sent2;?>"
/>
191.
192.
<?
if
(
$id_sent2
!=
""
){?>
193.
<input name=
"button"
type=
"submit"
class
=
"menuclick"
id=
"button"
value=
"เพิ่มรายการ"
/>
194.
<? }?>
195.
</div>
196.
</form>
197.
</td>
198.
<td> </td>
199.
</tr>
200.
</table>
201.
</fieldset>
202.
<? }?>
203.
</td>
204.
</tr>
205.
<tr>
206.
<td height=
"21"
>
207.
<?
208.
if
(
$a1
==1){
209.
?>
210.
<fieldset>
211.
<legend
class
=
"menuclick"
>ข้อมูลการค้างชำระค่าปรับ</legend>
212.
<span
class
=
"inputproject"
>คืนหนังสือช้ากว่าระยะเวลาที่กำหนดต้องชำระค่าปรับ</span>
213.
214.
<a href=
"javascript:NewWindow('<? echo"
frm_payment.php?pay=
$id_sent
";?>','newpopup','650','400','center','front');"
>
215.
<span
class
=
"menuclick"
> ดูรายละเอียดยอดค้างชำระ </span></a>
216.
</fieldset><? }?></td>
217.
</tr>
218.
219.
</table>
220.
<?
if
(
$a1
!=1){?>
221.
<table width=
"800"
border=
"0"
align=
"center"
>
222.
<tr>
223.
<td>
224.
<fieldset>
225.
<legend
class
=
"textstyle3"
>รายการยืม</legend>
226.
<table width=
"800"
border=
"0"
>
227.
<tr bgcolor=
"#E7F4FF"
>
228.
<td width=
"73"
height=
"28"
bgcolor=
"#E7F4FF"
class
=
"menuclick"
><div align=
"center"
class
=
"inputproject"
>
229.
<div align=
"center"
>รายการที่</div>
230.
</div></td>
231.
<td width=
"82"
class
=
"menuclick"
><div align=
"center"
class
=
"inputproject"
>
232.
<div align=
"center"
>เลข ISBN</div>
233.
</div></td>
234.
<td width=
"210"
bgcolor=
"#E7F4FF"
class
=
"menuclick"
><div align=
"center"
class
=
"inputproject"
>
235.
<div align=
"center"
>ชื่อหนังสือ</div>
236.
</div></td>
237.
<td width=
"182"
class
=
"menuclick"
><div align=
"center"
class
=
"inputproject"
>
238.
<div align=
"center"
>ประเภทหนังสือ</div>
239.
</div></td>
240.
<td width=
"58"
bgcolor=
"#E7F4FF"
class
=
"menuclick"
><div align=
"center"
class
=
"inputproject"
>
241.
<div align=
"center"
>จำนวน</div>
242.
</div></td>
243.
<td width=
"105"
bgcolor=
"#E7F4FF"
class
=
"menuclick"
><div align=
"center"
class
=
"inputproject"
>
244.
<div align=
"center"
>กำหนดคืน</div>
245.
</div></td>
246.
<td width=
"60"
class
=
"menuclick"
><div align=
"center"
class
=
"inputproject"
>
247.
<div align=
"center"
>ยกเลิก</div>
248.
</div></td>
249.
</tr>
250.
<?
251.
252.
if
(
$id_sent2_
){
253.
$sql_
=
"select * from bookborow where member_id= '$id_sent2_' and status_borrow='1' "
;
254.
255.
}
else
if
(
$id_sent
){
256.
$sql_
=
"select * from bookborow where member_id= '$id_sent' and status_borrow='1' "
;
257.
}
else
{
258.
$sql_
=
"select * from bookborow where 0 "
;
259.
}
260.
261.
262.
$re_
=mysql_query(
$sql_
);
$i
=1;
263.
while
(
$data_
=mysql_fetch_array(
$re_
)){
264.
$sql_book
=mysql_query(
"select * from tbl_book where id='$data_[book_id]' "
);
265.
$data_book
=mysql_fetch_array(
$sql_book
);
266.
$sql_type
=mysql_query(
"select * from type_book where id='$data_book[book_type]' "
);
267.
$data_type
=mysql_fetch_array(
$sql_type
);
268.
?>
269.
<tr>
270.
<td height=
"28"
bgcolor=
"#FFFFCC"
class
=
"inputtext"
><div align=
"center"
>
271.
<?=
$i
;?>
272.
</div></td>
273.
<td height=
"28"
bgcolor=
"#FFFFCC"
class
=
"inputtext"
><div align=
"center"
>
274.
<?=
$data_book
[no_id];?>
275.
</div></td>
276.
<td bgcolor=
"#FFFFCC"
class
=
"inputtext"
><div align=
"left"
>
277.
<?=
$data_book
[book_name];?>
278.
</div></td>
279.
<td bgcolor=
"#FFFFCC"
class
=
"inputtext"
><div align=
"left"
>
280.
<?=
$data_type
[name];?>
281.
</div></td>
282.
<td bgcolor=
"#FFFFCC"
class
=
"inputtext"
><div align=
"center"
>1</div></td>
283.
<td bgcolor=
"#FFFFCC"
class
=
"inputtext"
><div align=
"center"
>
284.
<?=
$data_
[date_sent];?>
285.
</div></td>
286.
<td bgcolor=
"#FFFFCC"
class
=
"inputtext"
><div align=
"center"
>
287.
<a href=
"<? echo"
index.php?module=BookBorow&chk=
$data_
[id]&id_sent=
$data_
[member_id]&id_book=
$data_
[book_id]
";?> "
>
288.
<img src=
"images/cancel.gif"
width=
"16"
height=
"16"
border=
"0"
/></a>
289.
</div></td>
290.
</tr> <?
$i
++; }?>
291.
<tr>
292.
<td height=
"28"
colspan=
"7"
bgcolor=
"#FFFFCC"
class
=
"menuclick"
><div align=
"right"
><span
class
=
"style42"
>รวมหนังสือที่ยืมทั่งหมด</span> :<span
class
=
"style42"
>
293.
<?=
$i
-1;?>
294.
เล่ม </span></div> <div align=
"left"
></div></td>
295.
</tr>
296.
</table>
297.
</fieldset>
298.
</td>
299.
</tr>
300.
</table>
301.
<? }?>
302.
<div align=
"center"
></div>
303.
<?
if
(
$but
==1){
304.
$d
=
date
(
'd-m-Y'
,
strtotime
(
"+3 day"
));
305.
$date_borrow
=
date
(
"d-m-Y"
);
306.
$sql_in
=
"insert bookborow values('','$id1','$id2','$date_borrow','$d','1')"
;
307.
308.
$sql_insert
=mysql_query(
$sql_in
);
309.
310.
$sq
=
"select * from tbl_book where id='$id2'"
;
311.
$sqa
=mysql_query(
$sq
);
312.
$data
=mysql_fetch_array(
$sqa
);
313.
$sql_up
=
"update tbl_book set book_num=$data[book_num]-1 where id='$id2' "
;
314.
315.
mysql_query(
$sql_up
);
316.
317.
if
(
$sql_insert
){
echo
"<script>alert('เพิ่มรายการหนังสือเรียบร้อยแล้ว')</script>"
;
echo
"<script>window.location='index.php?module=BookBorow& id_sent=$id1 '</script>"
;}
318.
}?>
319.
<?
if
(
$chk
!=
""
){
320.
$sql_insert
=mysql_query(
"delete from bookborow where id='$chk' "
);
321.
$sq
=
"select * from tbl_book where id='$id_book'"
;
322.
323.
$sqa
=mysql_query(
$sq
);
324.
$data
=mysql_fetch_array(
$sqa
);
325.
$sql_up
=
"update tbl_book set book_num=$data[book_num]+1 where id='$id_book' "
;
326.
mysql_query(
$sql_up
);
327.
328.
if
(
$sql_insert
){
echo
"<script>alert('ระบบได้ลบรายการที่เลือกเรียบร้อยแล้ว')</script>"
;
echo
"<script>window.location='index.php?module=BookBorow& id_sent=$id_sent '</script>"
;}
329.
}?>
330.
<?
331.
332.
if
(
$pay
!=
""
){
333.
$sql_up
=
"update bookborow set status_borrow=3 where member_id='$pay' and status_borrow=2 "
;
echo
$sql_up
;
exit
();
334.
mysql_query(
$sql_up
);
335.
336.
if
(
$sql_insert
){
echo
"<script>alert('ระบบได้รับเรื่องการชำระเงินเงินเรียบร้อยแล้ว')</script>"
;
echo
"<script>window.location='index.php?module=BookBorow& id_sent=$pay '</script>"
;}
337.
}?>