<?php include("../../include/dbconnect.php");?>
<script  type="text/javascript" language="javascript">
function addNumbers()
{
//var val1 = parseInt(document.getElementById("blankval").value);
var val1 = parseFloat(document.getElementById("blankval").value);
var val2 = parseFloat(document.getElementById("piercval").value);
var val3 = parseFloat(document.getElementById("formval").value);
var val4 = parseFloat(document.getElementById("blendval").value);
var val5 = parseFloat(document.getElementById("tools1val").value);
var val6 = parseFloat(document.getElementById("tools2val").value);
var ansD = document.getElementById("total");
ansD.value = val1 + val2 + val3 + val4 + val5 + val6 ;
}
function addnum()
{
var val1 = parseFloat(document.getElementById("rawcost").value);
var val2 = parseFloat(document.getElementById("processcost").value);
var val3 = parseFloat(document.getElementById("admnexp").value);
var ansD = document.getElementById("totcost");
ansD.value = val1 + val2 + val3;
}
function add_num()
{
var val1 = parseFloat(document.getElementById("procstripval").value);
var val2 = parseFloat(document.getElementById("procblankval").value);
var val3 = parseFloat(document.getElementById("procburrval").value);
var val4 = parseFloat(document.getElementById("procpierval").value);
var val5 = parseFloat(document.getElementById("procformval").value);
var val6 = parseFloat(document.getElementById("procbendval").value);
var val7 = parseFloat(document.getElementById("procflatval").value);
var val8 = parseFloat(document.getElementById("prochardval").value);
var val9 = parseFloat(document.getElementById("procfinishval").value);
var val10 = parseFloat(document.getElementById("procinsval").value);
var ansD = document.getElementById("totprocs");
ansD.value = val1 + val2 + val3 + val4 + val5 + val6 + val7 + val8 + val9 + val10;
}
</script>
<?
foreach($_POST as $p=>$t)
{
	$_POST[$p] = trim($t);
}
$myCustomer = $_POST['Customer'];
foreach($_POST as $q=>$r)
{
	$_POST[$q] = trim($r);
}
$myProduct = $_POST['Product'];
//echo "$myProduct";

?>
<title>Orders View</title>
<style type="text/css">
<!--
body {
	background-color: #FFFFCC;
}
-->
</style><body background=blater01.gif  topmargin=0>
<center> 
<table cellpadding=0 cellspacing=4 width=590>
  <tr> 
    <td style="padding:3px;" colspan=2 bgcolor="#93BEE2"><font face="Verdana, Arial, Helvetica, sans-serif"><b><b>WILSON PRESS TOOLS</b></font></td></tr>
<tr><td><font face="Verdana, Arial, Helvetica, sans-serif"><b><b>COST CALCULATION CARD</b></font></td></tr>
<tr><td ><font face="Verdana, Arial, Helvetica, sans-serif"><b> FOR PRESSED COMPONENTS</b></font></td></tr>
</table>
<body>
<hr align = center width = 620 >
</hr>
</body>

  <tr valign="top"> 
    <td colspan=2> <font >&nbsp;</font> </td>
  </tr>
</table>
<table border=0 cellpadding=3 cellspacing=4 width="590">
<tr> 
<td width="139" height="31" align="right" ><font color="#003366" size="1" face="Verdana, Arial, Helvetica, sans-serif"><b>Customer / Client
  &nbsp;</b></font></td><td>
<?

// Pull all the data from Customer master & populate it

$stQuery = mysql_query("select bcode,name,unit,buyertype from buy  where buyertype != 'LABOUR' order by name")or die( mysql_error() );

?>
<form name='myForm01' method='POST' action='<?=$_SERVER[PHP_SELF]?>'>
  <SELECT name='Customer' onChange="javascript:submit();">
    <?
echo "<option selected value=\" 0\"> Select Customer";
while($row = mysql_fetch_row($stQuery))
{
	   if($row[3]== 'LABOUR')
	   {
		   	$type='------>>'.$row[3];
		}
		elseif($row[3]!= 'LABOUR')
		{
			$type ='';
		}	
	$temp = $row[1].'&nbsp;&nbsp;'.$row[2].$type;
	if(isset($myCustomer) && eregi("$myCustomer",$row[0]))
	{
		echo "<option selected value=\"$row[0]\">$temp";
	}
	else{
		echo "<option value=\"$row[0]\">$temp";
	}
}
?>
  </SELECT></td></tr>

  
<tr > 
  <td width="139" height="31" align="right" ><font color="#003366" size="1" face="Verdana, Arial, Helvetica, sans-serif"><b>Product & Drawing No    &nbsp;</b></font></td>
<td>  
<SELECT name="Product"  onChange="javascript:submit();">
<?
$bkquery = "SELECT  prodname,drawing_no,prodcode FROM product WHERE bcode ='$myCustomer' order by prodname,drawing_no ";
    $bkquery=stripslashes($bkquery);
    $result=mysql_query($bkquery) or       die( mysql_error() );
   echo "<option selected value=' '> Select Product";
   while($row1 = mysql_fetch_row($result))
{
          //echo "<option value='$row1[2]'>";
          //echo ($row1[0].'&nbsp;&nbsp;Dr. No:'.$row1[1]);

		  	$temp = $row1[0].'&nbsp;&nbsp;'.$row1[1].$type;
  	if(isset($Product) && eregi("$Product",$row1[2]))
	{
		echo "<option selected value=\"$row1[2]\">$temp";
	}
	else{
		echo "<option value=\"$row1[2]\">$temp";
	}


}
?>
</SELECT></td>
</tr>
</table>

</form>
 <table class=MsoTableGrid border=0 cellspacing=0 cellpadding=0>
<form name="form5" method="POST">
<?
// Pull all Customers from Customer  based on Selected Customer id and populate it.
$result = mysql_query("select distinct enquiry.record, enquiry.bcode, enquiry.prodcode, product.prodname, enquiry.drawing_no, enquiry.enquiry_refno, enquiry.enquiry_refdt, enquiry.qty,
enquiry.tools_cost FROM enquiry, product WHERE (enquiry.bcode ='$myCustomer')  and  enquiry.prodcode= '$myProduct'   group by enquiry.record order by enquiry_refno,enquiry_refdt ") or die(mysql_error());
//and (enquiry.prodcode=product.prodcode and product.bcode = '$myCustomer')
 $row5=mysql_fetch_row($result);

$rec =  $row5[0];
$qty =  $row5[7];
$tcost = $row5[8];
$dno= $row5[4];
//echo "dno" . "$dno";
//echo "cust" . "$myCustomer";
//echo "prod" . "$myProduct";


 ?>

</form>
<?

if ($tcost!=0.00)
{
//echo "the tool cost exist in enquiry table";
//echo "$rec";
?>

<title> Schedules Edit</title>
<body bgcolor="#ffffff"  topmargin=0>
<center>
<table cellpadding=0 cellspacing=4 width=590>
<tr>
<td style="padding:3px;" colspan=2 bgcolor="#93BEE2"><font >Tools Cost edit</font></td>
</tr><tr valign="top"><td colspan=2>
<font >&nbsp;</font>
</td>
</tr>
</table>
<table border="1"  rules = "all" cellspacing="1" cellpadding="3" align="center" width="600" bgcolor="#999999">
        
 <form name="form1" method="POST"  action="update.php?record=<?echo($record);?>">
<?php 
//echo "cust ". "$myCustomer";
//echo "dno " ."$dno";
$result = mysql_query("SELECT distinct record, bcode, enquiry_refno, enquiry_refdt, drawing_no, prodname, cost_refno, cost_refdt,  rawdraw, rawoffer, rawsize, rawwgt, rawrate, rawqty, toolslife, blanktxt, blankval, pierctxt, piercval, formtxt, formval, blendtxt, blendval, tools1txt, tools1val, tools2txt, tools2val, procstriptxt, procstripval, procblanktxt, procblankval, procburrtxt, procburrval, procpiertxt, procpierval, procformtxt, procformval, procbendtxt, procbendval, procflattxt, procflatval, prochardtxt, prochardval, procfinishtxt, procfinishval, procinstxt, procinsval, tlcost, rawcost, processcost, admnexp, remarks, appby FROM toolscost WHERE (toolscost.bcode ='$myCustomer')  and  (toolscost.drawing_no= '$dno')  order by toolscost.cost_refno, toolscost.cost_refdt") or die(mysql_error());
$row1=mysql_fetch_row($result);
?>
<input type="hidden" name="record" value="<? echo($row1[0]); ?>">
<table border=2 rules = "all"  cellspacing=1 cellpadding=1>
<tr>
<td>  <font color="#003366" size="3" face="Verdana, Arial, Helvetica, sans-serif"><b>RAW MATERIALS  </b></font></td>
<td> </td>
<td><font color="#003366" size="3" face="Verdana, Arial, Helvetica, sans-serif"><b>TOOL COST</b></font></td>
</tr>


<tr>
<td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">Raw Materials as per Drawing </font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='20' name="rawdraw" value = <?php echo("'$row1[8]'");?> > </td>
<td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">Tool - Blanking </font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='20' name="blanktxt" value = <?php echo("'$row1[15]'");?>> </td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='10' name="blankval" value = <?php echo("'$row1[16]'");?> > </td>
</tr>


<tr>
<td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">Raw Material Offered </font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='20' name="rawoffer" value =<?php echo("'$row1[9]'");?> ></td>
<td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">Tool - Piercing </font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='20' name="pierctxt" value = <?php echo("'$row1[17]'");?> > </td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='10' name="piercval" value = <?php echo("'$row1[18]'");?> > </td>
</tr>

<tr><td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">Raw Material in Size </font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='20' name="rawsize" value =<?php echo("'$row1[10]'");?>>  </td>
<td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">Tool - Forming </font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='20' name="formtxt" value = <?php echo("'$row1[19]'");?> > </td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='10' name="formval" value = <?php echo("'$row1[20]'");?> > </td>
</tr>

<tr><td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">Component Weight </font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='20' name="rawwgt" value = <?php echo("'$row1[11]'");?>>  </td>
<td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">Tool - Blending </font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='20' name="blendtxt" value = <?php echo("'$row1[21]'");?> > </td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='10' name="blendval" value = <?php echo("'$row1[22]'");?> > </td>
</tr>


<tr><td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">Raw Material Rate</font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='20' name="rawrate" value =<?php echo("'$row1[12]'");?>>  </td>
<td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">Tool </font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='20' name="tools1txt" value = <?php echo("'$row1[23]'");?> > </td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='10' name="tools1val" value = <?php echo("'$row1[24]'");?> > </td>
</tr>

<tr><td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">
Component Qty / Month</font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='20' name="rawqty" value =<?php echo("'$row1[13]'");?>>  </td>
<td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">Tool </font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='20' name="tools2txt" value = <?php echo("'$row1[25]'");?> > </td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='10' name="tools2val" value = <?php echo("'$row1[26]'");?> > </td>
</tr>


<tr><td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">Tools Life</font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='20' name="toolslife" value =<?php echo("'$row1[14]'");?>>  </td>
<td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">TOTAL </font></td>
<td  bgcolor="#FFFFFF">
 </td>
<td  bgcolor="#FFFFFF">
<input type="text"  onKeyPress="return event.keyCode!=13" size='10' id="total" name="total" onFocus="javascript:addNumbers()" value="" > </td>
</tr>
</table>




<p>&nbsp;</p>
<table border=2 rules = "all" cellspacing=1 cellpadding=1>
<tr>
<td width="170">  <font color="#003366" size="3" face="Verdana, Arial, Helvetica, sans-serif"><b>COSTING  </b></font></td>
<td width="60"> </td>
<td width="187"><font color="#003366" size="3" face="Verdana, Arial, Helvetica, sans-serif"><b>PROCESS COST</b></font></td>
</tr>


<tr>
<td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">Tool Cost </font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='10' name="tlcost" value = <?php echo("'$row1[47]'");?> > </td>
<td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">Stripping </font></td>
<td width="120"  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='20' name="procstriptxt" value = <?php echo("'$row1[27]'");?> > </td>
<td width="84"  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='10' name="procstripval" value = <?php echo("'$row1[28]'");?> > </td>
</tr>


<tr>
<td  bgcolor="#FFFFFF"></td>
<td  bgcolor="#FFFFFF"></td>
<td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">Blanking </font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='20' name="procblanktxt" value = <?php echo("'$row1[29]'");?> > </td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='10' name="procblankval" value =<?php echo("'$row1[30]'");?> > </td>
</tr>

<tr><td  bgcolor="#FFFFFF"></td>
<td  bgcolor="#FFFFFF"></td>
<td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">Burr Cleaning & correction </font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='20' name="procburrtxt" value = <?php echo("'$row1[31]'");?> > </td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='10' name="procburrval" value = <?php echo("'$row1[32]'");?> > </td>
</tr>

<tr><td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">Raw Material Cost </font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='10' name="rawcost" value = <?php echo("'$row1[48]'");?> >  </td>
<td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">Piercing </font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='20' name="procpiertxt" value = <?php echo("'$row1[33]'");?> > </td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='10' name="procpierval" value = <?php echo("'$row1[34]'");?> > </td>
</tr>


<tr><td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">Process Cost</font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='10' name="processcost" value = <?php echo("'$row1[49]'");?>>  </td>
<td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">Forming </font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='20' name="procformtxt" value = <?php echo("'$row1[35]'");?> > </td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='10' name="procformval" value = <?php echo("'$row1[36]'");?> > </td>
</tr>

<tr><td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">
Admn. Expenses/Margin</font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='10' name="admnexp" value = <?php echo("'$row1[50]'");?>>  </td>
<td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">Bending </font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='20' name="procbendtxt" value = <?php echo("'$row1[37]'");?> > </td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='10' name="procbendval" value = <?php echo("'$row1[38]'");?> > </td>
</tr>


<tr><td  bgcolor="#FFFFFF"></td>
<td  bgcolor="#FFFFFF"> </td>
<td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">Flatening </font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='20' name="procflattxt" value = <?php echo("'$row1[39]'");?> > </td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='10' name="procflatval" value = <?php echo("'$row1[40]'");?> > </td>
</tr>

<tr><td  bgcolor="#FFFFFF"></td>
<td  bgcolor="#FFFFFF"> </td>
<td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">Hardening & Tempering </font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='20' name="prochardtxt" value = <?php echo("'$row1[41]'");?> > </td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='10' name="prochardval" value = <?php echo("'$row1[42]'");?> > </td>
</tr>

<tr><td  bgcolor="#FFFFFF"></td>
<td  bgcolor="#FFFFFF"> </td>
<td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">Finishing </font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='20' name="procfinishtxt" value = <?php echo("'$row1[43]'");?> > </td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='10' name="procfinishval" value = <?php echo("'$row1[44]'");?> > </td>
</tr>

<tr><td  bgcolor="#FFFFFF"></td>
<td  bgcolor="#FFFFFF"> </td>
<td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">Inspection </font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='20' name="procinstxt" value = <?php echo("'$row1[45]'");?> > </td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='10' name="procinsval" value = <?php echo("'$row1[46]'");?> > </td>
</tr>

<tr><td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">
TOTAL</font></td>
<td  bgcolor="#FFFFFF">
<input type="text"  onKeyPress="return event.keyCode!=13" size='10' id="totcost" name="totcost" onFocus="javascript:addnum()" value="" > </td>
<td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">TOTAL </font></td>
<td  bgcolor="#FFFFFF"></td>
<td  bgcolor="#FFFFFF">
<input type="text"  onKeyPress="return event.keyCode!=13" size='10' id="totprocs" name="totprocs" onFocus="javascript:add_num()" value="" > </td>
</tr>

</table>

<p>&nbsp;</p>
<table border = "1" rules = "all" >
<tr><td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">
REMARKS</font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='50' name="remarks" value = <?php echo("'$row1[51]'");?> > </td>
</tr>

<tr><td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">
Approved By</font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='50' name="appby" value = <?php echo("'$row1[52]'");?> > </td>
</tr>

<tr><td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">
Ref No</font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='50' name="cost_refno" value = 
<?php echo("'$row1[6]'");?> > </td>
</tr>
<SCRIPT LANGUAGE="JavaScript" src="../../include/CalendarPopup.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
var cal = new CalendarPopup();
</SCRIPT>

<?
$refdt = $row1[7];
$cost_refdt = substr($refdt,8,2).'/'.substr($refdt,5,2).'/'.substr($refdt,0,4);
?>
<tr><td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">
Date</font></td>
<td  bgcolor="#FFFFFF">
<INPUT NAME="cost_refdt" TYPE="text" class="text_box_button" VALUE="<?=$cost_refdt?>" SIZE="15" readonly  >
 <A HREF="#" onClick="cal.select(document.form1.cost_refdt,'anchor1','dd/MM/yyyy'); return false;"NAME="anchor1" ID="anchor1"><img  src="../../images/cal.gif" border="0"></A> <BR>
</td>
</tr>
</table>
</table>
<table>
<tr>
<blockquote>  
<td><input  type =submit name=submit value = "Update"></td> 
<td><input type =submit name=submit value = "Delete"></td>
</blockquote>
</table>
</tr>
</form>
<?
}
else
{
//echo "the tool cost is zero and adding new entry";
?>

<title> Schedules Edit</title>
<body bgcolor="#ffffff"  topmargin=0>
<center>
<table cellpadding=0 cellspacing=4 width=590>
<tr>
<td style="padding:3px;" colspan=2 bgcolor="#93BEE2"><font >Costing Sheet</font></td>
</tr><tr valign="top"><td colspan=2>
<font >&nbsp;</font>
</td>
</tr>
</table>
<form name="form3" method="POST"  action="costupd.php?rec=<?echo($rec);?>">
<table border=2 rules = "all" cellspacing=1 cellpadding=1>
<tr>
<td>  <font color="#003366" size="3" face="Verdana, Arial, Helvetica, sans-serif"><b>RAW MATERIALS  </b></font></td>
<td> </td>
<td><font color="#003366" size="3" face="Verdana, Arial, Helvetica, sans-serif"><b>TOOL COST</b></font></td>
</tr>

<tr>
<td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">Raw Materials as per Drawing </font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='20' name="rawdraw" value = '' > </td>
<td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">Tool - Blanking </font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='20' name="blanktxt" value = '' > </td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='10' name="blankval" value = 0.00 > </td>
</tr>


<tr>
<td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">Raw Material Offered </font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='20' name="rawoffer" value = <?php echo("'$qty'");?>  ></td>
<td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">Tool - Piercing </font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='20' name="pierctxt" value = '' > </td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='10' name="piercval" value = 0.00 > </td>
</tr>

<tr><td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">Raw Material in Size </font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='20' name="rawsize" value =''>  </td>
<td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">Tool - Forming </font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='20' name="formtxt" value = '' > </td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='10' name="formval" value = 0.00 > </td>
</tr>

<tr><td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">Component Weight </font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='20' name="rawwgt" value = ''>  </td>
<td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">Tool - Blending </font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='20' name="blendtxt" value = '' > </td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='10' name="blendval" value = 0.00 > </td>
</tr>


<tr><td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">Raw Material Rate</font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='20' name="rawrate" value =''>  </td>
<td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">Tool </font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='20' name="tools1txt" value = '' > </td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='10' name="tools1val" value = 0.00 > </td>
</tr>

<tr><td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">
Component Qty / Month</font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='20' name="rawqty" value =''>  </td>
<td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">Tool </font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='20' name="tools2txt" value = '' > </td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='10' name="tools2val" value = 0.00 > </td>
</tr>


<tr><td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">Tools Life</font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='20' name="toolslife" value =''>  </td>
<td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">TOTAL </font></td>
<td  bgcolor="#FFFFFF">
 </td>
<td  bgcolor="#FFFFFF">
<input type="text"  onKeyPress="return event.keyCode!=13" size='10' id="total" name="total" onFocus="javascript:addNumbers()" value="" > </td>
</tr>
</table>




<p>&nbsp;</p>
<table border=2 rules = "all" cellspacing=1 cellpadding=1>
<tr>
<td width="170">  <font color="#003366" size="3" face="Verdana, Arial, Helvetica, sans-serif"><b>COSTING  </b></font></td>
<td width="60"> </td>
<td width="187"><font color="#003366" size="3" face="Verdana, Arial, Helvetica, sans-serif"><b>PROCESS COST</b></font></td>
</tr>


<tr>
<td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">Tool Cost </font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='10' name="tlcost" value = 0.0 > </td>
<td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">Stripping </font></td>
<td width="120"  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='20' name="procstriptxt" value = '' > </td>
<td width="84"  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='10' name="procstripval" value = 0.00 > </td>
</tr>


<tr>
<td  bgcolor="#FFFFFF"></td>
<td  bgcolor="#FFFFFF"></td>
<td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">Blanking </font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='20' name="procblanktxt" value = '' > </td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='10' name="procblankval" value =0.00 > </td>
</tr>

<tr><td  bgcolor="#FFFFFF"></td>
<td  bgcolor="#FFFFFF"></td>
<td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">Burr Cleaning & correction </font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='20' name="procburrtxt" value = '' > </td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='10' name="procburrval" value = 0.00 > </td>
</tr>

<tr><td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">Raw Material Cost </font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='10' name="rawcost" value = 0.00>  </td>
<td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">Piercing </font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='20' name="procpiertxt" value = '' > </td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='10' name="procpierval" value = 0.00 > </td>
</tr>


<tr><td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">Process Cost</font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='10' name="processcost" value = 0.00>  </td>
<td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">Forming </font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='20' name="procformtxt" value = '' > </td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='10' name="procformval" value = 0.00 > </td>
</tr>

<tr><td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">
Admn. Expenses/Margin</font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='10' name="admnexp" value = 0.00>  </td>
<td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">Bending </font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='20' name="procbendtxt" value = '' > </td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='10' name="procbendval" value = 0.00 > </td>
</tr>


<tr><td  bgcolor="#FFFFFF"></td>
<td  bgcolor="#FFFFFF"> </td>
<td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">Flatening </font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='20' name="procflattxt" value = '' > </td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='10' name="procflatval" value = 0.00 > </td>
</tr>

<tr><td  bgcolor="#FFFFFF"></td>
<td  bgcolor="#FFFFFF"> </td>
<td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">Hardening & Tempering </font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='20' name="prochardtxt" value = '' > </td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='10' name="prochardval" value = 0.00 > </td>
</tr>

<tr><td  bgcolor="#FFFFFF"></td>
<td  bgcolor="#FFFFFF"> </td>
<td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">Finishing </font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='20' name="procfinishtxt" value = '' > </td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='10' name="procfinishval" value = 0.00 > </td>
</tr>

<tr><td  bgcolor="#FFFFFF"></td>
<td  bgcolor="#FFFFFF"> </td>
<td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">Inspection </font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='20' name="procinstxt" value = '' > </td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='10' name="procinsval" value = 0.00 > </td>
</tr>

<tr><td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">
TOTAL</font></td>
<td  bgcolor="#FFFFFF">
<input type="text"  onKeyPress="return event.keyCode!=13" size='10' id="totcost" name="totcost" onFocus="javascript:addnum()" value="" > </td>
<td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">TOTAL </font></td>
<td  bgcolor="#FFFFFF"></td>
<td  bgcolor="#FFFFFF">
<input type="text"  onKeyPress="return event.keyCode!=13" size='10' id="totprocs" name="totprocs" onFocus="javascript:add_num()" value="" > </td>
</tr>

</table>

<p>&nbsp;</p>
<table border="1" rules = "all" >
<tr><td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">
REMARKS</font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='50' name="remarks" value = '' > </td>
</tr>

<tr><td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">
Approved By</font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='50' name="appby" value = '' > </td>
</tr>

<tr><td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">
Ref No</font></td>
<td  bgcolor="#FFFFFF">
<input type="text"    onKeyPress="return event.keyCode!=13"   size='50' name="cost_refno" value = '' > </td>
</tr>
<SCRIPT LANGUAGE="JavaScript" src="../../include/CalendarPopup.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
var cal = new CalendarPopup();
</SCRIPT>
<?
 $cost_refdt=strftime ("%d/%m/%Y", mktime (0,0,0,date("m"),date("d"),date("Y"))); 
?>

<tr><td  bgcolor="#FFFFFF"><font class="sbd" face="Arial, Helvetica, sans-serif"  color="#0033FF">
Date</font></td>
<td  bgcolor="#FFFFFF">
<INPUT NAME="cost_refdt" TYPE="text" class="text_box_button" VALUE="<?=$cost_refdt?>" SIZE="15" readonly  >
 <A HREF="#" onClick="cal.select(document.form3.cost_refdt,'anchor1','dd/MM/yyyy'); return false;"NAME="anchor1" ID="anchor1"><img  src="../../images/cal.gif" border="0"></A> <BR>
 </td>
</tr>


<tr> 
<td align="right" ><font color="#003366" size="1" face="Verdana, Arial, Helvetica, sans-serif"><b>Transfer the Value of Tool Cost to Enquiry </b></font></td>
<td> <input type="radio"    onKeyPress="return event.keyCode!=13"   name="trans" value = "No" checked> <font color="#003366" size="1" face="Verdana, Arial, Helvetica, sans-serif"><b>No 
</b></font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type="radio"    onKeyPress="return event.keyCode!=13"   name="trans" value = "Yes"> <font color="#003366" size="1" face="Verdana, Arial, Helvetica, sans-serif"><b>Yes
</b></font>&nbsp;</td>
 </tr>  

</table>
</table>
  
  <table cellpading=0 cellspacing=10 width= 50>
    <tr> 
      <td> <blockquote> <input type =submit name="submit" value = "Submit"></td></blockquote>
  </table>
</table>
<?
}
?>
</form>
<?
//echo "$bcode";
?>
<input type="hidden" name="fname" value="<?echo $filename;?>">
<form><br><br><font size=1><center><a href= "index.html">Return to index page</center></font>
</body>

