<?php 
/********************************************************************************* 
 *  This file is part of Sentrifugo.
 *  Copyright (C) 2014 Sapplica
 *   
 *  Sentrifugo is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  Sentrifugo is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with Sentrifugo.  If not, see <http://www.gnu.org/licenses/>.
 *
 *  Sentrifugo Support <support@sentrifugo.com>
 ********************************************************************************/
 sapp_Global::generateClientValidations($this->form);?>
<div id="error_message" style="display:none;"></div>
<form name="<?php echo $this->form->getName(); ?>" id="<?php echo $this->form->getId(); ?>" action="<?php echo $this->form->getAction();?>" method="<?php echo $this->form->getMethod(); ?>">
		<?php echo $this->form->id; ?>
        <div class="total-form-controller">
		    <div class="new-form-ui">
			  <label class="required">Base Currency</label>
				<div class="division"><?php echo $this->form->basecurrency; ?>
					<?php if(isset($this->msgarray['basecurrency'])){?>
					   <span class="errors" id="errors-<?php echo $this->form->basecurrency->getId(); ?>"><?php echo $this->msgarray['basecurrency'];?></span>
					<?php }?>
				
				   <?php if(in_array('currency',$this->popConfigPermission)) { ?>	
						<span class="add-coloum" onclick="displaydeptform('<?php echo BASE_URL.'currency/addpopup' ?>','Currency');"> Add Currency </span>			
					<?php } ?>
				</div>
			</div>
			<div class="new-form-ui">
			  <label class="required">Target Currency</label>
				<div class="division loca_state_div"><?php echo $this->form->targetcurrency; ?>
					<?php if(isset($this->msgarray['targetcurrency'])){?>
					   <span class="errors" id="errors-<?php echo $this->form->targetcurrency->getId(); ?>"><?php echo $this->msgarray['targetcurrency'];?></span>
					<?php }?>
							 
				    <?php if(in_array('currency',$this->popConfigPermission)) { ?>	
						<span class="add-coloum" onclick="displaydeptform('<?php echo BASE_URL.'currency/addpopup' ?>','Currency');"> Add Currency </span>			
					<?php } ?>
				</div>
			</div>
			
			<div class="new-form-ui">
			  <label class="required">Exchange Rate <img class="tooltip" title="Only numbers and 6 digits allowed after decimal." src="<?php echo $this->baseUrl().'/public/media/';?>images/help.png"></label>
			<div class="division"><?php echo $this->form->exchangerate; ?></div>
			<?php if(isset($this->msgarray['exchangerate'])){?>
			   <span class="errors" id="errors-<?php echo $this->form->exchangerate->getId(); ?>"><?php echo $this->msgarray['exchangerate'];?></span>
			<?php }?>
			</div>
			
			<div class="new-form-ui">
			  <label class="required">Active Start Date <img class="tooltip" title="<?php echo DATE_DESCRIPTION;?>" src="<?php echo $this->baseUrl().'/public/media/';?>images/help.png"></label>
			<div class="division"><?php echo $this->form->start_date; ?></div>
			<?php if(isset($this->msgarray['start_date'])){?>
			   <span class="errors" id="errors-<?php echo $this->form->start_date->getId(); ?>"><?php echo $this->msgarray['start_date'];?></span>
			<?php }?>
			</div>
			
			<div class="new-form-ui">
			  <label class="required">Active End Date <img class="tooltip" title="<?php echo DATE_DESCRIPTION;?>" src="<?php echo $this->baseUrl().'/public/media/';?>images/help.png"> </label>
			<div class="division"><?php echo $this->form->end_date; ?></div>
			<?php if(isset($this->msgarray['end_date'])){?>
			   <span class="errors" id="errors-<?php echo $this->form->end_date->getId(); ?>"><?php echo $this->msgarray['end_date'];?></span>
			<?php }?>
			</div>
					
			<div class="new-form-ui textareaheight">
			  <label>Description</label>
			<div class="division"><?php echo $this->form->description; ?></div>
			</div>
		<div class="new-form-ui-submit">
		<?php echo $this->form->submit; ?>
		<button onclick="window.location.href='<?php echo BASE_URL; ?>currencyconverter';" type="button" id="Cancel" name="Cancel">Cancel</button>
		</div>
</div>

<div id="currencyContainer"  style="display: none; overflow: auto;">
	<div class="heading">
		<a href="javascript:void(0)">
	    <img src="<?php echo $this->baseUrl().'/public/media/';?>images/close.png" name="" align="right" border="0" hspace="3" vspace="5" class="closeAttachPopup" style="margin: -24px 8px 0 0;"> </a>
	</div>
	<iframe id="currencyCont" class="business_units_iframe" frameborder="0"></iframe>
</div>
</form>
<script type='text/javascript'>
$(document).ready(function(){
var now = new Date();
now.setDate(now.getDate()+1);
var currentyear = <?php  echo date('Y');?>;
var year = <?php  echo date('Y') - 6;?>;
var month = <?php  echo date('m');?>;
var day = <?php  echo date('d');?>;
var currendate =  currentyear+','+month+','+day;
var date = year+','+month+','+day;

$('#start_date').datepicker({
				showOn:'both',
				maxDate: new Date(currendate),
				minDate: new Date(date),
				dateFormat:"<?php echo DATEFORMAT_JS;?>",
				buttonImage: "<?php echo $this->baseUrl("public/media/images/cal.jpg");?>",
				buttonImageOnly: true,
				buttonText: "",
				changeMonth: true,
				changeYear: true,
                                showButtonPanel: true ,
                onClose:function(){
                                    $('#start_date').trigger('blur');
                                }				
		});
$('#end_date').datepicker({
				showOn:'both',
				minDate: new Date(currendate),
				dateFormat:"<?php echo DATEFORMAT_JS;?>",
				buttonImage: "<?php echo $this->baseUrl("public/media/images/cal.jpg");?>",
				buttonImageOnly: true,
				buttonText: "",
				changeMonth: true,
                                showButtonPanel: true ,
				changeYear: true,
                onClose:function(){
                                    $('#end_date').trigger('blur');
                                }				
		});		
});	
</script>