<?php 
if($_REQUEST['action']=='follow' && $_REQUEST['Id']!='')
{
if($_REQUEST['Add']!='')
{
	$insert="Insert into enquiry_followup set
					enquiryId='".$_REQUEST['Id']."', 
					followDate='".FormatDateForSQL($_REQUEST['followDate'])."',  
					comments='".$_REQUEST['comments']."',  
					createdBy='".$_SESSION['UserID']."',  
					createdDate='".FormatDateForSQL(date('d/m/Y'))."',CompanyId='".$_SESSION['ACGCompanyId']."'";
					
	$result=DB_query($insert,$db);
echo "<script>location.href='index.php?route=view_enquiry&modid=".$_REQUEST['']."&frmid=".$_REQUEST['']."&action=follow&Id=".$_REQUEST['Id']."'</script>";
}
$sql=DB_query("Select party from enquiry where id='".$_REQUEST['Id']."'",$db);
$row=DB_Fetch_array($sql);
	?>
<table align="right"><tr><td><a href="index.php?route=enquiry_list&modid=<?php echo $_REQUEST['modid'];?>&frmid=<?php echo $_REQUEST['frmid'];?>"><input type="button" value="Back" /></a></td></tr></table>
<h2 align="center">Party Follow Up</h2>
<form action="" method="post">
<table width="75%" cellpadding="2" cellspacing="2" align="center" border="0">
<tr>
	<th>Party</th>
	<td><input type="text" value="<?php echo $partyName=$s->getField('clientmaster','client_code',$row['party'],'c_name');?>" style="width: 100%"/></td>
	<th>Follow Up Date</th>
	<td><input type="text" name="followDate" value="<?php echo date('d/m/Y')?>" class="datepicker" size="15" /></td>
</tr>
<tr>
	<th>Comments</th>
	<td colspan="3"><textarea name="comments" rows="5" cols="54"></textarea></td>
</tr>
</table>
<p align="center"><input type="submit" name="Add" value="Add" /></p>
</form>
<br>
<table align="center" cellpadding="2" cellspacing="2" width="60%">
	<tr>
		<th colspan="2"><div align="center">Follow Up History</div></th>
	</tr>
	<?php 
	
	$follow_sql=DB_query("Select * from enquiry_followup where enquiryId='".$_REQUEST['Id']."'and CompanyId='".$_SESSION['ACGCompanyId']."'",$db);
	while($follow_row=DB_fetch_array($follow_sql))
	{?>
	<tr bgcolor="#FFFFFF">
		<td width="15%"><?php echo $follow_row['followDate'];?></td>
		<td><?php echo $follow_row['comments'];?></td>
	</tr>
	<?php 	
	}
	?>
	
</table>
<?php 
}
?>