<?php
session_start();

include 'dbc.php';

$userid=$_SESSION['userid'];

$id=$_REQUEST["id"];

  $sqlcus = "select * from expense_voucher where id='$id' and user_id='$userid'";
   $result=$conn->query($sqlcus);
$ppp = $result->fetch_assoc();
    $v_type=$ppp["v_type"];
	$disc=$ppp["discription"];
	


 	    
		
echo "<table border=0 width=100% align=center bgcolor=white>";
echo "<tr>";
echo "<th bgcolor=white align=center>  $userid </th>";
echo "</tr>";
echo "<tr>";
echo "<th bgcolor=white align=center>  $v_type </th>";
echo "</tr>";
echo "<tr>";
  echo "<th bgcolor=white align=left>  Date </th>";
  echo "<td>"  .$ppp["date"] . "</td>" ; 
  echo "</tr>";
echo "<tr>";
echo "<th bgcolor=white align=left> Invoice No </th>";
  echo "<td>"  .$ppp["tr_no"] . "</td>" ;
  echo "</tr>";
  echo "</table>";
  
 

$sql1 = "select * from expense_voucher where id='$id' and user_id='$userid'";
   $result1=$conn->query($sql1);
 echo "<table border=1 width=100% align=center bgcolor=white>";
 echo "<tr>";
 echo "<th bgcolor=white align=left height=50> Description Dr</th>";
 echo "<th bgcolor=white align=left height=50> Description Cr</th>";
 echo "<th bgcolor=white align=left height=50> Amount </th>";
 
 echo "</tr>";
  $sno=1;
  while($row = $result1->fetch_assoc())

  {
   echo "<tr>";
  
   echo "<th  height=50>"   .$row['acc_name_dr'] . "</th>";
   echo "<th  height=50>"   .$row['acc_name_cr'] . "</th>";
   
	 echo "<td height=50>" .$row['amount'] . "</td>";
		
		
  echo "</tr>";
 
  $sno=$sno + 1;
  $treceived=$treceived + $row['amount'];
   $disc= $row['discription'];

  }
  $bal=$treceived;
 echo "<tr>";
  
 echo "<th align=left height=50 colspan=3>" .$disc . "</th>" ;
 echo "</tr>";
 echo "<tr>";
  
 echo "<th align=right bgcolor=white height=50 colspan=2> Total    :      </th>";
 echo "<th align=right height=50>" .$bal . "</th>" ;
 echo "</tr>";
 
 
 echo "</table>";
	 
 
?>

<br />
<h3><br />
  <br />
  <br />
  <br />
Director:________ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Acounts Manager:________&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Customer:________
<br />

<br />

<br />

<br />

<br />


