Location: PHPKode > projects > CoreAsset > coreasset/templates/add_asset.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 Asset
</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>
            {if $status < 4}
            <table borderColor="#cccccc" cellSpacing="1" cellPadding="0" border="0">
              <form name="f1" action="?act=add" method="post" onSubmit="return validate();" ENCTYPE="multipart/form-data">
			  <input type="hidden" name="res_num"  id="res_num" value="{$res_num}" />
			 {section name=an loop=$asset_nickname}
			  <input type="hidden" name="nickname[]"  id="nickname" value="{$asset_nickname[an]}" />
			  {/section}
                <tr>
                  <td class="txtbox_bgcolor" width="20%">
                   &nbsp;Category</td>
                  <td class="txtbox_bgcolor" width="33%">
				  <input type="text" class="text" disabled
				  {section name=index loop=$category_id}
                     {if $cat_id==$category_id[index]}
	                      value="{$category_name[index]}"
					 {/if}
                  {/section} />
				  <input type="hidden" name="category_id" value="{$cat_id}" />
			</td>
                </tr>
                <tr>
                  <td class="alttxtbox_bgcolor" width="20%">
                  &nbsp;Asset Nickname</td>
                  <td class="alttxtbox_bgcolor" width="33%">
                  <input name="asset_nickname"  type="text" size="20" class="text"></td>
                </tr>

{*
		
                <tr>
                  <td class="txtbox_bgcolor" width="20%">
                  &nbsp;Model</td>
                  <td class="txtbox_bgcolor" width="33%">
                  <input name="model" type="text" size="20" class="text"></td>
                </tr>
*}
                <tr>
                  <td class="alttxtbox_bgcolor" width="20%">
                  &nbsp;Purchase Order No.</td>
                  <td class="alttxtbox_bgcolor" width="33%">
                  <input name="po_no" type="hidden" size="20" value="{$po_no}">
                  <input name="po_no" type="text" size="20" class="text" value="{$po_no}" readonly disabled></td>
                </tr>

                <tr>
                  <td class="txtbox_bgcolor" width="20%">
                  &nbsp;Price</td>
                  <td class="txtbox_bgcolor" width="33%">
                  <input name="asset_price" type="text" size="20"  disabled="disabled" class="text" value="0" onKeyPress="if (((event.keyCode < 48)||(event.keyCode > 57))&&(event.keyCode!=46)) event.returnValue = false;"></td>
                </tr>

                <tr>
                  <td class="alttxtbox_bgcolor" width="20%">
                  &nbsp;Vendor </td>
                  <td class="alttxtbox_bgcolor" width="33%">
                  <input name="vendor_id" type="hidden" size="20" value="{$vendor_id}">
                  <input name="vendor_name" type="text" size="20" value="{$vendor_name}"  class="text" readonly disabled>
				  <input type="hidden" name="cur_date" value="{$cur_date}" />
				  </td>
                </tr>

                <tr>
                  <td class="txtbox_bgcolor" width="20%">&nbsp;Equipment </td>
                  <td class="txtbox_bgcolor" width="" nowrap>
				  <div id="serial_no" style="border:#000000 1px solid; height:150px;overflow:auto; width:100%">
				  <table align="left" id="tbl_serial">

				{*  <input name="equi_id" type="hidden" size="20" value="{$equi_id}"> *}
				 
				  {section name=i loop=$equipment_name}
					{section name=idd loop=$no_pcs[i]}
						<tr>
						<td class="txtbox_bgcolor" nowrap><i><u>{$equipment_name[i]}</u></i> [{$equipment_model[i]}]</td>
						<td class="txtbox_bgcolor" nowrap>Serial</td>
						<td class="txtbox_bgcolor" nowrap><input type="text" name="serial[]" size="10" id="serial_n"  class="text"/></td>
						<td class="txtbox_bgcolor" nowrap>&nbsp;Manufacturer</td>
						<td nowrap>
						<input name="manufacturer[]"  type="text" size="10" class="text" id="manufac">
						</td>
						<td class="txtbox_bgcolor" nowrap>Price:</td>
						<td class="txtbox_bgcolor" nowrap>
						<input type="text" name="eq_price[]" size="10" id="eq_price"  onchange="update_total();" class="text" onKeyPress="if (((event.keyCode < 48)||(event.keyCode > 57))&&(event.keyCode!=46)) event.returnValue = false;"/></td>
						<td class="txtbox_bgcolor" nowrap>&nbsp;Warranty</td>
						<td nowrap>
						<input name="{'exp_date'|cat:$cal_cnt}"  type="text" size="10" class="text" id="{'exp_date'|cat:$cal_cnt}" readonly="">
						<td nowrap>
						<a href="javascript:cal_equip[{$cal_cnt++}].popup();"><img src="images/calender.gif" border="0" alt="Click to pickup..."></a></td>
						</td>

						<td class="txtbox_bgcolor" nowrap>&nbsp;Issue To</td>
						<td nowrap>
						  <select name="iss_userid[]">
						   <option value="" selected>-- Don't issue now --</option>
						   {section name=index1 loop=$userid}
						   <option value="{$userid[index1]}">{$full_name[index1]}</option>
						   {/section}
						  </select>
						</td>
						</tr>
					    <input name="equi_id[]" type="hidden" size="20" value="{$eeq[i]}">
					    {*$eeq[i]*}
					{/section}
				  {/section}

				
				  <input type="hidden" value="{$cal_cnt}" name="cal_count"/>
				 
				  </table>
				  </div>
				  </td>
                </tr>
                
                <tr>
                  <td class="alttxtbox_bgcolor" width="20%">
                  &nbsp;Decription</td>
                  <td class="alttxtbox_bgcolor" width="33%">
                  <textarea name="asset_description" rows="10" cols="30"></textarea>
		  </td>
                </tr>

                <tr>
                  <td class="txtbox_bgcolor" width="20%">
                  &nbsp;Receive Date</td>
                  <td class="txtbox_bgcolor" width="33%">
                  <input name="receive_date"  type="text" size="20" class="text" readonly>
                  <a href="javascript:cal_rec.popup();"><img src="images/calender.gif" border="0" alt="Click to pickup..."></a>                  </td>
                </tr>

                <tr>
                  <td class="alttxtbox_bgcolor" width="20%">
                  &nbsp;Upload Attachment</td>
                  <td class="alttxtbox_bgcolor" width="33%">
                  <input name="attachment_name"  type="file" size="20" class="text">
		  </td>
                </tr>

{*                
		<tr>
                  <td class="alttxtbox_bgcolor" width="20%">
                  &nbsp;Issue to User</td>
                  <td class="alttxtbox_bgcolor" width="33%">
                  <select name="issued_userid">
                   <option value="-1">-- Don't issue now --</option>
                   {section name=index loop=$userid}
                   <option value="{$userid[index]}">{$full_name[index]}</option>
                   {/section}
                  </select>                  
		 </td>
                </tr>
*}
                
		<tr>
				  <td class="btn_bg" colSpan="1"></td>
                  <td class="btn_bg" colSpan="1">
                  <input type="image" src="images/add_asset.gif" name="add" title="add asset"></td>
                </tr>
              </form>
            </table>

            {else}
            <table cellSpacing="1" cellPadding="0" width="100%" border="0">
                <tr>
                  <td class="txt" align="center" width="20%" height="23">
                  <font color="RED">{$mes}</font>
                  </td>
                </tr>
             </table>
            {/if}
            </td>
          </tr>
          
          </table>
        </td>
      </tr>
    </table>


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

{include file="foot.tpl"}
{if $status < 4}

{literal}
<script language="Javascript">

function update_total()
{
	var obj = document.f1.elements["eq_price"];
	target = document.f1.asset_price;
	var total_price=0;
	//alert(obj.length);
	if(!obj.length)
	{
		
		total_price = total_price + parseFloat(obj.value);
	}
	else
	{
		var len = obj.length;
	
		//alert("Length : "+len);
		
		
		for(var i= 0 ; i<len ; i++)
		{
			//alert("loop count "+i);
			//alert("Obj Value :" + obj[i].value);
			if(obj[i].value)
			{
				  //alert("Mrinmoy");
				  total_price = total_price + parseFloat(obj[i].value);
			}
		}
	}
	//alert("Total Price :" + total_price);
	target.value = total_price;
}
function validate()
{
 
// Asset Nickname Checking
var num_count = document.f1.res_num.value;

if(document.f1.asset_nickname.value == "")
 {
  alert("Please Enter Nickname !");
  document.f1.asset_nickname.focus();
  return false;
 }
if(num_count > 0)
{
 
var a = document.getElementById("nickname");
//alert(a.length);
if(a.length)
{
	alert("length found");
	var len =a.length;
	for(var i=0 ; i<len ; i++)
	 {
		 if(document.f1.asset_nickname.value == a[i].value)
		 {
		  alert("Nickname Already Exist in Database !");
		  document.f1.asset_nickname.focus();
		  return false;
		 }
	}
}
else
{
 	if(document.f1.asset_nickname.value == a.value)
		 {
		  alert("Nickname Already Exist in Database !");
		  document.f1.asset_nickname.focus();
		  return false;
		 }
}
}
// Model Name checking
/*
 if(document.f1.model.value=="")
 {
  alert("Please Enter Model !");
  document.f1.model.focus();
  return false;
 }
*/

  // Serial number check
 var obj_serial=document.f1.elements["serial_n"];
 if(obj_serial.length)
 {
	 //var obj_serial = document.f1.serial_n;
	 var len = obj_serial.length;
	 for(i=0;i<len;i++)
	  {
	   if(obj_serial[i].value=="")
	   {
		  alert("You Must Specify All The Serial Number");
		  obj_serial[i].focus();
		  return false;
	   }
	  }
  }
  else
  {
  	if(obj_serial.value=="")
	   {
		  alert("You Must Specify The Serial Number");
		  obj_serial.focus();
		  return false;
	   }
  }

  var len1=document.f1.serial_n.length;
  var ob1=document.f1.serial_n;

  for(i=0;i<len1;i++)
  { 
	for(j=i+1;j<len1;j++)
	{
		if(ob1[i].value==ob1[j].value)
		{
			alert("Serial Number should be distinct !");
			ob1[i].focus();
			return false;
		}
	}
  }

 // Manufacture validation check
 var obj_manufac=document.f1.elements["manufac"];
 if(obj_manufac.length)
 {
	 var len = obj_manufac.length;
	 for(i=0;i<len;i++)
	  {
	   if(obj_manufac[i].value=="")
	   {
		  alert("You Must Specify All The Manufacture Name ");
		  obj_manufac[i].focus();
		  return false;
	   }
	  }
  }
  else
  {
  		if(obj_manufac.value=="")
	   {
		  alert("You Must Specify The Manufacture Name ");
		  obj_manufac.focus();
		  return false;
	   }
  }
  
// Price Checking 
var obj_price=document.f1.elements["eq_price"];
 if(obj_price.length)
 {
	 var len = obj_price.length;
	 for(i=0;i<len;i++)
	  {
	   if(obj_price[i].value=="")
	   {
		  alert("You Must Specify All The Price ");
		  obj_price[i].focus();
		  return false;
	   }
	  }
  }
  else
  {
  	   if(obj_price.value=="")
	   {
		  alert("You Must Specify The Price ");
		  obj_price.focus();
		  return false;
	   }
  }

// Expiry date validation check
/*
 for(var i=0; i<cal_count; i++)
	{
		target="exp_date"+i;
		exp_dt=document.f1.elements[target].value;
		if(exp_dt != "")
		{
			toDay=document.f1.cur_date.value;
			if(exp_dt < toDay )
		 	 {
		  		alert("Warranty Date Must Be Greater than Current Date !");
		  		return false;
		 	 }
		}
	}
	
*/
	
// receive date validation check
 if(document.f1.receive_date.value=="")
 {
  alert("Please Select Receive Date !");
  document.f1.receive_date.focus();
  return false;
 }

/*
for(var i=0; i<cal_count; i++)
{
	target="exp_date"+i;
	exp_dt=document.f1.elements[target].value;
	if(exp_dt != "")
	{
		var rcv_dt = document.f1.receive_date.value;
		if(exp_dt < rcv_dt )
		 {
			alert("Warranty Date Must Be Greater than Receive Date !");
			return false;
		 }
	}
}
*/
 return confirm("Are you sure? The Asset will be added!");
}
</script>
<script language="JavaScript" src="js/calendar.js"></script>
<script language="JavaScript">
var cal_rec = new calendar1(document.f1.elements['receive_date']);
		cal_rec.year_scroll = true;
var cal_count=document.f1.cal_count.value;
var cal_equip=new Array(cal_count);
//alert(cal_equip.length);

		
for(var i=0; i<cal_count; i++)
{
	target="exp_date"+i;
	/*var obj=document.f1.elements[target];
	alert("Target is : " +target+ " & calender object is : "+"cal"+i+ " Object is : "+obj.name);*/
	cal_equip[i] = new calendar1(document.f1.elements[target]);
}



</script>
{/literal}
{/if}
Return current item: CoreAsset