<body background="blater01.gif" topmargin=0>
<?php include ("../../include/dbconnect.php");

$result = mysqli_query($conn,"select max(acctcode) from acctmast where acctgroup in ('11120002','11130005') order by acctcode ") or die(mysqli_error());
$row = mysqli_fetch_row($result);
 $newcode=$row[0];
 if(empty($newcode))
   { 
   	$newcode=$accthead.'0001'; 
	}
 else
 { 
 	$newcode=$newcode+1; 
 } 
 
  
if (!empty($bname))
{

		$query="insert into acctmast values ('$newcode','$bname','$accthead','$type','Yes','','$opening_balance','$db_cr','NIL',NULL)";
	//echo("$query<br>");
		mysqli_query($conn,$query) or die(mysqli_error());
		
		$mresult = mysqli_query($conn,"select max(record) from acctmast ") or die(mysqli_error());
		$mrow = mysqli_fetch_row($mresult);
		$acct_record = $mrow[0];


		$query="insert into buy  values('$newcode','$bname','$baddress1','$baddress2','$bcity','$bstate','$country','$bpin','$bemail','$bcst','$tin','$gstin','$bstd','$btelno','$mobile','$contact','$area','$buyertype','$incentive','$discount','$credit','Yes','$acct_record','$taxtype','$state_code',NULL)";
		mysqli_query($conn,$query) or 	die(mysqli_error());
}

?>
<meta http-equiv="refresh" content="0 url=parsys.php">

