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

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

 
    <script type="text/javascript">
        var total = 0;
        var num = 0;
        var num1 = 0;
        var num2 = 0;
        var num3 = 0;
        var num4 = 0;
        var num5 =0;
        var num6 = 0;
        var num7 = 0;
        var num8 = 0;
        var num9 = 0;
        var num10 =0;
        var num11 =0;
        var num12 = 0;
        var num13 =0;
        var num14 = 0;
        var num15 =0;
        var num16 = 0;
        $(document).ready(function () {
            $("#txtadm").val("0");
            $("#txttution").val("0");
            $("#txtmoney").val("0");
            $("#txtcoll").val("0");
            $("#txtide").val("0");
            $("#txtinsu").val("0");
            $("#txtuni").val("0");
            $("#txteligi").val("0");
            $("#txtbus").val("0");
            $("#txtexam").val("0");
            $("#txtenroll").val("0");
            $("#txtlocker").val("0");
            $("#txtgames").val("0");
            $("#txtboard").val("0");
            $("#txtexact").val("0");
            $("#txtdev").val("0");
            $('#txtamt').val("0");
            
            $("#btnSubmit").click(function () {
                //btnadd();
                if ($("#btnSubmit").val() == "Submit") {
                    savedata();
                }
                else if ($("#btnSubmit").val() == "Update") {
                    updatedata();
                }
            });
            datatable();
         
            $.ajax({
                type: "POST",
                contentType: "application/json; charset=utf-8",
                url: "Feesetup.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$=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);
                }

            });
            $.ajax({
                type: "POST",
                contentType: "application/json; charset=utf-8",
                url: "Feesetup.aspx/PopulateDropDownList4",
                data: "",
                dataType: "json",
                success: function (result) {
                    $('select[id$=ddlyear]').empty();
                    $('select[id$=ddlyear]').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$=ddlyear]').append($("<option data-toggle='tooltip' data-placement='top' title='" + stryr + "'></option>").val(value.DeptId).html(stryr));
                        //console.log(value.DeptName);
                    });
                    //$('select[id$=ddlyear]').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);
                }

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

                            $('select[id$=ddlclass]').append($("<option data-toggle='tooltip' data-placement='top' title='" + dd + "'></option>").val(value.DeptId).html(dd));
                            //console.log(value.DeptName);
                        });
                        $('select[id$=ddlclass]').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);
                    }

                });
            });
            $('select[id$=ddlyears]').change(function () {
                $.ajax({
                    type: "POST",
                    contentType: "application/json; charset=utf-8",
                    url: "Feesetup.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);
                    }

                });
            });
            $('select[id$=ddlclass]').change(function () {
                $.ajax({
                    type: "POST",
                    contentType: "application/json; charset=utf-8",
                    url: "Feesetup.aspx/PopulateDropDownList6",
                    data: "{clids :'" + $('select[id$=ddlclass]').val() + "'}",
                    dataType: "json",
                    success: function (result) {
                        $('select[id$=ddldivison]').empty();
                        $('select[id$=ddldivison]').append("<option value='0'>Select Division</option>");
                        $.each(result.d, function (key, value) {
                            var dd = value.DeptName;


                            $('select[id$=ddldivison]').append($("<option data-toggle='tooltip' data-placement='top' title='" + dd + "'></option>").val(value.DeptId).html(dd));
                            //console.log(value.DeptName);
                        });
                        $('select[id$=ddldivison]').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);
                    }

                });
            });
            $('select[id$=ddlsclass]').change(function () {
                $.ajax({
                    type: "POST",
                    contentType: "application/json; charset=utf-8",
                    url: "Feesetup.aspx/PopulateDropDownList6",
                    data: "{clids :'" + $('select[id$=ddlclass]').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);
                    }

                });
            });
            $("#txtadm").bind('blur keyup', function (e) {
                if (e.type === 'blur' || e.keyCode === 13) {
                  
                    total = 0;
                    num = parseFloat($("#txtadm").val());
                    total = total + num; $('#txtamt').val(total);
                }
          });  
            //$("#txtamt").blur(function (e) {
            
            //    // Perform the addition
            //    num1 = parseFloat($("#txtadm").val());
            //    total = total + num1;
            //    $('#txtamt').val(total);
            //});
            $("#txttution").bind('blur keyup', function (e) {
                if (e.type === 'blur' || e.keyCode === 13) {
                   
                    total = 0;
                    num2 = parseFloat($("#txttution").val()) + num;
                    total = total + num2; $('#txtamt').val(total);
                }
            });
            //$("#txtadm").blur(function () {
            //    $("#txtamt").trigger("blur");

            //});
            //$("#txttution").blur(function () {
            //    total = parseFloat($('#txtamt').val());
            //    num2 = parseFloat($("#txttution").val());
            //    total = total + num2;   $('#txtamt').val(total);
            //});
            $("#txtmoney").bind('blur keyup', function (e) {
                if (e.type === 'blur' || e.keyCode === 13) {

                    total = 0;
                    num3 = parseFloat($("#txtmoney").val()) + num2;
                    total = total + num3; $('#txtamt').val(total);
                }
            });
         //   $("#txtmoney").blur(function () {
         //       total = 0;
         //   num3 = parseFloat($("#txtmoney").val());
         ////   total = parseFloat( $('#txtamt').val());
         //       total = total + num3;
         //       $('#txtamt').val(total);
            //   });
            $("#txtcoll").bind('blur keyup', function (e) {
                if (e.type === 'blur' || e.keyCode === 13) {

                    total = 0;
                    num4 = parseFloat($("#txtcoll").val()) + num3;
                    total = total + num4; $('#txtamt').val(total);
                }
            });
            //$("#txtcoll").blur(function () {
                
            //    num4 = parseFloat($("#txtcoll").val());
            //total = parseFloat($('#txtamt').val());
            //    total = total + num4;
            //    $('#txtamt').val(total);
            //}); 
            $("#txtide").bind('blur keyup', function (e) {
                if (e.type === 'blur' || e.keyCode === 13) {

                    total = 0;
                    num5 = parseFloat($("#txtide").val()) + num4;
                    total = total + num5; $('#txtamt').val(total);
                }
            });
            //$("#txtide").blur(function () {
            //total = parseFloat($('#txtamt').val());
            //    num5 = parseFloat($("#txtide").val());
            //    total = total + num5;
            //    $('#txtamt').val(total);
            //});
            $("#txtinsu").bind('blur keyup', function (e) {
                if (e.type === 'blur' || e.keyCode === 13) {

                    total = 0;
                    num6 = parseFloat($("#txtinsu").val()) + num5;
                    total = total + num6; $('#txtamt').val(total);
                }
            });
            //$("#txtinsu").blur(function () {
            //    total = parseFloat($('#txtamt').val());
            //    num6 = parseFloat($("#txtinsu").val()); total = total + num6;
            //    $('#txtamt').val(total);
            //});
            $("#txtuni").bind('blur keyup', function (e) {
                if (e.type === 'blur' || e.keyCode === 13) {

                    total = 0;
                    num7 = parseFloat($("#txtuni").val()) + num6;
                    total = total + num7; $('#txtamt').val(total);
                }
            });
            //$("#txtuni").blur(function () {
            //    total = parseFloat($('#txtamt').val());
            //    num7 = parseFloat($("#txtuni").val()); total = total + num7;
            //    $('#txtamt').val(total);
            //});
            $("#txteligi").bind('blur keyup', function (e) {
                if (e.type === 'blur' || e.keyCode === 13) {

                    total = 0;
                    num8 = parseFloat($("#txteligi").val()) + num7;
                    total = total + num8; $('#txtamt').val(total);
                }
            });
            //$("#txteligi").blur(function () {
            //    total = parseFloat($('#txtamt').val());
            //    num8 = parseFloat($("#txteligi").val()); total = total + num8;
            //    $('#txtamt').val(total);
            //});
            $("#txtbus").bind('blur keyup', function (e) {
                if (e.type === 'blur' || e.keyCode === 13) {

                    total = 0;
                    num9 = parseFloat($("#txtbus").val()) + num8;
                    total = total + num9; $('#txtamt').val(total);
                }
            });
            //$("#txtbus").blur(function () {
            //    total = parseFloat($('#txtamt').val());
            //    num9 = parseFloat($("#txtbus").val()); total = total + num9;
            //    $('#txtamt').val(total);
            //});
            $("#txtexam").bind('blur keyup', function (e) {
                if (e.type === 'blur' || e.keyCode === 13) {

                    total = 0;
                    num10 = parseFloat($("#txtexam").val()) + num9;
                    total = total + num10; $('#txtamt').val(total);
                }
            });
            //$("#txtexam").blur(function () {

            //    total = parseFloat($('#txtamt').val());
            //    num10 = parseFloat($("#txtexam").val()); total = total + num10;
            //    $('#txtamt').val(total);
            //});
            $("#txtenroll").bind('blur keyup', function (e) {
                if (e.type === 'blur' || e.keyCode === 13) {

                    total = 0;
                    num11 = parseFloat($("#txtenroll").val()) + num10;
                    total = total + num11; $('#txtamt').val(total);
                }
            });
            //$("#txtenroll").blur(function () {
            //    total = parseFloat($('#txtamt').val());
            //    num11 = parseFloat($("#txtenroll").val()); total = total + num11;
            //    $('#txtamt').val(total);
            //});
            $("#txtlocker").bind('blur keyup', function (e) {
                if (e.type === 'blur' || e.keyCode === 13) {

                    total = 0;
                    num12 = parseFloat($("#txtlocker").val()) + num11;
                    total = total + num12; $('#txtamt').val(total);
                }
            });
            //$("#txtlocker").blur(function () {
            //    total = parseFloat($('#txtamt').val());
            //    num12 = parseFloat($("#txtlocker").val()); total = total + num12;
            //    $('#txtamt').val(total);
            //});
            $("#txtgames").bind('blur keyup', function (e) {
                if (e.type === 'blur' || e.keyCode === 13) {

                    total = 0;
                    num13 = parseFloat($("#txtgames").val()) + num12;
                    total = total + num13; $('#txtamt').val(total);
                }
            });
            //$("#txtgames").blur(function () {
            //    total = parseFloat($('#txtamt').val());
            //    num13 = parseFloat($("#txtgames").val()); total = total + num13;
            //    $('#txtamt').val(total);
            //});
            $("#txtboard").bind('blur keyup', function (e) {
                if (e.type === 'blur' || e.keyCode === 13) {

                    total = 0;
                    num14 = parseFloat($("#txtboard").val()) + num13;
                    total = total + num14; $('#txtamt').val(total);
                }
            });
            //$("#txtboard").blur(function () {
            //    total = parseFloat($('#txtamt').val());
            //    num14 = parseFloat($("#txtboard").val()); total = total + num14;
            //    $('#txtamt').val(total);
            //}); 
            $("#txtexact").bind('blur keyup', function (e) {
                if (e.type === 'blur' || e.keyCode === 13) {

                    total = 0;
                    num15 = parseFloat($("#txtexact").val()) + num14;
                    total = total + num15; $('#txtamt').val(total);
                }
            });
            //$("#txtexact").blur(function () {
            //    total = parseFloat($('#txtamt').val());
            //    num15 = parseFloat($("#txtexact").val()); total = total + num15;
            //    $('#txtamt').val(total);
            //});
            $("#txtdev").bind('blur keyup', function (e) {
                if (e.type === 'blur' || e.keyCode === 13) {

                    total = 0;
                    num16 = parseFloat($("#txtdev").val()) + num15;
                    total = total + num16; $('#txtamt').val(total);
                }
            });
            //$("#txtdev").blur(function () {
            //    total = parseFloat($('#txtamt').val());
            //    num16 = parseFloat($("#txtdev").val()); total = total + num16;
            //    $('#txtamt').val(total);
            //});
          
        });

        function savedata() {
            if ($("#txtname").val() == "") {

                noty({ text: 'Enter  Package Name', layout: 'topRight', type: 'information' });
                setTimeout(function () { $.noty.closeAll(); }, 3000);
              
                return false;
            }
            if ($("select[id$=ddlyear]").val() == "0") {

                noty({ text: 'Select Year', layout: 'topRight', type: 'information' });
                setTimeout(function () { $.noty.closeAll(); }, 3000);
               
                return false;
            }
            if ($("select[id$=ddlclass]").val() == "0") {

                noty({ text: 'Select Class', layout: 'topRight', type: 'information' });
                setTimeout(function () { $.noty.closeAll(); }, 3000);
                return false;
            }
            if ($("select[id$=ddldivison]").val() == "0") {

                noty({ text: 'Select Division', layout: 'topRight', type: 'information' });
                setTimeout(function () { $.noty.closeAll(); }, 3000);
              
                return false;
            }
            //if ($("#txtamt").val() == "") {

            //    noty({ text: 'Enter  Total Amount', layout: 'topRight', type: 'information' });
            //    setTimeout(function () { $.noty.closeAll(); }, 3000);
            //    setTimeout(function () { $.noty.closeAll(); }, 3000);
            //    return false;
            //}
            //if ($("#txtremark").val() == "") {

            //    noty({ text: 'Enter  Remark ', layout: 'topRight', type: 'information' });
            //    setTimeout(function () { $.noty.closeAll(); }, 3000);
            //    setTimeout(function () { $.noty.closeAll(); }, 3000);
            //    return false;
            //}
            //if ($("#txttax").val() == "") {

            //    noty({ text: 'Enter  Tax ', layout: 'topRight', type: 'information' });
            //    setTimeout(function () { $.noty.closeAll(); }, 3000);
            //    setTimeout(function () { $.noty.closeAll(); }, 3000);
            //    return false;
            //}
            //if ($("#txtadm").val() == "") {

            //    noty({ text: 'Enter  Admission Fees ', layout: 'topRight', type: 'information' });
            //    setTimeout(function () { $.noty.closeAll(); }, 3000);
            //    setTimeout(function () { $.noty.closeAll(); }, 3000);
            //    return false;
            //}
            //if ($("#txttution").val() == "") {

            //    noty({ text: 'Enter  Tution Fee ', layout: 'topRight', type: 'information' });
            //    setTimeout(function () { $.noty.closeAll(); }, 3000);
            //    setTimeout(function () { $.noty.closeAll(); }, 3000);
            //    return false;
            //}
            //if ($("#txtmoney").val() == "") {

            //    noty({ text: 'Enter  Caution Money ', layout: 'topRight', type: 'information' });
            //    setTimeout(function () { $.noty.closeAll(); }, 3000);
            //    setTimeout(function () { $.noty.closeAll(); }, 3000);
            //    return false;
            //}
            //if ($("#txtcoll").val() == "") {

            //    noty({ text: 'Enter  College Magzine Fees ', layout: 'topRight', type: 'information' });
            //    setTimeout(function () { $.noty.closeAll(); }, 3000);
            //    setTimeout(function () { $.noty.closeAll(); }, 3000);
            //    return false;
            //}
            //if ($("#txtide").val() == "") {

            //    noty({ text: 'Enter  Identity Card Fees ', layout: 'topRight', type: 'information' });
            //    setTimeout(function () { $.noty.closeAll(); }, 3000);
            //    setTimeout(function () { $.noty.closeAll(); }, 3000);
            //    return false;
            //}
            //if ($("#txtinsu").val() == "") {

            //    noty({ text: 'Enter  Insurance ', layout: 'topRight', type: 'information' });
            //    setTimeout(function () { $.noty.closeAll(); }, 3000);
            //    setTimeout(function () { $.noty.closeAll(); }, 3000);
            //    return false;
            //}
            //if ($("#txtuni").val() == "") {

            //    noty({ text: 'Enter  University Fees ', layout: 'topRight', type: 'information' });
            //    setTimeout(function () { $.noty.closeAll(); }, 3000);
            //    setTimeout(function () { $.noty.closeAll(); }, 3000);
            //    return false;
            //}
            //if ($("#txteligi").val() == "") {

            //    noty({ text: 'Enter  Eligibility Fee ', layout: 'topRight', type: 'information' });
            //    setTimeout(function () { $.noty.closeAll(); }, 3000);
              
            //    return false;
            //}
            //if ($("#txtbus").val() == "") {

            //    noty({ text: 'Enter  Bus Fees ', layout: 'topRight', type: 'information' });
            //    setTimeout(function () { $.noty.closeAll(); }, 3000);
              
            //    return false;
            //}
            //if ($("#txtexam").val() == "") {

            //    noty({ text: 'Enter  Examination Fee ', layout: 'topRight', type: 'information' });
            //    setTimeout(function () { $.noty.closeAll(); }, 3000);
          
            //    return false;
            //}
            //if ($("#txtenroll").val() == "") {

            //    noty({ text: 'Enter  Enrollment Fee ', layout: 'topRight', type: 'information' });
            //    setTimeout(function () { $.noty.closeAll(); }, 3000);
              
            //    return false;
            //}
            //if ($("#txtlocker").val() == "") {

            //    noty({ text: 'Enter  Locker Fees ', layout: 'topRight', type: 'information' });
            //    setTimeout(function () { $.noty.closeAll(); }, 3000);
            
            //    return false;
            //}
            //if ($("#txtgames").val() == "") {

            //    noty({ text: 'Enter  Games&sports Fees ', layout: 'topRight', type: 'information' });
            //    setTimeout(function () { $.noty.closeAll(); }, 3000);
            
            //    return false;
            //}
            //if ($("#txtboard").val() == "") {

            //    noty({ text: 'Enter  Board Fees ', layout: 'topRight', type: 'information' });
            //    setTimeout(function () { $.noty.closeAll(); }, 3000);
               
            //    return false;
            //}
            //if ($("#txtexact").val() == "") {

            //    noty({ text: 'Enter  Extracurricular Activity Fees ', layout: 'topRight', type: 'information' });
            //    setTimeout(function () { $.noty.closeAll(); }, 3000);
          
            //    return false;
            //}
            //if ($("#txtdev").val() == "") {

            //    noty({ text: 'Enter  Development fees ', layout: 'topRight', type: 'information' });
            //    setTimeout(function () { $.noty.closeAll(); }, 3000);
               
            //    return false;
            //}
            
            var obj = {}; 

            obj.packgenme = $("#txtname").val()
            obj.year = $('select[id$=ddlyear]').val()
            obj.classdetail = $('select[id$=ddlclass]').val()
            obj.divisiondet = $('select[id$=ddldivison]').val()
            obj.amount = $("#txtamt").val()
            obj.remark = $("#txtremark").val()
            obj.tax = $("#txttax").val()
            obj.admissionfee = $("#txtadm").val()
            obj.tuitionfee = $("#txttution").val()
            obj.cautionmny = $("#txtmoney").val()
            obj.collegefee = $("#txtcoll").val()
            obj.identycrdfee = $("#txtide").val()
            obj.insurance = $("#txtinsu").val()
            obj.unifees = $("#txtuni").val()
            obj.eligibilityfee = $("#txteligi").val()
            obj.busfee = $("#txtbus").val()
            obj.exminfee = $("#txtexam").val()
            obj.enrollfee = $("#txtenroll").val()
            obj.lockerfee = $("#txtlocker").val()
            obj.gmespofee = $("#txtgames").val()
            obj.boardfee = $("#txtboard").val()
            obj.exactivityfee = $("#txtexact").val()
            obj.developfee = $("#txtdev").val()
            $.ajax({
                type: "POST",
                url: "Feesetup.aspx/SavaData",
                data: JSON.stringify(obj),
                contentType: "application/JSON; charset=utf-8",
                datatype: "JSON",
                success: function (response) {
                    //window.location.reload();
                 
                    datatable();
                    Clear();
                    noty({ text: 'Insert Successfully', layout: 'topRight', type: 'information' });
                    setTimeout(function () { $.noty.closeAll(); }, 3000);

                },
                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);

                }

            });
        }

        var id1 = "";
        function editdata(id) {
            $.ajax({

                url: "Feesetup.aspx/EditData",
                contentType: "application/JSON; charset=utf-8",
                method: "post",
                datatype: "JSON",
                data: "{id:'" + id + "'}",
                success: function (data) {
                    data = JSON.parse(data.d);
                    console.log(data);
                    $("#txtname").val(data[0].packgenme);
                    $("select[id$=ddlyear]").val(data[0].year).change();
                    $("select[id$=ddlclass]").val(data[0].classdetail).change();
                    $("select[id$=ddldivison]").val(data[0].divisiondet).change();
                    $("#txtamt").val(data[0].amount);
                    $("#txtremark").val(data[0].remark);
                    $("#txttax").val(data[0].tax);
                    $("#txtadm").val(data[0].admissionfee);
                    $("#txttution").val(data[0].tuitionfee);
                    $("#txtmoney").val(data[0].cautionmny);
                    $("#txtcoll").val(data[0].collegefee);
                    $("#txtide").val(data[0].identycrdfee);
                    $("#txtinsu").val(data[0].insurance);
                    $("#txtuni").val(data[0].unifees);
                    $("#txteligi").val(data[0].eligibilityfee);
                    $("#txtbus").val(data[0].busfee);
                    $("#txtexam").val(data[0].exminfee);
                    $("#txtenroll").val(data[0].enrollfee);
                    $("#txtlocker").val(data[0].lockerfee);
                    $("#txtgames").val(data[0].gmespofee);
                    $("#txtboard").val(data[0].boardfee);
                    $("#txtexact").val(data[0].exactivityfee);
                    $("#txtdev").val(data[0].developfee);
                    id1 = id;
                    
                    $("#btnSubmit").val('Update');

                }
            });
        }
        function updatedata() {
            var obj1 = {};
            obj1.id = id1;
            obj1.packgenme = $("#txtname").val();
            obj1.year = $('select[id$=ddlyear]').val();
            obj1.classdetail = $('select[id$=ddlclass]').val();
            obj1.divisiondet = $('select[id$=ddldivison]').val();
            obj1.amount = $("#txtamt").val();
            obj1.remark = $("#txtremark").val();
            obj1.tax = $("#txttax").val();
            obj1.admissionfee = $("#txtadm").val();
            obj1.tuitionfee = $("#txttution").val();
            obj1.cautionmny = $("#txtmoney").val();
            obj1.collegefee = $("#txtcoll").val();
            obj1.identycrdfee = $("#txtide").val();
            obj1.insurance = $("#txtinsu").val();
            obj1.unifees = $("#txtuni").val();
            obj1.eligibilityfee = $("#txteligi").val();
            obj1.busfee = $("#txtbus").val();
            obj1.exminfee = $("#txtexam").val();
            obj1.enrollfee = $("#txtenroll").val();
            obj1.lockerfee = $("#txtlocker").val();
            obj1.gmespofee = $("#txtgames").val();
            obj1.boardfee = $("#txtboard").val();
            obj1.exactivityfee = $("#txtexact").val();
            obj1.developfee = $("#txtdev").val();

           

            $.ajax({

                url: "Feesetup.aspx/UpdateData",
                contentType: "application/JSON; charset=utf-8",
                method: "post",
                datatype: "JSON",
                data: JSON.stringify(obj1),
                success: function (data) {
                    datatable();
                    Clear();
                    $("#btnSubmit").val("Update");
                    noty({ text: 'Update Successfully', layout: 'topRight', type: 'information' });
                    setTimeout(function () { $.noty.closeAll(); }, 3000);
                }
            });
        }
        function datatable() {
            $.ajax({
                type: "POST",
                url: "Feesetup.aspx/GetData",
                contentType: "application/JSON; charset=utf-8",

                datatype: "JSON",
                success: function (data) {
                    var table = $('#dataemp').DataTable();
                    data = JSON.parse(data.d);
                    table.clear();
                    for (var i = 0,count = 1; i < data.length; i++,count++) {
                        var ddyear1 = data[i].fromdate;
                        var ddyear2 = data[i].todate;
                        var dtyear1 = new Date(ddyear1);
                        var dtyear2 = new Date(ddyear2);
                        var stryr = dtyear1.getFullYear() + "-" + dtyear2.getFullYear();
                        table.row.add([
                             count, data[i].packageids, data[i].packgenme, data[i].clsname, data[i].divsname, stryr, data[i].amount, data[i].pkgdate,
                             "<button  style='height:35px; width: 35px; padding-left:7px;' type='button' onclick=editdata('" + data[i].id + "') id='btnedit' class='btn btn-success' data-bs-toggle='modal' data-bs-target='#exampleLargeModal5' ><i class='bx bx-message-square-edit'></i></button> <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;' type='button' class='btn btn-primary'><i class='lni lni-save'></i></button> <button  style='height:35px; width: 35px; padding-left:7px;' type='button' class='btn btn-dark'><i class='bx bx-x'></i></span></button>",

                        ]).draw(true);

                    }
                }
            });
        }
        function deletedata(id1) {

            $.ajax({

                url: "Feesetup.aspx/DeleteData",
                contentType: "application/JSON; charset=utf-8",
                method: "post",
                datatype: "JSON",
                data: "{id:'" + id1 + "'}",
                success: function (data) {
                    datatable();
                    noty({ text: 'Delete Successfully', layout: 'topRight', type: 'information' });
                    setTimeout(function () { $.noty.closeAll(); }, 3000);

                }
            });
        }
        function Clear() {
            $("#txtname").val('');
           $('select[id$=ddlyear]').val('').change();
           $('select[id$=ddlclass]').val('').change();
           $('select[id$=ddldivison]').val('').change();
           $("#txtamt").val('');
           $("#txtremark").val('');
           $("#txttax").val('');
           $("#txtadm").val('');
           $("#txttution").val('');
           $("#txtmoney").val('');
           $("#txtcoll").val('');
           $("#txtide").val('');
           $("#txtinsu").val('');
           $("#txtuni").val('');
           $("#txteligi").val('');
           $("#txtbus").val('');
           $("#txtexam").val('');
           $("#txtenroll").val('');
           $("#txtlocker").val('');
           $("#txtgames").val('');
           $("#txtboard").val('');
           $("#txtexact").val('');
           $("#txtdev").val('');
        }

        function getdata12() {

            $.ajax({
                url: "Feesetup.aspx/Getdata12",
                method: "post",
                contentType: "application/json; charset=utf-8",
                data: "{srchyear:'" + $("select[id$=ddlyears]").val() + "', srchclass:'" + $("select[id$=ddlsclass]").val() + "',srchdivision:'" + $("select[id$=ddldivision]").val() + "'}",
                dataType: "json",
                success: function (data) {
                    console.log(JSON.stringify(data));
                    data = JSON.parse(data.d);

                    $("#dataemp").show();
                    $("#itembody1").empty();

                    for (var i = 0; i < data.length ; i++) {
                        {
                            var markup = '<tr ><td >' + data[i].id + '</td><td >' + data[i].packid + '</td><td >' + data[i].packgenme + '</td><td>' + data[i].classdetail + '</td><td> ' + data[i].divisiondet + '</td><td> ' + data[i].year + '</td><td> ' + data[i].amount + '</td><td> ' + date + '</td></tr> '
                            $("#itembody1").append(markup);
                        }
                    }
                },
                error: function () {
                    //alert("Error in display");
                    noty({ text: 'Get Error', layout: 'topRight', type: 'error' });
                    setTimeout(function () { $.noty.closeAll(); }, 3000);
                }
            });
        }

    </script>

    <!--start page wrapper -->
		<!--start page wrapper -->
		<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>Fees Setup</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">
									<%--<option selected>Select</option>
									<option>2020-2021</option>
									<option>2021-2022</option>
									<option>2022-2023</option>			--%>						
								</select>
							</div>														
							<div class="col-md-2">
								<label>Class</label>
								<select id="ddlsclass" class="form-select mb-3" aria-label="Default select example">
							 <%--  <option value="">Select</option>
							   <option value="BPharm">B.Pharm</option>
								<option >M.Pharm</option>
                                    <option >D.Pharm</option>	--%>		
														
								</select>
							</div>
							<div class="col-md-2">
								<label>Division</label>
								<select id="ddldivision" class="form-select mb-3" aria-label="Default select example">
									<%--<option selected>Select</option>
									<option>1st</option>
									<option>2nd</option>
									<option>3rd</option>
									<option >4th</option>			--%>													
								</select>
							</div>														
					       <div class="col-md-3" style="margin-top: 4.7vh;">
							<button type="button" onclick="getdata12();" class="btn btn-primary" title="search"><i class='bx bx-search'></i>Search</button>
							<button style="height:35px; width: 35px; padding-left:7px;" type="button" title="Add Package"  class="btn btn-secondary" data-bs-toggle="modal" data-bs-target="#exampleLargeModal5"><i class="fadeIn animated bx bx-user-plus"></i>
											</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>
				   <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>Sr.no </th>	
										   <th>Package ID</th>
										   <th>Package Name</th>  
										   <th>Class Name</th>
										   <th>Divison</th>
										   <th>Academic Year</th>
										   <th>Total Amount</th>
										   <th>Create Date</th>
										   <th style="background-color:white;">Action</th>
									   </tr>
								   </thead>
                             
								   <%--<tbody>
									<tr>
										<td></td>
										<td><input></td>
										<td><input></td>
										<td><input></td>
										<td><input></td>
										<td><input></td>
										<td><input></td>
										<td><input></td>
										<td style="background-color:white;"></td>
									</tr>
									   <tr>
										   <td>1</td>
										   <td>1321</td>	
										   <td>CAP</td>
										   <td>B.Pharm</td>
										   <td>1st Year</td>
										   <td>12-14-2022</td>
										   <td>749.00</td>
										   <td>14-10-2022</td>
										   <td style="background-color: white;">
											<button style="height:35px; width: 35px; padding-left:7px;" type="button" class="btn btn-secondary" data-bs-toggle="modal" data-bs-target="#exampleLargeModal5"><i class="fadeIn animated bx bx-user-plus"></i>
											</button>							
											<button  style="height:35px; width: 35px; padding-left:7px;" type="button" class="btn btn-success"  data-bs-toggle="modal" 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" class="btn btn-danger"><i class="fadeIn animated bx bx-trash-alt"></i>
											</button>
											<button  style="height:35px; width: 35px; padding-left:7px;" type="button" class="btn btn-primary"><i class="lni lni-save"></i>
											</button>
										   </td>										
										   </tr>
										   <tr>
											<td>2</td>
											<td>1321</td>	
											<td>APC</td>
											<td>M.Pharm</td>
											<td>1st Year</td>
											<td>12-14-2022</td>
											<td>749.00</td>
											<td>14-10-2022</td>
											<td style="background-color: white;">
											 <button style="height:35px; width: 35px; padding-left:7px;" type="button" class="btn btn-secondary" data-bs-toggle="modal" data-bs-target="#exampleLargeModal5"><i class="fadeIn animated bx bx-user-plus"></i>
											 </button>								
											 <button style="height:35px; width: 35px; padding-left:7px;" type="button" class="btn btn-success"  data-bs-toggle="modal" data-bs-target="#exampleLargeModal5" ><i class='bx bx-message-square-edit'></i>
											 </button>
											 <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>
											 <button style="height:35px; width: 35px; padding-left:7px;" type="button" class="btn btn-primary"><i class="lni lni-save"></i>
											 </button>
											</td>										
											</tr>
									   </tbody>--%>
							   </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">Package Details</h5>
						   <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
					   </div>
					   <div class="modal-body">
						<form class="row g-2">
							<div class="col-md-3">
								<label>Package Name<font color="#FF0000">*</font></label>
								<input class="form-control mb-3" id="txtname" type="text" placeholder="Package Name"
									aria-label="default input example">
							</div>
							<div class="col-md-3">
								<label>Year<font color="#FF0000">*</font></label>
								<select class="form-select mb-3" id="ddlyear" aria-label="Default select example">
								<%--	<option value="">Select Year</option>
									<option value="2020-2021">2020-2021</option>
									<option value="2021-2022">2021-2022</option>
									<option value="2022-2023">2022-2023</option>--%>
									
							
								</select>
							</div>
							
							


							<div class="col-md-3">
								<label>Class<font color="#FF0000">*</font></label>
								<select class="form-select mb-3" id="ddlclass" aria-label="Default select example">
								<%--	<option value="">Select Class</option>
									<option value="B.Pharm">B.Pharm</option>
								<option value="M.Pharm">M.Pharm</option>
								<option value="MSC">MSC</option>
								<option value="Bsc">Bsc</option>
								<option value="D.Pharm">D.Pharm</option>--%>
																
								</select>
							</div>
							<div class="col-md-3">
								<label>Division<font color="#FF0000">*</font></label>
								<select class="form-select mb-3" id="ddldivison" aria-label="Default select example">
								<%--	<option value="">Select Division</option>
									<option value="1styr">1st Year</option>
									<option value="2ndyr">2nd Year</option>
									<option value="3rdyear">3rd Year</option>
									<option value="4thyr">4th Year</option>
									--%>
							
								</select>
							</div>
							
							
					      
                           </form>
	
					<div class="overlay toggle-icon"></div>
					<hr/>
					<div class="col-md-12 mx-auto">
					<div class="card">
						<div class="card-body">
							<div class="table-responsive">
								<table id="Table1" class="table table-striped table-bordered">
									<thead>
										<tr>
											<th>Sr.no </th>	
											<th>Fee Category</th>
											<th>Amount</th>  
											
										</tr>
									</thead>
									<tbody>
									 
										<tr>
											<td>1</td>
											<td >Addmisson Fee</td>	
											<td><input id="txtadm" placeholder="Enter Addmisson Fee" /></td>
										</tr>
											<tr>
												<td>2</td>
												<td >Tution Fees</td>	
												<td><input id="txttution" placeholder="Enter Tution Fee" /></td>
											</tr>
                                        <tr>
												<td>3</td>
												<td>Caution Money</td>	
												<td><input id="txtmoney" placeholder=" Enter Caution Money" /></td>
											</tr>
                                        <tr>
												<td>4</td>
												<td >College Magzine Fees</td>	
												<td><input id="txtcoll" placeholder="Enter College Magzine Fees" /></td>
											</tr>
                                        <tr>
												<td>5</td>
												<td >Indentity Card Fees</td>	
												<td><input id="txtide" placeholder="Enter Indentity Card Fees" /></td>
											</tr>
											<tr>
												<td>6</td>
												<td >Insurance</td>	
												<td><input id="txtinsu" placeholder="Enter Insurance" /></td>
											</tr>
											<tr>
												<td>7</td>
												<td >University Fees</td>	
												<td><input id="txtuni" placeholder="Enter University Fees" /></td>
											</tr>
											<tr>
												<td>8</td>
												<td >Eligibility Fees</td>	
												<td><input id="txteligi" placeholder="Enter Eligibility Fee" /></td>
											</tr>
											<tr>
												<td>9</td>
												<td >Bus Fees</td>	
												<td><input id="txtbus" placeholder="Enter Bus Fee" /></td>
											</tr>
                                        <tr>
												<td>10</td>
												<td >Examination Fees</td>	
												<td><input id="txtexam" placeholder="Enter Examination Fee"></td>
											</tr>
                                      
                                             <tr>
												<td>11</td>
												<td >Enrollment Fees</td>	
												<td><input id="txtenroll" placeholder="Enter Examination Fee" /></td>
											</tr>
                                        
                                   <tr>
												<td>12</td>
												<td >Locker Fees</td>	
												<td><input id="txtlocker" placeholder="Enter Locker Fees" /></td>
											</tr>
                                        <tr>
												<td>13</td>
												<td >Games&sports Fees</td>	
												<td><input  id="txtgames" placeholder="Enter Games&sports Fees" /></td>
											</tr>
											<tr>
												<td>14</td>
												<td >Board Fees</td>	
												<td><input id="txtboard" placeholder="Enter Board Fees" /></td>
											</tr>
											<tr>
												<td>15</td>
												<td >Extracurricular Activity Fees</td>	
												<td><input id="txtexact" placeholder="Enter Extracurricular Activity Fees" /></td>
											</tr>
											<tr>
												<td>16</td>
												<td >Development fees</td>	
												<td><input id="txtdev" placeholder="Enter Development fees" /></td>
											</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>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>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-2" style="margin-top: 4vh;">
						<button type="button" id="btnSubmit"  value="Submit" class="btn btn-primary">Submit</button>
						</div>
					   </form>
				</div>
				</div>
			</div>
                   </div>
               </div>
               </div>
                   	</asp:Content>

