<?php
include("../../../include/dbconnect.php");?>
<title>Material Master Creation</title>
<body background="blater01.gif" topmargin=0>
<center>
<table cellpadding=0 cellspacing=4 width=590>
<tr>
<td style="padding:3px;" colspan=2 bgcolor="#93BEE2"><font ><b>Material Code Creation</b></font></td>
</tr><tr valign="top"><td colspan=2>
<font >&nbsp;</font>
</td>
</tr>
</table>
<table border=0 cellpadding=3 cellspacing=4 width="590">


<?

if ($submit == "Submit")
{

	$prodcode=$matcatcode.$mattype.$matsize.$matwidth.$matthick.$grade.$finish;
	
	$result = mysql_query("select prodcode from rawmaterial where  prodcode ='$prodcode' ") or die(mysql_error());
	$row = mysql_fetch_row($result);
	if(empty($row))
	{
	
		if($upd== "Yes")
		{
	
			$query="insert into rawmaterial values ('$prodcode','$prodname','$tariff','$cust_prodcode','$matcatcode','$mattype','$matsize','$matwidth','$matthick','$grade','$finish','$matdiv','$sizeunit','$widthunit','$thickunit','$composition','$minimum_qty',NULL)";
			mysql_query($query) or die(mysql_error());
		}
		
	
	}
	elseif(!empty($row))
	{
		echo("This Material is already available in Material master for this Supplier. Please check and retry<br>");
		exit;
	}
}



?>
<h2>Thanks !! </h2>
<h2><a href= "view.php"> View Materials !!! </a></h2>
<h3><a href= "product_add.php"> Add another Material !!! </a></h3>
<h3><a href= "index.html"> Return to Index page</a></h3>

<br>


