getId=(idName)=>{
    return document.getElementById(idName);
}
$(document).ready(function(){
    $("#advanceText").hide();
    $("#advanceValue").hide();
    $("#customerAdd").on("change",function(){
        let customer = $(this).val();
        $.ajax({
            type:'POST',
            url:'ajaxpath1/fetch_amount_details_debit.php',
            data:{customer:customer},
            success:function(data){
            var output = data.split("||");
            $("#totalAmount").val(output[0]);
            $("#pendingAmount").val(output[1]);
            $("#paymentMethod").trigger('change').val(null);
            $("#advanceText").hide();
            $("#advanceValue").hide();
            feildValidate();
                        }
           });  
    });
    $("#paymentMethod").on("change",function(){
        handlePaymentMethod();
        $("#advanceText").hide();
    $("#advanceValue").hide();
        let customer = $("#customerAdd").val();
        let paymentMethod = $("#paymentMethod").val();
        if(paymentMethod=="advance"||paymentMethod=="all"){
        $.ajax({
            type:'POST',
            url:'ajaxpath1/fetch_advance_amount.php',
            data:{customer:customer,payment:paymentMethod},
            success:function(data){
            $("#advanceText").show();
            $("#advanceValue").show();
            $("#advanceValue").html(data);
                        }
           });
        }  
    });
});