-
Notifications
You must be signed in to change notification settings - Fork 0
/
IssueDetails.php
361 lines (331 loc) · 11.8 KB
/
IssueDetails.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
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
<!DOCTYPE html>
<html lang="en">
<head>
<?php include 'connection.php' ;
if(isset($_POST['submitissue'])){
$cardno= $_POST['cardno'];
$issueddate = $_POST['issueddate'];
$issuedby = $_POST['issuedby'];
$issuedto = $_POST['issuedto'];
$issuedbook= $_POST['issuedbook'];
$res11= mysqli_query($con,"SELECT Quantity FROM Books as Quantity WHERE BookTitle = '$issuedbook'") or die("".mysqli_error($con));
$row11 = mysqli_fetch_row($res11);
$quantity=$row11[0];
if( $quantity >0){
$check=mysqli_query($con,"select * from issued where Card_No='$cardno' and IssuedTo='$issuedto'");
$checkrows=mysqli_num_rows($check);
if($checkrows>0) {
echo '<script language="javascript">';
echo 'alert("Only One Book Will Be Given To Student")';
echo '</script>';
} else{
$sql3 = "insert into Issued values('$cardno','$issueddate','$issuedby','$issuedto','$issuedbook')";
$sql10 = "update books set Quantity=Quantity-1 where BookTitle='".$issuedbook."' AND Quantity>0";
$res3=mysqli_query($con,$sql3);
$res10=mysqli_query($con,$sql10);
if($res3==1 && $res10==1){
header("Location:http://localhost/Lib/IssueDetailsView.php");
}else {
echo "ERROR";
}
}
}else{
echo '<script language="javascript">';
echo 'alert("Their Are No More Books")';
echo '</script>';
//header("Location:http://localhost/Lib/BookDetailsView.php");
// echo '<script> window.open(http://localhost/Lib/BookDetailsView.php","_self")</script>';
}
}
?>
<title>Issue Details</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet" type="text/css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link href="layout/styles/layout.css" rel="stylesheet" type="text/css" media="all">
<style>
body {
font: 400 15px/1.8 Lato, sans-serif;
color: #111;
//background-image: url("lib1.jpg");
background-color:#d2d2cf;
-webkit-filter: grayscale(90%);
filter: grayscale(90%);
}
h3, h4 {
margin: 10px 0 30px 0;
letter-spacing: 10px;
font-size: 20px;
color: #111;
}
.container {
padding: 80px 120px;
}
.person {
border: 10px solid transparent;
margin-bottom: 25px;
width: 80%;
height: 80%;
opacity: 0.7;
}
.person:hover {
border-color: #f1f1f1;
}
.carousel-inner img {
-webkit-filter: grayscale(90%);
filter: grayscale(90%); /* make all photos black and white */
width: 100%; /* Set width to 100% */
height: 40%;
margin: auto;
}
.carousel-caption h1 {
color: #fff !important;
}
@media (max-width: 600px) {
.carousel-caption {
display: none; /* Hide the carousel text when the screen is less than 600 pixels wide */
}
}
.bg-1 {
background: #2d2d30;
color: #bdbdbd;
}
.bg-1 h3 {color: #fff;}
.bg-1 p {font-style: italic;}
.list-group-item:first-child {
border-top-right-radius: 0;
border-top-left-radius: 0;
}
.list-group-item:last-child {
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
.thumbnail {
padding: 0 0 15px 0;
border: none;
border-radius: 0;
}
.thumbnail p {
margin-top: 15px;
color: #555;
}
.btn {
padding: 10px 20px;
background-color: #333;
color: #f1f1f1;
border-radius: 0;
transition: .2s;
}
.btn:hover, .btn:focus {
border: 1px solid #333;
background-color: #fff;
color: #000;
}
.modal-header, h4, .close {
background-color: #333;
color: #fff !important;
text-align: center;
font-size: 30px;
}
.modal-header, .modal-body {
padding: 40px 50px;
}
.nav-tabs li a {
color: #777;
}
.navbar {
font-family: Montserrat, sans-serif;
margin-bottom: 0;
background-color: #2d2d30;
border: 0;
font-size: 15px !important;
letter-spacing: 4px;
opacity: 0.9;
}
.navbar li a, .navbar .navbar-brand {
color: #d5d5d5 !important;
}
.navbar-nav li a:hover {
color: #fff !important;
}
.navbar-nav li.active a {
color: #fff !important;
background-color: #29292c !important;
}
.navbar-default .navbar-toggle {
border-color: transparent;
}
.open .dropdown-toggle {
color: #fff;
background-color: #555 !important;
}
.dropdown-menu li a {
color: #000 !important;
}
.dropdown-menu li a:hover {
background-color: red !important;
}
footer {
left:0px;
bottom:0px;
width:100%;
background-color: #2d2d30;
color: #f5f5f5;
padding: 32px;
}
footer a {
color: #f5f5f5;
}
footer a:hover {
color: #777;
text-decoration: none;
}
.form-control {
border-radius: 0;
}
textarea {
resize: none;
}
</style>
</head>
<body id="myPage" data-spy="scroll" data-target=".navbar" data-offset="50">
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="Second.php">Library Management</a>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Student
<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="Student Details.php">Add Student</a></li>
<li><a href="StudentDetailsView.php">Students List</a></li>
<li><a href="UpdateStudentDetails.php">Update Students Details</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Books
<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="BookDetails.php">Add Books</a></li>
<li><a href="BookDetailsView.php">Books List</a></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Issue
<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="IssueDetails.php">Issue Books</a></li>
<li><a href="IssueDetailsView.php">Issued List</a></li>
</ul>
</li>
<li><a href="ReturnDetails.php">Return of Book</a></li>
<li><a href="Contact.php">Contact</a></li>
<li><a href="Logout.php">Logout</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<div class="container">
<div class="row">
<div class="col-md-6 col-md-offset-3">
<div class="panel panel-primary">
<div class="panel-heading">Issue Details</div>
<div class="panel-body">
<form role="form" method="post" action="IssueDetails.php">
<label for="cardno">Card No</label>
<input type="number|text" id="cardno" class="form-control" name="cardno" placeholder="Example: 22A">
<label for="issuedate">Issue Date</label>
<input type="date" data-date="" data-date-format="YYYY MM DD" id="issuedate" class="form-control" name="issueddate" placeholder="Example: ">
<label for="issuedby">Issued By</label>
<select id="issuedby" class="form-control" name="issuedby">
<option value=""> --------Issued By-------- </option>
<?php include 'connection.php';
$dd_res2=mysqli_query($con,"SELECT Distinct Lib_Name FROM librarian");
while($row2=mysqli_fetch_row($dd_res2))
{
// echo "<option value='" . $row['BookTitle'] ."'>" . $row['BookTitle'] ."</option>";
echo "<option value='$row2[0]'> $row2[0] </option>";
}
?>
</select>
<label for="issuedto">Issued To</label>
<select id="issuedto" class="form-control" name="issuedto">
<option value=""> --------Issued To-------- </option>
<?php include 'connection.php';
$dd_res1=mysqli_query($con,"SELECT Distinct FirstName FROM student");
while($row1=mysqli_fetch_row($dd_res1))
{
// echo "<option value='" . $row['BookTitle'] ."'>" . $row['BookTitle'] ."</option>";
echo "<option value='$row1[0]'> $row1[0] </option>";
}
?>
</select>
<label for="issuedbook">Issued Book</label>
<select id="issuedbook" class="form-control" name="issuedbook">
<option value=""> --------Issued Book-------- </option>
<?php include 'connection.php';
$dd_res=mysqli_query($con,"SELECT Distinct BookTitle FROM books");
while($row=mysqli_fetch_row($dd_res))
{
// echo "<option value='" . $row['BookTitle'] ."'>" . $row['BookTitle'] ."</option>";
echo "<option value='$row[0]'> $row[0] </option>";
}
?>
</select>
<br>
<center><input type="submit" class="btn btn-primary m-t-10" name="submitissue" value="Submit Issue Details"></center>
</form>
</div>
</div>
</div>
</div>
</div>
<!-- Footer -->
<footer class="text-center">
<a class="up-arrow" href="#myPage" data-toggle="tooltip" title="TO TOP">
<span class="glyphicon glyphicon-chevron-up"></span>
</a><br><br>
<p>Project Made By <a href="https://www.w3schools.com" data-toggle="tooltip" title="Visit w3schools"> Akshatha Chawan
& MD Rayyan Ali</a></p>
</footer>
<script>
$(document).ready(function(){
// Initialize Tooltip
$('[data-toggle="tooltip"]').tooltip();
// Add smooth scrolling to all links in navbar + footer link
$(".navbar a, footer a[href='#myPage']").on('click', function(event) {
// Make sure this.hash has a value before overriding default behavior
if (this.hash !== "") {
// Prevent default anchor click behavior
event.preventDefault();
// Store hash
var hash = this.hash;
// Using jQuery's animate() method to add smooth page scroll
// The optional number (900) specifies the number of milliseconds it takes to scroll to the specified area
$('html, body').animate({
scrollTop: $(hash).offset().top
}, 900, function(){
// Add hash (#) to URL when done scrolling (default click behavior)
window.location.hash = hash;
});
} // End if
});
})
</script>
</body>
</html>