-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathunreturnbook.php
executable file
·304 lines (225 loc) · 7.96 KB
/
unreturnbook.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
<style>
.hed{
float:left;
width:860px;
margin-left:35px;
padding-bottom:20px;
margin-top:10px;}
</style>
<SCRIPT language="javascript">
$(function () {
// add multiple select / deselect functionality
$("#selectall").click(function () {
$('.name').attr('checked', this.checked);
});
// if all checkbox are selected, then check the select all checkbox
// and viceversa
$(".name").click(function () {
if ($(".name").length == $(".name:checked").length) {
$("#selectall").attr("checked", "checked");
} else {
$("#selectall").removeAttr("checked");
}
});
});
</SCRIPT>
<script>
function printDiv(divID) {
//Get the HTML of div
var divElements = document.getElementById(divID).innerHTML;
//Get the HTML of whole page
var oldPage = document.body.innerHTML;
//Reset the page's HTML with div's HTML only
document.body.innerHTML =
"<nav>" +
divElements + "</nav>";
//Print Page
window.print();
//Restore orignal HTML
document.body.innerHTML = oldPage;
window.location='index.php?unreturnedBooks';
}
</script>
<script>
$(document).ready(function(){
$("#closeempty").click(function(){
$("#divempty").fadeOut("slow");
window.location='index.php?unreturnedBooks';
});
});
</script>
<div id="divempty" style=" z-index:20; position:absolute; background:url(images/trans_bg.png); width:100%;height:100%;display:none;">
<div class="boxaction" style="margin-top:-20px;">
<div class="headbox">
<img src="icons/error.png" height="25" style="margin-top:8px; float:left; margin-left:10px;"/>
<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>
</div>
<div style="font-size:15px; padding-top:40px; margin-left:20px; margin-right:20px; font-family:Arial, Helvetica, sans-serif; text-align:center">Choose to print
</div>
<div class="btnbox" id="closeempty" style="cursor:pointer;">
<div style="font:14px; font-family:Verdana, Geneva, sans-serif; color:#FFF; font-weight:bold; text-align:center; margin-top:5px;">OK</div>
</div>
</div>
</div>
<div class="hed" id="printablediv">
<?php
if(isset($_POST['print'])){
if(!$_POST['checkbox']){ ?>
<script>
$(document).ready(function(){
$("#divempty").fadeIn(1000);
});
</script>
<?php }else{}
?>
<table width="360" border="0" align="center">
<tr>
<td align="center" style="font-size:20px; font-weight:bold;font-family:Arial, 'Arial Black', 'Arial Narrow';">St. Mary's Academy of San Nicolas</td>
</tr>
<tr>
<td style="font-size:17px; font-weight:bold; font-family:Arial, 'Arial Black', 'Arial Narrow';" align="center">T. Abella St., Cebu City</td>
</tr>
<tr>
<td height="50" align="center" style="font-size:22px; font-family:Arial, 'Arial Black', 'Arial Narrow';">List of Unreturned Books</td>
</table>
<table width="95%"bordercolor="#999999" a class="web" border="0" cellspacing="1" style=" margin-bottom:50px; margin-left:22px;font-size:12px;font-family:Verdana, Geneva, sans-serif; margin-top:20px;">
<thead>
<tr style="font-weight:bold; font-size:15px;" height="30">
<td class="web" width="100" align="center">Acc No</td>
<td class="web" width="400" align="center">Boook Title</td>
<td class="web" width="240" align="center">Borrowers Name</td>
<td class="web" width="240" align="center">Date of Lend</td>
</tr>
<tr>
<td colspan="4" style="border-bottom:1px #000 solid;">
</td>
</tr>
<?php include('config.php');
$printcount=0;
for($i=0;$i<count($_POST['checkbox']);$i++){
$printcount++;
$borrowid = $_POST['checkbox'][$i];
$sql =mysql_query("SELECT * FROM tblborrow WHERE borrowid='$borrowid'");
while($row=mysql_fetch_array($sql)){
?>
<tr align="center" height="30">
<td><?php echo $row['accNo']; ?></td>
<td>
<?php
$qsa=mysql_query("select * from books where accNo=$row[accNo]");
while($acc=mysql_fetch_array($qsa)){
echo $acc['booktitle']; }?>
</td>
<td>
<?php
$qs=mysql_query("select * from tblborrower where studentid=$row[studentid]");
while($title=mysql_fetch_array($qs)){
echo $title['fname']." ".$title['lname']; }?>
</td>
<td><?php echo date_format(date_create($row['dateborrow']), 'F d, Y'); ?></td>
</tr>
<!--end of printing -->
<?php }
}
?>
</thead>
</table>
<?php
}
else{
?>
<?php
include('config.php');
$qss="SELECT * FROM tblborrow where status='Unsigned'";
$rss=mysql_query($qss);
//
?>
<form action="" method="post">
<table width="100%"bordercolor="#999999" class="web" border="0" cellspacing="1" style=" margin-bottom:20px; margin-left:0px;font-size:12px;font-family:Verdana, Geneva, sans-serif; margin-top:20px;">
<thead>
<tr bgcolor="#B9C9FE" height="30">
<td><input type="checkbox" id="selectall"/></td>
<td>No.</td>
<td class="web" width="100" align="center">Acc No</td>
<td class="web" width="400" align="center">Boook Title</td>
<td class="web" width="240" align="center">Borrowers Name</td>
<td class="web" width="240" align="center">Date of Lend</td>
<td class="web" width="160" align="center" colspan="3">Action</td>
<?php
include('config.php');
$q="select * from tblborrow where status='Unsigned'";
$rs=mysql_query($q);
$count=0;
$ihap=0;
$num=mysql_num_rows($rs);
while($row=mysql_fetch_array($rs)){
$count++;
?>
</tr>
<tr bgcolor="#CCCCCC" align="center" height="25">
<td>
<input name="checkbox[]" class="name" type="checkbox" value="<?php echo $row['borrowid']; ?>"></td>
<td><?php echo $count; ?></td>
<td bgcolor="" width="100">
<?php
echo $row['accNo']; ?>
</td>
<td width="400"><?php
$qs=mysql_query("select * from books where accNo=$row[accNo]");
while($title=mysql_fetch_array($qs)){
echo $title['booktitle']; }?></td>
<td width="180">
<?php
$qs=mysql_query("select * from tblborrower where studentid=$row[studentid]");
while($title=mysql_fetch_array($qs)){
echo $title['fname']." ".$title['lname']; }?>
</td>
<td><?php echo date_format(date_create($row['dateborrow']), 'F d, Y'); ?></td>
<td><img src="icons/b_drop.png"></td>
<td><img src="icons/b_search.png"></td>
</tr>
<?php
} ?>
</thead>
</table>
<?php } ?>
</div>
<!--footer-->
<script>
/* function OpenPopUp(borrowid, pageURL, title,w,h) {
//alert("Pardeep")
var left = (screen.width/2)-(w/2);
var top = (screen.height/2)-(h/2);
var targetWin = window.open('http://localhost/lib/unreturn_check.php?borrowid=' + borrowid, 'name', 'location=no,menubar=no,wiscrollbars=no,resizable=no,fullscreen=no,width='+w+', height='+h+', top='+top+', left='+left);
return false;
}*/
</script>
<div class="footer">
<div class="leftfoot"></div>
<div class="bodyfoot">
<table border="1" style="margin-top:20px; font-family:Verdana, Geneva, sans-serif; font-size:10px;">
<tr>
<?php
if(isset($_POST['print'])){ ?>
<td>Print Record(s)</td>
<td><input type="text" value="<?php echo $printcount; ?>" style="padding:2px; width:60px;" readonly="readonly"></td>
<?php }else{?>
<td>Count of Unreturn Books</td>
<td><input type="text" value="<?php echo $num; ?>" style="padding:2px; width:60px;" readonly="readonly"></td>
<?php } ?>
<td>
<?php
if(isset($_POST['print'])){ ?>
<input type="button" value="Print" onClick="javascript:printDiv('printablediv')" />
<?php }else{?>
<input type="submit" value="Print View" name="print">
<?php } ?>
</td>
</tr>
</table>
</div>
<div class="rightfoot"></div>
</div>
</div>
</body>
</html>