<?
session_start();
include("../opendb.php");
include("../test.php");
?>
<head>
<TITLE>EXECUTIVE WISE REPORT</TITLE>
<style>
tr{font-family:arial;font-size:13;background-color:white}
TH{COLOR:WHITE;BACKGROUND-COLOR:STEELBLUE}
</style>

<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<CENTER>
<?
$sql="select distinct executive from followup where date>='$df' and date<='$dt' and platf='$pl' order by executive";

$re=mysqli_query($db,$sql);
while($row=mysqli_fetch_array($re))
{
 print "<fieldset><legend><b>$row[0]</b></legend>";
 print "<table cellspacing=1 cellpadding=2 bgcolor='lightsteelblue' width=100%>";
 print "<th>No <th>Date <th>Time Frm <th>Time To<th>Prospect<th>Address <th>Phone <th>Mob<th>Dist<th>Nxt Obj<th>Nxt Visit Dt. <th>Platform <th>Discus <th>Action to take";
 $re2=mysqli_query($db,"select * from followup where executive='$row[0]' and date>='$df' and date<='$dt' and platf='$pl' order by date");
 $i=1;
 while($row1=mysqli_fetch_array($re2))
 {
  print "<tr><td>".$i++."</td>";
  print "<td>".datetohtml($row1[date])."</td>";
  print "<td align=center>".substr($row1[tfrom],0,5)."</td>";
  print "<td align=center>".substr($row1[tto],0,5)."</td>";

  print "<td>".getpName($row1[prospect])."</td>";
  print "<td>$row1[nxtobj]</td>";
  print "<td>".datetohtml($row1[nxtobjdt])."</td>";
  print "<td><center>".$row1[platf]."</td>";
  print "<td>".$row1[discus]."</td>";
  print "<td>".$row1[atake]."</td>";

 }
 print "</table></fieldset><br>&nbsp;";
}// end if
?>
<?
function getpName($x)
{
 $gg=mysqli_query($db,"select * from prospmaster where pcode='$x'")or die(mysqli_error($db));
  $gg2=mysqli_fetch_array($gg);
  $var=$gg2[pname].'<td>'.$gg2[addr].'</td><td>'.$gg2[ph1].','.$gg2[ph2].'</td><td>'.$gg2[mob].'</td><td>'.$gg2[district].'</td>';
  return $var;
}
?>
