<?php  include("../../include/dbconnect.php");?>
<?php 
//echo "$rec";
// Pull all Customers from Customer  based on Selected Customer id and populate it.
$result6 = mysql_query("select distinct enquiry.record, enquiry.bcode, enquiry.prodcode,  enquiry.drawing_no, enquiry.enquiry_refno, enquiry.enquiry_refdt, enquiry.qty,
enquiry.tools_cost FROM enquiry WHERE record='$rec'") or die(mysql_error());
//and (enquiry.prodcode=product.prodcode and product.bcode = '$myCustomer')
 $row6=mysql_fetch_row($result6);

$bcode = $row6[1];
$prodcode = $row6[2];
$dno = $row6[3];
$enqrefno= $row6[4];
$enqrefdt =$row6[5];
$enqqty =$row6[6];
$tools_cost=$row6[7];


if ( isset($submit) && $submit == "Submit")
{
//echo "cccc" . "$bcode";
//echo "$enqrefdt";
	$result = mysql_query("select drawing_no, prodname from product where prodcode ='$prodcode' and bcode ='$bcode' ") or die(mysql_error());

	$row = mysql_fetch_row($result);
	$drawing_no = $row[0];
	$prodname = $row[1];

$query="insert into toolscost values('$bcode', '$enqrefno', '$enqrefdt', '$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',    NULL)";
//echo "$query";	

mysql_query($query) or die (mysql_error());
}
//echo "$trans";
if($trans=="Yes")
{
 $result1=mysql_query("update enquiry set tools_cost='$tlcost' where record='$rec'") or   die(mysql_error());
		
}	
?>
<meta http-equiv="refresh" content="0 url=index.html">

