<?php
$PageSecurity = 2; 
include('includes/session.inc');
include('includes/function_lib.php');
include('includes/SQL_CommonFunctions.inc');


  $query1  = "select * from currency_master_conversion where (currency='".$_REQUEST['oldCur']."' and currency_conversion='".$_REQUEST['newCur']."' AND CompanyId='".$_SESSION['ACGCompanyId']."') OR (currency='".$_REQUEST['newCur']."' AND currency_conversion='".$_REQUEST['oldCur']."') order by effective_date DESC";
$sql1=DB_query($query1,$db);
$row1=DB_fetch_array($sql1);
if(DB_num_rows($sql1)>=1)
{
	if($row1['currency']==$_REQUEST['oldCur'] && $row1['currency_conversion']==$_REQUEST['newCur'])
	{
	$data1 = $row1['rate'];
	}
	else
	{
	$data1 = round(1/$row1['rate']);
	}
}
if($data1!='')
{
$data2 = round($data1*$_REQUEST['basicAmount']);
}
else
{
$data1=0;
$data2=round($_REQUEST['basicAmount']);
}
echo $data=$data1."__".$data2;
?>
