<script type="text/javascript"> 

$(document).ready(function () {
       $('#coupon_qty').keyup(function (e) { 
        var input = $(this);
        var qty = input.val();
        var amount = $("#coupon_price").text();
        $("#total_amount").val(qty * amount);
        //alert();

    });
   });
$('#ra').submit(function () {
    
    if($('#transfer_mode').val() != "Cash"){
        if($('#transaction_number').val() == ""){
            swal({title: "Error", text: "Transaction Number cannot be Empty", icon: "error", buttons: false, timer: 2000});
            $('#transaction_number').focus();
            return false;
        }
    }
if($('#request_user').val()  ==  0) {
     swal({title: "Error", text: "Please select user first", icon: "error", buttons: false, timer: 2000});
}else{
     $('#rmoney').hide();
    $('#processing').show();

    var values = $("#ra").serialize();
    $.ajax({
        url: "send_uti_psa_request.php",
        type: "post", 
        data: values,
        success: function (response) {  
            var result = jQuery.parseJSON(response);
            console.log(result);
             $('#rmoney').show();
            $('#processing').hide();
            if (result['error'] == 1) {
                swal({title: "Error", text: result['error_msg'], icon: "error", buttons: false, timer: 3000});                
            } else {
                swal({title: "Success", text: result['error_msg'], icon: "success",buttons: false, timer: 3000});                
            }
                window.location.href = 'uti_psa.php';
    },
        error: function (jqXHR, textStatus, errorThrown) {
            console.log(textStatus, errorThrown);
        }
    });

}
   
});

</script>