{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 Purchase Order
</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" align="center">
<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">-->
{if $status < 4}
<table borderColor="#ffffff" cellSpacing="1" cellPadding="0" width="100%" border="0">
<form name="f1" action="?act=edit" method="post" onSubmit="return validate();">
<tr>
<td class="txtbox_bgcolor">Category Name</td>
<td class="txtbox_bgcolor"><input name="category" type="text" size="20" class="text" readonly value="{$category_name}"></td>
</tr>
<tr>
<td class="alttxtbox_bgcolor" width="20%">
Select Equipment {$var}</td>
{*
<td class="alttxtbox_bgcolor" width="33%">
{if $no1 > 0}
<select name="equipment_id[]" id="eq_id" multiple>
<option value="" >-- Select Equipment --</option>
{section name=index loop=$equip_id}
<option value="{$equip_id[index]}"
{section name=ind loop=$equip_arr}
{ if $equip_id[index]==$equip_arr[ind] } selected {/if}
{/section}
>{$equip_name[index]}</option>
{/section}
</select>
{else}
<font color="RED">No Equipment Still Aded !</font>
{/if}
</td>
*}
<td class="alttxtbox_bgcolor" width="33%">
<table width="100%" border="0">
{section name=index loop=$equip_id}
{if !($i++ % 2 > 0)}
<td>
{else}
<tr><td>
{/if}
{if $eq_siz > 1 }
<input type="checkbox" id="eq_id" name="equipment_id[]" value="{$equip_id[index]}" onClick="return put_val('{$equip_id[index]}', '{$equip_name[index]}')" {section name=ind loop=$equip_arr}
{ if $equip_id[index]==$equip_arr[ind] } checked {/if}
{/section}>
{else}
<input type="checkbox" id="eq_id" name="equipment_id" value="{$equip_id[index]}" onClick="return put_val('{$equip_id[index]}', '{$equip_name[index]}')" {section name=ind loop=$equip_arr}
{ if $equip_id[index]==$equip_arr[ind] } checked {/if}
{/section}>
{/if}
{$equip_name[index]} [<font color="#003366">{$equip_model[index]}</font>]
<br><br>
<div align="center" id="{$equip_id[index]}" style="width:auto;display:inline; border:#999999 1px solid; background-color:#cccc99; padding:1px;" >
No of Pcs for {$equip_name[index]} <input type="text" name="eq_pc[]" id="eq_pc" {section name=ind1 loop=$equip_arr}
{if $equip_id[index]==$equip_arr[ind1] } value="{$pcs[ind1]}" {/if}
{/section} value="0" size="4" maxlength="3" onKeyPress="if ((event.keyCode < 48)||(event.keyCode > 57)) event.returnValue = false;">
</div>
{if !($i % 2 > 0)}
</td>
{else}
</td></tr>
{/if}
{/section}
<input type="hidden" name="h_eq" value="{$eq_siz}">
{* <tr><td><a href="#" onclick="sh_al()"><font color="#333333">Show All</font></a></td><td><a href="#" onclick="hd_al()"><font color="#333333">Hide All</font></a></td></tr> *}
</table>
</td>
</tr>
<tr>
<td class="txtbox_bgcolor" width="20%">
Date</td>
<td class="txtbox_bgcolor" width="33%">
<input name="date" type="text" size="20" class="text" readonly value="{$po_date}">
<a href="javascript:cal4.popup();"> <img src="images/calender.gif" border="0" alt="Click to pickup date-time..."></a> </td>
</tr>
<tr>
<td class="alttxtbox_bgcolor" width="20%">
Vendor</td>
<td class="alttxtbox_bgcolor" width="33%">
<select name="vendor_id">
<option value="">-- Select Vendor --</option>
{section name=index loop=$vendor_id}
<option value="{$vendor_id[index]}" {if $vendor_id[index]==$vendorid}selected{/if}>{$vendor_name[index]}</option>
{/section}
</select> </td>
</tr>
<input name="po_no" type="hidden" value="{$po_no}">
{if $nor == 0}
<tr>
<td class="btn_bg" colSpan="1"></td>
<td class="btn_bg" colSpan="1">
<input type="image" src="images/edit_po.gif" name="add"></td>
</tr>
{else}
<td class="txt" align="center" width="20%" bgColor="#cccccc" height="23" colspan="3">
<font color="RED">Asset is Already Made!!</font>
</td>
{/if}
</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>
<!--<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"}
{if $status < 4}
{literal}
<script language="Javascript">
function validate()
{
//alert(document.f1.h_eq.value);
var eq = document.f1.eq_id;
var fl = 0;
if(document.f1.h_eq.value > 1)
{
for(var i=0; i<eq.length; i++)
{
if(eq[i].checked)
{
fl = 1;
}
}
}
else if(document.f1.h_eq.value==1)
{
if(document.f1.equipment_id.checked)
{
fl = 1;
}
else
{
fl = 0;
}
}
//alert(equipment_id.length);
if(fl==0)
{
alert("Please Select at least one Equipment !");
return false;
}
if(document.f1.h_eq.value > 1)
{
for(var i=0; i<eq.length; i++)
{
if(eq[i].checked)
{
if((document.f1.eq_pc[i].value=="0") || (document.f1.eq_pc[i].value=="") )
{
alert("Please enter No of Pcs !");
sh_al();
document.f1.eq_pc[i].focus();
document.f1.eq_pc[i].value.select;
return false;
break;
}
}
}
}
else
{
if(document.f1.equipment_id.checked)
{
if((document.f1.eq_pc.value=="0") || (document.f1.eq_pc.value=="") )
{
alert("Please enter No of Pcs !");
sh_al();
document.f1.eq_pc.focus();
document.f1.eq_pc.value.select;
return false;
// break;
}
}
}
if(document.f1.date.value=="")
{
alert("Please Select Date !");
document.f1.date.focus();
return false;
}
if(document.f1.vendor_id.value=="")
{
alert("Please Select a Vendor !");
document.f1.vendor_id.focus();
return false;
}
return confirm("Are you sure? the purchase order will be edited !");
}
function showequip()
{
var a;
a=document.f1.category.value;
if(a === "")
url= "add_purchase.php";
else
url="add_purchase.php?cat_id=";
location=url+a;
}
</script>
<script language="JavaScript" src="js/calendar.js"></script>
<script language="JavaScript">
var cal4 = new calendar1(document.f1.elements['date']);
cal4.year_scroll = true;
</script>
<script language="Javascript">
function hd_al()
{
var eq = document.f1.eq_id;
var epc = document.f1.eq_pc;
var fl = 0;
for(var i=0; i<eq.length; i++)
{
if(eq[i].checked)
{
}
else
{
epc[i].value = 0;
}
//document.getElementById(eq[i].value).style.display='none';
}
}
function sh_al()
{
var eq = document.f1.eq_id;
var epc = document.f1.eq_pc;
var fl = 0;
for(var i=0; i<eq.length; i++)
{
if(eq[i].checked)
{
}
else
{
epc[i].value = 0;
}
document.getElementById(eq[i].value).style.display='inline';
}
}
function put_val(i, v)
{
hd_al();
document.getElementById(i).style.display='inline';
}
</script>
{/literal}
{/if}