<?
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;
}

?>
<link type="text/css" href="includes/style1.css" rel="stylesheet" />
<link type="text/css" href="css/form.css" rel="stylesheet" />
<link rel="stylesheet" href="cal/jquery-ui.css" />
<script src="cal/jquery-1.9.1.js"></script>
<script src="cal/jquery-ui1.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css" />
<script type="text/javascript">
$(function() {
$( "#ref_date" ).datepicker("destroy");
     var fyr=document.getElementById('f_yr').value;
     var splv=fyr.explode("-");
     var syr=splv[0];
     var eyr='20'.concat(splv[1]);
     var syr1='01-04-';
     var eyr1='31-03-';
     var stfnyr=syr1.concat(syr);
     var efnyr=eyr1.concat(eyr);
     $("#ref_date").datepicker({ dateFormat: 'dd-mm-yy', minDate: stfnyr, maxDate: efnyr});

$( "#ref_date1" ).datepicker("destroy");
     var fyr=document.getElementById('f_yr').value;
     var splv=fyr.explode("-");
     var syr=splv[0];
     var eyr='20'.concat(splv[1]);
     var syr1='01-04-';
     var eyr1='31-03-';
     var stfnyr=syr1.concat(syr);
     var efnyr=eyr1.concat(eyr);
     $("#ref_date1").datepicker({ dateFormat: 'dd-mm-yy', minDate: stfnyr, maxDate: efnyr});
});

</script>
<style>
  //tr1{background-color:white}
  th{background-color:steelblue;color:white}
</style>
<body bgcolor="#0033FF">


<?php //include('includes/top.php'); ?>
<font style="font-family: 'Trebuchet MS',Verdana,Helvetica,sans-serif; font-size:15px; color:white;">  &nbsp;&nbsp;REPORTS >> STOCK REPORT</font>
<center>

<h3><font color='black'>RECEIPT AND DISBURSEMENT STATEMENT</font></H3>
<form action='rdreport_1.php' method='post' name="f1">
<table cellspacing=1 cellpadding=1 bgcolor='steelblue'>
<tr><td bgcolor='white' align=center>
<table class=noprint>
<?
$yeardat=explode('-',$fin_year);
$startingyr=$yeardat[0];
?>
<tr><td>Date from </td><td><input type=hidden name='f_yr' id='f_yr' value='<? echo $fin_year ?>'>
<?if($fromdt>0){?>
      <input type="text" id="ref_date" value="<?echo $fromdt;?>" name="fromdt" readonly  >
<?} else {?>
      <input type="text" id="ref_date" value="<?echo date('d-m-Y');?>" name="fromdt" readonly  >
<? } ?>
</td></tr>
<tr><td align=right>to </td><td>
<?if($todt>0){?>
      <input type="text" id="ref_date1" name="todt" value="<?echo $todt;?>" readonly > </td></tr>
<?} else {?>
      <input type="text" id="ref_date1" name="todt" value="<?echo date('d-m-Y');?>" readonly > </td></tr>
<? } ?>

<? $mgrp=mysqli_query($db,"select gname from groupmaster order by gname");
?>
<tr><td colspan=2 align=center bgcolor='lightsteelblue'><input type=submit value='Show' name='show'>
    <input type=button value="Print Report" onclick=conslfn()><input type=button value="Print Pdf" onclick=pdffun()>
    </td></tr>
</table>
</td></tr>
</table>
</form>
<script>
  function conslfn()
{
    var fromdt=document.f1.fromdt.value;
    var todt=document.f1.todt.value;
    document.location="rdreport_1prn.php?dfrom="+fromdt+"&&dto="+todt,true;
}
function pdffun()
{
    var fromdt=document.f1.fromdt.value;
    var todt=document.f1.todt.value;
    window.open("paypdf/rdreport_pdf.php?fromdt="+fromdt+"&&todt="+todt,true);
}
</script>