<?php 
include("../connection.php");
include("../user.php");
$user=$_SESSION['user'];
?>
<link rel="stylesheet" href="../css/sweet-alert.css" /> 
<?php

	$department_id=$_REQUEST['department'];
	$ven_code=$_REQUEST['vendor_code'];
	$ven_name=$_REQUEST['vendor_name'];
	$ven_addr=$_REQUEST['vendor_addr'];
	$phone=$_REQUEST['phone'];
	$mail=$_REQUEST['email'];
	$cnct=$_REQUEST['contact'];
	$gst_number=$_REQUEST['gst_number'];
	$inst="insert";

	$vendor_master=mysqli_query($con,"INSERT INTO `vendor_master`(`department`,`vendor_code`, `vendor_name`, `vendor_address`, `phone`, `email`, `contact_person`,`gst_number`,`status`,`created_by`)
	VALUES('$department_id','$ven_code','$ven_name','$ven_addr','$phone','$mail','$cnct','$gst_number','0','$user')");
	
/* 	echo "INSERT INTO `vendor_master`(`vendor_code`, `vendor_name`, `vendor_address`, `phone`, `email`, `contact_person`,`status`,`created_by`)
	VALUES('$ven_code','$ven_name','$ven_addr','$phone','$mail','$cnct','0','$user')";
	 */
		//	$vendor_master=mysqli_query($con,"call vendor('$ven_code','$ven_name','$ven_addr','$phone','$mail','$cnct','0','$user','','$inst')");
	//echo "call vendor('$ven_code','$ven_name','$ven_addr','$phone','$mail','$cnct','0','$user','','$inst')";
	
	
	
if($vendor_master)
	{
	?>
	<script>
	
	
    setTimeout(function() {
        swal({
            title: "Successfully",
            text: "Vendor Created!",
            type: "success"
        }, function() {
        window.location = "vendor_master.php";
        });
    }, 100);
</script>  
    <?php
	}	
	else
	{
	?>
	<script>
    setTimeout(function() {
        swal({
            title: "Not",
            text: "Vendor Created!",
            type: "error"
        }, function() {
        window.location = "vendor_master.php";
        });
    }, 100);
</script> 	  
	<?php
	}
	?>

  <script src="../js/sweet-alert.js"></script> 

		
