<?
session_start();
if(strlen($brcode)<=0)
{
 print "<script> alert('Session timed out'); parent.document.location='../ind.php'; </script>";
 return;
}
?>
<title>Xpress</title>
   <script src="../rightclick_deactive.js"></script>
    <script type="text/javascript" src="../scripts/jquery-latest.js"></script>
	<link type="text/css" href="../includes/style1.css" rel="stylesheet" />
     <link type="text/css" href="../css/form.css" rel="stylesheet" />
<script type="text/javascript">
        $(function() {
          if ($.browser.msie && $.browser.version.substr(0,1)<7)
          {
			$('li').has('ul').mouseover(function(){
				$(this).children('ul').show();
				}).mouseout(function(){
				$(this).children('ul').hide();
				})
          }
        });        
    </script>
<body background="../back_ground.jpg">

<?php include('top.php'); ?>
<br><br>
<table class="container"><tr><td>
<font style="font-family: 'Trebuchet MS',Verdana,Helvetica,sans-serif; font-size:15px; color:white;"> &nbsp;&nbsp;Accounts >> <a href="acrepo_menu.php" style="text-decoration:none;">Reports</a> >>Service Tax Report</font>
<h3>ServiceTax Report (Closed) </H3>
<table border=0 class='form'>
<?
if($show)
{
$dfrom=$y1.'-'.$m1.'-'.$d1;
 $dto=$y2.'-'.$m2.'-'.$d2;

include("opendb.php");
include("test.php");

?>

<?
$sql="select * from branch where brcode='$brcode'";
$br=mysqli_query($db,$sql);
$bro=mysqli_fetch_array($br);
$brstate=$bro[brstate];

$i=1;
$sql="select * from branch where brstate='$brstate'";
$br=mysqli_query($db,$sql);
while($r=mysqli_fetch_array($br))
{


$sql="select * from branch where brcode='$r[brcode]'";
$brres=mysqli_query($db,$sql);
$brow=mysqli_fetch_array($brres);



$sql="select * from serinquiry where brcode ='$r[brcode]' and jvno>0 and entrydate>='$dfrom' and entrydate<='$dto' order by invno";

$r=mysqli_query($db,$sql) or die('Err:'.mysqli_error($db));


print "<tr><td  bgcolor='#455342' align=center><font color='white'><b>".strtoupper($brow[brname])."</td></tr>";


$btax=0;
$tax=0;
$round=0;
$tot=0;

$a=1;

 
?>

<tr bgcolor='#6B852C'><th align=left>Sno<th>InvNo<th>Date<th>InquiryNo<th>Service<th>Customer<th>BeforeTax<th>ServiceTax 10.3%<th>Roundoff<th>Total</tr>
<?

while($row=mysqli_fetch_array($r))
{

 


print "<tr bgcolor='white' ><td><b>".$a++."</b></td><td><b>$row[invno]</b></td><td>".datetohtml($row[entrydate])."</td><td>$row[inqno]</td><td>$row[lastserv]</td><td>$row[prospect]</td><td>$row[rate]</td><td>$row[tax]</td><td>$row[roundoff]</td><td>$row[total]

</td>";
print $row[brcode];
print $brcode;
if($row[brcode]==$brcode)
{
print "<td><input type=button value='Print' onClick=javascript:prnfun('$row[invno]','$row[brcode]')></td></tr>";  
}
$btax+=$row[rate];
$tax+=$row[tax];
$round+=$row[roundoff];
$tot+=$row[total];

}
print "<tr bgcolor='white' ><td colspan=6 align=center> Total </td><td ><b>$btax</b></td><td><b>$tax</b></td><td>$round</td><td>$tot</td></tr>";  

}

}
?>
</table>
<script>
 function delfun(x,y)
 {
  if(confirm('Do you want to delete inquiry no '+x))
   document.location='delinquiry.php?inqno='+x+'&br='+y;
 }


 function prnfun(x,y)
 {

document.location='veh/prnservbill.php?invno='+x ;
 		
}

</script>

<form action='<?Print $PHP_SELF?>' >
<table cellspacing=1 cellpadding=1 class='form'>
<tr><td bgcolor='white' align=center>
<table class=noprint>
<tr><td>Date from </td><td>dd <input type=text name='d1' size=2 value='<?print date("d")?>'>
mm <input type=text name='m1' size=2 value='<?print date("m")?>'>
yy <input type=text name='y1' size=4 value='<?print date("Y")?>'></td></tr>

<tr><td align=right>to </td><td>dd <input type=text name='d2' size=2 value='<?print date("d")?>'>
mm <input type=text name='m2' size=2 value='<?print date("m")?>'>
yy <input type=text name='y2' size=4 value='<?print date("Y")?>'>
</td></tr>

<tr><td colspan=2 align=center bgcolor='lightsteelblue'><input type=submit value='Show' name='show'></td></tr>
</table>
</td></tr>
</table>


</form>


