$(function () {

    $('.btn_anular').on('click', function() {
    	var id = $(this).data("id");
		$('#register_modal').modal({
			closable: false,
	    	onApprove : function() {
	    		sendForm(id);
		    }
  		}).modal('show'); 
  	});

	function sendForm(id) {

        var data = {'id_egreso': id};

        $.requestApi('/egreso/anular', data, 'POST', function (resolve) {
	        if (resolve) {
	            $.showMessages(resolve, true, APP_URL+'/egreso/listar/');
	        }
	    });
        
        return false;
	};

});
