<?php 
$CompanyId =$_SESSION['ACGCompanyId'];
	if($CompanyId) {
	    $sql_query = "SELECT * FROM account_multi_currency where CompanyId=".$CompanyId;
		$sqlQuery =DB_query($sql_query,$db);
		$row=DB_fetch_array($sqlQuery);
		}
     if($_REQUEST['action']=='setItemnameAuto')
		{
		$multicurrency = $_REQUEST['multicurrency']; 
		if($multicurrency!='1'){
			$multicurrency=0;
		}
			
		if($row['CompanyId'])
		{
		
			$res1 = DB_query("update account_multi_currency set multicurrency ='$multicurrency' 
			, modified_by='".$_SESSION['UserID']."'
			          , modified_date='".date('Y-m-d')."' where
			    CompanyId ='".$_SESSION['ACGCompanyId']."' ",$db);
			$s->pageLocation("index.php?route=Setup/accountsettingpage&modid=9&frmid=406");	
		}
		else{
		
			$sql1 ="insert into account_multi_currency 
			(multicurrency, CompanyId, Created_date, Created_by) 
			values('$multicurrency', '".$_SESSION['ACGCompanyId']."', '".date('Y-m-d')."', '".$_SESSION['UserID']."')";//exit;	
			$res1 = DB_query($sql1,$db);
			$s->pageLocation("index.php?route=Setup/accountsettingpage&modid=9&frmid=406");
		}
		
}



?>
<link href="css/accountbook_css.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="css/new_mxerp.css">
<div class="body_contain">
<div class="tab_div">
<h1>Account Management</h1>
<form method="post" action=""  name="frm"  id="frm">
<h1 align="center">Voucher Management with multiple Currency</h1>
		
<?php //if($_REQUEST['tabid']==1){ ?>
<input type="hidden" name="action" value="setItemnameAuto" />

<table width="100%" cellpadding="3" cellspacing="0" border="0">
<tr class="row1">
	<td class="tabledata1"><strong>Multi Currency Conversion </strong></td>
	<td><input type="checkbox" <?php if($row['multicurrency']=="1"){ ?> checked="checked" <?php }?> value="1" 
	name="multicurrency" id="multicurrency" onclick="checkupdate(this.value);"/></td>
</tr>


</table>


<?php //} ?>




</form>
</div>
</div>
<script type="text/javascript" language="javascript">
function checkupdate(str)
{
	document.getElementById("frm").submit();
}

</script>