<?php  error_reporting(0);
$PageSecurity = 3;
 include('includes/Class_Branch.php');
	include('includes/AccountGroupMaster_Class.php');
 	$modid=$_REQUEST['modid'];
	$frmid=$_REQUEST['frmid'];
	$rurl="&modid=".$modid."&frmid=".$frmid;
 global $db;	
 include ('includes/session.inc');
  include ('includes/function_lib.php');
  
     $invledger= $s->getField('sales_tax_master','salestax_id',$_REQUEST['vid'],'tax_code');

   	$site= $_REQUEST['site'];
     $fromDate=ConvertSQLDate ($_REQUEST['fromDate']); 
     $toDate= ConvertSQLDate($_REQUEST['toDate']); 

    echo '<link href="'.$rootpath. '/css/'. $_SESSION['Theme'] .'/default.css" rel="stylesheet" type="text/css" />';
	if($site!=''){
			  $loccode=	$s->getField('locations','loccode',$site,'prefix');
			$filter1[]="branch_name='".$loccode."'";
			
			
			}
			if($fromDate!='' &&  $toDate!='')
			 $filter1[]="invoiceDate   >='".$fromDate."' and  invoiceDate   <='".$toDate."'";
			 
			 if(count($filter1)>0)
 			 {
			   $f=implode("and  " , $filter1);
  			   $query="select * from invoice  where $f and VatCst  ='".$_REQUEST['vid']."'  order by  invoiceDate ";
			 
			 }else{			
			 		 		
			   $query="select * from invoice  where VatCst  ='".$_REQUEST['vid']."' order by  invoiceDate  ";
			   }
?>
<center><h2>Vat Computation Detail Wise Report<br /><?php echo $invledger?></h2></center>
 <table width="100%" border="1">
  <tr>
    <th>Invoice No </th>
    <th>Invoice Date </th>
    <th>Party Name </th>
    <th>Basic Value </th>
    <th>Exise</th>
    <th>ECess.</th>
    <th>SHEC Amount </th>
    <th>Tax Amount </th>
    <th>Additional Tax </th>
     <th>Pack.Charges</th>
    <th>Frieght Charges </th>
    
    <th>Unit Name </th>
   </tr>
 <?php 
 	 $result=DB_query($query,$db);
		$i=0;
		if(DB_num_rows($result)>0)
		{
			while($myrow=DB_fetch_array($result))
			{ 
 			   if($i++%2==0)
			   $bg="bgcolor='#CCCCCC'";
			   else
			   $bg='';
			  ?>
 			  <tr <?php  echo $bg;?>>
			<td><?php echo $myrow['invoiceNo'] ?></td>
			<td><?php echo ConvertSQLDate($myrow['invoiceDate']) ?></td>
			<td><?php echo			 $s->getField('clientmaster','id',$myrow['client_id'],'c_name');
			// $myrow['client_id'] ?></td>
			<td><?php echo $myrow['basicAmount'] ?></td>
			<td><?php echo $myrow['exciseValue'] ?></td>
		   
			<td><?php echo $myrow['ECessValue'] ?></td>
			<td><?php echo $myrow['SAHCessValue'] ?></td>
			<td><?php echo $myrow['taxableAmount'] ?></td>
			<td><?php echo $myrow['additionalCharges'] ?></td>
	 		  <td><?php echo $myrow['packagingCharges'] ?></td>
			 <td><?php echo $myrow['freightValue'] ?></td>
			  <td><?php echo $myrow['branch_name'] ?></td>
 			  </tr>
			<?php
			}
			
		}
	?>		
</table>
