<?
session_start();
$brcode=$_SESSION['brcode'];
$user=$_SESSION['user'];
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'];
$df1=$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_log 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_log where jvno='$row[jvno]' and brcode='$brcode' order by dramt desc") or die(mysqli_error());
  $df=implode('-', array_reverse(explode('-', $row['date'])));
  print "\n<tr bgcolor='silver'><form name='form1' method='POST' method='POST'><td>".$df."</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='$df1'><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']),$db)."</td>";
        print "\n<td align=right>".nozero(putComa($jvrow['cramt']),$db)."</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;
  }
}
?>
</table>
</CENTER>
<?
if($mode=='cbook')
{
?>
<input type="button" value="<- Back" onClick="prvcbookpag()">
<?
}

else if($mode=='bbook')
{
?>
<input type="button" value="<- Back" onClick="prvbbookpag()">
<?
}
else if($mode=='sercldg')
{
?>
<input type="button" value="<- Back" onClick="prvsrcldg()">
<?
}
else
{
?>
<input type="button" value="<- Back" 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-test.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>
