<?php /*?><?php
if($_REQUEST['Add'])
{
	$fstatus=true;
	
	if($_REQUEST['noteDate']=='')
	{
		$msgErr[]="Please Enter The Date";
		$fstatus=false;
	}
	if($_REQUEST['description']=='')
	{
		$msgErr[]="Please Enter The Description";
		$fstatus=false;
	}
	
}


   if($_REQUEST['Add'] && $fstatus)
{
      $insert="Insert into crm_addleadnote set
					mst_leadid='".$_REQUEST['leadid']."',
					noteDate='".FormatDateForSQL($_REQUEST['noteDate'])."',  
					description='".$_REQUEST['description']."'";
	$result=DB_query($insert,$db);
 echo "<script>location.href='index.php?route=CRM/CrmFollowUp&leadid=".$_REQUEST['leadid']."&modid=".$_REQUEST['modid']."&frmid=".$_REQUEST['frmid']."'</script>";
   
}
if($_REQUEST['action']=='delete')
{
	$sql=DB_query("delete from crm_addleadnote where id='".$_REQUEST['id']."'",$db);
	
	
}

   
?><?php */?>

<?php  //include('field_visit_report_top_menu.php'); ?>
<!--<table align="right"><tr><td><a href="index.php?route=CRM/crmleadview&leadid=<?php  echo $_REQUEST['leadid']?>&modid=<?php echo $_REQUEST['modid'];?>&frmid=<?php echo $_REQUEST['frmid'];?>"><input type="button" value="Back" /></a></td></tr></table>-->
<link rel="stylesheet" href="css/new_mxerp.css">
<div class="body_contain">
<div class="tab_div">
<h1>ADD DAILY FIELD MARKETING NOTE</h1>
<form action="" method="post">
<table width="100%" cellpadding="3" cellspacing="0" border="0">
<?php if(count($msgErr)>0){?>
	<tr class="row1">
		<td>
<?php	for($i=0;$i<count($msgErr);$i++){
			echo "<div class='error'>".$msgErr[$i]."</div>";
		}?> 
		</td>
</tr>	
<?php }?>
<tr class="row1">
	<td class="tabledata1">Add Note Date</td>
	<td><input type="text" name="noteDate"  class="datepicker" style="width:150px;" /></td>
</tr>
<tr class="row1">
	<td class="tabledata1">Description</td>
	<td><textarea name="description" rows="5" cols="54"></textarea></td>
</tr>
<tr class="row1">
	<td colspan="2"><p align="left"><input type="submit" name="Add" value="Add" class="search" /></p></td>
</tr>
</table>
</form>
<br>
<table border="" cellpadding="3" cellspacing="0" width="100%">
<tr class="row1">
	<td class="tabledata" colspan="3"><div align="center"><strong>Add Note History</strong></div></td>
</tr>
<tr class="row1">
	<td class="tabledata">Add Note Date</td>
	<td class="tabledata">Description</td>
	<td class="tabledata">Action</td>
</tr>
<?php $follow_sql=DB_query("Select * from crm_addleadnote where mst_leadid='".$_REQUEST['leadid']."'",$db);
while($follow_row=DB_fetch_array($follow_sql)){?>
<tr class="row1">
	<td width="15%"><?php echo ConvertSQLDate($follow_row['noteDate']);?></td>
	<td><?php echo $follow_row['description'];?></td>
	<td><a href="index.php?route=CRM/AddLeadNote&leadid=<?php  echo $_REQUEST['leadid']?>&modid=<?php echo $_REQUEST['modid'];?>&frmid=<?php echo $_REQUEST['frmid'];?>&action=delete&id=<?php echo $follow_row['id'];?>" onclick="return confirm('This data will be deleted')" ><img src="images/Icon_Delete.png" height="15" width="15"></a></td>
</tr>
<?php }?>
</table>
