<? 
session_start();
$brcode=$_SESSION['brcode'];
if(strlen($brcode)<=0)
{
 print "<script> alert('Session timed out'); parent.document.location='../ind.php'; </script>";
 return;
}
include("../opendb.php");
include("../test.php");
$code =$_REQUEST['code'];
$da =$_REQUEST['da'];
?>
<style>
body,td{font-family:'arial narrow';letter-spacing:1;}
//td{background-color:e4ecc4}
th{background-color:green;color:white}
.mnu{margin-left:5}
</style>
<body bgcolor='ivory'>

<?
$result=mysqli_query($db,"select * from veh_purchase where pur_no='$code' and ledger not like 'eich%' and brcode='$brcode'")or die(mysqli_error());
$row=mysqli_fetch_array($result);
print "<table border=0 cellspacing=2 cellpadding=2 bgcolor='e4ecc4'>";
if($row['type']=='trans')
{
 $re=mysqli_query($db,"select brname from branch where brcode='$row[0]'");
 $br_row=mysqli_fetch_row($re);
 print "<tr><td bgcolor='85b8c8'>ledger/ Supplier</td><td>$br_row[0] <font color=red>(Transfer)</font></td>";
}
else
{
print "<tr><td bgcolor='85b8c8'>ledger/ Supplier</td><td>$row[0]</td>";
}
print "<tr><td bgcolor='85b8c8'>invno</td><td>$row[1]</td>";
print "<tr><td bgcolor='85b8c8'>invdate</td><td>".implode('-', array_reverse(explode('-', $row[2])))."</td>";
print "<tr><td bgcolor='85b8c8'>da</td><td>$row[3]</td>";
print "<tr><td bgcolor='85b8c8'>mcode</td><td>$row[4]</td>";
print "<tr><td bgcolor='85b8c8'>config</td><td>$row[5]</td>";
print "<tr><td bgcolor='85b8c8'>netamt</td><td>$row[6]</td>";
print "<tr><td bgcolor='85b8c8'>tax</td><td>$row[7]</td>";
print "<tr><td bgcolor='85b8c8'>amt before tax</td><td>$row[8]</td>";
print "<tr><td bgcolor='85b8c8'>disc</td><td>$row[9]</td>";
print "<tr><td bgcolor='85b8c8'>color</td><td>$row[10]</td>";
print "<tr><td bgcolor='85b8c8'>engno</td><td>$row[11]</td>";
print "<tr><td bgcolor='85b8c8'>chasis</td><td>$row[12]</td>";
print "<tr><td bgcolor='85b8c8'>remark</td><td>$row[13]</td>";
print "<tr><td bgcolor='85b8c8'>entrydate</td><td>".implode('-', array_reverse(explode('-', $row[15])))."</td>";
print "<tr><td bgcolor='85b8c8'>pur_no   </td><td>$row[16]</td>";
?>
</table>
<br>
<input type=button value='Back' onClick=history.back(1)>
