<?php
 	session_start();

	if(!isset($_SESSION['linkarisecrm']))
	{
		header('Location: index.php');
		return;
	}
	date_default_timezone_set("Asia/Kolkata");
	 $mdate1= date('Y-m-d');
	 $mdatetime= date('Y-m-d H:i:s');
	 $cdatetime= date('Y-m-d H:i:s');

	$cmpmid=$_SESSION['linkarisecmpmid'];
	$umid = $_SESSION['linkariseumid'];

	include("connect.php");

	$partymid=$_POST['partymid'];
	$_SESSION['partymid']=$_POST['partymid'];
	$fdate=date("Y-m-d", strtotime($_POST['fdate'])); 
	$stageremarks="";
	$followremarks=$_POST['followremarks'];
	$inquirystagename=$_POST['inquirystagename'];

	$eve1 = "INSERT INTO res_followup_detail ( ftype,fdate, partymid, fremarks, fstatus, cmpmid, faddedby, fupdatedby, faddedon, fupdatedon,inquirystage,stageremark) VALUES ('Inquiry','$fdate', '$partymid', '$followremarks', 'Open', $cmpmid, '$umid', '$umid', '$cdatetime', '$cdatetime','$inquirystagename','$stageremarks')";
	if ($conn->query($eve1) === TRUE)
	{
		$last_id = $conn->insert_id;
		$eve3 = "update res_party_master set partystage='$inquirystagename',stageremark='$stageremarks',followupdate='$fdate',followupremark='$followremarks' where partymid='$partymid' and cmpmid=$cmpmid ";
		$re3 = mysqli_query($conn, $eve3);
		$_SESSION['msg'] = "Follow-Up Addded";

	}
	else
	{
		$_SESSION['msg'] = "Follow-Up Not Addded";

	}
	header("Location: inquirystatus.php?id=$partymid");

?>
