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

  Edit 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  cellSpacing="1" cellPadding="0" width="100%" border="0">
              <form name="f1" action="?act=edit" method="post" onSubmit="return validate();" ENCTYPE="multipart/form-data">

                <tr>
                  <td class="alttxtbox_bgcolor" width="20%">
                  &nbsp;Asset Nick Name</td>
                  <td class="alttxtbox_bgcolor" width="33%">
                  <input name="asset_nickname" type="text" size="20" class="text" value="{$asset_nickname}"></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="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" class="text" value="{$asset_price}" disabled></td>
                </tr>

                <tr>
                  <td class="alttxtbox_bgcolor" width="20%">
                  &nbsp;Vendor Name</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></td>
				   <input type="hidden" name="cur_date" value="{$cur_date}" /> 
                </tr>

                <tr>
                  <td class="txtbox_bgcolor" width="20%">
                  &nbsp;Equipment Name</td>
                  <td class="txtbox_bgcolor" width="33%" nowrap>
                  <div id="serial_no" style="border:#000000 1px solid; height:150px;overflow:auto; width:100%">
				   <table align="left" id="tbl_serial" cellspacing="0" cellpadding="0" border="0">
				  
				  <input name="equi_id" type="hidden" size="20" value="{$equi_id}">
				  {section name=i loop=$equipment_name}
				  {if $eq_status[i] != 3 }
				  	  <tr><td class="txtbox_bgcolor" nowrap><u><i>{$equipment_name[i]}</i></u> [{$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" value="{$serial_no[i]}"/></td>
					 <td class="txtbox_bgcolor" width="20%" nowrap>&nbsp;Manufacturer</td>
                  <td nowrap><input name="asset_manufacturer[]"  type="text" size="10" class="text" value="{$man[i]}" 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"  class="text" value="{$eq_price[i]}" onchange="update_total();" 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;"/>
			-->
				  <input type="text" name="eq_price[]" size="10" id="eq_price"  class="text" value="{$eq_price[i]}" onchange="update_total();" class="text"  onKeyPress="if (((event.keyCode < 48)||(event.keyCode > 57))&&(event.keyCode!=46)) event.returnValue = false;"/>

			</td>
				  
				  <td class="txtbox_bgcolor" width="30%" nowrap>&nbsp;Warranty </td>
                   <td width="41%" nowrap>
				  <input name="{'exp_date'|cat:$cal_cnt}"  type="text" size="10" class="text" id="{'exp_date'|cat:$cal_cnt}"
				  value="{$expiry_date[i]}" readonly=""></td>
				  <td nowrap>
				  <a href="javascript:cal_equip[{$cal_cnt++}].popup();"><img src="images/calender.gif" border="0" alt="Click to pickup..."></a>
				   </td>
				  	 
			<td class="txtbox_bgcolor" nowrap>&nbsp;Issue To</td>
			<td nowrap>
			  <select name="iss_userid[]">
			   <option value="">-- Don't issue now --</option>
			   {section name=index1 loop=$userid}
			   <option value="{$userid[index1]}" {if $issud_userid[i]==$userid[index1]}selected{/if} >{$full_name[index1]}</option>
			   {/section}
			  </select>
			</td>
			
			<input type="hidden" name="serial_id[]" value="{$serial_id[i]}">
			<input type="hidden" name="eq1[]" value="{$eq[i]}">
					 
			</tr>
			{else}
				<!--	for equipments who are obsoleted -->
				
					{*
					<a href="javascript:void(0)" 
onclick="window.open('show_asset_history.php?hd83___2y8dh328f____8hhdiw___jd9={$asset_tag}','external','resizable=yes, toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, width=700, height=500, screenX=25,screenY=25,left=25,top=25'); return false;">
*}

                      <tr title="Equipment is Obsolete">
					 <td class="obsoleted" nowrap><u><i>{$equipment_name[i]}</i></u></td>
				  	  <td class="obsoleted" nowrap>Serial:</td>
				  	 <td class="obsoleted" nowrap><input type="text" name="serial[]" size="10" id="serial_n" class="text" value="{$serial_no[i]}" disabled="disabled"/></td>
					 <td class="obsoleted" width="20%" nowrap>&nbsp;Manufacturer</td>
                  <td nowrap class="obsoleted"><input name="asset_manufacturer[]"  type="text" size="10" class="text" value="{$man[i]}" id="manufac"/ disabled="disabled"></td>
				  <td class="obsoleted" nowrap>Price:</td>
			  	  <td class="obsoleted" nowrap>
				  <input type="text" name="eq_price[]" size="10" id="eq_price"  class="text" value="{$eq_price[i]}"  disabled="disabled"  /></td>
				  
				  <td class="obsoleted" width="30%" nowrap>&nbsp;Warranty </td>
                   <td width="41%" nowrap class="obsoleted">
				  <input name="{'exp_date'|cat:$cal_cnt}"  type="text" size="10" class="text" id="{'exp_date'|cat:$cal_cnt}"
				  value="{$expiry_date[i]}"  disabled="disabled"></td>
				 <td nowrap class="obsoleted">
				   <!--<a href="javascript:cal_equip[{$cal_cnt++}].popup();"><img src="images/calender.gif" border="0" alt="Click to pickup..."></a>-->
				   </td>

			<td  class="obsoleted" nowrap>&nbsp;Issue To</td>
			<td nowrap>
			  <select name="iss_userid[]" disabled>
			   <option value="">-- Don't issue now --</option>
			   {section name=index1 loop=$userid}
			   <option value="{$userid[index1]}">{$full_name[index1]}</option>
			   {/section}
			  </select>
			</td>
				 
			<input type="hidden" name="serial_id[]" value="{$serial_id}">
			
			 </tr>
                     
					{/if}
				  {/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">{$asset_description}</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 value="{$receive_date}">

                  <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" align="left" valign="TOP" width="33%">
		  <table width="50%">
		  <tr>
                  <td><input name="attachment_name"  type="file" size="20" class="text"></td>{if $attachment_name!=""} <td>&nbsp;&nbsp;{*<img border="0" src="{$img_nm}">*}</td><td>&nbsp;&nbsp;<a href="att_dnld.php?fl={$attachment_name}"><font color="BLUE">{$attachment_name}</font>&nbsp;</a></td>{/if}
		  </tr>
		  </table>
		  </td>
                </tr>

               <tr>
                <input name="asset_tag"  type="hidden"  value="{$asset_tag}">

                <tr>
				  <td class="btn_bg" colSpan="1">
                  <td class="btn_bg" colSpan="1">
                  <input type="image" src="images/edit_asset.gif" name="add"></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)
			{
				 
				  total_price = total_price + parseFloat(obj[i].value);
			}
		}
	}
	//alert("Total Price :" + total_price);
	target.value = total_price;
}
function validate()
{
 

 if(document.f1.asset_nickname.value=="")
 {
  alert("Please Enter Asset Nickname !");
  document.f1.asset_nickname.focus();
  return false;
 }

 

 /*if(document.f1.asset_price.value=="")
 {
  alert("Please Enter Price !");
  document.f1.asset_price.focus();
  return false;
 }*/

 if(document.f1.receive_date.value=="")
 {
  alert("Please Select Receive Date !");
  document.f1.receive_date.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 len=document.f1.manufac.length;
 var ob=document.f1.manufac;
 for(i=0;i<len;i++)
  {
   if(ob[i].value=="")
   {
      alert("You Must Specify All The Manufacture Name ");
	  ob[i].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;
		 	 }
		}
	}	
*/
	
 return confirm("Are you sure? the asset will be edited !");
}
</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;
	//alert(target);
	cal_equip[i] = new calendar1(document.f1.elements[target]);
}
</script>
{/literal}
{/if}
Return current item: CoreAsset