<!---- 
    Author 	: Wahyu
    Tanggal : 22-10-2014	
    Revisi 	:
-->
<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-journal" plain="true" disabled>Journal</a>
							<input type="checkbox" name="chk_status" id="chk_status" disabled />
							Pembatalan Transaksi
						</td>							
						<td height="25" align="right" valign="middle">								
							<span class="form-title">
								<?php echo $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">
				<table cellpadding="0" cellspacing="1" width="100%" height="100%" border="0">
					<tr>
						 <td valign="middle" height="24" align="left"><label>Transfer From</label></td>
						 <td valign="middle" align="left">
						 <select name="cmb_bank_from" editable='false' class="easyui-combogrid" id="cmb_bank_from" required="required" style="width:259px; height:18px;" data-options="
								panelWidth: 300,
								idField: 'AccountNumber',
								textField: 'AccountName',
								url: '<?php echo base_url(); ?><?php echo"activities/swift_bank"; ?>/get_akun_bank_cabang_add',                   
								columns: [[
								{field:'AccountName',title:'Account Name',width:190}
								]],
								fitColumns: true
								">
								</select>	
						 </td>
						 <td>
							 <table cellpadding="0" cellspacing="1" width="100%" border="0">
								<tr>
									  <td width="80" align="center" valign="middle" bgcolor="#333399"><label><span style="color: #fff">Sweep Bank No.</span></label></td>
							    </tr>
								<tr>
									  <td valign="top" align="left">
										 <input type="text" name="txt_swapbank_no" id="txt_swapbank_no" value="<?php echo"$swapbank_number"; ?>" class="easyui-validatebox" style="width:200px;" readonly  required="required" />
									  </td>
								</tr>
							</table>
						 </td>
				   </tr>
					<tr>
						<td valign="top" height="24" width="80" align="left">
							<label>Transfer To</label></td>
						<td valign="top" width="998" align="left">
							<select name="cmb_bank_to" editable='false' class="easyui-combogrid" id="cmb_bank_to" required="required" style="width:259px; height:18px;" data-options="
							panelWidth: 300,
							idField: 'AccountNumber',
							textField: 'AccountName',
							url: '<?php echo base_url(); ?><?php echo"activities/swift_bank"; ?>/get_akun_bank_add',                   
							columns: [[
							{field:'AccountName',title:'Account Name',width:190}
							]],
							fitColumns: true
							">
							</select>	
						</td>
					</tr>
					<tr>
						<td valign="top" height="26" align="left">
							<label>Date</label>
						</td>
						<td valign="top" align="left">
							<input name="txt_date" id="txt_date" editable='false' type="text" class="easyui-datebox validBackward" style="width:80px;" value="<?php echo $date_now;?>" required="required" />
					  </td>
					</tr>
					<tr>
						<td valign="top" height="37" align="left">
							<label>Memo</label>
						</td>
						<td height="37" valign="top" align="left">
							<textarea class="textbox" style="resize:none;" name="txa_memo" id="txa_memo" cols="50" rows="2"></textarea>
						</td>
					</tr>
					<tr>
					  <td valign="top" height="23" align="left"><label>Amount</label></td>
					  <td valign="top" align="left">
						<input name="txt_amount_rp" id="txt_amount_rp" type="text" onkeyup="cek_amount(this.value)" class="easyui-validatebox currency" style="width:100px;height:18px" required="required" autocomplete="off" />
						<!--<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-calculator',size:'small'" onClick="">-->
						<input name="txt_amount" id="txt_amount" type="hidden" />
					  </td>
					</tr>
					<tr>
						<td colspan="2" align="left" valign="top">&nbsp;</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" iconCls="icon-save" id="save_data">Save</a> 								
                         <a href="javascript:void(0)" class="easyui-linkbutton form-button" iconCls="icon-print" onclick="" disabled>Preview & Print</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">	
$(document).ready(function(){
        $('#txt_swapbank_no').val('<?php echo $sweep_number; ?>');
        $('#txt_date').datebox({
            onChange:function(){
                url             = base_url + 'activities/swift_bank/get_swep_number';                
                var Sweep_date   = $('#txt_date').datebox('getValue');
                
                $.post(url, {Sweep_date:Sweep_date}, function(result){
                    if (result.status === true){
                        $('#txt_swapbank_no').val(result.number);
                    } 
                },'json');
            }
        });        
    });
	
$("#save_data").click(function() { 	
	var total = $("#txt_amount").val();
	if(total < 1){
		$.messager.show({
			title: 'Unseccessfull',
			msg: 'Amount Tidak Boleh Nol',
			style:{
					right:'',
					bottom:''
			}
		});
	} else {
	    //$("#fm_swift_bank").submit();
	   	 $.messager.confirm('Confirm','Pastikan Semua Data Transaksi Sudah Terisi Benar',function(r){
			if(r){
		  		save_transaction('<?php echo"$menu_link"; ?>', '#fm_swift_bank');
		  	}
		});
		 
	}
}); 

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