<?session_start();
include("../opendb.php");
include("../test.php");
?>
<link rel="stylesheet" href="style.css" type="text/css" />
<style>
body,td{font-family:'arial narrow';letter-spacing:1;font-size:12}
th{background-color:c1d799}
//tr{background-color:c1d799}
.mnu{margin-left:5}
.summ{font-size:13};
</style>
<center>

ORDER FORM ACTIVATION
<form action='<?print $PHP_SELF?>' method=post>
<table bgcolor='silver'>
<tr><td> Date from </td><td>dd<input type=text name='d' size=2 value='<?print date('d',time())?>'>
				mm<input type=text name='m' size=2 value='<?print date('m',time())?>'>
				yy<input type=text name='y' size=4 value='<?print date('Y',time())?>'>
			</td></tr>
<tr><td> To </td><td>dd<input type=text name='d1' size=2 value='<?print date('d',time())?>'>
				mm<input type=text name='m1' size=2 value='<?print date('m',time())?>'>
				yy<input type=text name='y1' size=4 value='<?print date('Y',time())?>'>
			</td>
</tr>
<th colspan=2 align=center><input type=submit name='show' value='Show'>
</td></tr>
</table>
</form>
<?
if($show||$dt)
{
if(!$df)
{
$df=$y.'-'.$m.'-'.$d;
$dt=$y1.'-'.$m1.'-'.$d1;
}

$res=mysqli_query($db,"select * from orderform where actvtd='n' and brcode='$brcode' and dt>='$df' and dt<='$dt' and stat='Active' order by 1");

while($row=mysqli_fetch_array($res))
{
 	$segres1=mysqli_query($db,"select finname from fin_master where code='$row[fine]'");
        $segrow=mysqli_fetch_row($segres1);

 	$segres=mysqli_query($db,"select sname from seg_master where code='$row[seg]'");
        $segrow1=mysqli_fetch_row($segres);
print "\n<form action='actvt.php' method='post'> <input type=hidden name='formno' value='$row[0]'><br>\n";
print "<input type=hidden name='df' value='$df'>";
print "<input type=hidden name='dt' value='$dt'>";

print "<table border=1 width=100%>";
 print "<tr><td rowspan=20 bgcolor='lightsteelblue' width=50 align=center>$row[0]</td>";
 print "<td>Date</td><td>".datetohtml($row[dt])."</td>";
 print "<tr><td>Name</td><td>$row[2]</td>";
 print "<tr><td>Contact</td><td>$row[4]</td>";
 print "<tr><td>Model</td><td>$row[model]</td>";
 print "<tr><td>Config</td><td>$row[config]</td>";
 print "<tr><td>Segment</td><td>$segrow1[0]</td>";
 print "<tr><td>Financier</td><td>$segrow[0]</td>";
 print "<tr><td>Exchange</td><td>$row[exch]</td>";
 print "<tr><td>Exch Amt</td><td>$row[exvalue]</td>";
 print "<tr><td>Desc </td><td>$row[descr]</td></tr>";
 print "<tr><td>Invoice Amt</td><td>$row[invalue]</td>";
 print "<tr><td>Discount</td><td>$row[disamt]</td>";
 print "<tr><td>Net</td><td>$row[netamt]</td>";
 print "<tr><td>Opening</td><td>$row[op]</td>";
 print "<tr><td>Other Info</td><td>$row[oinf]</td>";
 print "<tr><td>Location</td><td>$row[location]</td>";
 $rep=getRep($row[rname]);
 print "<tr><td>Executive</td><td><b>$rep</td>";

 print "<tr><td colspan=2>";
?>
<select name='act'>
<option value='y'>Activate</option>
<option value='r'>Reject</option>
<option value='h'>Hold</option>
</select>
Remark : <input type=text name='rem' size=40>
<input type=submit value='Save'></td></tr>
<?
print "</table>\n</form>";
}
}
function getRep($x)
{
//include("../opendb.php");
 $eeres=mysqli_query($db,"select repname from rep_master where code='$x'")or die ('Err'.mysqli_error()); 
 $eerow=mysqli_fetch_row($eeres);
 return $eerow[0];
}

?>
