$(document).ready(function () {

   $("body").on("change blur", '.vouchdt, .expense', getEntryList);

    getEntryList();

    function getEntryList() {
       var vouchdt = $(".vouchdt").val();

       $.post('ShowEntryHeadList.php', { vouchdt: vouchdt }, function (data) {
           $(".tbodyy").html(data);
       });
    }
   
    $("form").on("submit", function (e) {
        var amount = parseFloat($(".amount").val());
        var paidby = $(".paidby").val();

        if (paidby != 'R') {
            if (isNaN(amount) || amount === 0) {
                alert("Amount cannot be zero.");
                e.preventDefault(); // Stop form submission
                return false;
            }
        }
    });

});