Location: PHPKode > projects > CoreAsset > coreasset/templates/add_book.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">

 Add New Book/s
</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">-->
			<td>
            <!--<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>
			<form name="f1" method="post" action="?act=add" onSubmit="return validate();">
			
             <table cellSpacing="1" cellPadding="0" width="100%" border="0">
               {if $status < 4}
			    
			    {if $book_count > 0}
				<tr>
                  <td class="txt" width="20%" colspan="2" align="center">
                   <font color="#FF0000">{$msg}</font> </td>
                </tr>

				<tr>
                  <td class="alttxtbox_bgcolor" width="20%">
                   Book Name </td>
                  <td class="alttxtbox_bgcolor" width="33%">
				  <input name="book_name"  id="date" type="text" size="20" class="text" value="{$book_name}" /></td>
				 
                </tr>
				
				<tr>
				<td width="20%" class="txtbox_bgcolor">&nbsp;Author</td>
				<td width="33%" class="txtbox_bgcolor"><input type="text"  name="author" id="author" size="20" class="text" value="{$author}"/>
				</tr>
				<tr>
				<td class="alttxtbox_bgcolor">Select Number of Copies</td>
				<td class="alttxtbox_bgcolor"><select name="pieces" onChange="return go(this.value);">
				   {assign var="c" value=11}
				   {section name=count start=1 loop=$c}
				   <option value="{$count++}"> {$count} </option>
				   {/section}
				   <!--<option value="2"> 2</option>
				   <option value="3"> 3</option>
				   <option value="4"> 4</option>
				   <option value="5"> 5</option>
				   <option value="6"> 6</option>
				   <option value="7"> 7</option>-->
				   </select>
				  </td>
				</tr>
				<tr>
				<td width="20%" class="txtbox_bgcolor">&nbsp;ISBN No</td>
				<td width="33%" class="txtbox_bgcolor">
				<input type="text" class="text"  name="isbn_no[]" id="isbn_no" >
				</td>
				</tr>
				<tr>
				<td colspan="2">
				<div id="contact"></div>
				</td>
				</tr>
				<tr>
				<td width="20%" class="txtbox_bgcolor">&nbsp;Publisher</td>
				<td width="33%" class="txtbox_bgcolor"><input type="text"  name="publisher" id="publisher" size="20" class="text" value="{$publisher}"/>
				</tr>
				<tr>
                  <td class="alttxtbox_bgcolor" width="20%">
                  &nbsp;Receiving Date</td>
                  <td class="alttxtbox_bgcolor" width="33%">
				  <input name="rec_date"  id="rec_date" type="text" size="20" class="text"   value="{$rec_date}" readonly/>
                  <a href="javascript:cal4.popup();">
				  <img src="images/calender.gif" border="0" alt="Click to pickup date-time...">
				  </a>
				  </td>
                </tr>
				<tr>
                  <td class="txtbox_bgcolor" width="20%">
                  &nbsp;Individual Price</td>
               <td width="33%" class="txtbox_bgcolor"><input type="text"  name="price"  value="{$price}" id="price" size="20" class="text" onKeyPress="if((event.keyCode!=43) &&(event.keyCode!=47) &&(event.keyCode!=45) 
			&&(event.keyCode!=93) &&(event.keyCode!=91) 
			&& ((event.keyCode<48) ||(event.keyCode>57)))  event.returnValue = false;"/>
                </tr>
				<tr>
				   <td class="btn_bg" colSpan="1" >
                  <td class="btn_bg" colSpan="1" >
                  <input type="image" src="images/add_book.gif" name="add" title="add purchase order"></td>
                </tr>
				
				<table  cellSpacing="1" cellPadding="0" width="100%" border="0">
                <tr>
                  <td class="txt" align="center" width="20%" class="alttxtbox_bgcolor" height="23">
                  <font color="RED"></font>
                  </td>
                </tr>
             </table>
           
            </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>-->
{literal}		  
<script language="JavaScript" src="js/calendar.js"></script>
	<script language="JavaScript">
	var cal4 = new calendar1(document.f1.elements['rec_date']);
	cal4.year_scroll = true;
</script>
{/literal}		  
         {else}
		    <tr>
			<td class="title_heading"></td> 
			</tr>
			<tr>
            <td class="txt" align="center" valign="MIDDLE" width="20%"  colSpan="4" height="30"><font color="RED">Sorry ! Book Category Still Not Added</font>
			</td>
             
		 </tr>
		 <tr>
                  <td class="btn_bg1" align="center" valign="MIDDLE" width="20%" bgColor="#cccccc" colSpan="4" height="30">
                  <a href="add_category.php"><img src="images/add_category.gif" border="0" title="Click to Add Category"></a>
                  </td>
                </tr>
			 {/if}
        {else}
		
		<tr>
            <td class="txt" colspan="9" align="center" width="25%"  height="23"><font color="RED">Sorry ! You have no such Privillage</font></td>
             
		 </tr>
				  
		{/if}
		
		</table>
		
	
  </td>
  </tr>
  </form>
  </table>


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

{include file="foot.tpl"}
{if $status ==1}
{literal}
<script language="Javascript">


// #################################################################

function all_clear()
{
	document.getElementById("contact").innerHTML = '';
}

function go(num)
{
	all_clear();
	for(var i=0; i < num; i++)
	{
		if(i%2 == 0)
			{
				var cl="alttxtbox_bgcolor";
			}
		else
			{
			  var cl="txtbox_bgcolor";
			}
			
		var p= document.getElementById("contact").innerHTML;
		
		document.getElementById("contact").innerHTML = p+'<table width="100%" cellspacing="1" cellpadding="0"><tr>'
				+'<td width="20%" class="'+cl+'">&nbsp;ISBN No</td>'
				+'<td width="33%" class="'+cl+'">'
				+'<input type="text" class="text"  name="isbn_no[]" id="isbn_no">'
				+'</tr></table>';
	}
}


// #################################################################
</script>


	
	<script type="text/javascript">
function validate()
{
		 
		 if(document.f1.book_name.value=="")
		 {
		  alert("Please Select Name Of The Book  !");
		  document.f1.book_name.focus();
		  return false;
		 }
		 if(document.f1.author.value=="")
		 {
		  alert("Please Select Author Name !");
		  document.f1.author.focus();
		  return false;
		 }
		
		// ISBN blank Check
		
		 var obj_isbn = document.f1.elements["isbn_no"];
		 if(obj_isbn.length)
		 {
			 	var len=obj_isbn.length;
				for(i=0;i<len;i++)
				   {
				 		if(obj_isbn[i].value=="")
				  		{
				  		alert("You Must Specify All The ISBN Number");
				  		obj_isbn[i].focus();
				  		return false;
				   		}
				   }
		 }
		 else
		 {
		 		if(obj_isbn.value=="")
				 {
				  		alert("You Must Specify The ISBN Number");
				  		obj_isbn.focus();
				  		return false;
				 }
		 }
		 // ISBN duplicate check
         var len1=document.f1.isbn_no.length;
		 
         var ob1=document.f1.isbn_no;
            for(i=0;i<len1;i++)
			 { 
               for(j=i+1;j<len1;j++)
			   {
                if(ob1[i].value==ob1[j].value)
              {
              alert("ISBN Number should be distinct");
	          ob1[i].focus();
	           return false;
			   }
              }
               }
			
		 if(document.f1.publisher.value=="")
		 {
		  alert("Please Select Publisher !");
		  document.f1.publisher.focus();
		  return false;
		 }
		 
		 if(document.f1.rec_date.value=="")
		 {
		  alert("Please Select Receving Date !");
		  document.f1.rec_date.focus();
		  return false;
		 }
		 if(document.f1.price.value=="")
		 {
		  alert("Please Select Price!");
		  document.f1.price.focus();
		  return false;
		 }
    var ans = confirm("Are you sure? The Book will be added !");
	if(ans)
	 {
		document.f1.pieces.value++;
	 }
return ans;
}
	</script> 
{/literal}		
{/if}		
				
Return current item: CoreAsset