<?
 session_start();
if(strlen($brcode)<=0)
{
 print "<script> alert('Session timed out'); 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}
th{background-color:c1d799}
.mnu{margin-left:5}
body{BACKGROUND-COLOR:fcfff1}
</style>
<H3>AXLE SHAFT SCHEME</H3>

<?


   $df=$y.'-'.$m.'-'.$d;
   $dt=$y1.'-'.$m1.'-'.$d1;
   $result=mysqli_query($db,"select * from veh_invoice a,veh_master b where a.invdate>='2010-10-01' and a.invdate<='2011-03-31'and a.brcode='$brcode' and a.type!='trans-out' and a.type!='sale-ret' and a.model_code=b.mcode and b.axleoth='axle'") or die(mysqli_error());
   if(mysqli_num_rows($result)>0)
   {
?>

<table bgcolor=silver cellspacing=1 cellpadding=1>
<th>No.<th>To <th>Inv NO.<th>Inv. Date <th>City <th>Dist.
<th>Model <th>Config <th>Eng No. <th>Chasis <th>Segment.
<?
$i=1;
     while($row=mysqli_fetch_array($result))
     {
    $addr1='';
    $dist='';
 if($row[type]=='-'||$row[type]=='sale-ret')
  { 
   $cus_result=mysqli_query($db,"select custname,addr1,addr2,city,dist,phone1,phone2 from cust_master where code='$row[cust]'")or die  (mysqli_error());
    $cus_row=mysqli_fetch_array($cus_result);
    $cust=$cus_row[0];
    $addr1=$cus_row[addr1];
    $dist=$cus_row[dist];
    $addr2=$cus_row[addr2];
  }
 else if($row[type]=='trans-out')
 {
   $cus_result=mysqli_query($db,"select brname from br_master where code='$row[cust]'")or die  (mysqli_error());
    $cus_row=mysqli_fetch_row($cus_result);
    $cust="<font color='brown'>".$cus_row[0];
}  
else
 $cust="<font color='green'>".$row[0];

      print "<tr bgcolor=white><td align=center>".$i++."</td><td>$cust</td><td align=center>$row[invno]</td><td>".datetohtml($row[invdate])."</td>";
print "<td>$cus_row[city]</td><td>$dist</td>";


      print "<td>$row[model_code]</td><td>$row[config]</td><td>$row[engno]</td>";
      print "<td>$row[chasis]</td><td>$row[segment]</td>";
   
}
}
else
 print "Record does not exist";

?>
</table>
