GOOGLE

aku nok ndi : /home/astwardha/public_html/polylibrary/library/
File Up :
aku nok ndi : /home/astwardha/public_html/polylibrary/library/books.php

<?php include('header.php'); date_default_timezone_set('Asia/Calcutta');  ?>
<?php include('session.php'); ?>
<?php include('navbar_books.php'); ?>
    <div class="container">
		<div class="margin-top">
			<div class="row">	
			   <div class="alert alert-info">
                    <button type="button" class="close" data-dismiss="alert">&times;</button>
                    <?php $username=mysql_query("select * from `registration` where `id`='".$_SESSION['user_id']."'")or die(mysql_error());
                          $seluser=mysql_fetch_array($username);  ?>
                    <strong><i class="icon-user icon-large"></i>&nbsp;Borrow Books List</strong><b><span style="float: right;">WELCOME : <?php echo $seluser['name'];?>  <?php echo $seluser['lname'];?></span></b>s
                </div>
           <?php 
           if(isset($_POST['searchBooks'])){
			    echo $searbook = $_POST['searchb'];
           }
			?>
			<div class="span2"><label class="control-label" for="inputEmail"><b>Search Book Name</b></label>
</div>
<div class="span3">
			<form method="post"  name="form">
		<div class="control-group">
				<div class="controls">
				<select name="searchb" class="chzn-select"/>
				<option>Select Book Here</option>
				<?php $result =  mysql_query("SELECT DISTINCT `subject` FROM  `book` WHERE `book_status`='returned' ORDER BY `subject` ASC")or die(mysql_error()); 
				while ($rowss=mysql_fetch_array($result)){ ?>
				<option value="<?php echo $rowss['subject']; ?>"><?php echo $rowss['subject'];?></option>
				<?php } ?>
				</select>
				</div>
			</div>
		</div>
		<div class="span2">
			<div class="control-group"> 
					<label class="control-label" for="inputEmail"></label>
					<div class="controls">
					<input type="submit" name="searchBooks" value="Search"  class="btn btn-success">
					</div>
				</div>
		</div>
</form>
		<div class="span2">
				<div class="control-group"> 
					<label class="control-label" for="inputEmail"></label>
					<div class="controls">
					<a href="viewBokks.php" class="btn btn-primary">Issue to Whom</a>
					</div>
				</div>
		</div>
		<div class="span2">
				<div class="control-group"> 
					<label class="control-label" for="inputEmail"></label>
					<div class="controls">
					<a href="books.php" class="btn btn-warning">View All Books</a>
					</div>
				</div>
		</div>
		</div>
	<div class="span12">

	<marquee scrollamount="3"><b>Book Issue time is 4:30 pm to 5:10 pm</b>|| <b style="color: red;">And Book Return time is 9:30 am to 2:00 pm</b></marquee>		
	</div>
	<hr/>
</div>
		<div class="span12">		
		<form method="post" action="borrow_save.php">
      <div class="span2">
		<div class="control-group">
				<label class="control-label" for="inputEmail"><b>Borrower Name</b></label>
				<div class="controls">
				<?php $result =  mysql_query("select * from `registration` WHERE `id`='".$_SESSION['user_id']."'")or die(mysql_error()); 
				$row=mysql_fetch_array($result); ?>
				<span style="color: green;"><b><?php echo $row['name'];?> <?php echo $row['lname'];?></b></span>
				</div>
			</div>
			<hr/>
				<div class="control-group"> 
					<label class="control-label" for="inputEmail"><span style="color: red;">Due Date</span></label>
					<div class="controls">
						<input type="hidden" name="member_id" value="<?php echo $_SESSION['user_id'];?>">
					<!-- <input type="text"  class="w8em format-d-m-y highlight-days-67 range-low-today" name="due_date" id="sd" maxlength="10" style="border: 3px double #CCCCCC;" required/> -->

					<?php

					$allowed = mysql_query("SELECT * FROM `borrowdetails` WHERE `member_id`='".$_SESSION['user_id']."' AND (`borrow_status`='Send Request' OR `borrow_status`='borrow')");
					    $count = mysql_num_rows($allowed);
					    $b = mysql_fetch_array($allowed);
						 $date = strtotime("+7 day");
						 echo date('M d, Y', $date);
						 $dueDate= date('Y-m-d', $date); 

						 $willingBook = mysql_query("SELECT * FROM `book` WHERE `willing`!='' AND `book_id`='".$b['book_id']."'");
						 $counsdg = mysql_num_rows($willingBook);
						 $wcounts =1+$counsdg;
                          ?>
			   <input type="hidden" value="<?php echo $dueDate;?>" name="due_date">
					</div>
				</div>
				<?php 
					    date_default_timezone_set('Asia/Calcutta'); 
						$t=date('d-m-Y');
					 	$mon = date("D",strtotime($t));?>

				

				<div class="control-group"> 

					<div class="controls">

                    <?php if($count<1){?>

                    <?php 

				 //echo $sem = ("SELECT * FROM `registration` WHERE `class`='B.Pharm. IV Sem' OR (`class`='B.Pharm. II Sem' OR`class`='M.Pharm') AND (`id`='".$_SESSION['user_id']."')");

                $sem = mysql_query("SELECT * FROM `registration` WHERE  `id`='".$_SESSION['user_id']."'");

				$selSem = mysql_fetch_array($sem);

				$selSemCount = mysql_num_rows($sem);



				if($mon=='Mon' && $selSem['class']=='B.Pharm III Sem' || $mon=='Mon' && $selSem['class']=='B.Pharm IV Sem' || $mon=='Mon' && $selSem['class']=='B.Pharm VII Sem' ||$mon=='Mon' && $selSem['class']=='B.Pharm VIII Sem' && $selSem['class']=='M.Pharm I' || $mon=='Mon' && $selSem['class']=='M.Pharm II' || $mon=='Mon' && $selSem['class']=='M.Pharm III' || $mon=='Mon' && $selSem['class']=='M.Pharm IV'){?>

		        <button name="delete_student" class="btn btn-success"><i class="icon-plus-sign icon-large"></i> Borrow</button>



			    <?php  }elseif($selSem['class']=='B.Pharm I Sem'  && $mon=='Tue' || $selSem['class']=='B.Pharm II Sem'  && $mon=='Tue' || $selSem['class']=='B.Pharm V Sem'  && $mon=='Tue' || $selSem['class']=='B.Pharm VI Sem' && $mon=='Tue' && $selSem['class']=='M.Pharm I' || $mon=='Tue' && $selSem['class']=='M.Pharm II' || $mon=='Tue' && $selSem['class']=='M.Pharm III' || $mon=='Tue' && $selSem['class']=='M.Pharm IV'){?>

			    <button name="delete_student" class="btn btn-success"><i class="icon-plus-sign icon-large"></i> Borrow</button>



			    <?php  }elseif($mon=='Wed' && $selSem['class']=='D.Pharm I Year' || $mon=='Wed' && $selSem['class']=='D.Pharm II Year' || $mon=='Wed' && $selSem['class']=='M.Pharm I' || $mon=='Wed' && $selSem['class']=='M.Pharm II' || $mon=='Wed' && $selSem['class']=='M.Pharm III' || $mon=='Wed' && $selSem['class']=='M.Pharm IV'){?>

			    <button name="delete_student" class="btn btn-success"><i class="icon-plus-sign icon-large"></i> Borrow</button>



			     <?php  }elseif($mon=='Thu' && $selSem['class']=='B.Pharm VII Sem' || $mon=='Thu' && $selSem['class']=='B.Pharm VIII Sem' || $mon=='Thu' && $selSem['class']=='B.Pharm III Sem' || $mon=='Thu' && $selSem['class']=='M.Pharm I' || $mon=='Thu' && $selSem['class']=='M.Pharm II' || $mon=='Thu' && $selSem['class']=='M.Pharm III' || $mon=='Thu' && $selSem['class']=='M.Pharm IV' || $mon=='Thu' && $selSem['class']=='B.Pharm IV Sem'){?>

			    <button name="delete_student" class="btn btn-success"><i class="icon-plus-sign icon-large"></i> Borrow</button>



			     <?php  }elseif($mon=='Fri' && $selSem['class']=='B.Pharm I Sem' || $mon=='Fri'&& $selSem['class']=='B.Pharm II Sem' || 

			     $mon=='Fri' && $selSem['class']=='B.Pharm V Sem' || $mon=='Fri' && $selSem['class']=='B.Pharm VI Sem' || $mon=='Fri' && $selSem['class']=='M.Pharm I' || $mon=='Fri' && $selSem['class']=='M.Pharm II' || $mon=='Fri' && $selSem['class']=='M.Pharm III' || $mon=='Fri' && $selSem['class']=='M.Pharm IV'){?>

			     <button name="delete_student" class="btn btn-success"><i class="icon-plus-sign icon-large"></i> Borrow</button>


				 <?php  }elseif($mon=='Sat' && $selSem['class']=='D.Pharm I Year' || $mon=='Sat' && $selSem['class']=='D.Pharm II Year' || $mon=='Sat' && $selSem['class']=='M.Pharm I' || $mon=='Sat' && $selSem['class']=='M.Pharm II' || $mon=='Sat' && $selSem['class']=='M.Pharm III' || $mon=='Sat' && $selSem['class']=='M.Pharm IV'){?>

			     <button name="delete_student" class="btn btn-success"><i class="icon-plus-sign icon-large"></i> Borrow</button>


                 <?php }else{ 

                  echo $mes = "Sorry Today not your Book borrow Day";

                 } ?>

					   <?php }elseif($b['borrow_status']=='borrow'){ ?>

					   	 <a href="view_borrow.php" class="btn btn-danger" readonly id="hidebtn"><i class="icon-plus-sign icon-large"></i> Return book</a>

					   <?php }else{ ?>

                         <a href="request.php" class="btn btn-warning" readonly><i class="icon-plus-sign icon-large" style="color: black;"></i><span style="color: black;">&nbsp;Cancel Request</span></a>

					  <?php } ?>

					</div>

				</div>

				<?php  

		$user_queryBook=mysql_query("SELECT * FROM `borrowdetails` WHERE `borrow_status`='Send Request' AND `member_id`='".$_SESSION['user_id']."'")or die(mysql_error());
				$rowBook=mysql_fetch_array($user_queryBook);
		$selectBookss = mysql_query("SELECT * FROM `book` WHERE `book_id`='".$rowBook['book_id']."'");
			$bookRowss = mysql_fetch_array($selectBookss);
						 if($rowBook['borrow_status']=='Send Request'){?>
				<div class="control-group"> 

					<div class="controls">

						<?php if($rowBook['borrow_status']=="Send Request"){?>

					   	 <a href="#modal_return" data-toggle="modal" class="btn btn-primary" readonly><i class="icon-plus-sign icon-large"></i> Cancel Book</a>

					   	 <?php }else{ ?>

                          <a  onclick="return confirm('You are not send any book request?')" data-toggle="modal" class="btn btn-primary" readonly><i class="icon-plus-sign icon-large"></i> Cancel Book</a>

					   	<?php } ?>

					</div>

				</div>

				<div class="control-group"> 

					<div class="controls">

						<?php if($rowBook['borrow_status']=="Send Request"){?>

						<a href="change.php?id=<?php echo $bookRowss['book_id'];?>" class="btn btn-info btn-xs" onclick="return confirm('Are you sure you want to Change Book? Book Name:- <?php echo $bookRowss['book_title'];?>')"><i class="icon-plus-sign icon-large"></i> Change Book</a>

						 <?php }else{ ?>

                          <a  onclick="return confirm('You are not send any book request?')" data-toggle="modal" class="btn btn-info" readonly><i class="icon-plus-sign icon-large"></i> Change Book</a>

					   	<?php } ?>

					</div>

				</div>

				<?php } ?>

				<hr>

				<div class="control-group"> 

					<label class="control-label" for="inputEmail"><span style="color: red;">Last Transaction</span></label>

					<div class="controls">

					<!-- <input type="text"  class="w8em format-d-m-y highlight-days-67 range-low-today" name="due_date" id="sd" maxlength="10" style="border: 3px double #CCCCCC;" required/> -->

					</div>

				<table border="1" class="table">

					<tr>

						<td style="background-color: orange;">Rem. Day</td>

						<td style="background-color: orange;">Titile</td>

					</tr>

					<span>Last Borrow Book</span>

					<?php

				   $bookteken = mysql_query("SELECT * FROM `borrowdetails` WHERE `member_id`='".$_SESSION['user_id']."' AND (`borrow_status`='borrow' OR `borrow_status`='Send Request')");

				   $i=1;

				   while($seltakenBook = mysql_fetch_array($bookteken)){



					$bookteken1 = mysql_query("SELECT * FROM `book` WHERE `book_id`='".$seltakenBook['book_id']."'");

					$seltakenBookone = mysql_fetch_array($bookteken1);

				?>

				<?php if($seltakenBook['borrow_status']=='borrow'){?>



				<tr>

					<td>

						<?php $startTimeStamp = strtotime($seltakenBook['due_date']);

					$dates = date("Y-m-d");

					$endTimeStamp = strtotime($dates);



					$timeDiff = abs($endTimeStamp - $startTimeStamp);



					$numberDays = $timeDiff/86400;  // 86400 seconds in one day



					// and you might want to convert to integer

					echo $numberDays = intval($numberDays);?></td>

					<td><?php echo $seltakenBookone['book_title'];?></td>

				</tr>

					<?php }else{ ?>

					<tr>

					<td colspan="3">

						<b>Book Name :- <span style="color: green;"><?php echo $bookRowss['book_title'];?></span><b><hr size="10" style="color: red !important; ">

						<b style="color: red;text-align: justify;">You have sent request for borrow book, please issue the book from library and complete the transaction to avoid penalty.

					</b></td>

					<?php } ?>

				</tr>

                <?php $i++; } ?>

				</table>

				</div>

				</div>

				<div class="span9">
                <div style="overflow-x:auto;">

                            <table cellpadding="0" cellspacing="0" border="1" class="table" id="example" border="1">

                                <thead>

                                    <tr>

                                    	<th style="background-color: #4267B2; color: white;">Add Book</th>

                                        <th style="background-color: #4267B2; color: white;">Acc. No.</th>                                 

                                        <th style="background-color: #4267B2; color: white;">Book title</th>                                 

                                        <th style="background-color: #4267B2; color: white;">Subject</th>

										<th style="background-color: #4267B2; color: white;">Author</th>

										<th style="background-color: #4267B2; color: white;">Publication Year</th>

                                    </tr>

                                </thead>

                                <tbody>

                                  <?php  

                                  if($searbook!=""){
                                      $user_query=mysql_query("SELECT * FROM book WHERE `subject`='".$searbook."'");
                                   }else{

									  $user_query=mysql_query("SELECT * FROM `book` WHERE book_status ='returned' AND `book_type`='Text Book'")or die(mysql_error());
                                   }
									while($row=mysql_fetch_array($user_query)){
									$id=$row['book_id'];  
									$cat_id=$row['category_id'];
									?>		

									<tr>

									<td width="20">

									<?php if($count<$wcounts){?>

									<input id="" class="uniform_on" name="selector[]" type="checkbox" value="<?php echo $id; ?>" >

									<?php }else{?>

									<input id="" class="" name="" type="checkbox" value=""  data-off="Yes" disabled>

									<?php } ?>

                                    </td>

                                    <td><?php echo $row['acc_no']; ?></td>

                                    <td><?php echo stripslashes($row['book_title']); ?></td>

									<td><?php echo stripslashes($row['subject']); ?> </td> 

                                    <td><?php echo trim($row['author']); ?> </td> 

									<td><?php echo stripslashes($row['publication_date']); ?></td> 

                                    </tr>

									<?php  }  ?>

                                </tbody>

                            </table>
</div>
							

			    </form>

			</div>		

			</div>

			<?php if($rowBook['borrow_status']!="Send Request"){?>

<script>		

$(".uniform_on").change(function(){

    var max= 1-<?php echo $count; ?>;

    if( $(".uniform_on:checked").length >= max ){

	

        $(".uniform_on").attr('disabled', 'disabled');

		         //alert('Only One Books are allowed per borrower');

        $(".uniform_on:checked").removeAttr('disabled');

		

    }else{



         $(".uniform_ons").removeAttr('disabled');

    }

})

$(".uniform_off").change(function(){

    

        $(".uniform_off").attr('disabled', 'disabled');

		         alert('you are not eligible for taken more books since you are already taken 1 book');

        $(".uniform_on:checked").removeAttr('disabled');

		

    

})

</script>

<?php }else{ ?>

<script>		

$(".uniform_on").change(function(){

    var max= 0;

    if( $(".uniform_on:checked").length >= max ){

	

        $(".uniform_on").attr('disabled', 'disabled');

		         alert('Only One Books are allowed per borrower');

        $(".uniform_on:checked").removeAttr('disabled');

		

    }else{



         $(".uniform_ons").removeAttr('disabled');

    }

})

$(".uniform_off").change(function(){

    

        $(".uniform_off").attr('disabled', 'disabled');

		         alert('you are not eligible for taken more books since you are already taken 1 book');

        $(".uniform_on:checked").removeAttr('disabled');

		

    

})

</script>

<?php } ?>



			</div>

		</div>
    </div>
<?php include('footer.php') ?>
	<div id="modal_return" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-body">
			<div class="alert alert-info"><strong>Cancel Borrow Book</strong></div>

	<form class="form-horizontal" method="post">

			<div class="control-group">

			 <table cellpadding="0" cellspacing="0" border="1" class="table" id="example" border="1">

                                <thead>

                                    <tr>

                                        <th style="background-color: #4267B2; color: white; font-size: 11px;">Acc. No.</th>        

                                        <th style="background-color: #4267B2; color: white; font-size: 11px;">Book title</th>                                 

                                        <th style="background-color: #4267B2; color: white; font-size: 11px;">Subject</th>

										<th style="background-color: #4267B2; color: white; font-size: 11px;">Author</th>

										<th style="background-color: #4267B2; color: white; font-size: 11px;">Publisher name</th>

										<th style="background-color: #4267B2; color: white; font-size: 11px;">Borrow Date</th>

										<th style="background-color: #4267B2; color: white; font-size: 11px;">Return</th>

                                    </tr>

                                </thead>

                                <tbody>

                                  <?php  

									 $user_query=mysql_query("SELECT * FROM `borrowdetails` WHERE `borrow_status`='Send Request' AND `member_id`='".$_SESSION['user_id']."'")or die(mysql_error());

									while($row=mysql_fetch_array($user_query)){

										$selectBook = mysql_query("SELECT * FROM `book` WHERE `book_id`='".$row['book_id']."'");

										$bookRow = mysql_fetch_array($selectBook);

									?>		

									<tr>

                                    </td>

                                    <td><?php echo $bookRow['acc_no']; ?></td>

                                    <td><?php echo $bookRow['book_title']; ?></td>

									<td><?php echo $bookRow['subject']; ?> </td> 

                                    <td><?php echo $bookRow['author']; ?> </td> 

									<td><?php echo $bookRow['publisher_name']; ?></td>

									<td><?php echo $row['date_borrow']; ?></td>

									<td><a href="cancel.php?id=<?php echo $row['book_id'];?>" class="btn btn-warning btn-xs" onclick="return confirm('Are you sure you want to Cancel Book?')">Cancel</a></td> 

                                    </tr>
									<?php  }  ?>
                                </tbody>
                            </table>

		</div>
		    </form>
		<div class="modal-footer">
			<button class="btn" data-dismiss="modal" aria-hidden="true"><i class="icon-remove icon-large"></i>&nbsp;Close</button>
		</div>
    </div>
    <style>
table {
    border-collapse: collapse;
    border-spacing: 0;
    width: 100%;
    border: 1px solid #ddd;
}

th, td {
    text-align: left;
    padding: 8px;
}

tr:nth-child(even){background-color: #f2f2f2}
</style>

Copyright © 1945 - 2024 GOOGLE