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


$userid=$_SESSION["userid"];
$today=date("Y-m-d");
$inv_no=$_POST["inv_no"];
$username=$_POST["username"];
$item_name=$_POST["statelist"];
$qty=$_POST["qty"];

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;
  

$sql2 = "SELECT * FROM complain where id = '$inv_no'";
$result2=$conn->query($sql2);
$row2 = $result2->fetch_assoc();
$cname=$row2['cname'] ;
$disc=$row2['disc'] ;
$tnetamount=$netamount + $totalamount;
		$sql = "Insert into complain_details (id,date,inv_no,item_name,amount,complain,user_id,status,cname,cdate,disc)values (null,'$today','$inv_no','$item_name','$srate','$qty','$userid','Pending','$cname','$today','$disc')";
$conn->query($sql);


$Message = "$inv_no";
    header("Location:Add_Complain_Item1.php?Message={$Message}");
/*$sql="Select * from agents where userid='$user_id'";
$data=mysql_query($sql) or die ("Error:" . mysql_error());
$userdata=mysql_fetch_array($data);
$email=$userdata["e_mail"];
mail($email . ",info@lalburj.com","Candidate Information","Candidate Data Posted Successfully","Passport No:" . $app_pp_no . " of " . $app_name . "Has been Posted Successfully By:" . $_SESSION["userid"]);*/

?>


                                                                     
