<?php

    $par=0;
	$paymode = $_GET['paymode'];
	$paycurrency = $_GET['paycurrency'];
	$paycurrencyvalue = $_GET['paycurrencyvalue'];
	
	
	include("connect.php");
	$eve = "select * from res_paymentmode_master where paymentmodemid='$paymode'";
	$re = mysqli_query($conn, $eve);
	if(mysqli_num_rows($re) > 0)
	{
		 while($rt = mysqli_fetch_assoc($re))
		 {
			 $pmodechargetype=$rt['pmodechargetype'];
			 $pmodecharge=$rt['pmodecharge'];
		 }
	}
	
	
	
	if($pmodechargetype == 'Percentage')
	{
		$aa = $paycurrencyvalue*$pmodecharge/100;
		$aa1 = $paycurrencyvalue + $aa;
		
	}else if($pmodechargetype == 'Fixed Amount')
	{
		$eve1 = "select * from res_currencytoinr_master where currencyname='$paycurrency'";
	$re1 = mysqli_query($conn, $eve1);
	if(mysqli_num_rows($re1) > 0)
	{
		 while($rt1 = mysqli_fetch_assoc($re1))
		 {
			 $currancyvalue=$rt1['currancyvalue'];
		 }
	}
	
	$data = $pmodecharge/$currancyvalue;
	$data = number_format($data,2);
	 $data = str_replace(',', '', $data);

		$aa1 = $paycurrencyvalue + (float)$data;
	}else{
		$aa1 = $paycurrencyvalue;
	}
	
	
	
	
	

	 echo trim($aa1);
	
	
	
	//echo trim($data);
	
?>		