<?php $PageSecurity = 11;
include('includes/session.inc');
//include('includes/header.inc');
include('includes/SQL_CommonFunctions.inc');
if($_REQUEST['taxId']!=''){

$exciseValue = 0;
$ecessValue = 0;
$shecessValue= 0;

$discounted=$_REQUEST['discounted'];

$sql=DB_query("select def_rate from excise_tax where id='".$_REQUEST['taxId']."'",$db);
$row=DB_fetch_array($sql);
$rate=$row['def_rate'];
$exciseValue=$discounted*($rate/100);

$cesssql = "SELECT def_rate, caption FROM  excise_tax WHERE caption LIKE '%e-cess%'";
$result = DB_query($cesssql,$db);
while($cessRow = DB_fetch_array($result)){
	if($cessRow['caption']=='E-Cess')
	{
		$ecessValue = $discounted*($cessRow['def_rate']/100);
	}elseif($cessRow['caption']=='SAHE-Cess ')
	{
		$shecessValue = $discounted*($cessRow['def_rate']/100);
	}
}
$data = $exciseValue."__".$ecessValue."__".$shecessValue;
echo $data;
}else
if($_REQUEST['salesId']!='')
{
	$sql=DB_query("Select taxrate from sales_tax_master where salestax_id ='".$_REQUEST['salesId']."'",$db);
	$row=DB_fetch_array($sql);
	$taxrate=$row['taxrate'];
	$total=$_REQUEST['taxable']*($taxrate/100);
echo $total;
}
else if($_REQUEST['quotTaxId']!='')
{
	
	$sql=DB_query("select def_rate from excise_tax where id='".$_REQUEST['quotTaxId']."'",$db);
	$row=DB_fetch_array($sql);
	$rate=$row['def_rate'];
	?>
	<input name="ExcisePercentage[<?php echo $_REQUEST['data']; ?>]" id="ExcisePercentage_<?php echo $_REQUEST['data']; ?>" type="text" value="<?php echo $rate;?>"  style="width:100%;"  /> <input name="exciseValue[<?php echo $_REQUEST['data']; ?>]" id="exciseValue_<?php echo $_REQUEST['data']; ?>" type="text" value="" size="25" style="width:75%;" onfocus="calculateExciseDuty(<?php echo $_REQUEST['data']; ?>)" />
<?php 	
} 

else if($_REQUEST['qid'])
{
$discounted=$_REQUEST['discounted'];	

$sql=DB_query("select def_rate from excise_tax where id='".$_REQUEST['qid']."'",$db);
$row=DB_fetch_array($sql);
$rate=$row['def_rate'];
$exciseValue=$discounted*($rate/100);	
	

?>
<input name="ExcisePercentage" id="ExcisePercentage" type="text" value="<?php echo $rate;?>"  style="width:100%;"  /> <input name="exciseValue" id="exciseValue" type="text" value="<?php echo $exciseValue;?>" size="25" style="width:75%;"  />

<?php } ?>
