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

  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:black;">  &nbsp;&nbsp;REPORTS >> FORM A</font>
<center>

<h3><font color='white'>FORM A</font></H3>
<form action='' method='post' name="form1">
<table cellspacing=1 cellpadding=1 bgcolor='steelblue'>
<tr><td bgcolor='white' align=center><input type=hidden name='f_yr' id='f_yr' value='<? echo $fin_year ?>'>
<table class=noprint bgcolor='steelblue'>
    <?
$yeardat=explode('-',$fin_year);
$startingyr=$yeardat[0];
?>
<tr><td>Date from </td><td>
<?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>
<? } ?>
</td></tr>
<? $mgrp=mysqli_query($db,"select gname from groupmaster order by gname");
?>
<tr><td align='center'>Item Group :  </td><td>
<select name='type' >
<?while($grrow=mysqli_fetch_array($mgrp))
{?>
<option><?print $grrow[0]?></option>
<?}?>
</td></tr>
<tr><td></td><td>
<input type=button value='Show' name='show' onclick="frma(document.form1.fromdt.value,document.form1.todt.value)">
<input type=button value='Print' name='show' onclick="frma_p(document.form1.fromdt.value,document.form1.todt.value)">
<input type=button value='Pdf'  onclick="frma_pdf(document.form1.fromdt.value,document.form1.todt.value)">
</td></tr>
</table>
</td></tr>
</table>
</form>

<script type="text/javascript">
    function frma(str1,str2)
        {
            window.open("forma_1.php?dfrom="+str1+"&&dto="+str2);
        }
    function frma_p(str1,str2)
        {
            
            document.location="forma_prn.php?dfrom="+str1+"&&dto="+str2;
        }
	function frma_pdf(str1,str2)
        {
            
            window.open("paypdf/forma_pdf.php?dfrom="+str1+"&&dto="+str2);
        }
</script>
