getId=(idName)=>{
    return document.getElementById(idName);
}
let paymentMethod = getId("paymentMethod");
let cashPay = getId("cashEntry");
let bankPay = getId("bankEntry");
let chequeNo = getId("chequeNo");
bankPay.readOnly=true;
cashPay.readOnly =true;
chequeNo.readOnly=true;
paymentMethod.addEventListener("change",function(e){
let pay = e.target.value;
if(pay == "cash")
{
bankPay.readOnly=true;
cashPay.readOnly =false;
chequeNo.readOnly=true;
bankPay.value = 0;
chequeNo.value = "-";
}
if(pay == "bank")
{
bankPay.readOnly=false;
cashPay.readOnly =true;
chequeNo.readOnly=false;
cashPay.value=0;
}
if(pay == "all")
{
bankPay.readOnly=false;
cashPay.readOnly =false;
chequeNo.readOnly=false;
}
});

$(document).ready(function(){
    $("#customerAdd").on("change",function(){
        let customer = $(this).val();
        $.ajax({
            type:'POST',
            url:'ajaxpath1/fetch_amount_details.php',
            data:{customer:customer},
            success:function(data){
            var output = data.split("||");
            $("#totalAmount").val(output[0]);
            $("#pendingAmount").val(output[1]);
                        }
           });  
    });
});