Location: PHPKode > projects > CoreAsset > coreasset/templates/manage_book_old.tpl
{include file="head.tpl"}
{include file="left.tpl"}

<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td height="21"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="images/corner9.gif" width="5" height="21"></td>
<td width="99%" class="header"><span class="whitetext">

 Library Management Section
</span></td>
<td><img src="images/corner10.gif" width="5" height="21"></td>
</tr>
</table></td>
</tr>
<tr>
<td class="border3side" valign="top" height="100%"><table width="100%" height="100%" border="0" cellspacing="8" cellpadding="0">
<tr>
<td valign="top">

<!-- #######################   Paste the Table to Table from here ############## -->

<table cellSpacing="0" cellPadding="0" width="98%" align="center" border="0">
          <!--<tr>
            <td><img title alt src="images/blank.gif" width="1" height="1"></td>
          </tr>
          <tr>
            <td style="border-left: 1px solid #bbbbbb; border-right: 1px solid #bbbbbb" bgColor="#bbbbbb">
            <img title height="3" alt src="images/blank.gif" width="1" valign="top"></td>
          </tr>-->
          <tr>
            <!--<td style="border-left: 1px solid #bbbbbb; border-right: 1px solid #bbbbbb; padding-left: 18px; padding-right: 23px; padding-top: 11px" vAlign="top" bgColor="#ededed" height="180">-->
			<td>
            {if $mes!=""}
            <table cellSpacing="0" cellPadding="0" width="100%" border="0">
              <tr>
                <td class="txt" colspan="4"><font color="RED">{$mes}</font></td>
              </tr>
              <tr>
                <td class="txt"  colspan="4">&nbsp;</td>
              </tr>
            </table>
            {/if}
			<form name="f2" action="" method="POST" onsubmit="return validate();">
            <table  cellSpacing="1" cellPadding="0" width="100%" border="0">

              
				<!-- Search Section Starts-->
			<tr>
			<td align="right" class="title_heading" colspan="3">&nbsp;Search Type </td>
			<td  class="title_heading" colspan="5">
			<select name="srch_type" onchange="view(this.value);">
			<option value="0">Select Search Type</option>
			<option value="1" {if $srch_val==1}selected{/if}>Normal Search</option>
			<option value="2" {if $srch_val==2}selected{/if}>Advance Search</option>
			</select>
			</td>
			</tr>
			<tr><td width="100%" colspan="8">	
			<div id="norm_srch" {if $srch_val==1} style="display:inline;" {else} style="display:none;" {/if}>
					<table width="100%" cellpadding="4" cellspacing="0" border="0">
					<tr>
					<td align="right" class="list_item" colspan="4">Book Name</td>
					<td align="center" colspan="4" class="list_item">
					<input type="text" name="book_name_norm" class="text" value="{$book_name_norm}"/>				</td>
					</tr>
					<tr align="center">
					<td width="100%" colspan="5" class="text" align="center" >
					OR
					</td></tr>
					<tr>
					<td align="right" class="list_item" colspan="4">Author</td>
					<td align="center" colspan="4" class="list_item">
					<input type="text" name="author_norm" class="text" value="{$author_norm}"/>
					</td>
					<tr align="center">
					<td width="100%" colspan="8" class="btn_bg1">
					<input type="image" src="images/search.gif" name="srch_norm"></td></tr>
					 
					</table>
			</div>
			</td></tr>
			<tr><td width="100%" colspan="8">
			<div id="adv_srch" {if $srch_val==2}style="display:inline;"{else}style="display:none;"{/if}>
					<table width="100%" cellpadding="4" cellspacing="0" border="0">
					<tr>
					<td align="right" class="list_item" colspan="4">Book Name</td>
					<td align="center" colspan="4" class="list_item">
					<input type="text" name="book_name" class="text" value="{$book_name_adv}"/>
					</td>
					</tr>
					<tr>
					<td align="right" class="txtbox_bgcolor" colspan="4">Author</td>
					<td align="center" colspan="4" class="txtbox_bgcolor">
					<input type="text" name="author" class="text" value="{$author_adv}"/>
					</td>
					</tr>
					<tr>
					<td align="right" class="list_item" colspan="4">Publisher</td>
					<td align="center" colspan="4" class="list_item">
					<input type="text" name="publisher" class="text" value="{$publisher_adv}"/>
					</td>
					</tr>
					<tr>
					<td align="right" class="txtbox_bgcolor" colspan="4">Receive Date</td>
					<td align="center" colspan="4" class="txtbox_bgcolor">
					<input name="rec_date"  id="rec_date" type="text" size="20" class="text" value="{$rec_date_adv}" readonly />
					  <a href="javascript:cal4.popup();">
					  <img src="images/calender.gif" border="0" alt="Click to pickup date...">
					  </a>
					  </td>
					</tr>
					<tr align="center">
					<td align="center" colspan="8" class="btn_bg1">
					<input type="image" src="images/search.gif" name="srch_adv"></td></tr>
					</table>
			</div>
			</td></tr>
			</form>
			<form name="f1" action="?act=assign" method="POST" onsubmit="return validate_assign();">
			</td></tr>
                <tr>
                 <td class="title_heading" align="left" width="25%"  height="23"><font color="#000000">&nbsp;Book Name </font></td>
                 <td class="title_heading" align="left" width="25%" height="23"><font color="#000000">&nbsp;Author</font></td>
                 <td class="title_heading" align="left" width="25%" ><font color="#000000">&nbsp;Publisher</font></td>
                 <td class="title_heading" align="left" width="25%" ><font color="#000000">&nbsp;ISBN No </font></td>
                 {if $status == 1}
                 <td class="title_heading" align="left" width="25%" ><font color="#000000">&nbsp;Issued To </font></td>
				 <td class="title_heading" align="left" width="25%" bgColor="#cccccc"><font color="#000000">&nbsp;Issued Date </font></td>

				   <td class="title_heading" align="left" width="25%" colspan="2" ><font color="#000000">&nbsp;Return Date </font></td>
				 
				 {/if}
                </tr>
				<input type="text" name="book_id_list" />
				<input type="text" name="user_id_list" />
				<input type="text" name="changed_list" />
				<input type="hidden" name="cur_date" value="{$cur_date}" />
                {if $num > 0}
				{assign var="count" value=0}
                {section name=index loop=$book_id}
                  <tr>
				   
				   
                    <td class="list_item" align="left" width="25%" >&nbsp;{$book_name[index]}</td>
                    <td class="list_item" align="left" width="25%" >&nbsp;{$author[index]}</td>
                    <td class="list_item" align="left" width="25%" >&nbsp;{$publisher[index]}</td>
                    <td class="list_item" align="left" width="25%" >&nbsp;{$isbn_no[index]}</td>
					<input type="hidden" name="is_no" value="{$isbn_no[index]}" />
                    {if $status == 1}
					<td class="list_item" align="left" width="25%" >
					
					<select name="user[]" onchange="set_data(this,{$book_id[index]},{$count++});" id="user">
    				<!--{html_options values=$user_id output=$user_name}-->
					<option value="">Not issued till Now</option>
					{section name=ind loop=$user_id}
					<option value="{$user_id[ind]}" {if $user_id[ind]==$issued_user[index]} selected {/if}>{$user_name[ind]}</option>             
					{/section}
					</select>
					</td>
					<td class="list_item" align="left" width="25%" ><input type="text" class="text" name="issued_date"  value="{$issued_date[index]}" size="10" /></td>
					<td nowrap>
	<input name="{'ret_date'|cat:$cal_cnt}"  type="text" size="10" class="text" id="{'ret_date'|cat:$cal_cnt}"  value="{$return_dt[index]}" readonly="" />
	<td nowrap>
	<a href="javascript:cal_equip[{$cal_cnt++}].popup();"><img src="images/calender.gif" border="0" alt="Click to pickup..." onclick="set_date({$count-1});"></a></td>
				     </td>
					
					{/if}
                  </tr>
				  
                {/section}
				<input type="hidden" value="{$cal_cnt}" name="cal_count"/>
                <tr>
                  <td class="btn_bg1"  align="center" valign="MIDDLE" width="20%" bgColor="#cccccc" colSpan="9" height="30">
                 {if $status == 1}
				  <input type="image" name="assign" src="images/assign_user.gif" title="Assign Book to User"/> 
				 {/if}
				 </td>
                </tr>
                {elseif ($num==0) and ($num!="")}
                  <tr>
                    <td class="txt" colspan="9" align="center" width="25%"  height="23"><font color="RED">Sorry ! You have no such Privillage</font></td>
                  </tr>
                  <tr>
                    <td class="txt" align="center" valign="MIDDLE" width="20%" bgColor="#cccccc" colSpan="9" height="24">                    </td>
                  </tr>
                 {else}
                  <tr>
                    <td class="txt" colspan="9" align="center" width="25%"  height="23"><font color="RED">Sorry ! No Book/s found </font></td>
                  </tr>
                <tr>
                  <td class="btn_bg" align="center" valign="MIDDLE" width="20%" bgColor="#cccccc" colSpan="9" height="30">
                  </td>
                </tr>
                {/if}
              
            </table>
			</form>
            </td>
          </tr>
          <!--<tr>
            <td style="border-left: 1px solid #bbbbbb; border-right: 1px solid #bbbbbb" bgColor="#bbbbbb">
            <img title height="4" alt src="images/blank.gif" width="1"></td>
          </tr>-->
          </table>
        </td>
      </tr>
    </table>


<!-- ########################      End Here ##########################-->

{include file="foot.tpl"}
{literal}
<script language="JavaScript" src="js/calendar.js"></script>
	<script language="JavaScript">
	var cal4 = new calendar1(document.f2.elements['rec_date']);
	cal4.year_scroll = true;
	</script>
<script language="Javascript">

function set_data(p,b_id,count)
{
	var bookid=b_id;
	var ob1= document.f1.book_id_list;
	var ob2= document.f1.user_id_list;
	var ob3= document.f1.changed_list;
	ob1.value= ob1.value+bookid+",";
	ob2.value= ob2.value+p.value+",";
	ob3.value= ob3.value+count+",";
	if(p.value == 0 )
	{
		target="ret_date"+count;
		document.f1.elements[target].value="Not Issued";
		document.f1.issued_date[count].value="Not Issued";
	}
	else
	{
		var val = document.f1.cur_date.value;
		document.f1.issued_date[count].value = val;
	}
}

function set_date(val)
{
	var ob3= document.f1.changed_list;
	ob3.value= ob3.value+val+",";
}
	function view(p)
		{
			if(p == 0)
			{
			document.getElementById("norm_srch").style.display="none";
			document.getElementById("adv_srch").style.display="none";
			
			}
			if(p == 1)
			{
			document.getElementById("norm_srch").style.display="inline";
			document.getElementById("adv_srch").style.display="none";
			
			
			}
			if(p == 2)
			{
			document.getElementById("norm_srch").style.display="none";
			document.getElementById("adv_srch").style.display="inline";
			}
		}

    function validate()
             {      
			 var option = document.f2.srch_type.value;
			        if(option == 1)
					 {
					if(document.f2.book_name_norm.value == "" && document.f2.author_norm.value == "" )
					 {
						 alert("Please Enter Any One Of These ");
						 document.f2.book_name_norm.focus();
						 return false;
					  }
					  
					 }
					 else if(option == 2) 
					  {
					  if(document.f2.book_name.value == "")
					 {
						 alert("Please Enter name of the book you are searching ");
						 document.f2.book_name.focus();
						 return false;
					  }
					   if(document.f2.author.value == "")
					 {
						 alert("Please Enter name of the authore of the book you are searching ");
						 document.f2.author.focus();
						 return false;
					  }
					   if(document.f2.publisher.value == "")
					 {
						 alert("Please Enter name of publisher of the book you are searching");
						 document.f2.publisher.focus();
						 return false;
					  }
					   if(document.f2.rec_date.value == "")
					 {
						 alert("Please Enter receive date  of the book you are searching ");
						 document.f2.rec_date.focus();
						 return false;
					  }
					} 
             }
			 
			 
       </script>

<script language="JavaScript">
var cal_count=document.f1.cal_count.value;
var cal_equip=new Array(cal_count);

for(var i=0; i<cal_count; i++)
{
	target="ret_date"+i;
	cal_equip[i] = new calendar1(document.f1.elements[target]);
}

function validate_assign()
{
 
 for(var i=0; i<cal_count; i++)
	{   
		target="ret_date"+i;
		ret_date=document.f1.elements[target].value;
		is_no=document.f1.is_no;
		if(ret_date	 != "")
		{
			toDay=document.f1.cur_date.value;
			
			if(ret_date < toDay )
		 	 {
		  		alert("Return Date of Book With ISBN NO :"+is_no[i].value+" Must Be Greater than Current Date !");
		  		return false;
		 	 }
		}
	
	//alert(ret_date);
	user_control=document.f1.elements["user"];
	//alert(user_control);
	
	user_id	=user_control[i].value;
	//alert("User id   "+user_id+"  have RET DATE   "+ret_date);
	if(!((user_id == "" && ret_date == "Not Issued") || (user_id != "" && ret_date != "Not Issued") ))
	    {
		  alert("Book With ISBN NO :"+is_no[i].value+" is Not Assigned Properly !");
		  return false;  
		}
		
	
	}	



}
</script> 
{/literal}

Return current item: CoreAsset