<?php  
require "commonincludefiles.php";
if($_SESSION["cCompany_id"]!="" && isset($_SESSION["cCompany_id"]))
{



	$objfollowMgmt = new followUpMgmt();
	
	$objfollowMgmt ->followup_id            = $_REQUEST["followup_id"] ; 
	$objfollowMgmt ->leadfinal            = $_REQUEST["finallead"] ;  
	$objfollowMgmt ->inquiry_id            = $_REQUEST["inquiry_id"] ;
	$objfollowMgmt ->followupdate		= $_REQUEST['followupdate'];
	$objfollowMgmt ->followuptime       = $_REQUEST["followuptime"] ;
	$objfollowMgmt ->comment				= $_REQUEST['comment'] ;
	$objfollowMgmt ->product_ids			= $_REQUEST['product_ids'];
	$objfollowMgmt ->inquery_status			= $_REQUEST['inquery_status'];
	
	if($objfollowMgmt->followup_id=="0"){
		$objfollowMgmt->add();						
	}
	else{
	
		$objfollowMgmt->edit();												
	}
	if($_REQUEST['inquiry_id']!="" &&  $_REQUEST['followupdate']!="")
	{
			
		global $SQLDateFormat;	
			
		
	 $qry="update lms_inquiry Set product_ids ='".$_REQUEST['product_ids']."',appointmentdate = STR_TO_DATE('".$_REQUEST['followupdate']."','$SQLDateFormat'),
	 appointmenttime ='".$_REQUEST['followuptime']."'
	  Where inquiry_id='".$_REQUEST['inquiry_id']."'";
	//echo $qry; exit;
	
	 dbQuery($qry);
	
	}
	else
	{
		$qry="update lms_inquiry Set product_ids ='".$_REQUEST['product_ids']."' Where inquiry_id='".$_REQUEST['inquiry_id']."'";
//	echo $qry; exit;
	
	 dbQuery($qry);
	}					
	
	echo '{"success":"true","msg":""}';
}
else {
	echo '{"success":"false","msg":"session expiry"}';
}	         
?>
