<%@ page title="" language="C#" masterpagefile="~/Pages/Common/MasterPages/MobileViewMasterPage.master" autoeventwireup="true" inherits="Pages_MobileView_StudentAttendanceDetailsOrgWiseDashBoard, App_Web_3jc1dqf5" enableEventValidation="false" viewStateEncryptionMode="Never" %>

<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
    <script>
        var TypeId = 0;
        var UpToDate = '';
        var OrgGroupId = 0;
        var OrgId = 0;
        var ClassId = 0;
        var GenderType = 0;
        var statusMaintain = 0;

        var Count = 0;
        var drpOrgGroup = '';
        var drpBatch = '';
        var OrgBatchId = 0;
        //var StatusId;
        var statusId = 0;
        var surl = "";
        var ShowType = "";
        var CommonOrgGroupBatchId = 0;

        $(document).ready(function () {

            // debugger;
            var myurl = window.location.href;
            var url = decodeURIComponent(myurl);
            //   console.log(url);
            var keyval = myurl.split('?')[1].split('&');

            TypeId = parseInt(keyval[0].split('=')[1].toString());
            UpToDate = (keyval[1].split('=')[1].toString());
            OrgGroupId = parseInt(keyval[2].split('=')[1].toString());
            OrgId = parseInt(keyval[3].split('=')[1].toString());
            ClassId = parseInt(keyval[4].split('=')[1].toString());
            GenderType = parseInt(keyval[5].split('=')[1].toString());
            CommonOrgGroupBatchId = parseInt(keyval[6].split('=')[1].toString());

            if (ClassId == 0) {

                if (TypeId == 2) {

                    //surl = "../MobileView/StudentAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=" + TypeId + "&UpToDate=" + UpToDate + "&OrgGroupId=" + parseInt(OrgGroupId) + "&OrgId=" + parseInt(OrgId) + "&DivisionId=" + DivisionId + "&GenderType=" + GenderType + "";
                    //$('#ctl00_CP_hfUrl').val(surl);
                    StudentAttendanceDetailsOrgWiseDataBind();


                }
                else if (TypeId == 11 || TypeId == 21 || TypeId == 12 || TypeId == 22 || TypeId == 13 || TypeId == 23) {

                    if (TypeId == 11 || TypeId == 12 || TypeId == 13) {
                        ShowType = "OrgGroup";
                    }
                    else {
                        ShowType = "Org";
                    }
                    StudentAttendanceDivisionDetailsDataBind();

                }
                else if (TypeId == 14 || TypeId == 24 || TypeId == 15 || TypeId == 25 || TypeId == 16 || TypeId == 26 || TypeId == 17 || TypeId == 27) {
                    StudentAttendanceStudentContactDetails();
                }
                else if (TypeId == 18 || TypeId == 28) {
                    StudentAttendanceClassDetails();

                }

            }
            else if (ClassId != 0) {

                StudentDivisionDetails();
            }

            //Count = parseInt(keyval[1].split('=')[1].toString());
            //  OrgGroupNameGet();
            //CurrentBatchGet();
            //var tblDropdown = "<tr><th style='width: 65.3%;'><select id='drpOrganization' class='form-control' onchange='OrganizationFunction()'><option value='0'>Select</option></select></th><th><select id='drpBatch' class='form-control' onchange='BatchFunction()'><option value='0'>Select</option></select></th></tr>";
            // document.getElementById("tblDropdown").innerHTML = tblDropdown;

            //ReceiptBookCollectionDataBind();



            // ReceiptBookCollectionDataBind();


        });


        //function BackOrgFunction() {
        //    //alert(statusId);
        //    debugger;
        //    if (statusId != 0 || statusId != null) {


        //        if (statusId == 5) {
        //            window.location.href = surl;

        //            //alert(statusId);
        //            //document.getElementById("tblStudentAttndDetailsOrgWise").style.display = "block";
        //            //document.getElementById("StudentAttndDetailsOrgWiseHead").style.display = "block";
        //            //document.getElementById("StudentDetailsHead").style.display = "none";
        //            //document.getElementById("tblStudentDetails").style.display = "none";


        //            //document.getElementById("StudentClassHead").style.display = "none";
        //            //document.getElementById("tblClassDetails").style.display = "none";
        //            //document.getElementById("DivisionHead").style.display = "none";
        //            //document.getElementById("tblDivisionDetails").style.display = "none";
        //            //statusId--;
        //        }
        //        else if (statusId == 4) {
        //            document.getElementById("StudentDetailsHead").style.display = "none";
        //            document.getElementById("tblStudentDetails").style.display = "none";
        //            document.getElementById("StudentAttndDetailsOrgWiseHead").style.display = "none";
        //            document.getElementById("tblStudentAttndDetailsOrgWise").style.display = "none";

        //            document.getElementById("StudentAttndDivisionDetailsHead").style.display = "block";
        //            document.getElementById("tblStudentAttndDivisionDetails").style.display = "block";
        //            document.getElementById("StudentClassHead").style.display = "none";
        //            document.getElementById("tblClassDetails").style.display = "none";
        //            document.getElementById("DivisionHead").style.display = "none";
        //            document.getElementById("tblDivisionDetails").style.display = "none";
        //            statusId--;

        //        }
        //        else if (statusId == 3) {
        //            window.location.href = surl;
        //            //document.getElementById("StudentAttndDetailsOrgWiseHead").style.display = "none";
        //            //document.getElementById("tblStudentAttndDetailsOrgWise").style.display = "none";

        //            //document.getElementById("StudentDetailsHead").style.display = "none";
        //            //document.getElementById("tblStudentDetails").style.display = "none";

        //            //document.getElementById("StudentAttndDivisionDetailsHead").style.display = "none";
        //            //document.getElementById("tblStudentAttndDivisionDetails").style.display = "none";
        //            //document.getElementById("StudentClassHead").style.display = "none";
        //            //document.getElementById("tblClassDetails").style.display = "none";
        //            //document.getElementById("DivisionHead").style.display = "none";
        //            //document.getElementById("tblDivisionDetails").style.display = "none";
        //            //statusId--;

        //            //window.location.href = surl;
        //        }
        //        else if (statusId == 2) {
        //            document.getElementById("StudentClassHead").style.display = "block";
        //            document.getElementById("tblClassDetails").style.display = "block";
        //            document.getElementById("StudentDetailsHead").style.display = "none";
        //            document.getElementById("tblStudentDetails").style.display = "none";
        //            document.getElementById("StudentAttndDetailsOrgWiseHead").style.display = "none";
        //            document.getElementById("tblStudentAttndDetailsOrgWise").style.display = "none";
        //            document.getElementById("StudentAttndDivisionDetailsHead").style.display = "none";
        //            document.getElementById("tblStudentAttndDivisionDetails").style.display = "none";
        //            document.getElementById("DivisionHead").style.display = "none";
        //            document.getElementById("tblDivisionDetails").style.display = "none";
        //            statusId--;
        //        }
        //        else if (statusId == 1) {
        //            document.getElementById("StudentClassHead").style.display = "none";
        //            document.getElementById("tblClassDetails").style.display = "none";
        //            document.getElementById("StudentDetailsHead").style.display = "none";
        //            document.getElementById("tblStudentDetails").style.display = "none";
        //            document.getElementById("StudentAttndDetailsOrgWiseHead").style.display = "none";
        //            document.getElementById("tblStudentAttndDetailsOrgWise").style.display = "none";
        //            document.getElementById("StudentAttndDivisionDetailsHead").style.display = "none";
        //            document.getElementById("tblStudentAttndDivisionDetails").style.display = "none";
        //            document.getElementById("DivisionHead").style.display = "block";
        //            document.getElementById("tblDivisionDetails").style.display = "block";
        //            statusId--;
        //        }
        //        else {
        //            window.location.href = "../MobileView/ConsolidateDashBoard.aspx";
        //        }
        //    }
        //    else {
        //        window.location.href = "../MobileView/ConsolidateDashBoard.aspx";
        //    }
        //}



        function BackOrgFunction() {
            //debugger;
            if ($('#StudentAttndDetailsOrgWiseHead').css('display') == "block") {
                window.location.href = "../MobileView/ConsolidateDashBoard.aspx";
            }
            else {
                history.go(-1);
            }
        }
        //function OrganizationFunction() {

        //    OrgGroupId = $("#drpOrganization").val();
        //    // $("#drpOrganization").val(OrgGroupId);
        //    CurrentBatchGet();
        //}
        //function CurrentBatchGet() {
        //    $.ajax({
        //        type: "POST",
        //        url: "ConsolidateReceiptDetailsDashBoard.aspx/GetBatch",
        //        data: JSON.stringify({ "OrgGroupId": parseInt(OrgGroupId) }),
        //        contentType: "application/json; charset=utf-8",
        //        dataType: "json",
        //        success: function (result) {
        //            drpBatch = (result.d);
        //            // OrgBatchId = $("#drpBatch").val();

        //            $("#drpBatch").html(drpBatch);


        //            //alert(OrgBatchId);

        //        },
        //        error: function (xhr, status, error) {
        //            var err = eval("(" + xhr.responseText + ")");
        //            console.log(err.Message);
        //        }
        //    });
        //}
        //function BatchFunction() {

        //    OrgBatchId = $("#drpBatch").val();
        //    // $("#drpBatch").val(OrgBatchId);
        //    ReceiptBookCollectionDataBind();
        //}
        function StudentDivisionDetails() {
            //alert("hi");
            $.ajax({
                //async: false,
                type: "POST",
                url: "StudentAttendanceDetailsOrgWiseDashBoard.aspx/StudentDivisionDetails",
                data: JSON.stringify({ "TypeId": parseInt(TypeId), "UpToDate": UpToDate, "OrgGroupId": parseInt(OrgGroupId), "OrgId": parseInt(OrgId), "ClassId": parseInt(ClassId), "GenderType": parseInt(GenderType), "CommonOrgGroupBatchId": parseInt(CommonOrgGroupBatchId) }),
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (result) {

                    // debugger;
                    var obj = (result.d);
                    var tblDivisionDetails = "";

                    //l = "";
                    ///  var total = 0;

                    if (obj != "") {
                        tblDivisionDetails += "<tr><th>Class-Division</th><th>StudentId</th><th>Student Name</th><th>Contact No</th></tr>";
                        $.each(obj, function (i, item) {
                            //tblStudentAttndGroupWiseDetail += "<tr><td>" + item.OrgGroupId + "</td><td><a href='../MobileView/ConsolidateReceiptDetailsDashBoard.aspx?OrgId=" + encodeURIComponent(item.OrgGroupId) + "&Count=1'>" + item.ReceiptCount + "</a></td><td><a href='../MobileView/ConsolidateReceiptDetailsDashBoard.aspx?OrgId=" + encodeURIComponent(item.OrgGroupId) + "&Count=2'>" + item.ReceiptAmount + "</a></td><td><a href='../MobileView/ConsolidateReceiptDetailsDashBoard.aspx?OrgId=" + encodeURIComponent(item.OrgGroupId) + "&Count=3'>" + item.CancelAmount + "</a></td></tr>";

                            tblDivisionDetails += "<tr><td>" + item.ClassDivision + "</td><td>" + item.StudentId + "</td><td>" + item.StudentName + "</td><td>" + item.ContactNo + "</td></tr>";



                            //total += parseInt(item.StudentCount);
                        });
                        //tblFeeStatus += "<tr><td style='font-weight:bold'>Total</td><td style='font-weight:bold'>" + total + "</td></tr>";
                    }
                    else { tblDivisionDetails += "<tr><td colspan='8' class='record'>No records found..!!</td></tr>"; }
                    $("#LoaderDiv1").css("display", "none");
                    document.getElementById("tblDivisionDetails").innerHTML = tblDivisionDetails;

                    document.getElementById("StudentClassHead").style.display = "none";
                    document.getElementById("tblClassDetails").style.display = "none";
                    document.getElementById("StudentDetailsHead").style.display = "none";
                    document.getElementById("tblStudentDetails").style.display = "none";
                    document.getElementById("StudentAttndDetailsOrgWiseHead").style.display = "none";
                    document.getElementById("tblStudentAttndDetailsOrgWise").style.display = "none";
                    document.getElementById("StudentAttndDivisionDetailsHead").style.display = "none";
                    document.getElementById("tblStudentAttndDivisionDetails").style.display = "none";
                    document.getElementById("DivisionHead").style.display = "block";
                    document.getElementById("tblDivisionDetails").style.display = "block";

                    debugger;
                    statusId = 1;
                    //alert(StatusId);

                },
                error: function (xhr, status, error) {
                    var err = eval("(" + xhr.responseText + ")");
                    console.log(err.Message);
                    $("#LoaderDiv1").hide();
                }
            });

        }

        function StudentAttendanceClassDetails() {
            $.ajax({
                //async: false,
                type: "POST",
                url: "StudentAttendanceDetailsOrgWiseDashBoard.aspx/StudentAttendanceClassDetails",
                data: JSON.stringify({ "TypeId": parseInt(TypeId), "UpToDate": UpToDate, "OrgGroupId": parseInt(OrgGroupId), "OrgId": parseInt(OrgId), "CommonOrgGroupBatchId": parseInt(CommonOrgGroupBatchId) }),
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (result) {                    
                    var obj = (result.d);
                    var tblClassDetails = "";
                    //l = "";
                    ///  var total = 0;
                    var alreadyAdded = [];
                    if (obj != "") {
                        tblClassDetails += "<tr><th  style='display:none'>OrgGroupId</th><th  style='display:none'>OrgGroupTitle</th><th style='display:none'>OrgId</th><th  style='display:none'>OrgTitle</th><th>Class Code</th><th>Student Count</th><th>Teacher Name</th><th>Contact No</th></tr>";
                        $.each(obj, function (i, item1) {
                            //tblStudentAttndGroupWiseDetail += "<tr><td>" + item.OrgGroupId + "</td><td><a href='../MobileView/ConsolidateReceiptDetailsDashBoard.aspx?OrgId=" + encodeURIComponent(item.OrgGroupId) + "&Count=1'>" + item.ReceiptCount + "</a></td><td><a href='../MobileView/ConsolidateReceiptDetailsDashBoard.aspx?OrgId=" + encodeURIComponent(item.OrgGroupId) + "&Count=2'>" + item.ReceiptAmount + "</a></td><td><a href='../MobileView/ConsolidateReceiptDetailsDashBoard.aspx?OrgId=" + encodeURIComponent(item.OrgGroupId) + "&Count=3'>" + item.CancelAmount + "</a></td></tr>";

                            if (alreadyAdded.indexOf(item1.OrgId) >= 0)
                            { }
                            else
                            {
                                tblClassDetails += "<tr><th colspan='9'>" + item1.OrgTitle + "</th></tr>";
                                $.each(obj, function (i, item) {
                                    if (item.OrgId === item1.OrgId) {
                                        //tblAdmissionStatusCountOrgWise += "<tr><td>" + item.Status + "</td><td>" + item.StatusCount + "</td></tr>";
                                        //totaladmissionorgwise += parseInt(item.StatusCount);
                                        //tblStudentAttndGroupWiseDetail += "<tr><td >" + item.OrgGroupId + "</td><td><a href='../MobileView/ConsolidateReceiptDetailsDashBoard.aspx?OrgId=" + encodeURIComponent(item.OrgGroupId) + "&Count=1'>" + item.ReceiptCount + "</a></td><td><a href='../MobileView/ConsolidateReceiptDetailsDashBoard.aspx?OrgId=" + encodeURIComponent(item.OrgGroupId) + "&Count=2'>" + item.ReceiptAmount + "</a></td><td><a href='../MobileView/ConsolidateReceiptDetailsDashBoard.aspx?OrgId=" + encodeURIComponent(item.OrgGroupId) + "&Count=3'>" + item.CancelAmount + "</a></td></tr>";
                                        tblClassDetails += "<tr><td  style='display:none'>" + item.OrgGroupId + "</td><td  style='display:none'>" + item.OrgGroupTitle + "</td><td  style='display:none'>" + item.OrgId + "</td><td  style='display:none'>" + item.OrgTitle + "</td><td>" + item.ClassCode + "</td><td>" + item.StudentCount + "</td><td>" + item.ClassTeacher + "</td><td>" + item.ContactNo + "</td></tr>";
                                        // alert(item.Total);


                                        //total += parseInt(item.TotalStudent);
                                        //Maletotal += parseInt(item.Male);
                                        //FeMaletotal += parseInt(item.Female);
                                    }
                                    else {
                                    }
                                });
                                alreadyAdded.push(item1.OrgId);
                            }



                           



                            //total += parseInt(item.StudentCount);
                        });
                        //tblFeeStatus += "<tr><td style='font-weight:bold'>Total</td><td style='font-weight:bold'>" + total + "</td></tr>";
                    }
                    else { tblClassDetails += "<tr><td colspan='8' class='record'>No records found..!!</td></tr>"; }
                    $("#LoaderDiv1").css("display", "none");
                    document.getElementById("tblClassDetails").innerHTML = tblClassDetails;

                    document.getElementById("StudentClassHead").style.display = "block";
                    document.getElementById("tblClassDetails").style.display = "block";
                    document.getElementById("StudentDetailsHead").style.display = "none";
                    document.getElementById("tblStudentDetails").style.display = "none";
                    document.getElementById("StudentAttndDetailsOrgWiseHead").style.display = "none";
                    document.getElementById("tblStudentAttndDetailsOrgWise").style.display = "none";
                    document.getElementById("StudentAttndDivisionDetailsHead").style.display = "none";
                    document.getElementById("tblStudentAttndDivisionDetails").style.display = "none";
                    document.getElementById("DivisionHead").style.display = "none";
                    document.getElementById("tblDivisionDetails").style.display = "none";


                    statusId = 2;

                },
                error: function (xhr, status, error) {
                    var err = eval("(" + xhr.responseText + ")");
                    console.log(err.Message);
                    $("#LoaderDiv1").hide();
                }
            });

        }



        function StudentAttendanceStudentContactDetails() {
            surl = "../MobileView/StudentAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=2&UpToDate=" + UpToDate + "&OrgGroupId=" + parseInt(OrgGroupId) + "&OrgId=" + parseInt(OrgId) + "&DivisionId=0&GenderType=0&CommonOrgGroupBatchId=" + CommonOrgGroupBatchId + "";
            $.ajax({
                //async: false,
                type: "POST",
                url: "StudentAttendanceDetailsOrgWiseDashBoard.aspx/StudentAttendanceStudentContactDetails",
                data: JSON.stringify({ "TypeId": parseInt(TypeId), "UpToDate": UpToDate, "OrgGroupId": parseInt(OrgGroupId), "OrgId": parseInt(OrgId), "CommonOrgGroupBatchId": parseInt(CommonOrgGroupBatchId) }),
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (result) {

                    debugger;
                    var obj = (result.d);
                    var tblStudentDetails = "";
                    //l = "";
                    ///  var total = 0;

                    if (obj != "") {
                        tblStudentDetails += "<tr><th style='display:none'>OrgGroupId</th><th style='display:none'>OrgGroupTitle</th><th style='display:none'>OrgId</th><th style='display:none'>OrgTitle</th><th>Division Code</th><th>Student Id</th><th>Student Name</th><th>Contact No</th></tr>";
                        $.each(obj, function (i, item) {
                            //tblStudentAttndGroupWiseDetail += "<tr><td>" + item.OrgGroupId + "</td><td><a href='../MobileView/ConsolidateReceiptDetailsDashBoard.aspx?OrgId=" + encodeURIComponent(item.OrgGroupId) + "&Count=1'>" + item.ReceiptCount + "</a></td><td><a href='../MobileView/ConsolidateReceiptDetailsDashBoard.aspx?OrgId=" + encodeURIComponent(item.OrgGroupId) + "&Count=2'>" + item.ReceiptAmount + "</a></td><td><a href='../MobileView/ConsolidateReceiptDetailsDashBoard.aspx?OrgId=" + encodeURIComponent(item.OrgGroupId) + "&Count=3'>" + item.CancelAmount + "</a></td></tr>";

                            tblStudentDetails += "<tr><td style='display:none'>" + item.OrgGroupId + "</td><td style='display:none'>" + item.OrgGroupTitle + "</td><td style='display:none'>" + item.OrgId + "</td><td style='display:none'>" + item.OrgTitle + "</td><td>" + item.DivisionCode + "</td><td>" + item.StudentId + "</td><td>" + item.StudentName + "</td><td>" + item.ContactNo + "</td></tr>";



                            //total += parseInt(item.StudentCount);
                        });
                        //tblFeeStatus += "<tr><td style='font-weight:bold'>Total</td><td style='font-weight:bold'>" + total + "</td></tr>";
                    }
                    else { tblStudentDetails += "<tr><td colspan='8' class='record'>No records found..!!</td></tr>"; }
                    $("#LoaderDiv1").css("display", "none");
                    document.getElementById("tblStudentDetails").innerHTML = tblStudentDetails;

                    document.getElementById("StudentDetailsHead").style.display = "block";
                    document.getElementById("tblStudentDetails").style.display = "block";
                    document.getElementById("StudentAttndDetailsOrgWiseHead").style.display = "none";
                    document.getElementById("tblStudentAttndDetailsOrgWise").style.display = "none";
                    document.getElementById("StudentAttndDivisionDetailsHead").style.display = "none";
                    document.getElementById("tblStudentAttndDivisionDetails").style.display = "none";
                    document.getElementById("StudentClassHead").style.display = "none";
                    document.getElementById("tblClassDetails").style.display = "none";
                    document.getElementById("DivisionHead").style.display = "none";
                    document.getElementById("tblDivisionDetails").style.display = "none";

                    statusId = 3;

                    //surl = "../MobileView/StudentAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=2&UpToDate=" + UpToDate + "&OrgGroupId=" + parseInt(OrgGroupId) + "&OrgId=" + parseInt(OrgId) + "&DivisionId=0&GenderType=0";
                    //alert(statusId);
                },
                error: function (xhr, status, error) {
                    var err = eval("(" + xhr.responseText + ")");
                    console.log(err.Message);
                    $("#LoaderDiv1").hide();
                }
            });

        }

        function StudentAttendanceDivisionDetailsDataBind() {
            $("#LoaderStudentAttndDivisionDetailsLoader").css("display", "block")
            $.ajax({
                //async: false,
                type: "POST",
                url: "StudentAttendanceDetailsOrgWiseDashBoard.aspx/StudentAttendanceDivisionDetailsDataBind",
                data: JSON.stringify({ "TypeId": parseInt(TypeId), "UpToDate": UpToDate, "OrgGroupId": parseInt(OrgGroupId), "OrgId": parseInt(OrgId), "CommonOrgGroupBatchId": parseInt(CommonOrgGroupBatchId) }),
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (result) {

                    debugger;
                    var obj = (result.d);
                    var tblStudentAttndDivisionDetails = "";
                    //l = "";
                    ///  var total = 0;
                    var total = 0;
                    var Maletotal = 0;
                    var FeMaletotal = 0;
                    var tblStudent = "";
                    var alreadyAdded = [];
                    if (obj != "") {

                        if (ShowType == "OrgGroup") {
                            tblStudentAttndDivisionDetails += "<tr><th style='display:none'>OrgId</th><th style='display:none'>OrgTitle</th><th style='display:none'>Class Id</th><th>Class</th><th>Total Students</th><th>Male</th><th>Female</th></tr>";
                        }
                        else {
                            tblStudentAttndDivisionDetails += "<tr><th style='display:none'>OrgId</th><th style='display:none'>OrgTitle</th><th style='display:none'>Division Id</th><th>Class</th><th>Total Students</th><th>Male</th><th>Female</th></tr>";
                        }
                        
                        $.each(obj, function (i, item1) {

                            if (alreadyAdded.indexOf(item1.OrgId) >= 0)
                            { }
                            else
                            {
                                tblStudentAttndDivisionDetails += "<tr><th colspan='9'>" + item1.OrgTitle + "</th></tr>";
                                $.each(obj, function (i, item) {
                                    if (item.OrgId === item1.OrgId) {
                                        //tblAdmissionStatusCountOrgWise += "<tr><td>" + item.Status + "</td><td>" + item.StatusCount + "</td></tr>";
                                        //totaladmissionorgwise += parseInt(item.StatusCount);
                                        //tblStudentAttndGroupWiseDetail += "<tr><td >" + item.OrgGroupId + "</td><td><a href='../MobileView/ConsolidateReceiptDetailsDashBoard.aspx?OrgId=" + encodeURIComponent(item.OrgGroupId) + "&Count=1'>" + item.ReceiptCount + "</a></td><td><a href='../MobileView/ConsolidateReceiptDetailsDashBoard.aspx?OrgId=" + encodeURIComponent(item.OrgGroupId) + "&Count=2'>" + item.ReceiptAmount + "</a></td><td><a href='../MobileView/ConsolidateReceiptDetailsDashBoard.aspx?OrgId=" + encodeURIComponent(item.OrgGroupId) + "&Count=3'>" + item.CancelAmount + "</a></td></tr>";
                                        if (ShowType == "OrgGroup") {
                                            tblStudentAttndDivisionDetails += "<tr><td style='display:none'>" + item.OrgId + "</td><td style='display:none'>" + item.OrgTitle + "</td><td style='display:none'>" + item.ClassId + "</td><td>" + item.ClassCode + "</td><td><a href='../MobileView/StudentAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=" + encodeURIComponent(TypeId) + "&UpToDate=" + UpToDate + "&OrgGroupId=" + OrgGroupId + "&OrgId=" + OrgId + "&ClassId=" + item.ClassId + "&rGenderType=0&CommonOrgGroupBatchId=" + CommonOrgGroupBatchId + "'>" + item.TotalStudent + "</a></td><td><a href='../MobileView/StudentAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=" + encodeURIComponent(TypeId) + "&UpToDate=" + UpToDate + "&OrgGroupId=" + OrgGroupId + "&OrgId=" + OrgId + "&ClassId=" + item.ClassId + "&rGenderType=1&CommonOrgGroupBatchId=" + CommonOrgGroupBatchId + "'>" + item.Male + "</a></td><td><a href='../MobileView/StudentAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=" + encodeURIComponent(TypeId) + "&UpToDate=" + UpToDate + "&OrgGroupId=" + OrgGroupId + "&OrgId=" + OrgId + "&ClassId=" + item.ClassId + "&rGenderType=2&CommonOrgGroupBatchId=" + CommonOrgGroupBatchId + "'>" + item.Female + "</td></a></tr>";
                                        }
                                        else {
                                            tblStudentAttndDivisionDetails += "<tr><td style='display:none'>" + item.OrgId + "</td><td style='display:none'>" + item.OrgTitle + "</td><td style='display:none'>" + item.ClassId + "</td><td>" + item.ClassCode + "</td><td><a href='../MobileView/StudentAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=" + encodeURIComponent(TypeId) + "&UpToDate=" + UpToDate + "&OrgGroupId=" + OrgGroupId + "&OrgId=" + OrgId + "&ClassId=" + item.ClassId + "&rGenderType=0&CommonOrgGroupBatchId=" + CommonOrgGroupBatchId + "'>" + item.TotalStudent + "</a></td><td><a href='../MobileView/StudentAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=" + encodeURIComponent(TypeId) + "&UpToDate=" + UpToDate + "&OrgGroupId=" + OrgGroupId + "&OrgId=" + OrgId + "&ClassId=" + item.ClassId + "&rGenderType=1&CommonOrgGroupBatchId=" + CommonOrgGroupBatchId + "'>" + item.Male + "</a></td><td><a href='../MobileView/StudentAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=" + encodeURIComponent(TypeId) + "&UpToDate=" + UpToDate + "&OrgGroupId=" + OrgGroupId + "&OrgId=" + OrgId + "&ClassId=" + item.ClassId + "&rGenderType=2&CommonOrgGroupBatchId=" + CommonOrgGroupBatchId + "'>" + item.Female + "</td></a></tr>";
                                        }
                                        // alert(item.Total);


                                        total += parseInt(item.TotalStudent);
                                        Maletotal += parseInt(item.Male);
                                        FeMaletotal += parseInt(item.Female);
                                    }
                                    else {
                                    }
                                });
                                alreadyAdded.push(item1.OrgId);
                            }
                          

                            //total += parseInt(item.StudentCount);
                        });
                        tblStudentAttndDivisionDetails += "<tr><td colspan='1' style='font-weight:bold'>Total</td><td style='font-weight:bold'>" + total + "</td><td style='font-weight:bold'>" + Maletotal + "</td><td style='font-weight:bold'>" + FeMaletotal + "</td></tr>";
                        //tblFeeStatus += "<tr><td style='font-weight:bold'>Total</td><td style='font-weight:bold'>" + total + "</td></tr>";
                    }
                    else { tblStudentAttndDivisionDetails += "<tr><td colspan='6' class='record'>No records found..!!</td></tr>"; }
                    $("#LoaderStudentAttndDivisionDetailsLoader").css("display", "none")

                    document.getElementById("tblStudentAttndDivisionDetails").innerHTML = tblStudentAttndDivisionDetails;

                    document.getElementById("StudentDetailsHead").style.display = "none";
                    document.getElementById("tblStudentDetails").style.display = "none";
                    document.getElementById("StudentAttndDetailsOrgWiseHead").style.display = "none";
                    document.getElementById("tblStudentAttndDetailsOrgWise").style.display = "none";

                    document.getElementById("StudentAttndDivisionDetailsHead").style.display = "block";
                    document.getElementById("tblStudentAttndDivisionDetails").style.display = "block";
                    document.getElementById("StudentClassHead").style.display = "none";
                    document.getElementById("tblClassDetails").style.display = "none";
                    document.getElementById("DivisionHead").style.display = "none";
                    document.getElementById("tblDivisionDetails").style.display = "none";

                    statusId = 4;
                    //alert(statusId);
                },
                error: function (xhr, status, error) {
                    var err = eval("(" + xhr.responseText + ")");
                    console.log(err.Message);
                    $("#LoaderDiv1").hide();
                }
            });

        }

        //function BackOrgFunction() { window.location.href = "../MobileView/ConsolidateDashboardStudentAttnd.aspx"; CurrentBatchGet(); }
        function DashBoard() { window.location.href = "../MobileView/ConsolidateDashboardStudentAttnd.aspx"; }






        //debugger;
        //parent.history.back();
        //return false;
        // window.location.href(document.referrer.toString());
        // window.location = document.referrer;
        //window.location.href = "../MobileView/StudentAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=" + TypeId + "&UpToDate=" + UpToDate + "&OrgGroupId=" + OrgGroupId + "&OrgId=" + OrgId + "&DivisionId=" + DivisionId + "&GenderType=" + GenderType + "";
        //   }

        function StudentAttendanceDetailsOrgWiseDataBind() {
            $("#LoaderAttndLoader").css("display", "block");
            // surl = "../MobileView/StudentAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=2&UpToDate=" + UpToDate + "&OrgGroupId=" + parseInt(OrgGroupId) + "&OrgId=" + parseInt(OrgId) + "&DivisionId=0&GenderType=0";
            $.ajax({
                //async: false,
                type: "POST",
                url: "StudentAttendanceDetailsOrgWiseDashBoard.aspx/StudentAttendanceDetailsOrgWiseDataBind",
                data: JSON.stringify({ "TypeId": parseInt(TypeId), "UpToDate": UpToDate, "OrgGroupId": parseInt(OrgGroupId), "OrgId": parseInt(OrgId), "CommonOrgGroupBatchId": parseInt(CommonOrgGroupBatchId) }),
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (result) {
                    //      debugger;
                    //alert(result.d);

                    var obj = (result.d);
                    var tblStudentAttndDetailsOrgWise = "";
                    //l = "";
                    ///  var total = 0;
                    if (obj != "") {
                        tblStudentAttndDetailsOrgWise += "<tr><th style='display:none'>OrgGroupId</th><th style='display:none'>Org Group Name</th><th style='display:none'>OrgId</th><th>Org Name</th><th>Total</th><th>Present</th><th>Absent</th><th>Pending</th><th>PR<70%</th><th>100%</th><th>Continue AB</th><th>Leave Request</th></tr>";
                        $.each(obj, function (i, item) {
                            //tblStudentAttndGroupWiseDetail += "<tr><td>" + item.OrgGroupId + "</td><td><a href='../MobileView/ConsolidateReceiptDetailsDashBoard.aspx?OrgId=" + encodeURIComponent(item.OrgGroupId) + "&Count=1'>" + item.ReceiptCount + "</a></td><td><a href='../MobileView/ConsolidateReceiptDetailsDashBoard.aspx?OrgId=" + encodeURIComponent(item.OrgGroupId) + "&Count=2'>" + item.ReceiptAmount + "</a></td><td><a href='../MobileView/ConsolidateReceiptDetailsDashBoard.aspx?OrgId=" + encodeURIComponent(item.OrgGroupId) + "&Count=3'>" + item.CancelAmount + "</a></td></tr>";

                            var Pending = item.Total - (item.PresentStudent+item.AbsentStudent)
                            tblStudentAttndDetailsOrgWise += "<tr><td style='display:none'>" + item.OrgGroupId + "</td><td style='display:none'>" + item.OrgGroupTitle + "</td><td style='display:none'>" + item.OrgId + "</td><td>" + item.OrgTitle + "</td><td><a href='../MobileView/StudentAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=21&UpToDate=" + UpToDate + "&OrgGroupId=0&OrgId=" + item.OrgId + "&DivisionId=0&GenderType=0&CommonOrgGroupBatchId=" + CommonOrgGroupBatchId + "'>" + item.Total + "</a></td><td><a href='../MobileView/StudentAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=22&UpToDate=" + UpToDate + "&OrgGroupId=0&OrgId=" + item.OrgId + "&DivisionId=0&GenderType=0&CommonOrgGroupBatchId=" + CommonOrgGroupBatchId + "'>" + item.PresentStudent + "</a></td><td><a href='../MobileView/StudentAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=23&UpToDate=" + UpToDate + "&OrgGroupId=0&OrgId=" + item.OrgId + "&DivisionId=0&GenderType=0&CommonOrgGroupBatchId=" + CommonOrgGroupBatchId + "'>" + item.AbsentStudent + "</a></td><td><a href='../MobileView/StudentAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=28&UpToDate=" + UpToDate + "&OrgGroupId=0&OrgId=" + item.OrgId + "&DivisionId=0&GenderType=0&CommonOrgGroupBatchId=" + CommonOrgGroupBatchId + "'>" + Pending + "</td></a><td><a href='../MobileView/StudentAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=24&UpToDate=" + UpToDate + "&OrgGroupId=0&OrgId=" + item.OrgId + "&DivisionId=0&GenderType=0&CommonOrgGroupBatchId=" + CommonOrgGroupBatchId + "'>" + item.LessThen70 + "</a></td><td><a href='../MobileView/StudentAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=25&UpToDate=" + UpToDate + "&OrgGroupId=0&OrgId=" + item.OrgId + "&DivisionId=0&GenderType=0&CommonOrgGroupBatchId=" + CommonOrgGroupBatchId + "'>" + item.HundredPer + "</a></td><td><a href='../MobileView/StudentAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=27&UpToDate=" + UpToDate + "&OrgGroupId=0&OrgId=" + item.OrgId + "&DivisionId=0&GenderType=0&CommonOrgGroupBatchId=" + CommonOrgGroupBatchId + "'>" + item.AbsentCount + "</a></td><td><a href='../MobileView/StudentAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=26&UpToDate=" + UpToDate + "&OrgGroupId=0&OrgId=" + item.OrgId + "&DivisionId=0&GenderType=0&CommonOrgGroupBatchId=" + CommonOrgGroupBatchId + "'>" + item.LeaveRequest + "</a></td></tr>";



                            //total += parseInt(item.StudentCount);
                        });
                        //tblFeeStatus += "<tr><td style='font-weight:bold'>Total</td><td style='font-weight:bold'>" + total + "</td></tr>";
                    }
                    else { tblStudentAttndDetailsOrgWise += "<tr><td colspan='8' class='record'>No records found..!!</td></tr>"; }
                    $("#LoaderAttndLoader").css("display", "none");
                    document.getElementById("tblStudentAttndDetailsOrgWise").innerHTML = tblStudentAttndDetailsOrgWise;


                    //document.getElementById("tblReceiptDetail").innerHTML = tblReceiptDetail;
                    document.getElementById("tblStudentAttndDetailsOrgWise").style.display = "block";
                    document.getElementById("tblStudentAttndDivisionDetails").style.display = "none";

                    document.getElementById("StudentDetailsHead").style.display = "none";
                    document.getElementById("tblStudentDetails").style.display = "none";
                    document.getElementById("StudentAttndDetailsOrgWiseHead").style.display = "block";
                    document.getElementById("tblStudentAttndDetailsOrgWise").style.display = "block";
                    document.getElementById("StudentAttndDivisionDetailsHead").style.display = "none";
                    document.getElementById("tblStudentAttndDivisionDetails").style.display = "none";
                    document.getElementById("StudentClassHead").style.display = "none";
                    document.getElementById("tblClassDetails").style.display = "none";
                    document.getElementById("DivisionHead").style.display = "none";
                    document.getElementById("tblDivisionDetails").style.display = "none";




                    statusId = 5;
                    // alert(statusId);

                },
                error: function (xhr, status, error) {
                    var err = eval("(" + xhr.responseText + ")");
                    console.log(err.Message);
                    $("#LoaderDiv1").hide();
                }
            });

        }










        //function BackOrgFunction() {
        //    if (StatusId == 2) {
        //        document.getElementById("ReceiptCollectionHead").style.display = "block";
        //        document.getElementById("ReceiptDetailHead").style.display = "none";
        //        StatusId--;
        //    }
        //    else if (StatusId == 1) {
        //        document.getElementById("ReceiptCollectionHead").style.display = "block";
        //        document.getElementById("ReceiptDetailHead").style.display = "none";
        //        StatusId--;
        //    } else { window.location.href = "../MobileView/ConsolidateDashBoard.aspx"; }
        //}
        //function DashBoard() { window.location.href = "../MobileView/DashBoard.aspx"; }
    </script>

    <asp:UpdatePanel ID="DoctorScheduleUpdatePanel" runat="server">
        <ContentTemplate>
            <asp:HiddenField ID="hfUrl" runat="server" />
            <div class="page-header row mb20">
                <div class="col-xl-12 col-sm-12 col-xs-12 border-bottom-inline padd-0">
                    <div class="col-md-12 ptb12 d-inline-flex">
                        <span class='btn btn-home btn-icon' onclick='DashBoard()' title='home'><span><i class='material-icons'>home</i></span></span>
                        <div class="d-inline-flex w-100">
                            <label class="header-topic justify-content-center" id="HeaderLabel">Consolidate DashBoard</label>
                        </div>
                        <input type="button" value="&#xf3e5;" id="bntBackOrg" onclick="BackOrgFunction()" skinid="0" class="float-right btn btn-back btn-icon fas" />
                    </div>
                    <div class="main-topic inner" id="HeaderTitle">
                    </div>
                </div>
            </div>

            <div class="bg-white row center-block">
                <div class="container-fluid">
                    <div class="gutters-tiny push js-appear-enabled animated fadeIn overflow-hidden" data-toggle="appear">
                        <%--<input type="button" value="Back" id="bntBack1" onclick="BackFunction1()" style="display:none" />
                        <input type="button" value="Back" id="bntBack2" onclick="BackFunction2()" style="display:none" />--%>
                        <div class="himssuHeader1WireBox col-md-12 pTop5" id="StudentAttndDetailsOrgWiseHead">
                            <h3 class="table-topic">Student Attendance - Organization Wise</h3>
                            <%-- <asp:PlaceHolder ID="DepartMentPlaceHolder" runat="server" /> --%>
                            <div class='himsBoxContent'>
                                <div class='table-responsive'>
                                    <table id='tblDropdown' class='table table-striped table-bordered mb-0'>
                                    </table>
                                    <img id="LoaderAttndLoader" style="display: none; position: relative; left: 16%; top: 0px;" src="../../Images/Loading1.gif" />
                                    <table id='tblStudentAttndDetailsOrgWise' class='table table-striped table-bordered'>
                                    </table>
                                </div>
                            </div>
                            <div class="se-pre-con" id="LoaderDiv1" style="display: none"></div>
                        </div>
                        <div class="himssuHeader1WireBox col-md-12 pTop5" id="StudentAttndDivisionDetailsHead" style="display: none">
                            <h3 class="table-topic">Division Detail</h3>
                            <%-- <asp:PlaceHolder ID="DepartMentPlaceHolder" runat="server" /> --%>
                            <div class='himsBoxContent'>
                                <div class='table-responsive'>
                                    <img id="LoaderStudentAttndDivisionDetailsLoader" style="display: none; position: relative; left: 16%; top: 0px;" src="../../Images/Loading1.gif" />
                                    <table id='tblStudentAttndDivisionDetails' class='table table-striped table-bordered'>
                                    </table>
                                </div>
                            </div>
                        </div>
                        <div class="himssuHeader1WireBox col-md-12 pTop5" id="StudentDetailsHead" style="display: none">
                            <h3 class="table-topic">Student Detail</h3>
                            <%-- <asp:PlaceHolder ID="DepartMentPlaceHolder" runat="server" /> --%>
                            <div class='himsBoxContent'>
                                <div class='table-responsive'>
                                    <table id='tblStudentDetails' class='table table-striped table-bordered'>
                                    </table>
                                </div>
                            </div>
                        </div>
                        <div class="himssuHeader1WireBox col-md-12 pTop5" id="StudentClassHead" style="display: none">
                            <h3 class="table-topic">Class Detail</h3>
                            <%-- <asp:PlaceHolder ID="DepartMentPlaceHolder" runat="server" /> --%>
                            <div class='himsBoxContent'>
                                <div class='table-responsive'>
                                    <table id='tblClassDetails' class='table table-striped table-bordered'>
                                    </table>
                                </div>
                            </div>
                        </div>
                        <div class="himssuHeader1WireBox col-md-12 pTop5" id="DivisionHead" style="display: none">
                            <h3 class="table-topic">Division Detail</h3>
                            <%-- <asp:PlaceHolder ID="DepartMentPlaceHolder" runat="server" /> --%>
                            <div class='himsBoxContent'>
                                <div class='table-responsive'>
                                    <table id='tblDivisionDetails' class='table table-striped table-bordered'>
                                    </table>
                                </div>
                            </div>
                        </div>




                        <%--   <input type="hidden" id="Departmentid" runat="server" />
                         <input type="hidden" id="ClassHiddenId" runat="server" />
                         <input type="hidden" id="DivisionHiddenId" runat="server" />--%>
                    </div>
                </div>
            </div>



        </ContentTemplate>
    </asp:UpdatePanel>





</asp:Content>

