<!---- 
    Author 	: Fachri
    Tanggal : 03-07-2015	
    Revisi 	:
-->
<?php
//---------Untuk privellege jika dia ada tombol save,suspen,jurnal----------
	if($group_user->SavePrivillage == 1){
		$cek_autority_save  = "";
	}
	else{
		$cek_autority_save 	= "disabled";
	}
	
	if($group_user->JournalPrivillage == 1){
		$cek_autority_journal  = "";
	}
	else{
		$cek_autority_journal 	= "disabled";
	}
	
	if($group_user->DeletePrivillage == 1){
		$cek_autority_delete  = "";
	}
	else{
		$cek_autority_delete 	= "disabled";
	}

    if($group_user->ReversePrivillage == 1){
        $cek_autority_reverse  = "";
    }
    else{
        $cek_autority_reverse    = "display:none";
    }
//-------------end----------------------------
?>
<div class="easyui-layout" data-options="fit:true,border:false">
	<?php 
		$trans_status = "";
		foreach($payment as $row): 
			$trans_status = $row->TransStatus;
	?>
	<!-- 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">
                    <input type="checkbox" class="easyui-checkbox" name="chk_suspended" id="chk_suspended" style="margin-top:0px;margin-right:1px;" onclick="suspend_transaction(1,'<?= $menu_link;?>',$('#txt_payment_no').val(),'<?=$menu_label;?>')" <?=(!in_array($row->TransStatus,array(5,6))) ? 'disabled' : ''?> <?=(in_array($row->TransStatus,array(3,9))) ? 'checked' : ''?> <?php echo $cek_autority_delete;?>/>
                    <span style="display:inline-block;margin-top:2px;<?=(($row->TransStatus==3)?'color:gray;':'color:black')?>">Suspend</span>
                     <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-journal" plain="true"  id="btn_journal" onclick="show_journal()" <?php echo $cek_autority_journal;?>>Journal</a>
                    <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-reload" plain="true" onclick="location.reload()">Refresh</a>
                   
                </td>
                <td align="center" width="40%">
                    <span id="approval_information">
                    <?php
                    if($row->TransStatus == 5){
                        echo get_status_approval_header($row->TransStatus);
                    }
                    ?>
                    </span>
                </td>       
                <td height="25" align="right" valign="middle">
                    <span class="form-title" style="margin-left:7px;">
                        <?=$menu_label?>
                    </span>
                </td>
            </tr>
            </table>		     	
        </div>			
    </div>
    <!-- End of top view -->
    
    <div id="form-body" data-options="region:'center',border:false">
    <?php if($trans_status==2){ ?>
        <div class="blanket"></div>
        <div class="finished-box"><b>Finished</b></div>
    <?php }else if($trans_status==3){ ?>
    	 <div class="blanket"></div>
         <div class="suspend-box"><b>Suspended</b></div>
	<?php
	}
	?>
        <div id="form-wrapper" class="easyui-panel" style="width:1180%;height:526px;padding:5px;" fit="true">
        	<form id="fm_payment" name="fm_payment" method="post">
				<input type="hidden" name="detail" id="detail" />
				<input type="hidden" name="id" id="id" value="<?= $row->OIncomeNumber;?>" />
                <input type="hidden" name="exsist_trans_status" id="exsist_trans_status" value="<?= $trans_status;?>" />
				<input type="hidden" name="code_appmgrspv" id="code_appmgrspv" />
				<input type="hidden" name="code_appdir" id="code_appdir" />
				<input type="hidden" name="copy_suspend" id="copy_suspend" />
                <input type="hidden" name="txt_curr_code" id="txt_curr_code" value="<?= $row->CurrencyCode;?>"/>
                <input type="hidden" name="detail_id" id="detail_id" value="">
                <!-- Form Header -->
                <table width="100%" height="141" cellpadding="0" cellspacing="0">
                <tr>
                    <td width="50%" valign="top">
                    	<table width="100%" cellpadding="0" cellspacing="1" style="margin-top:4px;">
                        <tr height="20">
                        	<td width="150"><b>Deposit To</b></td>
                            <td width="10"><b>:</b></td>
                            <td>
                            	<select id="cbg_bank" name="cbg_bank" 
                                	required editable='true' class="combo-grid" 
                                	style="width:300px;height:22px;" 
                                    data-options="
                                    	value:'<?= $row->BankPayment; ?>',
                                        panelWidth: 400,
                                        idField: 'AccountNumber',
                                        textField: 'AccountName',
                                        url: '<?=base_url().$menu_link;?>/ajax_bank_account/<?= $row->BranchCode;?>',
                                        method: 'get',
                                        columns: [[
                                            {field:'AccountNumber',title:'Account Number',width:110,halign:'center',hidden:true}, 
                                            {field:'AccountName',title:'Bank Name',width:190,halign:'center'}, 
                                            {field:'CurrencyCode',title:'Bank Currency',width:80,halign:'center',align:'center'}
                                        ]],
                                        fitColumns: true,
                                        onSelect:function(rowIndex, rowData){
                                            $('#span_curr').text(rowData.CurrencyCode);
                                            $('.app-button').linkbutton('disable');
                                            
                                            get_master_rate(rowData.CurrencyCode);
                                            get_bank_balance(rowData.AccountNumber,rowData.CurrencyCode); 

                                            if(rowData.CurrencyCode == 'IDR'){
                                                $('#txt_rate').prop('readonly',true);
                                                $('#txt_rate').numberbox({required:false});
                                                $('#txt_curr_code').val(rowData.CurrencyCode);
                                            }
                                            else{
                                                $('#txt_rate').prop('readonly',false);
                                                $('#txt_rate').numberbox({required:true});
                                                $('#txt_curr_code').val(rowData.CurrencyCode);
                                            }
                                        }
                                    ">
                                </select>
                            </td>
                        </tr>
                         <tr height="20">
                            <td width="150"><b><?php echo label_grid('check_no');?></b></td>
                            <td width="10"><b>:</b></td>
                            <td>
                                 <input type="text" name="cheque_number" id="cheque_number" value="<?=$row->ChequeNumber;?>" style="width:300px" <?=in_array($row->TransStatus,array(1,2,3,9))?'disabled':'';?>>
                            </td>
                        </tr>
                        <tr height="20">
                        	<td width="150" valign="top" style="padding-top:4px;"><b>Memo</b></td>
                            <td width="10" valign="top" style="padding-top:4px;"><b>:</b></td>
                            <td>
                            	<textarea class="textbox" name="txa_memo" id="txa_memo" rows="4" style="width:298px;resize:none;white-space:normal;" <?php if($row->TransStatus == 3 || $row->TransStatus == 2){echo "readonly";}?>><?php echo $row->OIncomeDesc;?></textarea>
                            </td>
                        </tr>
                        <tr height="20">
                        	<td width="150"><b>Rate</b></td>
                            <td width="10"><b>:</b></td>
                            <td>
                            	<input name="txt_rate" id="txt_rate" type="text" class="easyui-numberbox" style="width:300px;height:20px" formatter="formatRp" value="<?= $row->CurrencyRate;?>"
                                    data-options="
                                        min:0.01,precision:2,decimalSeparator:',',groupSeparator:'.',disabled:false
                                    " required>
                                
                            </td>
                        </tr>
                         <tr height="20">
                            <td width="150"><b>Amount</b></td>
                            <td width="10"><b>:</b></td>
                            <td>
                                <input name="txt_amount" id="txt_amount" type="text" class="easyui-numberbox" value="<?= $row->OInTotalAmount;?>" style="width:300px;height:20px" formatter="formatRp" 
                                    data-options="
                                        min:0.01,precision:2,decimalSeparator:',',groupSeparator:'.',disabled:true
                                    " required readonly>
                                <!-- <a href="#" id="btn_calculate" class="easyui-linkbutton" data-options="iconCls:'icon-calculator',size:'small'" onclick="count_amount()"></a> -->
                            </td>
                        </tr>
                        <tr height="25"><td colspan="3"></td></tr>
                        </table>
                    </td>
                    <td width="50%" valign="top">
                    	<table width="100%" cellpadding="0" cellspacing="1" style="margin-top:4px;">
                        <tr height="20">
                        	<td>&nbsp;</td>
                            <td width="190" style="background:#333399;text-align:center;color:#FFF;">Other Income No.</td>
                            <td width="122" style="background:#333399;text-align:center;color:#FFF;">Other Income Date</td>
                        </tr>
                        <tr height="20">
                        	<td>&nbsp;</td>
                            <td>
                            	<input type="text" name="txt_payment_no" id="txt_payment_no" class="easyui-validatebox" value="<?=$row->OIncomeNumber; ?>" style="width:200px;background-color:#E3E2E2;text-align:center;" required="required" readonly/>
                            </td>
                            <td>
                            	<input type="text" name="txt_payment_date" id="txt_payment_date" class="easyui-datebox" style="width:122px;height:20px" editable="false" required readonly/>
                            </td>
                        </tr>
                        
                        </table>
                        <table width="100%" cellpadding="0" cellspacing="0" style="margin-top:0px;">
                        <tr height="20">
                            <td rowspan="7" valign="top">&nbsp;</td>
                            <td width="122">&nbsp;</td>
                            <td width="190" style="background:#333399;text-align:center;color:#FFF;"><b>Available Balance (<span class='bank_balance_currency'></span>)</b></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;height:18px;width:325px" readonly /></td>
                        </tr>
                        </table>
                    </td>
                </tr>
                </table>
                <!-- End of Form header -->
                
                <!-- Datagrid -->
                <table id="dtg_payment" class="easyui-<?=(in_array($row->TransStatus,array(0,1,2)))?'datagrid':'edatagrid'?>"
                	toolbar="#tb_dtg_payment" idField="id" 
                    rownumbers="true" fitColumns="true" 
					singleSelect="true" 
                    style="height:340px;"
                    url="<?= base_url().$menu_link;?>/detail_payment/<?= $row->OIncomeNumber;?>" 
                    data-options = "
                        onBeforeLoad:function(){
                            $('#dtg_payment').datagrid('loadData', {'total':0,'rows':[]});
                        },
                        onBeginEdit:function(rowIndex){
                            /*====================on beg in edit saat grid di klik maka tombol save disable===================*/
                            save_button_begendedit('<?=$group_user->SavePrivillage;?>');
                            /*=================================end============================================================*/
                        },
                        onEndEdit:function(indexRow,row,changes){
                            /*====================on beg in edit saat grid di klik maka tombol save disable===================*/
                            save_button_endedit('<?=$group_user->SavePrivillage;?>');
                            /*=================================end============================================================*/
                            var subtotal = 0;
                            var item =  $('#dtg_payment').datagrid('getRows');

                            $.each(item, function( index,value) {
                                subtotal += parseFloat(value.OIncomeAmount);
                            });

                            $('#total_amount').html(subtotal);
                            $('#txt_amount').numberbox('setValue',subtotal);
                        }
                    "
                >
					<thead>
                    <tr>
                        <th halign="center" align="left" valign="middle" data-options="field:'AccountName',width:400,align:'left'"  readonly='true'>Account Name</th>
                        <th halign="center" align="right" valign="middle" data-options="minValue:0,field:'OIncomeAmount',width:120,align:'center',editor:{type:'numberbox',options:{precision:2,decimalSeparator:',',required:true}}" formatter="formatRp">Amount (<span id="span_curr"><?php echo $row->CurrencyCode;?></span>)</th>
                        <th halign="center" align="left" valign="middle" data-options="field:'OIncomeMemo',width:400,align:'left',editor:'text'">Memo</th>
                        <th halign="center" align="left" valign="middle" data-options="field:'OIncomDetailID',width:150,align:'left',editor:'text'" hidden='true'>CPayDetailID</th>
                   	</tr>
					</thead>
				</table>
                
                <!-- Datagrid Toolbar -->
                <div id="tb_dtg_payment">
                    <!-- <a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="javascript:$('#dtg_payment').edatagrid('addRow')">New</a> -->
                    <a href="#" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="remove_row()">Delete</a>
                </div>
                <!-- End of Datagrid Toolbar -->
                <!-- End of Datagrid -->
                
            </form>
        </div>
        
        <div id="form-footer">
            	
		</div>
    </div>
    <div id="form-footer" data-options="region:'south',border:false">
    	<table width="100%" cellpadding="0" cellspacing="0">
            <tr>
                <td>&nbsp;</td>
                <td align="right">
                 <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-help" onclick="" plain="true">Help</a>
               
                <a href="javascript:void(0)" class="easyui-linkbutton form-button app-button" iconCls="icon-ok" onclick="app_dir()" id="btn_appmgrspv" <?= (($this->session->userdata("jobtitle_status") != 0 || !in_array($row->TransStatus, array(5,6))) || (date('Y-m-d') < date('Y-m-d', strtotime($row->OIncomeDate))))?'disabled':'' ?>>App. Dir</a>
                <a href="javascript:void(0)" class="easyui-linkbutton form-button app-button" iconCls="icon-ok" onclick="app_reverse()" <?= (($this->session->userdata("jobtitle_status") != 0 || !in_array($row->TransStatus, array(1,2,9))) || (date('Y-m-d') < date('Y-m-d', strtotime($row->OIncomeDate))))?'disabled':'' ?> style="<?= $cek_autority_reverse;?>" >Reverse</a>
                <a href="javascript:void(0)" class="easyui-linkbutton form-button save-button" iconCls="icon-save" id="" onclick="update_payment();" <?=(in_array($row->TransStatus,array(0,1,2,3)))?'disabled':''?><?php echo $cek_autority_save;?>>Save</a>
                
                <a href="javascript:void(0)" class="easyui-linkbutton form-button" iconCls="icon-print" onclick="parent.tab_edit('Other Income', '<?=$menu_link?>', 'icon-print', 'to_print_detail','<?php echo $row->OIncomeNumber;?>');" <?=(in_array($row->TransStatus,array(4,5,6,1,2,3,9)))?'':'disabled'?>>Preview & Print</a>
                <a href="javascript:void(0)" class="easyui-linkbutton form-button" iconCls="icon-cancel" onclick="<?=($this->session->userdata('jobtitle_status')==0)?'suspend(2)':'parent.tab_close(\'tt\')'?>" <?=(!in_array($row->TransStatus,array(0,5,6)))?'disabled':''?>><?=($this->session->userdata('jobtitle_status')==0)?'Cancel':'Close'?></a> 	     
                </td>
             </tr>
         </table>
		</div>
    <?php endforeach;?>
</div>

<!-- Dialog Payment Department -->
<div id="dialog-payment-department" class="easyui-dialog" style="width:450px;height:523px;top:27px;background-color:#F8F8F8;padding:0px" closed="true" data-options="modal:true, iconCls:'icon-save'" buttons="#dialog-buttons-department-payment">
    <form id="form_payment_department" method="post" novalidate>
        <table width="100%" align="left" border="0">
            <tr>
                <td width="120" align="left" valign="middle"><b>Department Code</b></td>
                <td width="10"><b>:</b></td>
                
                <td colspan="2">
                    <input type="text" style="width:288px;height:20px" name="txt_department_code" id="txt_department_code" class="easyui-validatebox" placeholder="< Department Code >" onkeyup="search_payment_department_popup();" />
                </td>
            </tr>

            <tr>
                <td width="120" align="left" valign="middle"><b>Department Name</b></td>
                <td><b>:</b></td>

                <td colspan="2">
                    <input type="text" style="width:288px;height:20px" name="txt_department_name" id="txt_department_name" class="easyui-validatebox" placeholder="< Department Name >" onkeyup="search_payment_department_popup();" />
                </td>
            </tr>
            
            <tr>
                <td colspan="3">
                    <table id="tt_choose_department_payment" class="easyui-datagrid" 
                        url="<?= base_url(); ?>list/payment/all_department/<?php echo $this->session->userdata('company');?>" 
                        singleSelect="true" fitColumns="true" 
                        style="width:428px;height:388px;"
                    >
                        <thead>
                            <tr>
                                <th halign="center" width="170" field="DepartmentCode" sortable="true">Department Code</th>
                                <th halign="center" width="375" field="DepartmentName" sortable="true">Name</th>
                            </tr>
                        </thead>
                    </table>
                </td>
            </tr>
        </table>
    </form>
</div>

<!-- Dialog Button -->
<div id="dialog-buttons-department-payment" style="border:none;">
    <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onClick="choose_department_payment();">OK</a>
    <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onClick="modal_close('dialog-payment-department');">Cancel</a>
</div>
<!-- End Tagor -->

<script type="text/javascript">

var arr_detail_id = [];

var SavePrivillage  = '<?=$group_user->SavePrivillage;?>';

$(document).ready(function(){

	<?php foreach($payment as $row): ?>
	$('#txt_payment_date').datebox('setValue', '<?php echo date("d-m-Y", strtotime($row->OIncomeDate));?>');
	$('#cmb_bank_account').val('<?=$row->BankPayment?>');
	var currency_code = '<?=$row->CurrencyCode?>';
	<?php endforeach; ?>
	
	if(currency_code == 'IDR'){
		$('#txt_rate').prop('readonly',true);
        $('#txt_rate').numberbox({required:false});
	}
	else{
		$('#txt_rate').prop('readonly',false);
        $('#txt_rate').numberbox({required:true});
	}
			
    $('#chk_suspend').click(function(){
		if($(this).is(':checked')){
			$('#copy_suspend').val('1');
		}
		else{
			$('#copy_suspend').val('');
		}
	});

    var bank_payment = '<?= $row->BankPayment ?>';
    
    get_bank_balance(bank_payment,currency_code);

    $('#fm_payment').click(function(){
        $('#dtg_payment').edatagrid('saveRow');
    });

});


function app_mgr(){
	
	$('#code_appmgrspv').val('5');
	custom_data('<?=$menu_link;?>/approval2','#fm_payment');
		
}
	
function app_dir(){
	var no_transaksi    = $('#txt_payment_no').val();

    checking_approval(no_transaksi,function(check){
        
        if(check.status == false){
            $('#code_appdir').val('5');
            approved_dir('<?=$menu_link;?>','#fm_payment');
        }else{
            $.messager.alert('Unseccessfull',check.message,'error',function(){
                location.reload();
            });
        }
    });
}

    
function count_amount(){
	var total_amount = 0;
	var selected	= $('#dtg_payment').datagrid('getSelected');
	var index		= $('#dtg_payment').datagrid('getRowIndex', selected);
	var editor 		= $('#dtg_payment').datagrid('getEditors', index);
	
	$('#dtg_payment').edatagrid('saveRow');		
	var rows 	= $('#dtg_payment').datagrid('getRows');
	for(var i=0; i<rows.length; i++){
		total_amount += parseFloat(rows[i].OIncomeAmount);
	}

	$('#total_amount').html(total_amount);
	$('#txt_amount').numberbox('setValue',total_amount);
}
    
function update_payment(){
	
	$('#dtg_payment').edatagrid('saveRow');
	var cek = $('#dtg_payment').datagrid('getRows');
	err  = 0;
	
    var txt_rate = $('#txt_rate').numberbox('getValue');
	var transaksi = "";
	
	$.each(cek, function( index, value ) {
		if(transaksi != value.AccountNumber){
			err++;
			transaksi = value.AccountNumber;
		}
	});
	
	var total_amount = 0;
	
	for(var i=0; i<cek.length; i++){
		if(isNaN(cek[i].OIncomeAmount)){ cek[i].CPayAmount = 0; }
		total_amount += parseFloat(cek[i].OIncomeAmount);
	}
	$('#total_amount').html(total_amount);
	
	if(err == 0) {
		$.messager.alert('Unseccessfull','Harap di pilih satu Transaksi.','error',function(){
			$('#dtg_payment').datagrid('reload');
		});
	}
	else if(total_amount != $('#txt_amount').numberbox('getValue')){
		$.messager.alert('Unseccessfull','Total Payment tidak sama dengan Amount.','error',function(){
			$('#dtg_payment').datagrid('reload');
		});
	}else if(txt_rate <= 0){
            $.messager.alert('Unseccessfull','Rate tidak boleh kurang dari sama dengan nol','warning');
        }
	else{

        var login_as        = "<?= $this->session->userdata('username');?>";
        var created_by      = "<?= $row->CreatedBy;?>";
        var depart_by       = "<?= $row->DepartmentCode;?>";
        var depart_ses      = "<?= $this->session->userdata('department');?>";
        var jobtitle_status = "<?= $this->session->userdata('jobtitle_status');?>";

        var no_transaksi    = $('#txt_payment_no').val();
        var status          = '<?= $row->TransStatus;?>';

        checking_update(no_transaksi,status,function(check){
        
            if(check.status == true){
                $('#dtg_payment').edatagrid('saveRow');
                var i=$('#dtg_payment').datagrid('getRows');
                var detail = JSON.stringify(i);
                $("#detail").val(detail);
                edit_data('<?=$menu_link?>','#fm_payment',created_by,login_as,depart_by,depart_ses,jobtitle_status);
                $('#id_tojournal').val($('#txt_payment_no').val());
            }else{
                $.messager.alert('Unseccessfull',check.message,'error',function(){
                    location.reload();
                });
            }

        });
		
	}
}
	
function show_journal(){
	var id_hidden	= $('#txt_payment_no').val();
	parent.tab_edit('Journal Other Income', '<?=$menu_link?>', 'icon-journal', 'to_preview_journal', id_hidden);
}

function open_department_payment() { 
   modal_open('Department','dialog-payment-department');
}

function choose_department_payment() {
    var selected_data = $('#tt_choose_department_payment').datagrid('getSelected');

    $('.Department_Account_Name').val(selected_data.DepartmentName);
    $('.Department_Account_Code').val(selected_data.DepartmentCode);

    modal_close('dialog-payment-department');
}
$.extend($.fn.datagrid.defaults.editors, {

    Department_Account_Name: {
        init: function(container, options){
            var input = $('<input type="text" class="Department_Account_Name" onClick="open_department_payment()" style="height:18px;" readonly/>').appendTo(container);
            return input.validatebox(options);
        },
        destroy: function(target){
            $(target).remove();
        },
        getValue: function(target){
            return $(target).val();
        },
        setValue: function(target, value){
            $(target).val(value);
        },
        resize: function(target, width){
            $(target)._outerWidth(width);
        }
    },
            
    Department_Account_Code: {
        init: function(container, options){
            var input = $('<input type="text" class="Department_Account_Code" onClick="open_payment_department()" style="height:18px;" readonly/>').appendTo(container);
            return input.validatebox(options);
        },
        destroy: function(target){
            $(target).remove();
        },
        getValue: function(target){
            return $(target).val();
        },
        setValue: function(target, value){
            $(target).val(value);
        },
        resize: function(target, width){
            $(target)._outerWidth(width);
        }
    }
});

function remove_row(){
    $('#dtg_payment').edatagrid('saveRow');     
    var selectedrow         = $('#dtg_payment').datagrid('getSelected');
    var row_index           = $('#dtg_payment').datagrid('getRowIndex', selectedrow);
    
    $.messager.confirm('Confirmation :', 'Anda yakin, Anda ingin menghapus item "' + selectedrow.AccountName + '"?',  
        function(r){
            if (r){

                arr_detail_id.push(selectedrow.OIncomDetailID);
                $('#detail_id').val(JSON.stringify(arr_detail_id));
                $('#dtg_payment').datagrid('deleteRow', row_index);
                 $('.app-button').linkbutton('disable');
                calculate_sub();
            }
        }
    );
}

function calculate_sub(){
    $('#dtg_payment').edatagrid('saveRow');

    var item        = $('#dtg_payment').datagrid('getRows');
    var sub_total   = 0;
    
    $.each(item, function(index, value) {
        if(value.OIncomeAmount != undefined){
            sub_total+= parseFloat(value.OIncomeAmount);
        }               
    });
    
    $('#total_amount').html(sub_total);
    $('#txt_amount').numberbox('setValue',sub_total);
}

function app_reverse(){
    var no_transaksi    = $('#txt_payment_no').val();

    checking_reverse(no_transaksi,function(check){
        if(check.status == true){
            reversed_data('F','<?=$menu_link?>', no_transaksi, 'Other Income');
        }else{
           $.messager.alert('Unseccessfull',check.message,'error',function(){
                location.reload();
            });
        }
    });
}

function suspend(type){
    var created_by      = '<?php echo $row->CreatedBy;?>';
    var login_as        = '<?php echo$this->session->userdata('username');?>';
    var job_title       = '<?php echo $this->session->userdata('jobtitle_status');?>';
    var url             = '<?= base_url();?>custom/custom/checking_suspend';
    
    suspend_check_trans('F', type, '<?=$menu_link?>', $('#txt_payment_no').val(), '<?=$menu_label;?>', url, created_by, login_as, job_title);
}

//**===== End Tagor ====

</script>