<?php $PageSecurity = 11;
include('includes/session.inc');
//include('includes/header.inc');
include('includes/SQL_CommonFunctions.inc');
if($_REQUEST['taxId']!=''){
$discounted=$_REQUEST['discounted'];
//echo "select def_rate from excise_tax where id='".$_REQUEST['taxId']."'";
$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);
?>
<input name="exciseValue[<?php echo $_REQUEST['data']; ?>]" id="exciseValue_<?php echo $_REQUEST['data'];?>" type="text" value="<?php echo $exciseValue;?>" style="width:107px;" readonly />
<?php
}else
if($_REQUEST['salesId']!='')
{
	$sql=DB_query("Select taxrate from sales_tax_master where salestax_id ='".$_REQUEST['salesId']."'",$db);
	$row=DB_fetch_array($sql);
	echo $taxrate=$row['taxrate'];

}
else if($_REQUEST['servicesId']!='')
{
	$sql=DB_query("Select taxrate from service_tax_master where id ='".$_REQUEST['servicesId']."'",$db);
	$row=DB_fetch_array($sql);
	echo $taxrate=$row['taxrate'];

}


else if($_REQUEST['salesIdamount']!='')
{
//echo "Select taxrate from service_tax_master where id ='".$_REQUEST['salesIdamount']."'";
	$sql=DB_query("Select taxrate from sales_tax_master where salestax_id ='".$_REQUEST['salesIdamount']."'",$db);
	$row=DB_fetch_array($sql);
	$taxrate=$row['taxrate'];
	  $taxamount=round(($_REQUEST['amt']*$row['taxrate'])/100,2);
	echo  $data=$taxrate."__".$taxamount;

}


else if($_REQUEST['quotTaxId']!='')
{
	//echo "select def_rate from excise_tax where id='".$_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:20%;"  /> 
	
	
	<input name="exciseValue[<?php echo $_REQUEST['data']; ?>]" id="exciseValue_<?php echo $_REQUEST['data']; ?>" type="text" value="" size="25" style="width:75%;" onfocus="calculateExciseDuty1(<?php echo $_REQUEST['data']; ?>)" />
<?php 	
} else if($_REQUEST['type']=='TELORD')
{
$sql=DB_query("select def_rate from excise_tax where id='".$_REQUEST['q']."'",$db);
$row=DB_fetch_array($sql);
$rate=$row['def_rate'];
$exciseValue=$_REQUEST['amount']*($rate/100);
echo $exciseValue;
}
else if($_REQUEST['type']=='bill')
{
//echo "select def_rate from excise_tax where id='".$_REQUEST['id']."'";
$sql=DB_query("select def_rate from excise_tax where id='".$_REQUEST['id']."'",$db);
$row=DB_fetch_array($sql);
$rate=$row['def_rate'];
$exciseValue=($_REQUEST['value']*$rate)/100;
echo $exciseValue;

}
else if($_REQUEST['exciseId']!='')
{
$sql=DB_query("select def_rate from excise_tax where id='".$_REQUEST['exciseId']."'",$db);
$row=DB_fetch_array($sql);
$rate=$row['def_rate'];
echo $rate;
}
elseif($_REQUEST['mrnTaxId']!='')
{
	$discounted=$_REQUEST['discAmt'];
	$sql=DB_query("select def_rate from excise_tax where id='".$_REQUEST['mrnTaxId']."'",$db);
	$row=DB_fetch_array($sql);
	$rate=$row['def_rate'];
	$exciseValue=$discounted*($rate/100);
	?>
	<input name="excise_perc[<?php echo $_REQUEST['data']; ?>]" id="ExcisePercentage_<?php echo $_REQUEST['data']; ?>" type="text" value="<?php echo $rate;?>"  style="width:35px;;"  /> <input name="excise_val[<?php echo $_REQUEST['data']; ?>]" id="exciseValue_<?php echo $_REQUEST['data']; ?>" type="text" value="<?php echo $exciseValue; ?>" style="width:70px;" onfocus="calculateExciseDuty1(<?php echo $_REQUEST['data']; ?>)" />
<?php
} else if($_REQUEST['caltaxdata']!='')
{

$sql=DB_query("select def_rate from excise_tax where id='".$_REQUEST['caltaxdata']."'",$db);
	$row=DB_fetch_array($sql);
	$rate=$row['def_rate'];
	if($_REQUEST['data']!=0) {
	?>
<input name="excise_perc[<?php echo $_REQUEST['data']; ?>]" id="ExcisePercentage_<?php echo $_REQUEST['data']; ?>" type="text" value="<?php echo $rate;?>"  style="width:35px;;"  /> <input name="excise_val[<?php echo $_REQUEST['data']; ?>]" id="exciseValue_<?php echo $_REQUEST['data']; ?>" type="text" value="" style="width:70px;" onfocus="calculateExciseDuty1(this.id,this.value)" />

<?php } else { ?>  

<input name="excise_perc[<?php echo $_REQUEST['data']; ?>]" id="ExcisePercentage_<?php echo $_REQUEST['data']; ?>" type="text" value="<?php echo $rate;?>"  style="width:35px;;"  /> <input name="excise_val[<?php echo $_REQUEST['data']; ?>]" id="exciseValue_<?php echo $_REQUEST['data']; ?>" type="text" value="" style="width:70px;" onfocus="calculateExciseDuty1(this.id,this.value)" />


<?php  } } ?>