<body background="">
<?php include("../../include/dbconnect.php"); 


if($cnf=="Yes")
{
	if(empty($bcode)) 
	{
		echo("Customer not selected, Please select Customer and resubmit<br>");
		exit;
	}

	if($prodcode=='0')
	{
		echo("Product not selected, Please select Product and resubmit<br>");
		exit;
	}

	if(empty($order_no))
	{
		echo("No Order number ,Please Type Order No and resubmit<br>");
		exit;
	}
	if($rate==0)
	{
		echo("Rate is not entered, please enter the rate and re submit<br>");
		exit;
	}

	if(empty($order_date))
	{
		echo("Order Date is not entered, please enter the Order Date and re submit<br>");
		exit;
	}	

	$sdate = $order_date;
	$ord_dt = substr($sdate,6,4).'-'.substr($sdate,3,2).'-'.substr($sdate,0,2);
	
	$sdate = $schedule_date;
	$sc_dt = substr($sdate,6,4).'-'.substr($sdate,3,2).'-'.substr($sdate,0,2);
	
	$sdate = $due_date;
	$d_date = substr($sdate,6,4).'-'.substr($sdate,3,2).'-'.substr($sdate,0,2);
	
	$result = mysql_query("select drawing_no from product where prodcode ='$prodcode' and bcode ='$bcode' ") or die(mysql_error());
	$row = mysql_fetch_row($result);
	$drawing_no = $row[0];
	
	if($upd=="Yes")
	{
		$schedule_qty=' ';

		$month= '';
		$year=' ';

	}
	elseif($upd=="No")
	{
		$schedule_qty=$order_qty;
	}
	
	$query="insert into orders values('$bcode','$prodcode','$drawing_no','$order_no','$ord_dt','$order_qty','$schedule_qty','','$schedule_qty','$rate','$schedule_no','$sc_dt','$d_date','','','','','','','','','','','$upd','','','','','','','','$month','$year','$plan_type','','$tentative_qty','',NULL)";
	
	mysql_query($query) or die (mysql_error());
		
}	


?>
<br>
<br><br><font size=1><center><a href= "input.php">Make another Entry</a></center></font>
<br><br><font size=1><center><a href= "../../index.html">Return to index page</a></center></font>
