<?php 
$PageSecurity = 4;
$PageName = 'Add Items';
include('includes/DefinePOClass.php');
include('includes/session.inc');
include('includes/SQL_CommonFunctions.inc');
include('includes/DefineSuppTransClass.php');
include('includes/PaginationClass.php');
//include('includes/header.inc');
include('includes/function_lib.php');
if($_REQUEST['Add'])
{
	$data['vendor']=$_REQUEST['verderid'];
	$data['rgb_id']=$_REQUEST['id'];
	$data['followup_date']=FormatDateForSQL($_REQUEST['followDate']);
	$data['fillowup_type']=$_REQUEST['FollowType'];
	$data['comments']=$_REQUEST['comments'];
	$data['user']=$_SESSION['UserID'];
	$row=$s->RecordInsert('rgp_follow_up', $data);
	
	
	/*echo "<script>parent.window.close();
parent.window.opener.location.href='index.php?route=Inventory/transation/Rgp_index&modid=".$_REQUEST['modid']."&frmid=".$_REQUEST['frmid']."'</script>";	*/
	//$s->pageLocation("index.php?route=TaskMgt/FollowUp".$rurl);
}


?>

<link rel="stylesheet" href="css/jquery.ui.all.css">
 <script src="js/jquery-1.5.1.js"></script>
<script src="ui/jquery.ui.core.js"></script>
<script src="ui/jquery.ui.widget.js"></script>
<script src="ui/jquery.ui.datepicker.js"></script>
<script type="text/javascript" src="js/dynamicRow.js"></script>
<script src="js/tax_calculation.js"></script>
<script src="js/add_mrn.js"></script>

<script>
 $(function() {
$(".datepicker").datepicker({ dateFormat: 'dd/mm/yy' ,changeMonth: true,
changeYear: true,
yearRange: '-80:+20'});
});
</script>
<link href="css/professional/default.css" rel="stylesheet" type="text/css" />
<div class="body_contain">
<div class="tab_div">
<h1>Follow Up</h1>
<?php 
$venderid=$s->getField('rgp_tab','id',$_REQUEST['id'],'supplier');
$vender=$s->getField('suppliers','id',$venderid,'vendor_name');


//$sql=DB_query("select * from rgp_follow_up where rgb_id='".$_REQUEST['id']."'",$db);
//$num=DB_num_rows($sql);
//if($num>0)
//{
//$action='Edit';
//$row2=DB_fetch_array($sql);
//$vender=$s->getField('suppliers','id',$row2['vendor'],'vendor_name');
//$followup_date=ConvertSQLDate($row2['followup_date']);
//$fillowup_type=$row2['fillowup_type'];
//$comments=$row2['comments'];
//}
//else
//{
$action='';
$vendername='';
$followup_date='';
$fillowup_type='';
$comments='';

//}

?>
<p align="center"><input type="button" name="Close" value="Close"  onclick="show()"/></p>
<form action="" method="post">
<table  cellpadding="3" cellspacing="0" border="0" width="85%">
<tr class="row1">
	<td width="14%" class="tabledata1">Vendor</td>
	<td width="21%"><input type="hidden" name="action" value="<?php echo $action; ?>" />
	<input type="hidden" name="verderid" id="venderid" value="<?php echo $venderid; ?>" />
	<input type="text"  style="width:100%" name="party"  value="<?php echo $vender; ?>"  readonly/></td>
	<td width="14%" class="tabledata1">Follow Up Date</td>
	<td width="12%"><input type="text"  style="width:100%" name="followDate" value="<?php echo $followup_date; ?>"  class="datepicker" size="15" /></td>
	<td width="11%" class="tabledata1">Follow Type</td>
	<td width="28%">
	<select  name="FollowType" >
		<option value="0">--Select--</option>
		<option value="By Phone"<?php echo($fillowup_type=='By Phone'?'selected':''); ?>>By Phone</option>
		<option value="By Mail"<?php echo($fillowup_type=='By Mail'?'selected':''); ?>>By Mail</option>
	</select>
	</td>
</tr>
<tr class="row1">
	<td class="tabledata1">Comments</td>
	<td colspan="5"><textarea name="comments" style="width:100%;" rows="5" cols="40"><?php echo $comments ?></textarea></td>
</tr>
<tr class="row1">
<td style="text-align:center;" class="tabledata1" colspan="6"><input type="submit" name="Add" value="Add" class="search" /></td>
</tr>
</table>
</form>
<div style="overflow:auto; height:400px;">
<?php
$remarks_sql1=DB_query("Select * from rgp_follow_up where rgb_id='".$_REQUEST['id']."'",$db);
$numrow1=DB_num_rows($remarks_sql1);
?>
<table width="110%" cellpadding="3" cellspacing="0">
		 <?php
		 $i=1; 
	   $remarks_sql=DB_query("Select * from rgp_follow_up where rgb_id='".$_REQUEST['id']."'",$db);
	   while($remarks_row=DB_fetch_array($remarks_sql)){?>
		<tr class="row1">
		<td width="11%">Comments : <?php echo $i; ?></td>
		   <td width="89%" class="tabledata1">
		   <textarea name=""  style="width:75%;"><?php echo $remarks_row['comments'];?></textarea>
		   <br />
		   <strong><?php 
		   $username=$s->getField('www_users','id',$remarks_row['user'],'realname');
		   echo "By ".$username." - ".ConvertSQLDate($remarks_row['followup_date']);?></strong>
	      </td>
		</tr>
		   <tr height="5px"><td>&nbsp;</td></tr>
		   <?php $i++; } ?>
    </table>
</div>


<script>
function show()
{
parent.window.close();
}
</script>



