<?php 
session_start();
include 'dbc.php';

date_default_timezone_set("Asia/Karachi");
$today=date("Y-m-d");
$month = date("m",strtotime($today));
		$year = date("Y",strtotime($today));
		 $month_name = date("F", mktime(0, 0, 0, $month, 10));
		
		
		 $my=$month_name . " " . $year;
$userid=$_SESSION["userid"];

$ven_name=$_POST["ven_name"];
$date=$_POST["date"];
$month_name=$_POST["month_name"];
$username=$_POST["username"];
$sqlpur = "SELECT * FROM vendor where ven_name = '$ven_name' and user_id = '$userid'";
$resultpur=$conn->query($sqlpur);
$rowpur = $resultpur->fetch_assoc();
$venid=$rowpur['id'] ;

$sql = "Insert into purchase_return (id,date,month_name,ven_name,username,status,user_id,venid) values (null,'$today','$month_name','$ven_name','$username','Open','$userid','$venid')";
$conn->query($sql);

header("location:Open_Purchase_Return.php");

?>
