<?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"];


$date=$_POST["date"];
$month_name=$_POST["month_name"];
$username=$_POST["username"];
$cname=$_POST["bname"];
$disc=$_POST["disc"];
$dno=$_POST["dno"];
$pno=$_POST["pno"];

$sqlpur = "SELECT * FROM customer where bname = '$cname' and user_id = '$userid'";
$resultpur=$conn->query($sqlpur);
$rowpur = $resultpur->fetch_assoc();
$address=$rowpur['address'] ;
$pname=$rowpur['pname'] ;
$ntnno=$rowpur['ntnno'] ;


$sql = "Insert into invoice_st (id,date,month_name,cell,username,status,user_id,cname,disc,dno,pno,pname,yr,address) values (null,'$date','$month_name','$ntnno','$username','Pending','$userid','$cname','$disc','$dno','$pno','$pname','$year','$address')";
$conn->query($sql);

header("location:Open_Invoice_SaleTax.php");

?>
