<?
 session_start();
if(strlen($brcode)<=0)
{
  print "<script> alert('Invalid User'); parent.document.location='ind.php' </script>";
  return;
}
include("../opendb.php");
include("../test.php");
?>
<style>
body,td{font-family:'arial narrow';letter-spacing:1;font-size:13}
tr{background-color:white} 
th{background-color:c1d799;font-size:13}
.mnu{margin-left:5}
body{BACKGROUND-COLOR:fcfff1}
</style>
<!-- <p align=right> <input type=button value='Print' onClick=window.open('')> </p> -->
<center>
<h2><?print $branch?> <br>CUSTOMER REPORT </H2>
<table cellspacing=1 cellpadding=1 bgcolor='gray'>
<th> No. <th>Date <th> Inv NO <th>Customer Name <th>Address 1 <th> Address 2 <th>Address 3
<th>Area <th>District <th>Phone <th>Chasis <th>Engine <th>Config <th>Financer <th>Exec
<?
$i=1;
if($sea)
{
 $df=$y.'-'.$m.'-'.$d;
 $dt=$y1.'-'.$m1.'-'.$d1;
$sql="select distinct(name),date,invoiceno,addr1,addr2,addr3,area,dist,phone,chasis,engno,config,fine,exec,brcode from dupoldinvoice where date>='$df' and date<='$dt' and brcode='$brcode' group by name,addr1 order by date,invoiceno";
}
else
$sql="select distinct(name),date,invoiceno,addr1,addr2,addr3,area,dist,phone,chasis,engno,config,fine,exec,brcode from dupoldinvoice group by name,addr1 order by date,invoiceno";

$re=mysqli_query($db,$sql);
while($row=mysqli_fetch_array($re))
{
if($pswd=='age')
{
 print "<tr bgcolor=white><td align=center>".$i++."</td><td>".datetohtml($row[1])."</td><td align=center>$row[2]</td><td><a href='editcust.php?date=$row[date]&invno=$row[1]'>$row[0]</a></td>";
 print "<td>$row[3]</td><td>$row[4]</td><td>$row[5]</td><td>$row[6]</td>";
 print "<td>$row[7]</td><td>$row[8]</td><td>$row[9]</td><td>$row[10]</td>";
 print "<td>$row[11]</td><td>$row[12]</td><td>$row[13]</td>";
}
}
?>
</table>
