53
53
54
54
$(document).ready(function(){
55
55
56
- $(".search").keyup(function()
56
+ $(".search").keyup(function()
57
57
{
58
58
var searchbox = $(this).val();
59
59
var dataString = 'searchword='+ searchbox;
72
72
$("#display").html(h).hide();
73
73
}});
74
74
75
-
75
+
76
76
}
77
77
else
78
78
{
89
89
}});
90
90
91
91
92
- }return false;
92
+ }return false;
93
93
94
94
95
95
});
98
98
jQuery(function($){
99
99
$("#searchbox").Watermark("Search StudentID, Name");
100
100
});
101
-
102
-
103
-
101
+
102
+
103
+
104
104
</script>
105
105
<script language="javascript" type="text/javascript">
106
106
function timing()
@@ -153,7 +153,7 @@ function timing()
153
153
<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>
154
154
</div>
155
155
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.
157
157
</div>
158
158
159
159
<div class="btnbox" id="closeerror">
@@ -199,7 +199,7 @@ function timing()
199
199
.dewey{
200
200
font-size:20px;
201
201
font-family:Arial, Helvetica, sans-serif;
202
-
202
+
203
203
font-weight:bold;}
204
204
hr{
205
205
background:#999;
@@ -253,7 +253,7 @@ function timing()
253
253
$ get =mysql_fetch_array ($ rs );
254
254
255
255
} ?>
256
-
256
+
257
257
<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;">
258
258
</tr>
259
259
<tr><td>Name</td><td>Card No.</td>
@@ -267,47 +267,12 @@ function timing()
267
267
</tr>
268
268
</table>
269
269
<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>
271
271
<tr>
272
272
<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)" />
311
276
312
277
</td>
313
278
</tr>
@@ -356,8 +321,8 @@ function timing()
356
321
year += 1900
357
322
}
358
323
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
+
361
326
var dayArray = new Array("Sunday","Monday","Tuesday","Wednesday", "Thursday","Friday","Saturday")
362
327
363
328
document.write( dayArray[day] + ", " + monthArray[month] + " " + date + ", " + year )
@@ -422,23 +387,18 @@ function OpenPopUp(borrowid, pageURL, title,w,h) {
422
387
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);
423
388
return false;
424
389
}
425
-
390
+
426
391
427
392
</script>
428
393
<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
434
394
435
395
</script>
436
396
<span id="ass"></span>
437
397
438
398
</td>
439
399
<td class="value" align="center" style="width:25px;">
440
400
<div id="id" title="Change default value">
441
- <a href="" style="margin-right:10px;" id=""
401
+ <a href="" style="margin-right:10px;" id=""
442
402
onclick="OpenPopUp(id,'','',300,100);" class='trnone'>
443
403
444
404
<img src="icons/b_edit.png" />
@@ -463,22 +423,23 @@ function ()
463
423
$ bday = $ _POST ['bday ' ];
464
424
$ byear = $ _POST ['byear ' ];
465
425
$ duedate = $ byear .'- ' .$ bmonth .'- ' .$ bday .'- ' .date ('H:i:s ' );
466
-
467
-
426
+
427
+
468
428
$ classid =$ _POST ['classID ' ];
469
- $ accNo =$ _POST ['bookid ' ];
429
+ $ accNo = explode ("- " , $ _POST ['bookid ' ])[0 ];
430
+ $ branch_id = explode ("- " , $ _POST ['bookid ' ])[1 ];
470
431
$ studentid =$ _POST ['studentid ' ];
471
432
$ dateborrow =$ _POST ['dateborrow ' ];
472
433
$ date =$ _POST ['ed ' ];
473
434
$ copy =$ _POST ['copy ' ];
474
435
$ theDate = isset ($ _REQUEST ["date5 " ]) ? $ _REQUEST ["date5 " ] : "" ;
475
436
$ mydate = $ theDate .'- ' .date ("H:i:s " );
476
-
437
+
477
438
$ copies =$ _POST ['copies ' ];
478
439
if (isset ($ _POST ['borrow ' ]))
479
440
{
480
441
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 ' " ;
482
443
$ objExec = mysql_query ($ strSQL );
483
444
$ count =0 ;
484
445
while ($ row =mysql_fetch_array ($ objExec )){
@@ -492,7 +453,7 @@ function ()
492
453
});
493
454
</script>
494
455
495
- <?php // echo "<div class='error'>tulo ra limit bai </div>";
456
+ <?php echo "<div class='error'>You cannot issue more books. </div> " ;
496
457
}
497
458
elseif (empty ($ classid )){?>
498
459
<script>
@@ -509,66 +470,57 @@ function ()
509
470
</script>
510
471
<?php }
511
472
else {
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 ' " ;
513
474
$ objExec = mysql_query ($ strSQL );
514
- $ row =mysql_fetch_array ($ objExec );
475
+ $ row =mysql_fetch_array ($ objExec );
515
476
if ($ row ){ ?>
516
477
<script>
517
478
$(document).ready(function(){
518
479
$("#error2").fadeIn(1000);
519
480
});
520
481
</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> " ;
522
483
}
523
484
else {
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(
525
486
' " .$ accNo ."',
526
- ' " .$ classid ."',
487
+ ' " .$ branch_id ."',
527
488
' " .$ studentid ."',
528
489
' " .date ('Y-m-d H:i:s ' )."',
529
490
' " .$ mydate ."',
530
- ' " .$ date ."',
531
- 'Unsigned',
532
- ' " .$ _POST ['pay ' ]."',
533
- '1'
534
-
491
+ '0000-00-00'
535
492
) " ;
536
-
537
493
$ rs_update =mysql_query ($ sql );
538
494
if ($ rs_update ){
539
495
540
496
541
- $ upd ="select * from books where accNo =' " .$ _GET ['accNo ' ]."' " ;
497
+ $ upd ="select * from book_copies where book_id =' " .$ _GET ['accNo ' ]."' " ;
542
498
$ obj = mysql_query ($ upd );
543
499
$ cop =mysql_fetch_array ($ obj );
544
500
545
501
if (isset ($ _GET ['accNo ' ])){
546
-
547
- $ get =$ cop ['bookcopies ' ]-1 ;
502
+
503
+ $ get =$ cop ['no_of_copies ' ]-1 ;
548
504
}else {
549
505
550
506
$ get =$ copy -1 ;
551
507
}
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' " ;
554
510
$ objExec = mysql_query ($ update );
555
511
if ($ 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 );
560
512
?>
561
513
562
514
<script>
563
515
$(document).ready(function(){
564
516
$("#success").fadeIn(1000);
565
517
});
566
518
</script>
567
- <?php
519
+ <?php
568
520
//echo "Your Borrow has been Registered";
569
521
}
570
-
571
-
522
+
523
+
572
524
}
573
525
}
574
526
}
0 commit comments