<?php
if($_SESSION[id]!=""){
 $tab1='2'; $tab2='5'; ?>
<?php
include ('dbf.php');
include_once('search.class.php');
$search = new search;
?>
<html dir="rtl">
<head>
<title>
صفحه امانات
</title>

</head>
<body>
<?php

//include ('header.php');
?>
<br>
<table  border="0" align="center" dir="rtl">
	<tr>
		<td>
			<table border="0" width="750" align="center" dir="rtl">
			<tr>
				<td  >
				<table border="0" style="border-color:#003366"   width="600" align="center"  >
				<tr>
					<td valign="middle" align="center">
						<?php
						if ($_GET['v']=="amanat")
						{
						?>
						<form action="index1.php?page=four" name="f1" method="post">
							<table  border="0" style="height:70pt" width="680">
								<?php
								include_once('jdf.php');
								$t=jdate('Y/m/d');
								include ('dbf.php');
								$fg=mysql_query("select * from amanat where (id='{$_GET['p']}')");
								$g=mysql_fetch_assoc($fg);
								$mm1=mysql_query("select * from rezerv where id_b='{$g['id_b']}' order by date desc limit 1");
								$fmm1=mysql_fetch_assoc($mm1);
								$da=$g['date_out'];
								include('date.php');
								$haz=$dm*$g1['hazine'];


								?>
								<tr dir="rtl" style="height:10px;width:380px">
									<td height="50" align="right">
										<span class="blacktext">تاريخ بازگشت كتاب <?php echo $g['name_b'];?>
										به امانت گرفته شده توسط آقاي / خانم <?php echo $g['lname_ozv'];?> را وارد فرماييد :
										</span>
									</td>
								</tr>
								<tr>
									<td align="center" colspan="4">
										<span class="blacktext">تاريخ بازگشت  :</span>
										<input tabindex="1" type="text" name="date_in" id="date_in" size="10" value="<?php echo $g['date_sar'];?>" style="font-size: 10pt;font-family:tahoma">
										<input type="hidden" name="date_in2"  id="date_in2" value="<?php echo $t;?>"  style="font-size: 10pt;font-family:tahoma">
										<input type="hidden" name="id" id="id" value="<?php echo $_GET['p'];?>">
									</td>
								</tr><?php if($fmm1['id']!=""){ ?>
								<tr>
									<td height="50" align="right">
										<span class="blacktext">این کتاب توسط آقای / خانم<?php echo ' '.$fmm1['fname_ozv'].' '.$fmm1['lname_ozv'].' '; ?>رزرو شده است</span>
									</td>
								</tr>
								<?php } if($dm!=""){ ?>
								<tr>
									<td align="center"><br>
										<table border="1" width="300" cellpadding="3" cellspacing="0.75">
											<tr>
												<td align="center" colspan="2" height="30">
													<span class="blacktext"><b>تاخیر در بازگشت</b></span>
												</td>
											</tr>
											<tr>
												<td>
													<span class="blacktext">مدت زمان دیرکرد</span>
												</td>
												<td>
													<input type="text" size="15" name="day_t" id="day_t" value="<?php echo $dm." روز"; ?>" readonly >
												</td>
											</tr>
											<tr>
												<td>
													<span class="blacktext">هزینه ی دیرکرد</span>
												</td>
												<td>
													<input type="text" size="15" name="haz_t" id="haz_t" value="<?php echo $haz; ?>" readonly >
												</td>
											</tr>
											<tr>
												<td colspan="2" align="right">
													<input type="hidden" name="day_takhir" id="day_takhir" value="<?php echo $dm; ?>" >
													<input type="checkbox" name="chk" id="chk" >
													<span class="blacktext">اخذ مبلغ دیرکرد</span>
												</td>
											</tr>

										</table><br>
									</td>
								</tr>
								<?php

								 }
								 if($dm!="")
								  $parm='id,date_in,day_takhir,haz_t';
								 else
								   $parm='id,date_in';

								  ?>

											<input type="hidden"  id="val" name="val" value="" >
											<div id="m"></div>
											<input type="hidden"  id="dval" name="dval" value="" >
								<tr>
									<td height="50" valign="middle" align="center" colspan="4">
										<input type="hidden" name="date_tamdidi" value="<?php echo $g['date_sar']; ?>">
										<button tabindex="2" name="inn" type="button" onClick="param('<?php echo $parm; ?>'),insert1(document.getElementById('val').value,'<?php echo 'a_requirpage.php' ; ?>','date_in'),ajaxload('requirpage.php')" ><img src="images/sabtf2.png"  name="neew"  border="0" width="20" height="20" title="ثبت شود"></button>
										<button tabindex="3" title="تمدید کتاب" name="tamdid" type="button" onClick="param('date_in,date_in2,id'),insert4(document.getElementById('val').value,'<?php echo 'a_requirpage.php' ; ?>','date_in','تمديد با موفقيت انجام شد'),ajaxload('requirpage.php')" ><img src="images/tamdid.png"  name="eslah"  border="0" width="20" height="20" ></button>
										<button tabindex="4" title="بازگشت" name="ut" type="button"  onClick="ajaxload('requirpage.php')"><img src="images/r1.png"  name="eslah"  border="0" width="20" height="20" ></button>
									</td>
								</tr>
							</table>
							</form>
						<?php
						}
						elseif ($_GET['p']=='out') {
							?>
							<form action="index1.php?page=four" name="f2" method="post">
							<input type="hidden" name="city" value="<?php echo $_SESSION[city];?>">
							<table  border="0" style="height:70pt"  >
							  <tr>
							    <td colspan="2" align="center" style="padding-bottom:30px"><span class="bluetext"><b>	امانت كتاب </span></td>
							  </tr>
							  <tr dir="rtl" >
								<td  align="right"><span class="blacktext">نام عضو : </td>
								<td align="right">
                                    <input type="text" id="tid_ozv"    onKeyUp="ajaxselct(this.id,'dvozv')"  onblur="ajxshow('id_ozv','tid_ozv','ozv')" /><span id=spid_ozv style="color:red;padding-right:10px;display:none"></span>
                                    <span id="dvozv" style="padding:30px"></span><br>
                                    <input type="hidden" id="id_ozv"   />
								</td>
							 </tr>
							 <tr>
								<td  align="right"><span class="blacktext">عنوان کتاب : </td>
								<td align="right">
									<input type="text" id="tbooko"  onKeyUp="ajaxselct1(this.id,'dvbooko')" onblur="ajxshow('booko','tbooko','ketab')" /><span id=spbooko style="color:red;padding-right:10px;display:none"></span>
                                    <span id="dvbooko" style="padding:30px"></span><br>
                                    <input type="hidden" id="booko"   />
                                    <input type="hidden" tabindex="3" title="بارکد عضو" size="10" name="ozvid" id="ozvid">
								</td>
               						<input type="hidden" tabindex="6" size="10" name="bookid" id="bookid"  title="بارکد کتاب">
							</tr>
							<?php
								include_once('jdf.php');
								$t=jdate('Y/m/d');
							?>
							<tr>
								<td align="right" >
								  <span class="blacktext">تاريخ رفت  : </span></td>
								 <td align="right">
        								<input type="text" tabindex="5" size="10" name="active1" value="<?php  echo  $_POST['active1'] ;?>"   id="active1" />
       	 								&nbsp;&nbsp;<img src="images/calendar.jpg" onClick="displayDatePicker('active1', this);" title="انتخاب تاریخ"/>
								</td>
							</tr>
							<tr>
								<td align="right" colspan="2">
									<input type="checkbox" name="chk" id="chk" value="1">
									<span class="blacktext">تحویل موقت کتاب</span>
								</td>
								</tr>
								<input type="hidden"  id="val" name="val" value="" >
								<div id="d1"></div>
                                  <input type="hidden"  id="dval" name="dval" value="" >
								<tr>
									<td height="50" valign="middle" align="center" colspan="2">
										<button tabindex="6" name="sub" type="button"  onClick="param('id_ozv,ozvid,booko,bookid,active1'),insert5(document.getElementById('val').value,'<?php echo 'a_requirpage.php' ; ?>','tid_ozv,tbooko,active1','spid_ozv,spbooko')"><img src="images/sabtf2.png"  name="neew"  border="0" width="20" height="20" ></button>
										<button tabindex="7" title="بازگشت" name="ut" type="button"  onClick="ajaxload('requirpage.php')"><img src="images/r1.png"  name="eslah"  border="0" width="20" height="20" ></button>
									</td>
								</tr>
							</table>
							</form>
							<?php
						}
						elseif ($_GET['p']=='list')
						{
						?>
							<form action="" name="f7" method="post">
								<div class="divfieldset">
	                                <fieldset style="width:450px;height:150px"><legend align="right" >مشاهده عضو مورد نظر </legend>
							<table  border="0" style="height:70pt" width="450" dir="rtl">
								<tr dir="rtl" style="height:10px;width:380px">
									<td align="center"><br><?php $tab1='2'; ?>

                                    	<table border="0" align="center" >
                                    		<tr>
												<td  align="right"><span class="blacktext">نام عضو : </td>
												<td align="center" width="100">
               								 		<input type="text" tabindex="1" size="10" name="ozvename" onKeyUp="getozve(this.value)">
												</td>
												<td align="right" width="120">
													<div id="ozvo" >
													<select name="id_ozv" id="id_ozv"  tabindex="<?php echo $tab1; ?>" >
														<option value=''>انتخاب نماييد</option>
													<?php
														$q1=mysql_query("select * from ozv ");
														while($n1=mysql_fetch_array($q1)){
														echo "<option value=$n1[id]><span class='blacktext'>".$n1[fname]." ".$n1[lname]." - ".$n1[id]."</span></option>";
														}
														?>
													</select></div>
												</td>
												<td align="center" width="100">
               								 		<input type="text" tabindex="3" title="بارکد عضو" size="10" name="ozvid" id="ozvid" >
												</td>
											</tr>
										</table>

									</td>
								</tr>
								<input type="hidden"  id="val" name="val" value="" >
                                <tr>
                                    <td align="center">
                                    	<button tabindex="4" name="lis" type="button"  onClick="param('id_ozv,ozvid'),ajaxload2('listmemberpage.php','lis',document.getElementById('val').value,'کدعضویت را وارد کنید')" ><img src="images/sabtf2.png"  name="neew"  border="0" width="20" height="20" ></button>
										<button tabindex="5" title="بازگشت" name="ut" type="button"  onClick="ajaxload('requirpage.php')" ><img src="images/r1.png"  name="eslah"  border="0" width="20" height="20" ></button>
									</td>
								</tr>

							</table>
								</fieldset>
                                       </div>
							</form>
						<?php
						}

						elseif($_GET['p']=='ket')
						{
						?>
							<form action="" name="f8" method="post">
                                 <div class="divfieldset">
	                                <fieldset style="width:450px;height:150px"><legend align="right" >مشاهده كتاب مورد نظر </legend>
							<table  border="0" style="height:70pt" width="450" dir="rtl">
								<tr dir="rtl" >
									<td height="50" align="center">


										<table>
										<tr>
												<td  align="right" class="label"><span>عنوان کتاب : </td>
												<td align="center" width="100">
               									 <input type="text" tabindex="2" size="10" name="bookname" onKeyUp="getbook(this.value)">
												</td>
												<td align="right" width="120">
													<div id="bookodiv" >
													<select name="booko"  id="booko" tabindex="3" >
														<option value=''>انتخاب نماييد</option>
							       					</div>
													<?php
														$q=mysql_query("select * from ketab ");
														while($n=mysql_fetch_array($q)){
														echo "<option value=$n[id]><span class='blacktext'>".$n[name]."</span></option>";
														}
														?>
													</select>
												</td>
												<td align="center" width="100">
               									 	<input type="text" tabindex="4" size="10" name="bookid" id="bookid"  title="بارکد کتاب" >
												</td>
											</tr>
										</table>

									</td>
								</tr>
								<input type="hidden"  id="val" name="val" value="" >
								<tr>
                                    <td align="center"><br>
                                    	<button tabindex="5" name="kett" type="button"  onClick="param('booko,bookid'),ajaxload2('listketab.php','kett',document.getElementById('val').value,'کدکتاب را وارد نمایید')"  ><img src="images/sabtf2.png"  name="neew"  border="0" width="20" height="20" ></button>
										<button tabindex="6" title="بازگشت" name="ut" type="button"  onClick="ajaxload('requirpage.php')"><img src="images/r1.png"  name="eslah"  border="0" width="20" height="20" ></button>
									</td>
								</tr>
							</table>
								</fieldset>
                                       </div>
							</form>
						<?php
						}

						?>
					</td>
				</tr>
				</table>
				</td>
			</tr><?php if(($_GET['p']=='kol') || ($_GET['p']=='lis') || ($_GET['p']=='kett')){ ?>
			<tr>
				<td align="center" height="80" valign="middle">
					<form name="f5" method="post" action="output.php" >
					<button tabindex="1" title="بازگشت" name="ut" type="button"  onClick="ajaxload('requirpage.php')"><img src="images/r1.png"  name="eslah"  border="0" width="20" height="20" ></button>
					<?php if($_GET['p']=='kol'){ ?>
					<button tabindex="2" title="چاپ" name="print" type="button"  onClick="ajaxloadp1('print.php','aman','requirpage.php','1')"  ><img src="images/1465.png"	 name="print"  border="0" width="20" height="20" ></button>
					<button tabindex="3" title="خروجی" name="out"  type="submit"  ><img src="images/excel.png" name="print"  border="0" width="20" height="20" ></button>
					<?php } elseif($_GET['p']=='lis'){
					 $_SESSION[head]='مشاهده اطلاعات عضو خاص';
					 ?>
					<button tabindex="2" title="چاپ" name="print" type="button"  onClick="ajaxloadp2('print.php','requirpage.php','aman','<?php echo $is; ?>','<?php echo $k; ?>','2')" ><img src="images/1465.png"	 name="print"  border="0" width="20" height="20" ></button>
					<button tabindex="3" title="خروجی" name="out" type="submit"  ><img src="images/excel.png" name="print"  border="0" width="20" height="20" ></button>
					<?php } elseif($_GET['p']=='kett'){
					$_SESSION[head]='مشاهده اطلاعات كتاب خاص';
					 ?>
					<button tabindex="2" title="چاپ" name="print" type="button"  onClick="ajaxloadp2('print.php','requirpage.php','aman','<?php echo $is; ?>','<?php echo $k; ?>','3')"  ><img src="images/1465.png"	 name="print"  border="0" width="20" height="20" ></button>
					<button tabindex="3" title="خروجی" name="out" type="submit"  ><img src="images/excel.png" name="print"  border="0" width="20" height="20" ></button>
					<?php } ?></form>
				</td>
			</tr><?php } ?>
			</table>
		</td>
		<td valign="top">
			<?php
			//include ('menu.html');
			//include ('back.htm');
			?>
		</td>
	</tr>
</table>
<?php
//include ('foteer.php');

}
else
include('index.php');
?>
</body>
</html>