5353
5454$(document).ready(function(){
5555
56- $(".search").keyup(function()
56+ $(".search").keyup(function()
5757{
5858var searchbox = $(this).val();
5959var dataString = 'searchword='+ searchbox;
7272$("#display").html(h).hide();
7373 }});
7474
75-
75+
7676}
7777else
7878{
8989 }});
9090
9191
92- }return false;
92+ }return false;
9393
9494
9595});
9898jQuery(function($){
9999 $("#searchbox").Watermark("Search StudentID, Name");
100100 });
101-
102-
103-
101+
102+
103+
104104 </script>
105105 <script language="javascript" type="text/javascript">
106106function timing()
@@ -153,7 +153,7 @@ function timing()
153153<div style=" margin-left:7px; margin-top:13px; color:#030; font-size:15px; font-family:Verdana, Geneva, sans-serif; font-weight:bold;float:left">Error</div>
154154</div>
155155
156- <div style="font-size:15px; padding-top:40px; margin-left:20px; margin-right:20px; font-family:Arial, Helvetica, sans-serif; text-align:center">Tulo sa ang limit karun
156+ <div style="font-size:15px; padding-top:40px; margin-left:20px; margin-right:20px; font-family:Arial, Helvetica, sans-serif; text-align:center">You cannot issue more books.
157157</div>
158158
159159<div class="btnbox" id="closeerror">
@@ -199,7 +199,7 @@ function timing()
199199.dewey{
200200 font-size:20px;
201201 font-family:Arial, Helvetica, sans-serif;
202-
202+
203203 font-weight:bold;}
204204 hr{
205205 background:#999;
@@ -253,7 +253,7 @@ function timing()
253253$ get =mysql_fetch_array ($ rs );
254254
255255 } ?>
256-
256+
257257<table width="420" border="0" style="font-size:12px; font-family:Arial, 'Arial Black', 'Arial Narrow'; font-weight:bold;border:1px inset #999; margin-top:5px; margin-left:20px; float:left;">
258258</tr>
259259<tr><td>Name</td><td>Card No.</td>
@@ -267,47 +267,12 @@ function timing()
267267</tr>
268268</table>
269269<table border="0" wi style="font-size:12px; font-family:Arial, 'Arial Black', 'Arial Narrow'; font-weight:bold; border:inset #999 1px;width: 420px; margin-top:10px; margin-bottom:20px; float:left; margin-left:20px;">
270- <tr><td colspan="3">Book ID </td></tr>
270+ <tr><td colspan="3">Search Book </td></tr>
271271<tr>
272272<td colspan="3">
273- <select
274- <?php if (isset ($ _GET ['card_no ' ])) {?>
275- <?php }else { ?> disabled="disabled"<?php } ?> name="classID" style=" padding:4px;" class="com" onChange="display(this.value)">
276- <option ></option>
277- <?php if (isset ($ _GET ['book_id ' ])){
278- $ res =mysql_query ("select b.book_id, title, author_name from book b JOIN book_authors ba ON b.book_id = ba.book_id where b.book_id= $ _GET [book_id]" );
279- $ r =mysql_fetch_array ($ res );
280-
281- } ?>
282-
283- <?php
284-
285- include ('config.php ' );
286- $ sql ="SELECT * FROM bookclass " ;
287- $ rs =mysql_query ($ sql );
288- $ class =0 ;
289-
290- while ($ row =mysql_fetch_array ($ rs )){
291- $ class ++;
292- ?>
293- <option
294- <?php
295- if ($ r ['bookclass ' ]==$ row ['classid ' ]){
296- echo 'selected="selected" ' ;
297- }else {}
298- ?>
299- value="<?php
300- echo $ row ['classid ' ];?> ">
301- <?php
302-
303- echo $ row ['classid ' ]." " .$ row ['classname ' ];
304-
305- ?>
306- </option>
307- <?php
308- }
309- ?>
310- </select>
273+ <input
274+ <?php if (isset ($ _GET ['card_no ' ])) { ?>
275+ <?php }else { ?> disabled="disabled"<?php } ?> name="classID" style=" padding:4px;" class="com" onChange="display(this.value)" />
311276
312277</td>
313278</tr>
@@ -356,8 +321,8 @@ function timing()
356321year += 1900
357322}
358323
359- var monthArray = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December")
360-
324+ var monthArray = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December")
325+
361326var dayArray = new Array("Sunday","Monday","Tuesday","Wednesday", "Thursday","Friday","Saturday")
362327
363328document.write( dayArray[day] + ", " + monthArray[month] + " " + date + ", " + year )
@@ -422,23 +387,18 @@ function OpenPopUp(borrowid, pageURL, title,w,h) {
422387 var targetWin = window.open('http://localhost/lib/default.php' + borrowid, 'name', 'location=no,menubar=no,wiscrollbars=no,resizable=no,fullscreen=no,width='+w+', height='+h+', top='+top+', left='+left);
423388 return false;
424389 }
425-
390+
426391
427392</script>
428393<script type="text/javascript">
429- var auto_refresh = setInterval(
430- function ()
431- {
432- $('#ass').load('loadpay.php').fadeIn("slow");
433- }, 1000); // refresh every 10000 milliseconds
434394
435395</script>
436396<span id="ass"></span>
437397
438398</td>
439399<td class="value" align="center" style="width:25px;">
440400 <div id="id" title="Change default value">
441- <a href="" style="margin-right:10px;" id=""
401+ <a href="" style="margin-right:10px;" id=""
442402 onclick="OpenPopUp(id,'','',300,100);" class='trnone'>
443403
444404<img src="icons/b_edit.png" />
@@ -463,22 +423,23 @@ function ()
463423 $ bday = $ _POST ['bday ' ];
464424 $ byear = $ _POST ['byear ' ];
465425 $ duedate = $ byear .'- ' .$ bmonth .'- ' .$ bday .'- ' .date ('H:i:s ' );
466-
467-
426+
427+
468428 $ classid =$ _POST ['classID ' ];
469- $ accNo =$ _POST ['bookid ' ];
429+ $ accNo = explode ("- " , $ _POST ['bookid ' ])[0 ];
430+ $ branch_id = explode ("- " , $ _POST ['bookid ' ])[1 ];
470431 $ studentid =$ _POST ['studentid ' ];
471432 $ dateborrow =$ _POST ['dateborrow ' ];
472433 $ date =$ _POST ['ed ' ];
473434 $ copy =$ _POST ['copy ' ];
474435 $ theDate = isset ($ _REQUEST ["date5 " ]) ? $ _REQUEST ["date5 " ] : "" ;
475436 $ mydate = $ theDate .'- ' .date ("H:i:s " );
476-
437+
477438 $ copies =$ _POST ['copies ' ];
478439 if (isset ($ _POST ['borrow ' ]))
479440{
480441 include ('config.php ' );
481- $ strSQL = "SELECT * FROM tblborrow WHERE studentid = ' $ studentid' and status='Unsigned ' " ;
442+ $ strSQL = "SELECT * FROM book_loans WHERE card_no = ' $ studentid' and date_in = '0000-00-00 ' " ;
482443$ objExec = mysql_query ($ strSQL );
483444$ count =0 ;
484445while ($ row =mysql_fetch_array ($ objExec )){
@@ -492,7 +453,7 @@ function ()
492453});
493454</script>
494455
495- <?php // echo "<div class='error'>tulo ra limit bai </div>";
456+ <?php echo "<div class='error'>You cannot issue more books. </div> " ;
496457 }
497458 elseif (empty ($ classid )){?>
498459 <script>
@@ -509,66 +470,57 @@ function ()
509470</script>
510471 <?php }
511472else {
512- $ strSQL = "SELECT * FROM tblborrow WHERE accNo = ' $ accNo' and studentid = ' $ studentid' and status='Unsigned ' " ;
473+ $ strSQL = "SELECT * FROM book_loans WHERE book_id = ' $ accNo' and card_no = ' $ studentid' and branch_id = $ branch_id and date_in = '0000-00-00 ' " ;
513474$ objExec = mysql_query ($ strSQL );
514- $ row =mysql_fetch_array ($ objExec );
475+ $ row =mysql_fetch_array ($ objExec );
515476if ($ row ){ ?>
516477<script>
517478$(document).ready(function(){
518479 $("#error2").fadeIn(1000);
519480});
520481</script>
521- <?php // echo "<div class='error'>You can borrow only one type of books</div>";
482+ <?php echo "<div class='error'>You can borrow only one type of books</div> " ;
522483 }
523484else {
524- $ sql ="insert into tblborrow (accNo,classid,studentid,dateborrow,duedate,datereturn,status,amount,item ) values(
485+ $ sql ="insert into book_loans (book_id,branch_id,card_no,date_out,due_date,date_in ) values(
525486 ' " .$ accNo ."',
526- ' " .$ classid ."',
487+ ' " .$ branch_id ."',
527488 ' " .$ studentid ."',
528489 ' " .date ('Y-m-d H:i:s ' )."',
529490 ' " .$ mydate ."',
530- ' " .$ date ."',
531- 'Unsigned',
532- ' " .$ _POST ['pay ' ]."',
533- '1'
534-
491+ '0000-00-00'
535492 ) " ;
536-
537493 $ rs_update =mysql_query ($ sql );
538494 if ($ rs_update ){
539495
540496
541- $ upd ="select * from books where accNo =' " .$ _GET ['accNo ' ]."' " ;
497+ $ upd ="select * from book_copies where book_id =' " .$ _GET ['accNo ' ]."' " ;
542498 $ obj = mysql_query ($ upd );
543499$ cop =mysql_fetch_array ($ obj );
544500
545501if (isset ($ _GET ['accNo ' ])){
546-
547- $ get =$ cop ['bookcopies ' ]-1 ;
502+
503+ $ get =$ cop ['no_of_copies ' ]-1 ;
548504}else {
549505
550506$ get =$ copy -1 ;
551507}
552-
553- $ update ="update books set bookcopies =' $ get' where accNo =' $ accNo' " ;
508+
509+ $ update ="update book_copies set no_of_copies =' $ get' where book_id =' $ accNo' " ;
554510 $ objExec = mysql_query ($ update );
555511if ($ objExec ){
556- $ up ="update tblborrower set status='1' where studentid=' $ studentid' " ;
557- $ obj = mysql_query ($ up );
558- $ updateres ="update tblbookreserve set status='0' where accNo=' $ accNo' " ;
559- $ objExec = mysql_query ($ updateres );
560512 ?>
561513
562514 <script>
563515$(document).ready(function(){
564516 $("#success").fadeIn(1000);
565517});
566518</script>
567- <?php
519+ <?php
568520 //echo "Your Borrow has been Registered";
569521 }
570-
571-
522+
523+
572524 }
573525 }
574526}
0 commit comments