<link type="text/css" href="includes/style1.css" rel="stylesheet" />
<link type="text/css" href="css/form1.css" rel="stylesheet" />

<?
include_once('includes/top.php');
include_once('opendb.php');
$brcode=$_SESSION['brcode'];
$user=$_SESSION['user'];
//$br=$_SESSION['branch'];
if(strlen($user)<=0)
{
  print "<script> alert('Invalid User'); document.location='inde.php' </script>";
  return;
}
$code=$_REQUEST['code'];
?>
<CENTER><B>
J O U R N A L <?print $code?><BR>&nbsp;
<?
$jv=false;
$dt;
$re=mysqli_query($db,"select distinct jvno,date from journal2 where jvno='$code' and brcode='$brcode'order by date");
?>
<table bgcolor='ivory' border=0 cellspacing=3 cellpadding=1 width=100% class="grid">  

<th>Date <th>Particulars <th>Debit <th>Credit <th>Narration <th>Type <th>Ref. <th> Ref. NO
<?
while($row=mysqli_fetch_array($re))
{
  $re2=mysqli_query($db,"select * from journal2 where jvno='$row[jvno]' and brcode='$brcode'") or die(mysqli_error($db));
  print "\n<tr bgcolor='silver'><td>".$row[date]."</td><td>Trans No:$row[jvno]</td>";
 $dt=$row[date];
  print "<td></td><td></td><td></td><td></td><td></td><td></td></tr>";
    while($jvrow=mysqli_fetch_array($re2))
    {
        print "\n<tr><td>&nbsp;</td><td>$jvrow[partic]</td>";
        print "<td align=right>".number_format($jvrow[dramt],2,'.','')."</td>";
        print "\n<td align=right>".number_format($jvrow[cramt],2,'.','')."</td><td>$jvrow[narr]</td><td>$jvrow[j_type]</td>";
        print "<td>$jvrow[against]</td><td>$jvrow[no]</td></tr>";
     if($jvrow[j_type]=='JV') 
       $jv=true;
  }

if($jv)
{

$us=mysqli_query($db,"select level from bruser where username='$user'")or die(mysqli_error($db));
$r=mysqli_fetch_row($us);
$user_level=$r[0];

if($user_level>=4)
{
     //print "\n<tr><form action='accounts/multientry/editjour.php'><input type=hidden name=jvno value='$code'>";
     
     print "<input type=hidden name='dt' value='$dt'><td colspan=9 bgcolor=silver align=right></td></form></tr>";
}
}

}
?>
</table>
</CENTER>

<input type=button value='<- Back' onClick='history.back(1)'>
