$(document).ready(function () {
    $("body").on("blur", '.fmdate,.todate', datecheck);


    function datecheck() {
        var stdate = $('.zstdate').val();
        var endate = $('.zenddate').val();

        var fmdate = $('.fmdate').val();
        var todate = $('.todate').val();
//        var chqdate = $('.chqdate').val();

        if (fmdate >= stdate && fmdate <= endate) {
        } else {
            alert("Date Does Not Belong To Finacial Year");
            $(".fmdate").val("0000-00-00");
        }

        if (todate >= stdate && todate <= endate) {
        } else {    
            alert("Date Does Not Belong To Finacial Year");
            $(".todate").val("0000-00-00");
        }
        
    }


    $(".vouchdt").on("blur", function () {

        var date = $('.vouchdt').val();
        var stdate = $('.zstdate').val();
        var endate = $('.zenddate').val();

        if (date != '') {
            if (date >= stdate && date <= endate) {
            } else {
                alert("Date Does Not Belong To Finacial Year");
                $(".vouchdt").val("0000-00-00");
                $(".vouchdt").focus();
            }
        }

    });
});
