<?php
session_start();
include_once('../opendb.php');
$brcode=$_SESSION['brcode'];
$user=$_SESSION['user'];
if(strlen($user)<=0)
{
  print "<script> alert('Session timed out'); parent.document.location='../index.html'; </script>";
  return;
}
?>
<!DOCTYPE html>
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<title>PSN Eicher</title>
<style>
.cont
	{
	background-color:#3b5998;

	//background:url(images/bg-inner.jpg) #e9e0c3 repeat-x;
  	width: 100%;position: absolute ;
	height:99%;
    	/* Optional - just for DIV)*/
    	//border: solid 1px #000000;
	-moz-box-shadow: 0px 5px 5px #888;
	-webkit-box-shadow: 0px 5px 5px #888;
	box-shadow: 0px 5px 10px #888;
    }
.tble1 input {
background-color:transparent;
border: 0px solid;
height:20px;
//width:160px;
color:black;
}
.tble1
{
border-collapse:collapse;

}	



</style>



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



<body >

<?

$acpd=mysqli_query($db,"select * from acperiod") or die ('err'.mysqli_error($db));
     $acrow=mysqli_fetch_row($acpd);

      $acf= $acrow[0];
      $act= $acrow[1];
      
 if($brcode=='3777')
 {

  $qry=mysqli_query($db,"select distinct(grno) from sparepurchase where brcode='$brcode' and jvno='0' and entrydate>='$acf' and entrydate<='$act' order by grno desc");
  
 }
  if($user=='joy1'||$user=='nisanth'||$user=='subisha'||$user=='anson')
 {
  //$qry=mysqli_query($db,"select distinct(grno) from sparepurchase where brcode='$brcode'  and taxtype in('GST','CGST','IGST') and porderno not in('VE1000','VE1153') and entrydate>='$acf' and entrydate<='$act' order by grno desc");
  $qry=mysqli_query($db,"select distinct(grno) from sparepurchase where brcode='$brcode'  and taxtype in('GST','CGST','IGST')  and entrydate>='$acf' and entrydate<='$act' order by grno desc");
  
  $qq="select distinct(grno) from sparepurchase where brcode='$brcode'  and taxtype in('GST','CGST','IGST') and suplier not like 've com%' and entrydate>='$acf' and entrydate<='$act' order by grno desc";
 // print $qq;
 }
 else
 {
  $qry=mysqli_query($db,"select distinct(grno) from sparepurchase where brcode='$brcode' and jvno='0' and taxtype in('GST','CGST','IGST') and porderno not in('VE1000','VE1153','VE1154','VE1152','VE2000','VE1155','VE1156','VE1157','VE1141') and entrydate>='$acf' and entrydate<='$act'  order by grno desc");
  $yy="select distinct(grno) from sparepurchase where brcode='$brcode' and jvno='0' and taxtype in('GST','CGST','IGST') and porderno not in('VE1000','VE1153','VE1152','VE1154','VE2000','VE1155','VE1156','VE1157','VE1141') and entrydate>='$acf' and entrydate<='$act' order by grno desc";
  //print $yy;
 }
 
 
?>




<table align='center'>
<form name='f1' action='purchase_editgst.php' onsubmit="return validateForm()"  >
           <tr><td> <b>Invoice Number:</b></td><td>
<select id="cid"  name='inno' >
          <option>-Select-</option>
           <?
           while($row=mysqli_fetch_array($qry))
             {
                print "<option>$row[0]</option>";
             }
             ?>
             </select>
</td><td ><input type='submit' name='edit' value='OpenPage' ></td></tr>
</table>







</body>