<%@ Page Language="C#" AutoEventWireup="true" CodeFile="accountreport.aspx.cs" MasterPageFile="~/module/dashboardPage.master" Inherits="module_accountreport" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <script type="text/javascript">
        var fullname = ""; var total = 0; var total1 = 0;
        var adm = 0; var adm1 = 0;
        var totalamount = 0;
        var remainstotalamt = 0;
        var tutionfess = 0; var tutionfess2 = 0; var tutionfess3 = 0; var adm2 = 0;
        var cautinmon = 0; var scholer = "";
        var collegemag = 0; var chksdt = "";
        var identitys = 0; var totalamts = 0; var totalamts1 = 0;
        var insurance = 0;
        var university = 0;
        var eligible = 0;
        var busfees = 0;
        var examfess = 0;
        var enrollment = 0;
       var lockerfee = 0;
       var gamesfees = 0;
       var boardfees = 0;
       var extraactivity = 0;
       var developemntfee = 0; remainspaidadd = 0;
       var paystatus = "";
       var studentcode = "";
       var pakgid = "";
       var tutionfess1 = 0;
       var scholtution = 0;
       var totalremainsschol = 0;
       var scholdevelop = 0;
       var cautinmon1 = 0;
       var collegemag1 = 0;
       var identitys1 = 0;
       var insurance1 = 0;
       var university1 = 0;
       var eligible1 = 0;
       var busfees1 = 0;
       var examfess1 = 0;
       var enrollment1 = 0;
       var lockerfee1 = 0;
       var gamesfees1 = 0;
       var boardfees1 = 0;
       var extraactivity1 = 0;
       var paidamount = 0;
       var packageamount = 0;
       var developemntfee1 = 0; var developemntfee2 = 0;
       var totalfess = 0;
       var curryears = ""; var currclass = ""; var currdivs = "";
       var totalschol = 0;
       var toalpaids = 0;
       var clgfees = 0;
       var allbalnce = 0;
      var schstudentids = "";
     var  schclsids = "";
      var  schdivsids = "";
       var schadmyrs = "";
       var schfirinstall = 0;
       var schsecondinstall = 0;
       var remainsscholership = 0;
        $(document).ready(function () {
            $('select[id$=Select1] option:eq(1)').attr("selected", true);
            $(document).on('shown.bs.modal', function (e) {
                $('input:visible:enabled:first', e.target).focus();
            });
            $.ajax({
                type: "POST",
                contentType: "application/json; charset=utf-8",
                url: "accountreport.aspx/PopulateDropDownList4",
                data: "",
                dataType: "json",
                success: function (result) {
                    $('select[id$=ddlyears]').empty();
                    $('select[id$=ddlyears]').append("<option value='0'>Select Year</option>");
                    $.each(result.d, function (key, value) {
                        var ddyear1 = value.DeptName;
                        var ddyear2 = value.year1;
                        var dtyear1 = new Date(ddyear1);
                        var dtyear2 = new Date(ddyear2);
                        var stryr = dtyear1.getFullYear() + "-" + dtyear2.getFullYear();

                        $('select[id$=ddlyears]').append($("<option data-toggle='tooltip' data-placement='top' title='" + stryr + "'></option>").val(value.DeptId).html(stryr));
                        //console.log(value.DeptName);
                    });
                    $('select[id$=ddlyears]').val('0').change();
                    $('select[id$=ddlyears]').trigger("change");
                    //$('select[id$=cat] option:eq(0)').attr("selected", true);
                    //  $('select[id$=ddlclassty]').selectpicker('refresh');
                    //  hdndoc=$('select[id$=cat] option:eq(1)').val();
                },
                error: function ajaxError(result) {
                    console.log(result.status + ' : ' + result.statusText);
                }

            });
            $('select[id$=ddlyears]').change(function () {
                $.ajax({
                    type: "POST",
                    contentType: "application/json; charset=utf-8",
                    url: "accountreport.aspx/PopulateDropDownList5",
                    data: "",
                    dataType: "json",
                    success: function (result) {
                        $('select[id$=ddlsclass]').empty();
                        $('select[id$=ddlsclass]').append("<option value='0'>Select class</option>");
                        $.each(result.d, function (key, value) {
                            var dd = value.DeptName;


                            $('select[id$=ddlsclass]').append($("<option data-toggle='tooltip' data-placement='top' title='" + dd + "'></option>").val(value.DeptId).html(dd));
                            //console.log(value.DeptName);
                        });
                        $('select[id$=ddlsclass]').val('0').change();
                        //$('select[id$=cat] option:eq(0)').attr("selected", true);
                        //  $('select[id$=ddlclassty]').selectpicker('refresh');
                        //  hdndoc=$('select[id$=cat] option:eq(1)').val();
                    },
                    error: function ajaxError(result) {
                        console.log(result.status + ' : ' + result.statusText);
                    }

                });
            });
            $("#Radio1").click(function () {
                if ($("#Radio1").prop('checked') == true) {
                    $("#chkque1").hide();
                    $("#chkque2").hide();
                }
            });
            $("#Radio2").click(function () {
                if ($("#Radio2").prop('checked') == true) {
                    $("#chkque1").show();
                    $("#chkque2").show();
                }
            });
            $("#Radio3").click(function () {
                if ($("#Radio3").prop('checked') == true) {
                    $("#chkque1").show();
                    $("#chkque2").show();
                }
            });
            $("#cheques").click(function () {
                if ($("#cheques").prop('checked') == true) {
                    $("#Div1").show();
                    $("#Div2").show();
                }
            });
            $("#dds").click(function () {
                if ($("#dds").prop('checked') == true) {
                    $("#Div1").show();
                    $("#Div2").show();
                }
            });
            $("#cash1").click(function () {
                if ($("#cash1").prop('checked') == true) {
                    $("#Div1").hide();
                    $("#Div2").hide();
                }
            });
            $('select[id$=ddlsclass]').change(function () {
                $.ajax({
                    type: "POST",
                    contentType: "application/json; charset=utf-8",
                    url: "accountreport.aspx/PopulateDropDownList6",
                    data: "{clids :'" + $('select[id$=ddlsclass]').val() + "'}",
                    dataType: "json",
                    success: function (result) {
                        $('select[id$=ddldivision]').empty();
                        $('select[id$=ddldivision]').append("<option value='0'>Select Division</option>");
                        $.each(result.d, function (key, value) {
                            var dd = value.DeptName;


                            $('select[id$=ddldivision]').append($("<option data-toggle='tooltip' data-placement='top' title='" + dd + "'></option>").val(value.DeptId).html(dd));
                            //console.log(value.DeptName);
                        });
                        $('select[id$=ddldivision]').val('0').change();
                        //$('select[id$=cat] option:eq(0)').attr("selected", true);
                        //  $('select[id$=ddlclassty]').selectpicker('refresh');
                        //  hdndoc=$('select[id$=cat] option:eq(1)').val();
                    },
                    error: function ajaxError(result) {
                        console.log(result.status + ' : ' + result.statusText);
                    }

                });
            });
          
            //$('.tdClass').on('blur', 'td', function (event) {
             
            //});
        });
        var totalpaid = 0;
        var remainsamt = 0;
        var totalremainsamt = 0;
        function getdata12() {

            $.ajax({
                url: "accountreport.aspx/Getdata",
                method: "post",
                contentType: "application/json; charset=utf-8",
                data: "{acdyear :'" + $('select[id$=ddlyears]').val() + "',clasr:'" + $("select[id$=ddlsclass]").val() + "', division:'" + $("select[id$=ddldivision]").val() + "'}",
                dataType: "json",
                success: function (data) {
                   

                
                    //$("#dataemp").find("tbody").empty();
                   // $("#dataemp").find("tbody").empty();

                    table = $('#dataemp').DataTable();
                    table.destroy();
                    if (data.d != "") {
                        data = JSON.parse(data.d);
                    }
                    var table = $('#dataemp').DataTable({
                        //"aaSorting": [[0, "desc"]],
                        //"ordering": false,
                        "pageLength": 10,
                        "columns": [
                                 { "width": "5%" },
                                 { "width": "8%" },
                                 { "width": "10%" },
                                 { "width": "10%" },
                                 { "width": "10%" },
                                 { "width": "7%" },
                                 { "width": "6%" },
                                 { "width": "10%" },
                                 { "width": "7%" },
                                 { "width": "10%" },
                                 { "width": "10%" },
                                 { "width": "10%" },  { "width": "6%" },
                                  { "width": "6%" },
                        { "width": "6%" },
                         { "width": "6%" },  { "width": "6%" }
                        ]
                    });
                  
                    $('#dataemp').DataTable().clear().draw();
                    for (var i = 0; i < data.length ; i++) {
                        if (data[i].packgenme != null) {
                            totalpaid = parseFloat(data[i].totalpaidamt);
                            remainsamt = parseFloat(data[i].amount);
                            totalremainsamt = remainsamt - totalpaid;
                        }
                        if (totalpaid == "") {
                            totalremainsamt = 0;
                        }  
                        totalfess = parseFloat(data[i].totaltutionfee) + parseFloat(data[i].totaldevelopfee)
                        if(data[i].firstinstall != "" && data[i].firstinstall != null && data[i].secondinstall != "" && data[i].secondinstall != null){
                          //  totalfess = parseFloat(data[i].totaltutionfee) +  parseFloat(data[i].totaldevelopfee) + parseFloat(data[i].firstinstall) + parseFloat(data[i].secondinstall);
                            totalschol = parseFloat(data[i].firstinstall) + parseFloat(data[i].secondinstall);
                       } 
                       else if(data[i].firstinstall != "" && data[i].firstinstall != null){
                           //  totalfess = parseFloat(data[i].totaltutionfee) + parseFloat(data[i].totaldevelopfee) + parseFloat(data[i].firstinstall);
                           totalschol = parseFloat(data[i].firstinstall);
                       }
                     
                        else{
                            totalfess = parseFloat(data[i].totaltutionfee) + parseFloat(data[i].totaldevelopfee);
                            totalschol = 0;
                        } 
                        if(totalfess != 0 && totalschol == 0){
                            totalpaid = parseFloat(totalfess);
                        }else if(totalfess == 0 && totalschol != 0){
                            totalpaid = parseFloat(totalschol);
                        }
                        else if(totalfess != 0 && totalschol != 0){
                           
                            totalpaid = parseFloat(totalfess) + parseFloat(totalschol);
                        }
                        clgfees = parseFloat(64000);
                        if(totalschol > 0){
                            if(parseFloat(data[i].scholerhipamount) != 0){
                                allbalnce = 0;
                            }else{
                                allbalnce = parseFloat(clgfees) - parseFloat(totalpaid);
                            }
                        }else{
                            allbalnce = 0;
                        }
                      
                        fullname = data[i].title + "." + data[i].fname + " " + data[i].mname + " " + data[i].lname;
                        var markup = "<tr><td>" + data[i].studid + "</td><td>"+ data[i].admdate + "</td><td>" + fullname + "</td><td>" + data[i].packgenme + "</td><td>" + data[i].clsname + "</td><td>" + data[i].divsname + "</td><td>" + data[i].amount + "</td><td>" + data[i].totalpaidamt + "</td><td>" + totalremainsamt + "</td><td>" + data[i].scholerhipstudent + "</td><td>" + data[i].scholershipstatus + "</td><td><button  style='height:35px; width: 35px; padding-left:7px;' type='button' onclick=getdataacctstudent('" + data[i].pkgid + "',\"" + data[i].studid + "\"," + data[i].clsids + "," + data[i].divsid + "," + data[i].admyrs + ") id='btnedit' class='btn btn-success' data-bs-toggle='modal' data-bs-target='#exampleLargeModal5' ><i class='bx bx-message-square-edit'></i></button></td></tr>";

                      //  $("#dataemp").find("tbody").append(markup);
                       
                        table.row.add([
                            data[i].studid,data[i].admdate , fullname, data[i].packgenme, data[i].clsname, data[i].divsname, data[i].amount, data[i].totalpaidamt, totalremainsamt,totalfess, data[i].firstinstall, data[i].secondinstall,totalschol,totalpaid,clgfees,allbalnce,"<button  style='height:35px; width: 35px; padding-left:7px;' type='button' onclick=getdataacctstudent('" + data[i].pkgid + "',\"" + data[i].studid + "\"," + data[i].clsids + "," + data[i].divsid + "," + data[i].admyrs + ") id='btnedit' class='btn btn-success' data-bs-toggle='modal' title='Pay Now' data-bs-target='#exampleLargeModal5' ><i class='bx bx-message-square-edit'></i></button>&nbsp;<button  style='height:35px; width: 35px; padding-left:7px;' type='button' onclick='getstdetails(\"" + data[i].studid + "\"," + data[i].clsids + "," + data[i].divsid + "," + data[i].admyrs + ","+data[i].firstinstall+","+ data[i].secondinstall+","+allbalnce+")' id='btnedit' class='btn btn-success' data-bs-toggle='modal' title='Against Scholership' data-bs-target='#exampleLargeModal51' ><i class='bx bx-message-square-edit'></i></button>"
                        ]).draw(false);
                    }
                },
                error: function () {
                    //alert("Error in display");
                    noty({ text: 'Get Error', layout: 'topRight', type: 'error' });
                    setTimeout(function () { $.noty.closeAll(); }, 3000);
                }

            });
        } 
        function getstdetails(studentids, classids, divisionsids, admissionyrs,firinstall,secondinstall,allbal){
            let today2 = new Date().toISOString().substr(0, 10);
                     
            document.querySelector("#paydates").value = today2;
            schstudentids = studentids;
            schclsids = classids;
            schdivsids = divisionsids;
            schadmyrs = admissionyrs;
            schfirinstall = parseFloat(firinstall);
            schsecondinstall = parseFloat(secondinstall);
            remainsscholership =parseFloat( allbal);
            if(remainsscholership > 0){
                if(schfirinstall > 0 && schsecondinstall > 0){
                    $("#scholamount").val(remainsscholership);
                }else{
                    $("#scholamount").val(0);
                }
            }
            else{
                $("#scholamount").val(remainsscholership);
            }
        }
        var paystatus1 = "";
        function savescholership(){
            if($("#scholamount").val() != "0"){
                var obj3 = {};
                obj3.schstud = schstudentids;
                obj3.schadmyrs = schadmyrs;
                obj3.schclsids = schclsids
                obj3.schdivsid = schdivsids;
                if($("#cash1").prop("checked") == true){
                    paystatus1 = $("#cash1").val();
                }
                else  if($("#cheques").prop("checked") == true){
                    paystatus1 = $("#cheques").val();
                }
                else  if($("#dds").prop("checked") == true){
                    paystatus1 = $("#dds").val();
                }
                if(paystatus1 == ""){
                    noty({ text: 'Please select pay mode', layout: 'topRight', type: 'information' });
                    setTimeout(function () { $.noty.closeAll(); }, 3000);
                    return false;
                }
                //if($("#txtremarks").val() == ""){
                //    noty({ text: 'Please Enter Remark', layout: 'topRight', type: 'information' });
                //    setTimeout(function () { $.noty.closeAll(); }, 3000);
                //    return false;
                //}
                obj3.schpaymode = paystatus1;
                obj3.cheques1 = $("#chequesnos").val();
                obj3.banknms = $("#banknames").val();
                obj3.schpaydt = $("#paydates").val();
                obj3.schremarks =  $("#txtremarks").val();
                obj3.schremainsamt = $("#scholamount").val();
                    
                $.ajax({
                    type: "POST",
                    contentType: "application/json; charset=utf-8",
                    url: "accountreport.aspx/saveremainsscholerhip",
                    data: JSON.stringify(obj3),
                    dataType: "json",
                    success: function (data) {
                        noty({ text: 'Remaining paid Fees Collected', layout: 'topRight', type: 'error' });
                        setTimeout(function () { $.noty.closeAll(); }, 3000);
                    },
                    error: function ajaxError(result) {
                        console.log(result.status + ' : ' + result.statusText);
                    }

                });
            }
            else{
                noty({ text: 'Balance amount should not be zero', layout: 'topRight', type: 'error' });
                setTimeout(function () { $.noty.closeAll(); }, 3000);
            }
        }
        function getdataacctstudent(pckids, studentids, classids, divisionsids, admissionyrs) {
            let today2 = new Date().toISOString().substr(0, 10);
                     
            document.querySelector("#dp-5").value = today2;
            Clear();
            studentcode = studentids;
            pakgid = pckids; 
            curryears = admissionyrs; 
            currclass = classids;
            currdivs = divisionsids;
            var obj = {};
            obj.pkgids = pckids; 
            obj.stids = studentids;
            obj.years = admissionyrs; 
            obj.classs = classids;
            obj.divisions = divisionsids;
            $.ajax({
                url: "accountreport.aspx/GetDatafeedetails",
                method: "post",
                contentType: "application/json; charset=utf-8",
                data: JSON.stringify(obj),
                dataType: "json",
                success: function (data) {
                    if(data.d != "")
                    {
                        data = JSON.parse(data.d);
                        console.log(data);
                      
                        $("#Tbody2").empty();

                       // for (var i = 0; i < data.length ; i++) {
                      
                        
                        var markup = "<tr><td>Addmisson Fee</td><td>" + data[0].admissionfee + "</td><td class='tdClass'><input id='txtadm' onkeydown='dotest(this);' onblur=''  /><label id='lbladm'></label></td></tr><tr><td>Tution Fees</td><td>" + data[0].tuitionfee + "</td><td><input id='txttution' class='tdClass1' onkeydown='dotest1(this);' onblur='myfunction(this," + data[0].tuitionfee + ")' /><label id='lbltution'></label></td></tr><tr><td>Caution Money</td><td>" + data[0].cautionmny + "</td><td><input id='txtcaution' class='tdClass2' onkeydown='dotest2(this);' onblur='myfunction2(this,"+ data[0].cautionmny +")' /><label id='lblcaution'></label></td></tr><tr><td>College Magzine Fees</td><td>" + data[0].collegefee + "</td><td><input id='txtcollege' class='tdClass3' onkeydown='dotest3(this);' onblur='myfunction3(this," + data[0].collegefee + ")' /><label id='lblcolleges'></label></td></tr><tr><td>Indentity Card Fees</td><td>" + data[0].identycrdfee + "</td><td><input id='txtidscard' class='tdClass4' onkeydown='dotest4(this);' onblur='myfunction4(this," + data[0].identycrdfee + ")' /><label id='lblidentity'></label></td></tr><tr><td>Insurance</td><td>" + data[0].insurance + "</td><td><input id='txtinsu' class='tdClass5' onkeydown='dotest5(this);' onblur='myfunction5(this," + data[0].insurance + ")'  /><label id='lblinsurance'></label></td></tr><tr><td>University Fees</td><td>" + data[0].unifees + "</td><td><input id='txtuniverse' class='tdClass6' onkeydown='dotest6(this);' onblur='myfunction6(this," + data[0].unifees + ")'   /><label id='lbluniversity'></label></td></tr><tr><td>Eligibility Fees</td><td>" + data[0].eligibilityfee + "</td><td><input id='txtelgible' class='tdClass7' onkeydown='dotest7(this);' onblur='myfunction7(this," + data[0].eligibilityfee + ")'   /><label id='lbleligible'></label></td></tr><tr><td>Bus Fees</td><td>" + data[0].busfee + "</td><td><input id='txtbus' class='tdClass8' onkeydown='dotest8(this);' onblur='myfunction8(this," + data[0].busfee + ")'  /><label id='lblbusefees'></label></td></tr><tr><td>Examination Fees</td><td>" + data[0].exminfee + "</td><td><input id='txtexam' class='tdClass9' onkeydown='dotest9(this);' onblur='myfunction9(this," + data[0].exminfee + ")'  /><label id='lblexamfees'></label></td></tr><tr><td>Enrollment Fees</td><td>" + data[0].enrollfee + "</td><td><input id='txtenroll' class='tdClass10' onkeydown='dotest10(this);' onblur='myfunction10(this," + data[0].enrollfee + ")' /><label id='lblenrollfee'></label></td></tr><tr><td>Locker Fees</td><td>" + data[0].lockerfee + "</td><td><input id='txtlocker' class='tdClass11' onkeydown='dotest11(this);' onblur='myfunction11(this," + data[0].lockerfee + ")' /><label id='lbllockerfee'></label></td></tr><tr><td>Games&sports Fees</td><td>" + data[0].gmespofee + "</td><td><input id='txtgames' class='tdClass12' onkeydown='dotest12(this);' onblur='myfunction12(this," + data[0].gmespofee + ")' /><label id='lblgamesfee'></label></td></tr><tr><td>Board Fees</td><td>" + data[0].boardfee + "</td><td><input id='txtboard'  class='tdClass13' onkeydown='dotest13(this);' onblur='myfunction13(this," + data[0].boardfee + ")'/><label id='lblboardfee'></label></td></tr><tr><td>Extracurricular Activity Fees</td><td>" + data[0].exactivityfee + "</td><td><input id='txtextra' class='tdClass14'  onkeydown='dotest14(this);' onblur='myfunction14(this," + data[0].boardfee + ")' /><label id='lblboardfee'></label></td></tr></tr> <td>Development fees</td><td>" + data[0].developfee + "</td><td><input id='txtdevelop' class='tdClass15'  onkeydown='dotest15(this);' onblur='myfunction15(this," + data[0].developfee + ")' /><label id='lbldevelopfee'></label></td></tr>";
                        paidamount =parseFloat( data[0].totalpaidamt);
                     
                        packageamount = parseFloat(data[0].amount);
                
                            if (data[0].scholbaltutions == null) {
                          
                                scholer = "0";
                            } else {
                           
                                scholer = data[0].scholbaltutions;
                            }
                            $("#Tbody2").append(markup);
                            if(paidamount < packageamount)
                            {
                               
                                totalremainsschol = packageamount - paidamount;
                                totalamts1 = packageamount - paidamount;
                            }
                         else  if (scholer != "0") {
                       
                                tutionfess1 = parseFloat(data[0].scholbaltutions);
                                scholtution = parseFloat(data[0].baltution);
                                totalremainsschol = scholtution - tutionfess1;
                           
                                if (data[0].balatotalamts == data[0].amount) {
                                    totalamts = parseFloat(data[0].balatotalamts);
                                    totalamts1 = totalamts - tutionfess1;
                                }
                                else {
                                    totalamts1 = data[0].balatotalamts;
                                }
                                if (data[0].scholbaldevelop != "0") {
                                    if (data[0].baldevelope != "0") {
                                        developemntfee1 = parseFloat(data[0].baldevelope);
                                        scholdevelop = parseFloat(data[0].scholbaldevelop) + developemntfee1;
                                        totalremainsschol = totalremainsschol - parseFloat(data[0].scholbaldevelop);
                                        if (data[0].balatotalamts == data[0].amount) {
                                            totalamts1 = totalamts1 - parseFloat(data[0].scholbaldevelop);
                                        }
                                        else {
                                            totalamts1 = data[0].balatotalamts;
                                        }
                                    
                                    } else {
                                        scholdevelop = parseFloat(data[0].scholbaldevelop);
                                        totalremainsschol = totalremainsschol - scholdevelop;
                                        if (data[0].balatotalamts == data[0].amount) {
                                            totalamts1 = totalamts1 - parseFloat(data[0].scholbaldevelop);
                                        }
                                        else {
                                            totalamts1 = data[0].balatotalamts;
                                        }
                                    }

                                }
                            } 
                           
                            else {
                         
                                totalremainsschol = data[0].baltution; totalamts1 = data[0].balatotalamts;
                            }
                            
                            $("#txtadm").val(data[0].balanceadm); $("#txttution").val(data[0].baltution); $("#txtcaution").val(data[0].balcaution); $("#txtcollege").val(data[0].balcollege); $("#txtidscard").val(data[0].balstudids); $("#txtinsu").val(data[0].balinsuranes); $("#txtuniverse").val(data[0].baluniversity); $("#txtelgible").val(data[0].baleligibles); $("#txtbus").val(data[0].balbusfess); $("#txtexam").val(data[0].balexamfee); $("#txtenroll").val(data[0].balenrollfee); $("#txtlocker").val(data[0].ballockerfee); $("#txtgames").val(data[0].balgamesfee); $("#txtboard").val(data[0].balnboard); $("#txtextra").val(data[0].balextra); $("#txtdevelop").val(data[0].baldevelope);
                     
                       // }
                   
                    adm1 = data[0].balanceadm;
                    tutionfess2 = totalremainsschol;
                   
                    cautinmon1 = data[0].balcaution;
                    collegemag1 = data[0].balcollege;
                    identitys1 = data[0].balstudids;
                    insurance1 = data[0].balinsuranes;
                    university1 = data[0].baluniversity;
                    eligible1 = data[0].baleligibles;
                    busfees1 = data[0].balbusfess;
                    examfess1 = data[0].balexamfee;
                    enrollment1 = data[0].balenrollfee;
                    lockerfee1 = data[0].ballockerfee;
                    gamesfees1 = data[0].balgamesfee;
                    boardfees1 = data[0].balnboard;
                    extraactivity1 = data[0].balextra;
                    developemntfee2 = data[0].baldevelope;
                    $("#txtamt").val(totalamts1);
                    $("#Table2").find("tbody").empty();
                    getdetails(studentcode,curryears,currclass,currdivs,pckids);
                    }
                },
                error: function () {
                    //alert("Error in display");
                    noty({ text: 'Get Error', layout: 'topRight', type: 'error' });
                    setTimeout(function () { $.noty.closeAll(); }, 3000);
                }

            });
        }
        function savedata() {
            adm = parseFloat($("#txtadm").val());
            if (adm > adm1 ||  adm < 0) {
                noty({ text: 'Please Enter Amount Should be less Admission Fee', layout: 'topRight', type: 'error' });
                setTimeout(function () { $.noty.closeAll(); }, 3000);
                return false;
            }
            tutionfess = parseFloat($("#txttution").val());
            if (tutionfess > tutionfess2 || tutionfess < 0) {
                noty({ text: 'Please Enter Amount Should be less Tution Fee', layout: 'topRight', type: 'error' });
                setTimeout(function () { $.noty.closeAll(); }, 3000);
                return false;
            }
            collegemag = parseFloat($("#txtcollege").val());
            if (collegemag > collegemag1 || collegemag < 0) {
                noty({ text: 'Please Enter Amount Should be less College Fee', layout: 'topRight', type: 'error' });
                setTimeout(function () { $.noty.closeAll(); }, 3000);
                return false;
            }
            cautinmon = parseFloat($("#txtcaution").val());
            if (cautinmon > cautinmon1 || cautinmon < 0) {
                noty({ text: 'Please Enter Amount Should be less Caution Money', layout: 'topRight', type: 'error' });
                setTimeout(function () { $.noty.closeAll(); }, 3000);
                return false;
            }
            identitys = parseFloat($("#txtidscard").val());
            if (identitys > identitys1 ||  identitys < 0) {
                noty({ text: 'Please Enter Amount Should be less Identity Card Fee', layout: 'topRight', type: 'error' });
                setTimeout(function () { $.noty.closeAll(); }, 3000);
                return false;
            }
            insurance = parseFloat($("#txtinsu").val());
            if (insurance > insurance1 || insurance < 0) {
                noty({ text: 'Please Enter Amount Should be less Insurance Fee', layout: 'topRight', type: 'error' });
                setTimeout(function () { $.noty.closeAll(); }, 3000);
                return false;
            }
            university = parseFloat($("#txtuniverse").val());
            if (university > university1 || university < 0) {
                noty({ text: 'Please Enter Amount Should be less University Fee', layout: 'topRight', type: 'error' });
                setTimeout(function () { $.noty.closeAll(); }, 3000);
                return false;
            }
            eligible = parseFloat($("#txtelgible").val());
            if (eligible > eligible1 || eligible < 0) {
                noty({ text: 'Please Enter Amount Should be less Eligibility Fee', layout: 'topRight', type: 'error' });
                setTimeout(function () { $.noty.closeAll(); }, 3000);
                return false;
            }
            busfees = parseFloat($("#txtbus").val());
            if (busfees > busfees1 || busfees < 0) {
                noty({ text: 'Please Enter Amount Should be less Bus Fee', layout: 'topRight', type: 'error' });
                setTimeout(function () { $.noty.closeAll(); }, 3000);
                return false;
            }
            examfess = parseFloat($("#txtexam").val());
            if (busfees > busfees1 || busfees < 0) {
                noty({ text: 'Please Enter Amount Should be less Bus Fee', layout: 'topRight', type: 'error' });
                setTimeout(function () { $.noty.closeAll(); }, 3000);
                return false;
            }
            enrollment = parseFloat($("#txtenroll").val());
            if (enrollment > enrollment1 || enrollment < 0) {
                noty({ text: 'Please Enter Amount Should be less Enrollment Fee', layout: 'topRight', type: 'error' });
                setTimeout(function () { $.noty.closeAll(); }, 3000);
                return false;
            }
            lockerfee = parseFloat($("#txtlocker").val());
            if (lockerfee > lockerfee1 || lockerfee < 0) {
                noty({ text: 'Please Enter Amount Should be less Locker Fee', layout: 'topRight', type: 'error' });
                setTimeout(function () { $.noty.closeAll(); }, 3000);
                return false;
            }
            gamesfees = parseFloat($("#txtgames").val());
            if (gamesfees > gamesfees1 || gamesfees < 0) {
                noty({ text: 'Please Enter Amount Should be less Games & sports Fee', layout: 'topRight', type: 'error' });
                setTimeout(function () { $.noty.closeAll(); }, 3000);
                return false;
            }
            boardfees = parseFloat($("#txtboard").val());
            if (boardfees > boardfees1 || boardfees < 0) {
                noty({ text: 'Please Enter Amount Should be less Board Fee', layout: 'topRight', type: 'error' });
                setTimeout(function () { $.noty.closeAll(); }, 3000);
                return false;
            }
            extraactivity = parseFloat($("#txtextra").val());
            if (extraactivity > extraactivity1 || extraactivity < 0) {
                noty({ text: 'Please Enter Amount Should be less ExtraActivity Fee', layout: 'topRight', type: 'error' });
                setTimeout(function () { $.noty.closeAll(); }, 3000);
                return false;
            }
            developemntfee = parseFloat($("#txtdevelop").val());
            if (developemntfee > developemntfee2 || developemntfee < 0) {
                noty({ text: 'Please Enter Amount Should be less Development Fee', layout: 'topRight', type: 'error' });
                setTimeout(function () { $.noty.closeAll(); }, 3000);
                return false;
            }
         total1 =   adm + tutionfess + cautinmon + collegemag + identitys + insurance + university + eligible + busfees + examfess + enrollment + lockerfee + gamesfees + boardfees + extraactivity + developemntfee;

       
       //  $("#txtpaid").val(total);
         totalamount = parseFloat($("#txtamt").val());
         remainstotalamt = totalamount - total1;
         var obj = {};
       
        obj.adm = parseFloat($("#txtadm").val());
        obj.tutionfess = parseFloat($("#txttution").val());
        obj.collegemag = parseFloat($("#txtcollege").val());
        obj.cautinmon = parseFloat($("#txtcaution").val());
        obj.identitys = parseFloat($("#txtidscard").val());
        obj.insurance = parseFloat($("#txtinsu").val());
        obj.university = parseFloat($("#txtuniverse").val());
        obj.eligible = parseFloat($("#txtelgible").val());
        obj.busfees = parseFloat($("#txtbus").val());
        obj.examfess = parseFloat($("#txtexam").val());
        obj.enrollment = parseFloat($("#txtenroll").val());
        obj.lockerfee = parseFloat($("#txtlocker").val());
        obj.gamesfees = parseFloat($("#txtgames").val());
        obj.boardfees = parseFloat($("#txtboard").val());
        obj.extraactivity = parseFloat($("#txtextra").val());
        obj.developemntfee = parseFloat($("#txtdevelop").val());
        obj.paidamt = $("#txtpaid").val(); 
        obj.totalpkgamt = $("#txtamt").val();
        obj.balamt = remainstotalamt;
        obj.payemntdt = $("#dp-5").val();
        if($("#Radio1").prop("checked") == true){
            paystatus = $("#Radio1").val();
        }
        else  if($("#Radio2").prop("checked") == true){
            paystatus = $("#Radio2").val();
        }
        else  if($("#Radio3").prop("checked") == true){
            paystatus = $("#Radio3").val();
        }
        obj.paymode = paystatus;
        obj.chkdd = $("#txtchkddnos").val();
        obj.bankname = $("#txtbanknm").val();
        obj.taxes = $("#txttax").val();
        obj.remarks = $("#txtremark").val();
        obj.studids = studentcode;
        obj.cyears = curryears;
        obj.cclasses = currclass;
        obj.cdivs = currdivs;
        obj.packid = pakgid;
        $.ajax({
            type: "POST",
            url: "accountreport.aspx/SavaData",
            data: JSON.stringify(obj),
            contentType: "application/JSON; charset=utf-8",
            datatype: "JSON",
            success: function (response) {
                //window.location.reload();
                if (response.d == "insert") {
                    noty({ text: 'Insert Successfully', layout: 'topRight', type: 'information' });
                    setTimeout(function () { $.noty.closeAll(); }, 3000);
                }
                $("#Table2").find("tbody").empty();
               // $("#Table2 TBODY tr:gt(0)").remove();
                getdetails(studentcode,curryears,currclass,currdivs,pakgid);
                getdata12();
                getremainingdata(studentcode, pakgid,curryears,currclass,currdivs);
                Clear();
              
            },
            error: function (error) {
                console.log(JSON.stringify(error));
                //alert("Error in insert");
                noty({ text: 'Error in insert', layout: 'topRight', type: 'information' });
                setTimeout(function () { $.noty.closeAll(); }, 3000);

            }

        });
        }
        function Clear() {
           adm = 0;
          totalamount = 0;
            remainstotalamt = 0;
            tutionfess = 0;
            cautinmon = 0;
             collegemag = 0;
             identitys = 0;
             insurance = 0;
            university = 0;
             eligible = 0;
            busfees = 0;
             examfess = 0;
             enrollment = 0;
             lockerfee = 0;
            gamesfees = 0;
             boardfees = 0;
             extraactivity = 0;
             developemntfee = 0; remainspaidadd = 0;
             $("#txtpaid").val("0");
             $("#txtadm").val("0"); $("#txttution").val("0"); $("#txtcaution").val("0"); $("#txtcollege").val("0"); $("#txtidscard").val("0"); $("#txtinsu").val("0"); $("#txtuniverse").val("0"); $("#txtelgible").val("0"); $("#txtbus").val("0"); $("#txtexam").val("0"); $("#txtenroll").val("0"); $("#txtlocker").val("0"); $("#txtgames").val("0"); $("#txtboard").val("0"); $("#txtextra").val("0"); $("#txtdevelop").val("0");
             $("#txttax").val("");$("#txtremark").val("");
             let today2 = new Date().toISOString().substr(0, 10);
                     
             document.querySelector("#dp-5").value = today2;
        }
        function getremainingdata(studids,pkgsid,scurryears,scurrclass,scurrdivs) {
                var obj1 = {};
                obj1.pkgids = pkgsid;
                obj1.stids = studentids;
                obj1.years = scurryears; 
                obj1.classs = scurrclass;
                obj1.divisions = scurrdivs;
                $.ajax({
                url: "accountreport.aspx/GetDatafeedetails",
                method: "post",
                contentType: "application/json; charset=utf-8",
                data: JSON.stringify(obj1),
                dataType: "json",
                success: function (data) {
                    console.log(JSON.stringify(data));
                    data = JSON.parse(data.d);
                   
                   
                    $("#Tbody2").empty();

                    for (var i = 0; i < data.length ; i++) {
                      
                        
                        var markup = "<tr><td>Addmisson Fee</td><td>" + data[0].admissionfee + "</td><td class='tdClass' ><input id='txtadm' onkeydown='dotest(this);' onblur='myfunction1(this," + data[0].admissionfee + ")'  /><label id='lbladm'></label></td></tr><tr><td>Tution Fees</td><td>" + data[0].tuitionfee + "</td><td><input id='txttution' class='tdClass1' onkeydown='dotest1(this);' onblur='myfunction(this," + data[0].tuitionfee + ")' /><label id='lbltution'></label></td></tr><tr><td>Caution Money</td><td>" + data[0].cautionmny + "</td><td><input id='txtcaution' class='tdClass2' onkeydown='dotest2(this);' onblur='myfunction2(this," + data[0].cautionmny + ")' /><label id='lblcaution'></label></td></tr><tr><td>College Magzine Fees</td><td>" + data[0].collegefee + "</td><td><input id='txtcollege' class='tdClass3' onkeydown='dotest3(this);' onblur='myfunction3(this," + data[0].collegefee + ")' /><label id='lblcolleges'></label></td></tr><tr><td>Indentity Card Fees</td><td>" + data[0].identycrdfee + "</td><td><input id='txtidscard' class='tdClass4' onkeydown='dotest4(this);' onblur='myfunction4(this," + data[0].identycrdfee + ")' /><label id='lblidentity'></label></td></tr><tr><td>Insurance</td><td>" + data[0].insurance + "</td><td><input id='txtinsu' class='tdClass5' onkeydown='dotest5(this);' onblur='myfunction5(this," + data[0].insurance + ")'  /><label id='lblinsurance'></label></td></tr><tr><td>University Fees</td><td>" + data[0].unifees + "</td><td><input id='txtuniverse' class='tdClass6' onkeydown='dotest6(this);' onblur='myfunction6(this," + data[0].unifees + ")'   /><label id='lbluniversity'></label></td></tr><tr><td>Eligibility Fees</td><td>" + data[0].eligibilityfee + "</td><td><input id='txtelgible' class='tdClass7' onkeydown='dotest7(this);' onblur='myfunction7(this," + data[0].eligibilityfee + ")'   /><label id='lbleligible'></label></td></tr><tr><td>Bus Fees</td><td>" + data[0].busfee + "</td><td><input id='txtbus' class='tdClass8' onkeydown='dotest8(this);' onblur='myfunction8(this," + data[0].busfee + ")'  /><label id='lblbusefees'></label></td></tr><tr><td>Examination Fees</td><td>" + data[0].exminfee + "</td><td><input id='txtexam' class='tdClass9' onkeydown='dotest9(this);' onblur='myfunction9(this," + data[0].exminfee + ")'  /><label id='lblexamfees'></label></td></tr><tr><td>Enrollment Fees</td><td>" + data[0].enrollfee + "</td><td><input id='txtenroll' class='tdClass10' onkeydown='dotest10(this);' onblur='myfunction10(this," + data[0].enrollfee + ")' /><label id='lblenrollfee'></label></td></tr><tr><td>Locker Fees</td><td>" + data[0].lockerfee + "</td><td><input id='txtlocker' class='tdClass11' onkeydown='dotest11(this);' onblur='myfunction11(this," + data[0].lockerfee + ")' /><label id='lbllockerfee'></label></td></tr><tr><td>Games&sports Fees</td><td>" + data[0].gmespofee + "</td><td><input id='txtgames' class='tdClass12' onkeydown='dotest12(this);' onblur='myfunction12(this," + data[0].gmespofee + ")' /><label id='lblgamesfee'></label></td></tr><tr><td>Board Fees</td><td>" + data[0].boardfee + "</td><td><input id='txtboard'  class='tdClass13' onkeydown='dotest13(this);' onblur='myfunction13(this," + data[0].boardfee + ")'/><label id='lblboardfee'></label></td></tr><tr><td>Extracurricular Activity Fees</td><td>" + data[0].exactivityfee + "</td><td><input id='txtextra' class='tdClass14'  onkeydown='dotest14(this);' onblur='myfunction14(this," + data[0].boardfee + ")' /><label id='lblboardfee'></label></td></tr></tr> <td>Development fees</td><td>" + data[0].developfee + "</td><td><input id='txtdevelop' class='tdClass15'  onkeydown='dotest15(this);' onblur='myfunction15(this," + data[0].developfee + ")' /><label id='lbldevelopfee'></label></td></tr>";
                     
                        if (data[0].scholbaltutions == null) {
                          
                            scholer = "0";
                        } else {
                           
                            scholer = data[0].scholbaltutions;
                        }
                        $("#Tbody2").append(markup);
                        if (scholer != "0") {
                       
                            tutionfess1 = parseFloat(data[0].scholbaltutions);
                            scholtution = parseFloat(data[0].baltution);
                            totalremainsschol = scholtution - tutionfess1;
                            if (data[0].balatotalamts == data[0].amount) {
                                totalamts = parseFloat(data[0].balatotalamts);
                                totalamts1 = totalamts - tutionfess1;
                            }
                            else {
                                totalamts1 = data[0].balatotalamts;
                            }
                            if (data[0].scholbaldevelop != "0") {
                                if (data[0].baldevelope != "0") {
                                    developemntfee1 = parseFloat(data[0].baldevelope);
                                    scholdevelop = parseFloat(data[0].scholbaldevelop) + developemntfee1;
                                    totalremainsschol = totalremainsschol - parseFloat(data[0].scholbaldevelop);
                                    if (data[0].balatotalamts == data[0].amount) {
                                        totalamts1 = totalamts1 - parseFloat(data[0].scholbaldevelop);
                                    }
                                    else {
                                        totalamts1 = data[0].balatotalamts;
                                    }
                                    
                                } else {
                                    scholdevelop = parseFloat(data[0].scholbaldevelop);
                                    totalremainsschol = totalremainsschol - scholdevelop;
                                    if (data[0].balatotalamts == data[0].amount) {
                                        totalamts1 = totalamts1 - parseFloat(data[0].scholbaldevelop);
                                    }
                                    else {
                                        totalamts1 = data[0].balatotalamts;
                                    }
                                }

                            }
                        }
                        else {
                         
                            totalremainsschol = data[0].baltution; totalamts1 = data[0].balatotalamts;
                        }
                    
                        $("#txtadm").val(data[0].balanceadm); $("#txttution").val(totalremainsschol); $("#txtcaution").val(data[0].balcaution); $("#txtcollege").val(data[0].balcollege); $("#txtidscard").val(data[0].balstudids); $("#txtinsu").val(data[0].balinsuranes); $("#txtuniverse").val(data[0].baluniversity); $("#txtelgible").val(data[0].baleligibles); $("#txtbus").val(data[0].balbusfess); $("#txtexam").val(data[0].balexamfee); $("#txtenroll").val(data[0].balenrollfee); $("#txtlocker").val(data[0].ballockerfee); $("#txtgames").val(data[0].balgamesfee); $("#txtboard").val(data[0].balnboard); $("#txtextra").val(data[0].balextra); $("#txtdevelop").val(data[0].baldevelope);
                     
                    }
                    adm1 = data[0].balanceadm;
                    tutionfess2 = totalremainsschol;
                   
                    cautinmon1 = data[0].balcaution;
                    collegemag1 = data[0].balcollege;
                    identitys1 = data[0].balstudids;
                    insurance1 = data[0].balinsuranes;
                    university1 = data[0].baluniversity;
                    eligible1 = data[0].baleligibles;
                    busfees1 = data[0].balbusfess;
                    examfess1 = data[0].balexamfee;
                    enrollment1 = data[0].balenrollfee;
                    lockerfee1 = data[0].ballockerfee;
                    gamesfees1 = data[0].balgamesfee;
                    boardfees1 = data[0].balnboard;
                    extraactivity1 = data[0].balextra;
                    developemntfee2 = data[0].baldevelope;
                    $("#txtamt").val(totalamts1);
                    $("#Table2").find("tbody").empty();
                    getdetails(studentcode,scurryears,scurrclass,scurrdivs,pkgsid);
                },
                error: function () {
                    //alert("Error in display");
                    noty({ text: 'Get Error', layout: 'topRight', type: 'error' });
                    setTimeout(function () { $.noty.closeAll(); }, 3000);
                }

            });
        }
        var markup1 = "";
        function getdetails(stids,scurryears,scurrclass,scurrdivs,packageid) {
            $.ajax({
                url: "accountreport.aspx/Getdata12",
                method: "post",
                contentType: "application/json; charset=utf-8",
                data: "{studids:'" + stids + "',curryear :'"+ scurryears +"',sclass :'"+ scurrclass +"',scurrdivision :'"+ scurrdivs +"',pkgssid :'"+ packageid +"'}",
                dataType: "json",
                success: function (data) {
                    $("#Table2").find("tbody").empty();
                    if(data.d != "")
                    {
                        console.log(JSON.stringify(data));
                        data = JSON.parse(data.d);
                 
                   
                       
                 
                        for (var i = 0; i < data.length ; i++) {
                            {
                                if (data[i].chequenos != null) {
                                    $("#chk1").show(); 
                                    $("#chk2").show(); 
                                    $("#chk3").show(); 
                                } else {
                                    $("#chk1").hide(); 
                                    $("#chk2").hide(); 
                                    $("#chk3").hide(); 
                                }
                                if (data[i].chqdt != null) {
                                    chksdt = data[i].chqdt;
                                }
                                markup1 = '<tr ><td >' + data[i].receiptnos + '</td><td >' + data[i].paidamt + '</td><td >' + data[i].recptdate + '</td><td>' + data[i].paymode + '</td><td  id="chks1' + i + '"> ' + data[i].chequenos + '</td><td id="chks2' + i + '"> ' + chksdt + '</td><td id="chks3' + i + '"> ' + data[i].bankname + '</td><td><button  style="height:35px; width: 35px; padding-left:7px;" type="button" onclick="deletedata(' + data[i].id + ')" id="btndelete" class="btn btn-danger"><i class="fadeIn animated bx bx-trash-alt"></i></button> <button  style="height:35px; width: 35px; padding-left:7px;" onclick="printdata(\'' + data[i].studid + '\',' + data[i].id + ','+ data[i].receiptnos +',' + data[i].scholershipids + ','+ data[i].pkgddids +','+ data[i].yids +','+ data[i].clsid +','+ data[i].divsids +')" type="button" class="btn btn-primary"><i class="fadeIn animated bx bx-printer"></i></button> </td></tr>';
                                //  alert(data[i].chequenos);
                          
                                $("#Table2").find("tbody").append(markup1);
                       
                                //if (data[i].chequenos != null) {
                                //    $("#chks1" + i).show(); $("#chks2" + i).show(); $("#chks3" + i).show();
                                //}
                                //else {
                                //    $("#chks1" + i).hide(); $("#chks2" + i).hide(); $("#chks3" + i).hide();
                                //}
                            }
                        }
                    }
                },
                error: function () {
                    //alert("Error in display");
                    noty({ text: 'Get Error', layout: 'topRight', type: 'error' });
                    setTimeout(function () { $.noty.closeAll(); }, 3000);
                }
            });
        }
         function deletedata(installids) {
            Swal.fire({
                title: "Delete",
                //text: "Enter your Pin",
                html:
               '<input id="swal-input1" type="password" class="swal2-input" placeholder="Enter Your Pin" autofocus>',
                // input: 'password',
                showCancelButton: true,
                target: document.getElementById('exampleLargeModal5'),
             
            }).then((result) => {
                if ($("#swal-input1").val() != "") {
//Swal.fire('Result:'+result.value); 
      inputValue = $("#swal-input1").val();
                    
            if (inputValue == "2024") {
                $.ajax({
                    type: "POST",
                    url: "accountreport.aspx/Deletedata",
                    data: "{ids :'"+ installids +"'}",
                    contentType: "application/JSON; charset=utf-8",
                    datatype: "JSON",
                    success: function (response) {
                        //window.location.reload();
                  
                        if (response.d == "1") {
                            noty({ text: 'Deleted Successfully', layout: 'topRight', type: 'information' });
                            setTimeout(function () { $.noty.closeAll(); }, 3000);
                            getdata12();
                        }
                        else if (response.d == "0") { 
                            noty({ text: 'Not Deleted ', layout: 'topRight', type: 'information' });
                            setTimeout(function () { $.noty.closeAll(); }, 3000);
                        }
                        $("#Table2").find("tbody").empty();
                        // $("#Table2 TBODY tr:gt(0)").remove();
                        getdetails(studentcode);
                        Clear();

                    },
                    error: function (error) {
                        console.log(JSON.stringify(error));
                        //alert("Error in insert");
                        noty({ text: 'Error in insert', layout: 'topRight', type: 'information' });
                        setTimeout(function () { $.noty.closeAll(); }, 3000);

                    }

                });
            }
            else   {
                //  Swal.fire("Input","Please Enter Valid Pin!");
                Swal.fire({
                    title: 'Please Enter Valid Pin!',
                    text: "do you want to continue!",
                    icon: 'warning',
                    showCancelButton: true,
                    confirmButtonColor: '#3085d6',
                    cancelButtonColor: '#d33',
                    cancelButtonText: 'Continue',
                    confirmButtonText: 'Re-Enter'
                }).then(function (result) {
                    if (result.isConfirmed) {
                        $("#swal-input1").focus();
                    }
                    else if(result.isDismissed && result.dismiss=="cancel") {
                        // rnear = "1";
                        //glass1101(Uhid,pid);
                    }
                
            
                });
        } 
        }
        });
           
            }
        function dotest(button) {
            // adm = parseFloat($("#txtadm").val());
            remainspaidadd = 0;
            var row = $(button).closest("TR"); 
            adm2 = parseFloat(row.find('td:eq(2) input').val()); 
            if (adm2 = adm1 || adm2 == 0) {
                remainspaidadd = adm2;
                $("#txtpaid").val(remainspaidadd);
           
            }
            else {
                noty({ text: 'Please Enter Amount Should be less Admission Fee', layout: 'topRight', type: 'error' });
                setTimeout(function () { $.noty.closeAll(); }, 3000);
                return false;
            }
           
        } 
        //function myfunction1(buttons, tt4) {
        //    alert(tutionfess3);
        //    var row = $(buttons).closest("TR");
        //    remainspaidadd = 0;
        //    // $(button).focus();
        //    tutionfess3 = parseFloat(row.find('td:eq(2) input').val()) + adm2; 
        //    if (tutionfess3 > tutionfess2) {
        //        // tutionfess3 = 0;
        //        $(buttons).focus();
        //        return false;
        //    }
        //    else {
        //        remainspaidadd = remainspaidadd + parseFloat(tutionfess3); $("#txtpaid").val(remainspaidadd);
        //    }

        //}
        function dotest1(button) {
            var row = $(button).closest("TR");
           // $(button).focus();
            tutionfess3 = parseFloat(row.find('td:eq(2) input').val()); 
         
            // tutionfess = parseFloat($("#txttution").val()); 
            var remtutionfee = tutionfess2 - tutionfess3;
            $("#lbltution").html(remtutionfee);
            if (tutionfess3 = tutionfess2 || tutionfess2 == 0) {

               
            }

            else {

                noty({ text: 'Please Enter Amount Should be less Tution Fee', layout: 'topRight', type: 'error' });
                setTimeout(function () { $.noty.closeAll(); }, 3000);
                //tutionfess3 = 0;
                return false;

          
               // $("#txtpaid").val(remainspaidadd);
                // tutionfess3 = 0; remainspaidadd = 0; total = 0;
            }
        }
     
        function myfunction(buttons,tt4) {
            var row = $(buttons).closest("TR");
            remainspaidadd = 0;
            //tutionfess3 = parseFloat(row.find('td:eq(2) input').val()); 
            // $(button).focus();
            if(adm2 != true){
                tutionfess3 = parseFloat(row.find('td:eq(2) input').val())  +  parseFloat(adm2); 
            }else{
                tutionfess3 = parseFloat(row.find('td:eq(2) input').val());
            }
            if (tutionfess3 < 0) {
                // tutionfess3 = 0;
                $(buttons).focus();
               
                return false;
            }
            else { 
                remainspaidadd = remainspaidadd + parseFloat( tutionfess3); $("#txtpaid").val(remainspaidadd);
              
            }
           
        }
        function dotest2(button) {
          
           // remainspaidadd = 0;
          
            var row = $(button).closest("TR");

            cautinmon = parseFloat(row.find('td:eq(2) input').val()); 
            if (cautinmon = cautinmon1 || cautinmon1 == 0 || cautinmon == 0) {
              
               
            }

            else {

                noty({ text: 'Please Enter Amount Should be less Tution Fee', layout: 'topRight', type: 'error' });
                setTimeout(function () { $.noty.closeAll(); }, 3000);
                //tutionfess3 = 0;
                return false;

          
                // $("#txtpaid").val(remainspaidadd);
                // tutionfess3 = 0; remainspaidadd = 0; total = 0;
            }
       
        } 
        function myfunction2(buttons, tt4) {
        
            var row = $(buttons).closest("TR");
            remainspaidadd = 0;
          
          cautinmon = parseFloat(row.find('td:eq(2) input').val()); 
          
            if(tutionfess3 != true){
                cautinmon = parseFloat(row.find('td:eq(2) input').val()) + parseFloat(tutionfess3); 
            }else{cautinmon = parseFloat(row.find('td:eq(2) input').val());
            }
            if (cautinmon < 0) {
                remainspaidadd = 0;
                cautinmon = 0;
                $(buttons).focus();
                return false;
            }
            else {
                remainspaidadd = remainspaidadd + parseFloat( cautinmon); $("#txtpaid").val(remainspaidadd); 
            }
           
        }
        function dotest3(button) {
           // remainspaidadd = 0;
         
            var row = $(button).closest("TR");

            collegemag = parseFloat( row.find('td:eq(2) input').val());
            if(collegemag = collegemag1 || collegemag1 == 0 || collegemag == 0)
            {
            }
            else {

                noty({ text: 'Please Enter Amount Should be less Tution Fee', layout: 'topRight', type: 'error' });
                setTimeout(function () { $.noty.closeAll(); }, 3000);
                //tutionfess3 = 0;
                return false;

          
                // $("#txtpaid").val(remainspaidadd);
                // tutionfess3 = 0; remainspaidadd = 0; total = 0;
            }
            //remainspaidadd = parseFloat($("#txtpaid").val());
            //total = remainspaidadd + parseFloat(collegemag);
            //$("#txtpaid").val(total);
            //collegemag = 0;
        }
        function myfunction3(buttons,tt4){
            var row = $(buttons).closest("TR");
           
          
          //  collegemag = parseFloat(row.find('td:eq(2) input').val()) + parseFloat( cautinmon);
            if(cautinmon != true){
                collegemag = parseFloat(row.find('td:eq(2) input').val()) + parseFloat(cautinmon); 
            }else{collegemag = parseFloat(row.find('td:eq(2) input').val());
            }
            if (collegemag < 0) {
                collegemag = 0; remainspaidadd = 0;
                $(buttons).focus();
                return false;
            }
            else {
                remainspaidadd = remainspaidadd + parseFloat(collegemag); $("#txtpaid").val(remainspaidadd);
            } 
         
        }
        function dotest4(button) {
         //   remainspaidadd = 0;

            var row =  $(button).closest("TR");

            identitys = parseFloat( row.find('td:eq(2) input').val());
            if(identitys = identitys1 || identitys1 == 0 || identitys == 0){
            }
            else {

                noty({ text: 'Please Enter Amount Should be less Tution Fee', layout: 'topRight', type: 'error' });
                setTimeout(function () { $.noty.closeAll(); }, 3000);
                //tutionfess3 = 0;
                return false;

          
                // $("#txtpaid").val(remainspaidadd);
                // tutionfess3 = 0; remainspaidadd = 0; total = 0;
            }
            //remainspaidadd = parseFloat($("#txtpaid").val());
            //total = remainspaidadd + parseFloat(identitys);
            //$("#txtpaid").val(total);
            //identitys = 0;
        } 
        function myfunction4(buttons,tt4){
            var row = $(buttons).closest("TR");
            remainspaidadd = 0;
          
           // identitys = parseFloat(row.find('td:eq(2) input').val()) + parseFloat( collegemag);
            if(collegemag != true){
                identitys = parseFloat(row.find('td:eq(2) input').val()) + parseFloat(collegemag);
            }else{identitys = parseFloat(row.find('td:eq(2) input').val());
            }
            if (identitys < 0) {
                identitys = 0;
                $(buttons).focus();
                return false;
            }
            else {
                remainspaidadd = remainspaidadd + parseFloat(identitys); $("#txtpaid").val(remainspaidadd);
            } 
         
        }
        function dotest5(button) {
          //  remainspaidadd = 0;

            var row = $(button).closest("TR");

            insurance = parseFloat(row.find('td:eq(2) input').val());
            if(insurance = insurance1 || insurance1 == 0 || insurance == 0){
            }
            else {

                noty({ text: 'Please Enter Amount Should be less Tution Fee', layout: 'topRight', type: 'error' });
                setTimeout(function () { $.noty.closeAll(); }, 3000);
                //tutionfess3 = 0;
                return false;

          
                // $("#txtpaid").val(remainspaidadd);
                // tutionfess3 = 0; remainspaidadd = 0; total = 0;
            }
            //remainspaidadd = parseFloat($("#txtpaid").val());
            //total = remainspaidadd + parseFloat(insurance);
            //$("#txtpaid").val(total);
            //insurance = 0;
        }
        function myfunction5(buttons,tt4){
            var row = $(buttons).closest("TR");
            remainspaidadd = 0;
          
           // insurance = parseFloat( row.find('td:eq(2) input').val()) + identitys;

            if(identitys != true){
                insurance = parseFloat(row.find('td:eq(2) input').val()) + parseFloat(identitys); 
            }else{insurance = parseFloat(row.find('td:eq(2) input').val());
            }
            if (insurance < 0) {
                insurance = 0;
                $(buttons).focus();
                return false;
            }
            else {
                remainspaidadd = remainspaidadd + parseFloat(insurance); $("#txtpaid").val(remainspaidadd);
            } 
         
        }
        function dotest6(button) {
           // remainspaidadd = 0;

            var row = $(button).closest("TR");

            university = parseFloat( row.find('td:eq(2) input').val());
            if(university = university1 || university1 == 0 || university == 0){
            }
            else {

                noty({ text: 'Please Enter Amount Should be less Tution Fee', layout: 'topRight', type: 'error' });
                setTimeout(function () { $.noty.closeAll(); }, 3000);
                //tutionfess3 = 0;
                return false;

          
                // $("#txtpaid").val(remainspaidadd);
                // tutionfess3 = 0; remainspaidadd = 0; total = 0;
            }
            //remainspaidadd = parseFloat($("#txtpaid").val());
            //total = remainspaidadd + parseFloat(university);
            //$("#txtpaid").val(total);
            //university = 0;
        } 
        function myfunction6(buttons,tt4){
            var row = $(buttons).closest("TR");
            remainspaidadd = 0;
          
            //university = parseFloat( row.find('td:eq(2) input').val()) +  parseFloat(identitys);

            if(insurance != true){
                university = parseFloat(row.find('td:eq(2) input').val()) + parseFloat( insurance); 
            }else{university = parseFloat(row.find('td:eq(2) input').val());
            }
            if (university < 0) {
                university = 0;
                $(buttons).focus();
                return false;
            }
            else {
                remainspaidadd = remainspaidadd + parseFloat(university); $("#txtpaid").val(remainspaidadd);
            } 
         
        }
        function dotest7(button) {
           // remainspaidadd = 0;

            var row = $(button).closest("TR");

            eligible = parseFloat( row.find('td:eq(2) input').val());
            if(eligible = eligible1 || eligible1 == 0 || eligible == 0){
            } 
            else {

                noty({ text: 'Please Enter Amount Should be less Tution Fee', layout: 'topRight', type: 'error' });
                setTimeout(function () { $.noty.closeAll(); }, 3000);
                //tutionfess3 = 0;
                return false;

          
                // $("#txtpaid").val(remainspaidadd);
                // tutionfess3 = 0; remainspaidadd = 0; total = 0;
            }
            //remainspaidadd = parseFloat($("#txtpaid").val());
            //total = remainspaidadd + parseFloat(eligible);
            //$("#txtpaid").val(total);
            //eligible = 0;
        } 
        function myfunction7(buttons,tt4){
            var row = $(buttons).closest("TR");
            remainspaidadd = 0;
          
          //  eligible = parseFloat( row.find('td:eq(2) input').val()) + parseFloat( university);

            if(university != true){
                eligible = parseFloat(row.find('td:eq(2) input').val()) + parseFloat( university);
            }else{eligible = parseFloat(row.find('td:eq(2) input').val());
            }
            if (eligible < 0) {
                eligible = 0;
                $(buttons).focus();
                return false;
            }
            else {
                remainspaidadd = remainspaidadd + parseFloat(eligible); $("#txtpaid").val(remainspaidadd);
            } 
         
        }
        function dotest8(button) {
          //  remainspaidadd = 0;

            var row = $(button).closest("TR");

            busfees = parseFloat( row.find('td:eq(2) input').val());
            if(busfees = busfees1 || busfees1 == 0 || busfees == 0){
            } 
            else {

                noty({ text: 'Please Enter Amount Should be less Tution Fee', layout: 'topRight', type: 'error' });
                setTimeout(function () { $.noty.closeAll(); }, 3000);
                //tutionfess3 = 0;
                return false;

          
                // $("#txtpaid").val(remainspaidadd);
                // tutionfess3 = 0; remainspaidadd = 0; total = 0;
            }
            //remainspaidadd = parseFloat($("#txtpaid").val());
            //total = remainspaidadd + parseFloat(busfees);
            //$("#txtpaid").val(total);
            //busfees = 0;
        } 
        function myfunction8(buttons,tt4){
            var row = $(buttons).closest("TR");
            remainspaidadd = 0;
          
         //   busfees = parseFloat(row.find('td:eq(2) input').val()) + parseFloat( eligible); 

            if(eligible != true){
                busfees = parseFloat(row.find('td:eq(2) input').val()) + parseFloat(eligible); 
            }else{busfees = parseFloat(row.find('td:eq(2) input').val());
            }
            if (busfees < 0) {
                busfees = 0;
                $(buttons).focus();
                return false;
            }
            else {
                remainspaidadd = remainspaidadd + parseFloat(busfees); $("#txtpaid").val(remainspaidadd);
            } 
         
        }
        function dotest9(button) {
           // remainspaidadd = 0;

            var row = $(button).closest("TR");

            examfess = parseFloat( row.find('td:eq(2) input').val());
            if(examfess = examfess1  || examfess == 0 || examfess == 0){

            } 
            else {

                noty({ text: 'Please Enter Amount Should be less Tution Fee', layout: 'topRight', type: 'error' });
                setTimeout(function () { $.noty.closeAll(); }, 3000);
                //tutionfess3 = 0;
                return false;

          
                // $("#txtpaid").val(remainspaidadd);
                // tutionfess3 = 0; remainspaidadd = 0; total = 0;
            }
            //remainspaidadd = parseFloat($("#txtpaid").val());
            //total = remainspaidadd + parseFloat(examfess);
            //$("#txtpaid").val(total);
            //examfess = 0;
        } 
        function myfunction9(buttons,tt4){
            var row = $(buttons).closest("TR");
            remainspaidadd = 0;
          
            examfess = parseFloat(row.find('td:eq(2) input').val()) + parseFloat(busfees); 

            if(busfees != true){
                examfess = parseFloat(row.find('td:eq(2) input').val()) + busfees; 
            }else{examfess = parseFloat(row.find('td:eq(2) input').val());
            }
            if (examfess < 0) {
                examfess = 0;
                $(buttons).focus();
                return false;
            }
            else {
                remainspaidadd = remainspaidadd + parseFloat(examfess); $("#txtpaid").val(remainspaidadd);
            } 
         
        }
        function dotest10(button) {
            //remainspaidadd = 0;

            var row = $(button).closest("TR");

            enrollment = parseFloat( row.find('td:eq(2) input').val());
            if(enrollment = enrollment1 || enrollment1 == 0 || enrollment == 0){

            } 
            else {

                noty({ text: 'Please Enter Amount Should be less Tution Fee', layout: 'topRight', type: 'error' });
                setTimeout(function () { $.noty.closeAll(); }, 3000);
                //tutionfess3 = 0;
                return false;

          
                // $("#txtpaid").val(remainspaidadd);
                // tutionfess3 = 0; remainspaidadd = 0; total = 0;
            }
            //remainspaidadd = parseFloat($("#txtpaid").val());
            //total = remainspaidadd + parseFloat(enrollment);
            //$("#txtpaid").val(total);
            //enrollment = 0;
        } 
        function myfunction10(buttons,tt4){
            var row = $(buttons).closest("TR");
            remainspaidadd = 0;
          
           // enrollment = parseFloat( row.find('td:eq(2) input').val()) + parseFloat( examfess);

            if(examfess != true){
                enrollment = parseFloat(row.find('td:eq(2) input').val()) + parseFloat( examfess);
            }else{enrollment = parseFloat(row.find('td:eq(2) input').val());
            }
            if (enrollment < 0) {
                enrollment = 0;
                $(buttons).focus();
                return false;
            }
            else {
                remainspaidadd = remainspaidadd + parseFloat(enrollment); $("#txtpaid").val(remainspaidadd);
            } 
         
        }
        function dotest11(button) {
           // remainspaidadd = 0;

            var row = $(button).closest("TR");

            lockerfee =parseFloat(row.find('td:eq(2) input').val());
            if(lockerfee <= lockerfee1 || lockerfee == 0 || lockerfee1 == 0){ 
            }
            else {
            
                noty({ text: 'Please Enter Amount Should be less Tution Fee', layout: 'topRight', type: 'error' });
                setTimeout(function () { $.noty.closeAll(); }, 3000);
                //tutionfess3 = 0;
                return false;

          
                // $("#txtpaid").val(remainspaidadd);
                // tutionfess3 = 0; remainspaidadd = 0; total = 0;
            }
            //remainspaidadd = parseFloat($("#txtpaid").val());
            //total = remainspaidadd + parseFloat(lockerfee);
            //$("#txtpaid").val(total);
            //lockerfee = 0;
        } 
        function myfunction11(buttons,tt4){
            var row = $(buttons).closest("TR");
            remainspaidadd = 0;
          
           // lockerfee = parseFloat( row.find('td:eq(2) input').val()) + parseFloat( enrollment);

            if(enrollment != true){
                lockerfee = parseFloat(row.find('td:eq(2) input').val()) +  parseFloat(enrollment);
            }else{ lockerfee = parseFloat(row.find('td:eq(2) input').val());
            }
            if (lockerfee < 0) {
                lockerfee = 0;
                $(buttons).focus();
                return false;
            }
            else {
                remainspaidadd = remainspaidadd + parseFloat(lockerfee); $("#txtpaid").val(remainspaidadd);
            } 
         
        }
        function dotest12(button) {
           // remainspaidadd = 0;

            var row = $(button).closest("TR");

            gamesfees = parseFloat(row.find('td:eq(2) input').val());
            if(gamesfees = gamesfees1 || gamesfees1 == 0 || gamesfees == 0){
            }
            else {

                noty({ text: 'Please Enter Amount Should be less Tution Fee', layout: 'topRight', type: 'error' });
                setTimeout(function () { $.noty.closeAll(); }, 3000);
                //tutionfess3 = 0;
                return false;

          
                // $("#txtpaid").val(remainspaidadd);
                // tutionfess3 = 0; remainspaidadd = 0; total = 0;
            }
            //remainspaidadd = parseFloat($("#txtpaid").val());
            //total = remainspaidadd + parseFloat(gamesfees);
            //$("#txtpaid").val(total);
            //gamesfees = 0;
        } 
        function myfunction12(buttons,tt4){
            var row = $(buttons).closest("TR");
            remainspaidadd = 0;
          
          //  gamesfees = parseFloat(cautinmon = row.find('td:eq(2) input').val()) + lockerfee;

            if(lockerfee != true){
                gamesfees = parseFloat(row.find('td:eq(2) input').val()) + parseFloat(lockerfee); 
            }else{gamesfees = parseFloat(row.find('td:eq(2) input').val());
            }
            if (gamesfees < 0) {
                gamesfees = 0;
                $(buttons).focus();
                return false;
            }
            else {
                remainspaidadd = remainspaidadd + parseFloat(gamesfees); $("#txtpaid").val(remainspaidadd);
            } 
         
        }
        function dotest13(button) {
           // remainspaidadd = 0;

            var row = $(button).closest("TR");

            boardfees = parseFloat(row.find('td:eq(2) input').val());
            if(boardfees = boardfees1 || boardfees1 == 0 || boardfees == 0){
            } 
            else {

                noty({ text: 'Please Enter Amount Should be less Tution Fee', layout: 'topRight', type: 'error' });
                setTimeout(function () { $.noty.closeAll(); }, 3000);
                //tutionfess3 = 0;
                return false;

          
                // $("#txtpaid").val(remainspaidadd);
                // tutionfess3 = 0; remainspaidadd = 0; total = 0;
            }
            //remainspaidadd = parseFloat($("#txtpaid").val());
            //total = remainspaidadd + parseFloat(boardfees);
            //$("#txtpaid").val(total);
            //boardfees = 0;
        } 
        function myfunction13(buttons,tt4){
            var row = $(buttons).closest("TR");
            remainspaidadd = 0;
          
           // boardfees = parseFloat(cautinmon = row.find('td:eq(2) input').val()) + parseFloat(gamesfees);

            if(gamesfees != true){
                boardfees = parseFloat(row.find('td:eq(2) input').val()) + parseFloat(gamesfees);
            }else{boardfees = parseFloat(row.find('td:eq(2) input').val());
            }
            if (boardfees < 0) {
                boardfees = 0;
                $(buttons).focus();
                return false;
            }
            else {
                remainspaidadd = remainspaidadd + parseFloat(boardfees); $("#txtpaid").val(remainspaidadd);
            } 
         
        }
        function dotest14(button) {
            //remainspaidadd = 0;

            var row = $(button).closest("TR");

            extraactivity = parseFloat(row.find('td:eq(2) input').val());
            if(extraactivity = extraactivity1 || extraactivity1 == 0 || extraactivity == 0){
            } 
            else {

                noty({ text: 'Please Enter Amount Should be less Tution Fee', layout: 'topRight', type: 'error' });
                setTimeout(function () { $.noty.closeAll(); }, 3000);
                //tutionfess3 = 0;
                return false;

          
                // $("#txtpaid").val(remainspaidadd);
                // tutionfess3 = 0; remainspaidadd = 0; total = 0;
            }
            //remainspaidadd = parseFloat($("#txtpaid").val());
            //total = remainspaidadd + parseFloat(extraactivity);
            //$("#txtpaid").val(total);
            //extraactivity = 0;

        } 
        function myfunction14(buttons,tt4){
            var row = $(buttons).closest("TR");
            remainspaidadd = 0;
          
           // extraactivity = parseFloat(cautinmon = row.find('td:eq(2) input').val()) + parseFloat( boardfees);

            if(boardfees != true){
                extraactivity = parseFloat(row.find('td:eq(2) input').val()) + parseFloat(boardfees);
            }else{extraactivity = parseFloat(row.find('td:eq(2) input').val());
            }
            if (extraactivity < 0) {
                extraactivity = 0;
                $(buttons).focus();
                return false;
            }
            else {
                remainspaidadd = remainspaidadd + parseFloat(extraactivity); $("#txtpaid").val(remainspaidadd);
            } 
         
        }
        function dotest15(button) {
          //  remainspaidadd = 0;

            var row = $(button).closest("TR");

            developemntfee = row.find('td:eq(2) input').val();
            if(developemntfee = developemntfee1 || developemntfee1 == 0 || developemntfee == 0){
            } 
            else {

                noty({ text: 'Please Enter Amount Should be less Tution Fee', layout: 'topRight', type: 'error' });
                setTimeout(function () { $.noty.closeAll(); }, 3000);
                //tutionfess3 = 0;
                return false;

          
                // $("#txtpaid").val(remainspaidadd);
                // tutionfess3 = 0; remainspaidadd = 0; total = 0;
            }
            //remainspaidadd = parseFloat($("#txtpaid").val());
            //total = remainspaidadd + parseFloat(developemntfee);
            //$("#txtpaid").val(total);
            //developemntfee = 0;
        } 
        function myfunction15(buttons,tt4){
            var row = $(buttons).closest("TR");
            remainspaidadd = 0;
          
           // developemntfee = parseFloat(row.find('td:eq(2) input').val()) + parseFloat( developemntfee);

            if(extraactivity != true){
                developemntfee = parseFloat(row.find('td:eq(2) input').val()) + parseFloat(extraactivity);
            }else{developemntfee = parseFloat(row.find('td:eq(2) input').val());
            }
            if (developemntfee < 0) {
                developemntfee = 0;
                $(buttons).focus();
                return false;
            }
            else {
                remainspaidadd = remainspaidadd + parseFloat(developemntfee); $("#txtpaid").val(remainspaidadd);
            } 
         
        }
        function printdata(stdids,installtid,recptid,scholid,pkgid,yrsid,classid,divsid) {
          
            $("#printabel3").remove();
            loadpage1(stdids, installtid,recptid,pkgid,yrsid,classid,divsid);
        }
        function loadpage1(id,recept,receptsid,pkgsids,yrsid,classid,divsid) {
            setTimeout(function () {
                $("<iframe id='printabel3'>")

            .attr("src", "printreceipt.aspx?student=" + id + "&instids=" + recept+"&receptsids="+ receptsid+"&pkgsids="+pkgsids+"&yrs="+yrsid+"&clsid="+classid+"&diviid="+divsid)
                
            .appendTo("body");
                $("#printabel3").hide();
            }, 2000);
           // $("#mcloses")[0].click();
        } 
        //export data
        function ExportData() {
         
            var obj = {};
            obj.clasr = $("select[id$=ddlsclass]").val();
            obj.division = $("select[id$=ddldivision]").val();
            obj.acdyear = $('select[id$=ddlyears]').val();
            if($('select[id$=ddlyears]').val() != "0"){
                if($("select[id$=ddldivision]").val() != "0"){
                    if($('select[id$=ddlsclass]').val() != "0"){
                        $.ajax({
                            url: 'accountreport.aspx/Export',
                            method: 'post',
                            contentType: 'application/json;charset=utf-8',
                            data : JSON.stringify(obj),
                            dataType: 'json',
                            success: function (_data) {
                                table = $('#dataemp').DataTable();
                                table.destroy();
                                if (_data.d != "") {
                                    _data = JSON.parse(_data.d);
                                }
                                var table = $('#dataemp').DataTable({

                                    "order": [[ 0, "asc" ]],
                                    "ordering": false,
                                    "pageLength": 10,
                                    "lengthMenu": [ [10, 25, 50, -1], [10, 25, 50, "All"] ],
                                    "dom": 'lBfrtip',
                                    buttons: [
                                    {
                                        extend: 'excelHtml5',
                                        text: 'Export to Excel',
                                        title: 'Student List',
                                        download: 'open',
                                        orientation: 'landscape',
                                        exportOptions: {
                                            columns: ':visible'
                                        }
                                    }],
                                    "columns": [
                                           { "width": "5%" },
                                 { "width": "8%" },
                                 { "width": "10%" },
                                 { "width": "10%" },
                                 { "width": "10%" },
                                 { "width": "7%" },
                                 { "width": "6%" },
                                 { "width": "10%" },
                                 { "width": "7%" },
                                 { "width": "10%" },
                                 { "width": "10%" },
                                 { "width": "10%" },  { "width": "6%" },
                                  { "width": "6%" },
                        { "width": "6%" },
                         { "width": "6%" },  { "width": "6%" }
                                    ]
                                });

                                $('#dataemp').DataTable().clear().draw();

                                //for (var i = 0; i < _data.length; i++) {
                                //    if (_data[i].packgenme != null) {
                                //        totalpaid = parseFloat(_data[i].totalpaidamt);
                                //        remainsamt = parseFloat(_data[i].amount);
                                //        totalremainsamt = remainsamt - totalpaid;
                                //    }
                                //    if (totalpaid == "") {
                                //        totalremainsamt = 0;
                                //    }
                                //    fullname = _data[i].title + "." + _data[i].fname + " " + _data[i].mname + " " + _data[i].lname;
                                //    table.row.add([
                   
                                //                     _data[i].studid,_data[i].admdate , fullname, _data[i].packgenme, _data[i].clsname, _data[i].divsname, _data[i].amount, _data[i].totalpaidamt, totalremainsamt, _data[i].scholerhipstudent, _data[i].scholershipstatus,"<button  style='height:35px; width: 35px; padding-left:7px;' type='button' onclick=getdataacctstudent('" + _data[i].pkgid + "',\"" + _data[i].studid + "\"," + _data[i].clsids + "," + _data[i].divsid + "," + _data[i].admyrs + ") id='btnedit' class='btn btn-success' data-bs-toggle='modal' title='Pay Now' data-bs-target='#exampleLargeModal5' ><i class='bx bx-message-square-edit'></i></button>"

                   

                                //    ]).draw(false);
                                //}
                                for (var i = 0; i < _data.length ; i++) {
                                    if (_data[i].packgenme != null) {
                                        totalpaid = parseFloat(_data[i].totalpaidamt);
                                        remainsamt = parseFloat(_data[i].amount);
                                        totalremainsamt = remainsamt - totalpaid;
                                    }
                                    if (totalpaid == "") {
                                        totalremainsamt = 0;
                                    }  
                                    totalfess = parseFloat(_data[i].totaltutionfee) + parseFloat(_data[i].totaldevelopfee)
                                    if(_data[i].firstinstall != "" && _data[i].firstinstall != null){
                                        //  totalfess = parseFloat(data[i].totaltutionfee) + parseFloat(data[i].totaldevelopfee) + parseFloat(data[i].firstinstall);
                                        totalschol = parseFloat(_data[i].firstinstall);
                                    }
                                    else if(_data[i].firstinstall != "" && _data[i].firstinstall != null && _data[i].secondinstall != ""){
                                        //  totalfess = parseFloat(data[i].totaltutionfee) +  parseFloat(data[i].totaldevelopfee) + parseFloat(data[i].firstinstall) + parseFloat(data[i].secondinstall);
                                        totalschol = parseFloat(_data[i].firstinstall) + parseFloat(_data[i].secondinstall);
                                    } 
                                    else{
                                        totalfess = parseFloat(_data[i].totaltutionfee) + parseFloat(_data[i].totaldevelopfee);
                                        totalschol = 0;
                                    } 
                                    if(totalfess != 0 && totalschol == 0){
                                        totalpaid = parseFloat(totalfess);
                                    }else if(totalfess == 0 && totalschol != 0){
                                        totalpaid = parseFloat(totalschol);
                                    }
                                    else if(totalfess != 0 && totalschol != 0){
                           
                                        totalpaid = parseFloat(totalfess) + parseFloat(totalschol);
                                    }
                                    clgfees = parseFloat(64000);
                                    if(totalschol > 0){
                                        allbalnce = parseFloat(clgfees) - parseFloat(totalpaid);
                                    }else{
                                        allbalnce = 0;
                                    }
                      
                                    fullname = _data[i].title + "." + _data[i].fname + " " + _data[i].mname + " " + _data[i].lname;
                                    //var markup = "<tr><td>" + data[i].studid + "</td><td>"+ data[i].admdate + "</td><td>" + fullname + "</td><td>" + data[i].packgenme + "</td><td>" + data[i].clsname + "</td><td>" + data[i].divsname + "</td><td>" + data[i].amount + "</td><td>" + data[i].totalpaidamt + "</td><td>" + totalremainsamt + "</td><td>" + data[i].scholerhipstudent + "</td><td>" + data[i].scholershipstatus + "</td><td><button  style='height:35px; width: 35px; padding-left:7px;' type='button' onclick=getdataacctstudent('" + data[i].pkgid + "',\"" + data[i].studid + "\"," + data[i].clsids + "," + data[i].divsid + "," + data[i].admyrs + ") id='btnedit' class='btn btn-success' data-bs-toggle='modal' data-bs-target='#exampleLargeModal5' ><i class='bx bx-message-square-edit'></i></button></td></tr>";

                                    //  $("#dataemp").find("tbody").append(markup);
                       
                                    table.row.add([
                                        _data[i].studid,_data[i].admdate , fullname, _data[i].packgenme, _data[i].clsname, _data[i].divsname, _data[i].amount, _data[i].totalpaidamt, totalremainsamt,totalfess, _data[i].firstinstall, _data[i].secondinstall,totalschol,totalpaid,clgfees,allbalnce,"<button  style='height:35px; width: 35px; padding-left:7px;' type='button' onclick=getdataacctstudent('" + _data[i].pkgid + "',\"" + _data[i].studid + "\"," + _data[i].clsids + "," + _data[i].divsid + "," + _data[i].admyrs + ") id='btnedit' class='btn btn-success' data-bs-toggle='modal' title='Pay Now' data-bs-target='#exampleLargeModal5' ><i class='bx bx-message-square-edit'></i></button>"
                                    ]).draw(false);
                                }
                            },
                            error: function () {
                               
                              
                                noty({ text: 'Get Error', layout: 'topRight', type: 'error' });
                                setTimeout(function () { $.noty.closeAll(); }, 3000);
                            }
                        });
                    }else{
                        noty({ text: 'Please Select Class', layout: 'topRight', type: 'information' });
                        setTimeout(function () { $.noty.closeAll(); }, 3000);
                    }
                }
                else{
                    noty({ text: 'Please Select Division', layout: 'topRight', type: 'information' });
                    setTimeout(function () { $.noty.closeAll(); }, 3000);
                } 
            }else{
                noty({ text: 'Please Select Year', layout: 'topRight', type: 'information' });
                setTimeout(function () { $.noty.closeAll(); }, 3000);
            }
           
        }
       
    </script>
    	<div class="page-wrapper">
			<div class="page-content">
				<div class="row">
                    <div class="col-md-12 mx-auto" >
					
				<div class="card">
					<div class="card-body">
						<div class="card-title d-flex align-items-center">

							<h6>Account Reports</h6>
						</div>
						<hr/>
						
						
						<form class="row g-2">
							<div class="col-md-2">
								<label>Year</label>
								<select id="ddlyears" class="form-select mb-3" aria-label="Default select example">
													
								</select>
							</div>	
                            <div class="col-md-2">
								<label>College</label>
								<select id="Select1" class="form-select mb-3" aria-label="Default select example">
									<option value="0">Select</option>
									<option value="1">Hi-Tech College of B. Pharmacy</option>
												
								</select>
							</div>															
							<div class="col-md-2">
								<label>Class</label>
								<select id="ddlsclass" class="form-select mb-3" aria-label="Default select example">
						
								</select>
							</div>
							<div class="col-md-2">
								<label>Division</label>
								<select id="ddldivision" class="form-select mb-3" aria-label="Default select example">
																			
								</select>
							</div>														
					       <div class="col-md-3" style="margin-top: 4.7vh;">
							<button type="button" onclick="getdata12()" class="btn btn-primary"><i class='bx bx-search'></i>Search</button>
							<button style="" type="button" title="Print"  class="btn btn-secondary">Print</button>											
						   </div>						   
                           </form>
                       </div>
                   </div>				   				  						
				<!-- <div class="row row-cols-auto g-2">

				<div class="col">
					<button style="height:35px; width: 35px; padding-left:7px;"  data-bs-toggle="modal" data-bs-target="#exampleLargeModal" type="button" class="btn btn-secondary"6><i class="fadeIn animated bx bx-user-plus"></i>
					</button>
				</div>
				<div class="col">
					<button  style="height:35px; width: 35px; padding-left:7px;" type="button" class="btn btn-success"><i class='bx bx-message-square-edit'></i>
					</button>
				</div>
				<div class="col">
					<button  style="height:35px; width: 35px; padding-left:7px;" type="button" class="btn btn-danger"><i class="fadeIn animated bx bx-trash-alt"></i>
					</button>
				</div>
				<div class="col">
					<button  style="height:35px; width: 35px; padding-left:7px;" type="button" class="btn btn-warning"><i class="lni lni-share"></i>
					</button>
				</div>
				
				<div class="col">
					<button  style="height:35px; width: 35px; padding-left:7px;" type="button" class="btn btn-dark"><i class="fadeIn animated bx bx-printer"></i>
					</button>
				</div>
				</div>
				</div>
				</div> -->
				

				   <div class="overlay toggle-icon"></div>
                          <div class="btn-group pull-right">
                                        <button class="btn btn-danger dropdown-toggle" style="display:none" data-toggle="dropdown"><i class="fa fa-bars"></i> Export Data</button>
                                        <ul  class="has-arrow">
                                           
                                            <li><%--<a href="#" onclick ="$('#dataemp').tableExport({type:'excel',escape:'false'});"> Student Installment(Excel)</a>--%><a href="#" onclick="ExportData();">Student Installment(Excel)</a></li>
                                          
                                           <%-- <li><a href="#" onclick ="$('#tt').tableExport({type:'pdf',escape:'false'});"> PDF</a></li>--%>
                                        </ul>
                                    </div> 
				   <hr/>
				   <div class="col-md-12 mx-auto">
				   <div class="card">
					   <div class="card-body">
						   <div class="table-responsive">
							   <table id="dataemp" class="table table-striped table-bordered">
								   <thead>
									   <tr>
										   <th>Student ID</th>	
                                           <th>Admission Date</th>
                                           <th>Student Name</th>	
									       <th>Package Name</th>  
										   <th>Class Name</th>
										   <th>Divison</th>
										   <th>Total Amount</th>
									       <th>Paid Amount</th>
                                           <th>Balance Amount</th>
                                           <th>All Fees</th>
                                           <th>First Installment</th>
                                           <th>Second Installment</th>
                                           <th>Total Scholership</th>
                                             <th>Total Paid</th>
                                            <th>College Fee</th>
                                               <th>All Balance</th>
										   <th style="background-color:white;">Action</th>
									   </tr>
								   </thead>
                                
								
							   </table>
						   </div>
					   </div>
				   </div>
			   </div>
			   </div>
                    </div>
                </div>
            </div>
    <div class="col">
		<!-- Button trigger modal -->
		
		<!-- Modal -->
		<div class="modal fade" id="exampleLargeModal5" tabindex="-1" aria-hidden="true">
			<div class="modal-dialog modal-lg">
				<div class="modal-content">
					<div class="modal-header">
						<h5 class="modal-title">Installment Details</h5>
						<button type="button" class="btn-close" data-bs-dismiss="modal" id="mcloses" aria-label="Close"></button>
					</div>
					<div class="modal-body"><%--<form class="row g-2">
					
						<div class="col-md-2">
						
							<select class="form-select mb-3" id="clasrch1" aria-label="Default select example">
						
							</select>
						</div>
						
						
						<div class="col-md-2">
						
								<select class="form-select mb-3" id="divisrch1" aria-label="Default select example">
						
						
							</select>
						</div>
                         <div class="col-md-1" style="margin-top: 1vh;">
						<button type="button" onclick="getdata13();" class="btn btn-primary">Search</button>
						
										
					   </div>
						<div class="col-md-3">
						
								<select class="form-select mb-3" id="ddlpkg1" aria-label="Default select example">
					
							</select>
						</div>
					  

				

					
					<div class="col-md-1" style="margin-top: 1vh;">
						<button type="button" onclick="updatepkg1()" class="btn btn-primary">Assign</button>
						
										
					   </div>

					   
					   </form>--%>

					   <div class="col-md-12 mx-auto">
						<div class="card">
							<div class="card-body">
								<table class="table mb-0" id="Table1">
									<thead class="table-dark">
										<tr>
											
												
											<th scope="col">Category Name</th>
											<th scope="col">Total Amount</th>
											<th scope="col">Balance Amount</th>
											
										</tr>
									</thead>
									<tbody id="Tbody2">
										<tr>
										
										</tr>
									
									</tbody>
								</table>
							</div>
						</div>
					
					</div>
                        <form class="row g-2">
						<div class="col-md-3">
							<label>Total amount<font color="#FF0000">*</font></label>
							<input class="form-control mb-3" id="txtamt" type="text" placeholder="Total amount"
								aria-label="default input example" />
						</div>
						<div class="col-md-3">
							<label>Tax<font color="#FF0000">*</font></label>
							<input class="form-control mb-3" id="txttax" type="text" placeholder="Tax"
								aria-label="default input example" />
						</div>
                         
						<div class="col-md-6">
							<label>Pay Mode<font color="#FF0000">*</font></label>
							<input  type="radio" id="Radio1" name="st" value="cash" /> Cash &nbsp;
                                <input  type="radio" id="Radio2" name="st" value="cheque" /> Cheque &nbsp;
                             <input  type="radio" id="Radio3" name="st" value="dd" /> DD
			
						</div>

                                </form>
                          <form class="row g-2">
                              <div class="col-md-3">
							<label>Pay Date<font color="#FF0000">*</font></label>
								<input class="form-control mb-3" id="dp-5" type="date" />
			
						</div>
                              <div class="col-md-3" id="chkque1" style="display:none">
							<label>Cheque No./DD No. <font color="#FF0000">*</font></label>
							<input class="form-control mb-3" id="txtchkddnos" type="text" placeholder="Cheque No./DD No."
								aria-label="default input example" />
						</div>
                              <div class="col-md-3" id="chkque2" style="display:none">
							<label>Bank Name<font color="#FF0000">*</font></label>
							<input class="form-control mb-3" id="txtbanknm" type="text" placeholder="Bank Name"
								aria-label="default input example" />
						</div>
                              <div class="col-md-3">
							<label>Remark<font color="#FF0000">*</font></label>
							<input class="form-control mb-3" id="txtremark" type="text" placeholder="Remark"
								aria-label="default input example" />
			
						</div>
                             
                            <div class="col-md-3">
							<label>Paid Amount<font color="#FF0000">*</font></label>
							<input class="form-control mb-3" id="txtpaid" type="text" placeholder="Total amount"
								aria-label="default input example" />
						</div>
					   <div class="col-md-2" style="margin-top: 4vh;">
						<button type="button" id="btnSubmit" onclick="savedata();"  value="Submit" class="btn btn-primary">Save</button>
						</div>
					  </form>
                        
					   <div class="col-md-12 mx-auto">
						<div class="card">
							<div class="card-body">
								<table class="table mb-0" id="Table2">
									<thead class="table-dark">
										<tr>
											
												
											<th scope="col">Ref. No</th>
											<th scope="col">Amount</th>
											<th scope="col">Pay Date</th>
                                            <th scope="col">Mode</th>
											<th scope="col"  id="chk1">Cheque/DD No.</th>
                                            <th scope="col"  id="chk2">Date</th>
                                            <th scope="col"  id="chk3">Bank</th>
                                             <th scope="col">Action</th>
										</tr>
									</thead>
									<tbody>
										
									
									</tbody>
								</table>
							</div>
						</div>
					
					</div>
					</div>
				
				</div>
			</div>
		</div>
        <div class="col">
            	<div class="modal fade" id="exampleLargeModal51" tabindex="-1" aria-hidden="true">
			<div class="modal-dialog modal-lg">
				<div class="modal-content">
					<div class="modal-header">
						<h5 class="modal-title">Against Scholership</h5>
						<button type="button" class="btn-close" data-bs-dismiss="modal" id="Button1" aria-label="Close"></button>
					</div>
					<div class="modal-body">
                        <div class="col-md-12">
                        	 <form class="row g-2">
						
                         
						<div class="col-md-6">
							<label>Pay Mode<font color="#FF0000">*</font></label>
							<input  type="radio" id="cash1" name="st" value="cash" /> Cash &nbsp;
                                <input  type="radio" id="cheques" name="st" value="cheque" /> Cheque &nbsp;
                             <input  type="radio" id="dds" name="st" value="dd" /> DD
			
						</div> 
                           <div class="col-md-3">
							<label>Pay Date<font color="#FF0000">*</font></label>
								<input class="form-control mb-3" id="paydates" type="date" />
			
						</div>
                              <div class="col-md-3" id="Div1" style="display:none">
							<label>Cheque No./DD No. <font color="#FF0000">*</font></label>
							<input class="form-control mb-3" id="chequesnos" type="text" placeholder="Cheque No./DD No."
								aria-label="default input example" />
						</div>
                              <div class="col-md-3" id="Div2" style="display:none">
							<label>Bank Name<font color="#FF0000">*</font></label>
							<input class="form-control mb-3" id="banknames" type="text" placeholder="Bank Name"
								aria-label="default input example" />
						</div>
                              <div class="col-md-3">
							<label>Remark<font color="#FF0000">*</font></label>
							<input class="form-control mb-3" id="txtremarks" type="text" placeholder="Remark"
								aria-label="default input example" />
			
						</div>
                             
                            <div class="col-md-3">
							<label>Paid Amount<font color="#FF0000">*</font></label>
							<input class="form-control mb-3" id="scholamount" type="text" placeholder="Paid amount"
								aria-label="default input example" />
						</div>
                                    <div class="col-md-2" style="margin-top: 4vh;">
						<button type="button" id="Button2" onclick="savescholership();"  value="Submit" class="btn btn-primary">Pay Now</button>
						</div>
                                 </form>
                       </div>
                        </div>
                    </div> 
                </div> 
                    </div>
        </div>
	</div>
</asp:Content>