$("#error_explanation_move").html("")
<% if @cash_registers_move.errors.any? %>
	$('#error_explanation_move').removeClass('hidden');
    <% @cash_registers_move.errors.values.each do |message| %>
        $("#error_explanation_move").append($("<li />").html("<%= message.first.to_s %>"));
    <% end %>
<% else %>
	if($("#error_explanation_move").is(':visible')) {
		$("#error_explanation_move").addClass('hidden');
	}

	<% if @sale.present? && @sale.saletype == 'credit' %>
		window.location = "<%= debtors_path %>";
		var ticket_window = window.open("<%= print_credit_payment_receipt_path(:sale_id => @sale.id, :debts => @debt, format: 'pdf') %>", 'New tab', '' );
	<% else %>
		var newRow = $('<%= j render (@cash_registers_move) %>');
		$('#payments_table tbody').append(newRow);
		$('#cash_registers_move_quantity').val('');
		$('#cash_registers_move_payment_method_id').val('');
		$('#cash_registers_move_received').attr('disabled', false);
		if($("#card_info").is(":visible")) {
			$('#cash_registers_move_cardnumber').val('');
			$("#card_info").fadeOut();
		}
		unlockConfirmPayment();
	<% end %>
<% end %>
