<!---- 
    Author 	: Wahyu
    Tanggal : 22-10-2014	
    Revisi 	:
-->
<?php
//---------Untuk privellege jika dia ada tombol save----------
	if($group_user->SavePrivillage == 1){
		$cek_autority_save  = "";
	}
	else{
		$cek_autority_save 	= "disabled";
	}
//-------------end----------------------------
?>
<div class="easyui-layout" data-options="fit:true,border:false">
	<!-- top view-->
	<div id="form-header" data-options="region:'north',border:false" >
		 <div id="form-header-wrapper">
				<table cellpadding="0" cellspacing="0" width="100%" height="100%" border="0">
					<tr>
						<td align="left" valign="middle">
                        	<a href="#" class="easyui-linkbutton" iconCls="icon-document" plain="true" onclick="location.reload()">New</a>
                        	<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-reload" plain="true" onclick="location.reload()">Refresh</a>
						</td>							
						<td height="25" align="right" valign="middle">								
							<span class="form-title">
								<?=$menu_label; ?>
							</span>
						</td>
					</tr>
				</table>		     	
		 </div>			
	</div>
	<!-- end top view -->	
	<!-- center view -->
	<div id="form-body-grey" data-options="region:'center',border:false">
		<div id="form-wrapper" class="easyui-panel"  style="width:1180%;padding:5px;"  fit="true">
			<form id="fm_swift_bank" name="fm_swift_bank" method="post">
			<!-- Form Header -->
                <table width="100%" height="141" cellpadding="0" cellspacing="0">
	                <tr>
	                    <td width="50%" valign="top">
							<table cellpadding="0" cellspacing="1" width="100%" height="100%" border="0">
								<tr>
									 <td valign="middle" align="left"><b><label>Transfer From</label></b></td>
									 <td valign="middle" align="left">
									 <select name="cmb_bank_from" editable='true' class="combo-grid" id="cmb_bank_from" required="required" style="width:259px;" data-options="
											panelWidth: 300,
											idField: 'AccountNumber',
											textField: 'AccountName',
											url: '<?= base_url().$menu_link; ?>/get_akun_bank_cabang_add',                   
											columns: [[
												{field:'AccountNumber',title:'AccountNumber',width:100,hidden:true},
												{field:'AccountName',title:'Account Name',width:190},
												{field:'CurrencyCode',title:'Currency Code',width:80},
												{field:'BranchName',title:'Branch Name',width:80}
											]],
											fitColumns: true,
											onSelect: function(rowIndex, rowData){
												
                                           		get_bank_balance(rowData.AccountNumber,rowData.CurrencyCode); 
                                           		$('#branch_from').html(rowData.BranchName);
											}
											">
											</select>
											<span id="branch_from"></span>	
									 </td>
							 
							   </tr>
								<tr>
									<td valign="top" width="80" align="left">
										<b><label>Transfer To</label></b></td>
									<td valign="top" width="998" align="left">
										<select name="cmb_bank_to" editable='true' class="combo-grid" id="cmb_bank_to" required="required" style="width:259px;" data-options="
										panelWidth: 300,
										idField: 'AccountNumber',
										textField: 'AccountName',
										url: '<?= base_url().$menu_link; ?>/get_akun_bank_add',                   
										columns: [[
											{field:'AccountNumber',title:'AccountNumber',width:100,hidden:true},
												{field:'AccountName',title:'Account Name',width:190},
												{field:'CurrencyCode',title:'Currency Code',width:80},
												{field:'BranchName',title:'Branch Name',width:80}
										]],
										fitColumns: true,
										onSelect:function(rowIndex,rowData){
											$('#branch_to').html(rowData.BranchName);
										}
										">
										</select>	
										<span id="branch_to"></span>
									</td>
								</tr>
								 <tr>
		                            <td valign="top"><b><?php echo label_grid('check_no');?></b></td>
		                            <td>
		                                <input type="text" name="cheque_number" id="cheque_number" style="width:259px">
		                            </td>
		                        </tr>
								<tr>
									<td valign="top" align="left">
										<b><label>Memo</label></b>
									</td>
									<td valign="top" align="left">
										<textarea class="textbox" style="resize:none;width:259px" name="txa_memo" id="txa_memo"  rows="3"></textarea>
									</td>
								</tr>
								<tr>
								  <td valign="top" align="left"><b><label>Amount</label></b></td>
								  <td valign="top" align="left">
									<input name="txt_amount" id="txt_amount" type="text" class="easyui-numberbox currency" data-options="min:0.01,precision:2,decimalSeparator:',',groupSeparator:'.',prefix:''" style="width:260px;text-align:right" required="required" autocomplete="off" />
									<!--<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-calculator',size:'small'" onClick="">-->
									
								  </td>
								</tr>
								
								<tr>
									<td colspan="2" align="left" valign="top">&nbsp;</td>
								</tr>
							</table>
						</td>
						<td width="50%" valign="top" align="right">
							<table width="100%" cellpadding="0" cellspacing="1" style="margin-top:4px;">
		                        <tr height="20">
		                            <td rowspan="7" valign="top">&nbsp;</td>
		                            <td width="122">&nbsp;</td>
		                            <td width="125" style="background:#333399;text-align:center;color:#FFF;"><b>Available Balance (<span class='bank_balance_currency'></span>)</b></td>
		                            <td width="122" style="background:#333399;text-align:center;color:#FFF;">Date</td>
		                        </tr>
		                        <tr height="20">
		                        	<td>&nbsp;</td>
		                            <td><input name="txt_bank_balance" id="txt_bank_balance" type="text" class="easyui-numberbox" data-options="precision:2,decimalSeparator:',',groupSeparator:'.',prefix:''" style="text-align:right;width:260px" readonly /></td>
		                            <td><input type="text" name="txt_date" id="txt_date" class="easyui-datebox validBackward" style="width:122px;height:22px" editable="false" value="<?php echo $date_now;?>" required="required"/></td>
		                        </tr>
                        	</table>
						</td>
					</tr>
				</table>				  
			</form>
		</div>	
	</div>
    
    <div id="form-footer" data-options="region:'south',border:false">
			<table cellpadding="0" cellspacing="0" width="100%" height="100%" border="0">
				 <tr>
				   <td align="left">
				   </td>
					<td align="right">                              
						  <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-help" onclick="" plain="true">Help</a>
						  <?php if($this->session->userdata('jobtitle') == 'MGR'){ ?>
                         <!--<a href="javascript:void(0)" class="easyui-linkbutton form-button" iconCls="icon-ok" onclick="" disabled>App. Mgr</a>-->
                         <?php } ?>	
                         <a href="javascript:void(0)" class="easyui-linkbutton form-button save-button" iconCls="icon-save" id="save_data" <?php echo $cek_autority_save;?>>Save</a>    
                         <a href="javascript:void(0)" class="easyui-linkbutton form-button" iconCls="icon-cancel" onclick="">Cancel</a>	
					</td>
				 </tr>
			</table>				
		</div>	
</div>

<script type="text/javascript">	

var SavePrivillage  = '<?=$group_user->SavePrivillage;?>';
	
$("#save_data").click(function() { 	
	var total = $("#txt_amount").val();
	if(total <= 0){
		$.messager.alert('Unseccessfull','Amount tidak boleh kurang dari sama dengan nol','warning');
	} else {
		  save_transaction('<?php echo"$menu_link"; ?>', '#fm_swift_bank'); 
	}
}); 

function cek_amount(value){
	var total = toAngka(value);
	$("#txt_amount").val(total);
}
</script>