<?php
session_start(); 
include("db.php");
     
	
	$ccurrencyId=$counterCurrency;
	$basecurrencyId=$basecurrency;
	
	include("newPlagin_lastPrice.php"); 
	
	
	
	
	 if($counterCurrency==1){
	 
	    $counterAmountRate=1;
	 }
	 if($counterCurrency!=1){
      $counterAmountSql="select rate from crrencyrate where counterCurrency='$counterCurrency' and type='1'  ORDER BY id desc  LIMIT 1";
      $counterAmountQuery=$db ->query($counterAmountSql);
	  $counterAmountRow=$counterAmountQuery ->fetch_array();
	  $counterAmountRate=$counterAmountRow['rate'];
       
	 }
 //==========================================================================
      $baseAmountSql="select rate from crrencyrate where counterCurrency='$basecurrency' and type='1'  ORDER BY id desc  LIMIT 1";
      $baseAmountQuery=$db ->query($baseAmountSql);
	  $baseAmountRow=$baseAmountQuery ->fetch_array();
	  $baseAmount=$baseAmountRow['rate'];
 //==================================================================
      
  
   $newCalculation=$baseAmount/$counterAmountRate;
 
 
?>