<?
session_start();
$brcode=$_SESSION['brcode'];
$user=$_SESSION['user'];
include_once('includes/top.php');
if(strlen($brcode)<=0)
{
  print "<script> alert('Invalid User'); parent.document.location='../../index.html' </script>";
  return;
}


include("opendb.php");
include("test.php");
$code=$_REQUEST['code'];
$df=$_REQUEST['df'];
$dtnw=$_REQUEST['dt'];
$cd=$_REQUEST['cd'];
$sea=$_REQUEST['sea'];
$mode=$_REQUEST['mode'];
$banknm=$_REQUEST['bnk'];
?>
<style>
BODY,td,th{margin-left:6; letter-spacing:1;font-family:arial narrow}
th{background-color:c1d7bf}
</style>
<!-- <link rel="stylesheet" href="../style.css" type="text/css" /> -->
	
<CENTER><B>
J O U R N A L<BR>&nbsp;
</b>
<?
$jv=false;
$dt;
$re=mysqli_query($db,"select distinct jvno,date from journal2 where jvno='$code' and brcode='$brcode'order by date");
print "<table bgcolor='ivory' border=0 cellspacing=3 cellpadding=1 width=100%>  <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'><form name='form1' method='POST' method='POST'><td>".implode('-', array_reverse(explode('-', $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]<input type='hidden' name='partynm' value='$cd'><input type='hidden' name='df' value='$df'><input type='hidden' name='dt' value='$dtnw'><input type='hidden' name='sea' value='$sea'><input type='hidden' name='bnknm' value='$banknm'><input type='hidden' name='modvl' value='$mode'></td>";
        print "<td align=right>".nozero(putComa($jvrow['dramt']))."</td>";
        print "\n<td align=right>".nozero(putComa($jvrow['cramt']))."</td><td>$jvrow[narr]</td><td>$jvrow[j_type]</td>";
        print "<td>$jvrow[against]</td><td>$jvrow[no]</td></form></tr>";
 

     if($jvrow['j_type']=='JV') 
 
      $jv=true;
  }


if($jv)
{
     print "\n<tr><form action='editjour.php' method='POST'><input type=hidden name=jvno value='$code'>";
     print "<input type=hidden name='dt' value='$dt'><td colspan=9 bgcolor=silver align=right><input type=submit value='Edit'> <input type=button value='Delete'></td></form></tr>";
}
print "<td> <td></td></td><td><input type=button value='Print' onclick=window.open('prnvoucher.php?jvno=".$row['jvno']."')></td>";

}
?>
</table>
</CENTER>
<?
if($mode=='cbook')
{
?>
<input type="button" value="<- Back1" onClick="prvcbookpag()">
<?
}

else if($mode=='bbook')
{
?>
<input type="button" value="<- Back2" onClick="prvbbookpag()">
<?
}
else if($mode=='sercldg')
{
?>
<input type="button" value="<- Back3" onClick="prvsrcldg()">
<?
}
else
{
?>

<input type="button" value="<- Back4" onClick="prvpag()">
<?
}
?>
<script>


function prvpag()
{
var part=document.form1.partynm.value;
var df=document.form1.df.value;
var dtnw=document.form1.dt.value;
var sn=document.form1.sea.value;
document.location="vmledger-testnew.php?cd="+part+"&&shvl="+sn+"&&df="+df+"&&dt="+dtnw,true;
}
function prvcbookpag()
{
var part=document.form1.partynm.value;
var df=document.form1.df.value;
var dtnw=document.form1.dt.value;
var sn=document.form1.sea.value;
document.location="cbook-test.php?cd="+part+"&&shvl="+sn+"&&df="+df+"&&dt="+dtnw,true;
}
function prvbbookpag()
{
var part=document.form1.bnknm.value;
var df=document.form1.df.value;
var dtnw=document.form1.dt.value;
var sn=document.form1.sea.value;
document.location="bbook-t.php?bnk="+part+"&&shvl="+sn+"&&df="+df+"&&dt="+dtnw,true;
}
function prvsrcldg()
{
var part=document.form1.partynm.value;
var mdvl=document.form1.modvl.value;
var sn=document.form1.sea.value;
document.location="vmledger.php?cd="+part+"&&sea="+sn+"&&mode="+mdvl,true;
}
</script>
