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

<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
    <script type="text/javascript">
        var TypeId = 0;
        var TypeId1 = 0;
        var UpToDate = '';
        var OrgGroupId = 0;
        var OrgId = 0;
        var DepartmentId = 0;
        var statusMaintain = 0;

        var Count = 0;
        var drpOrgGroup = '';
        var drpBatch = '';
        var OrgBatchId = 0;
        //var StatusId;
        var statusId = 0;
        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());
            if (TypeId == 3 || TypeId == 31 || TypeId == 32 || TypeId == 33 || TypeId == 34 || TypeId == 35 || TypeId == 36 || TypeId == 37 || TypeId == 38 || TypeId == 39) {
                TypeId1 = parseInt(keyval[1].split('=')[1].toString());
                UpToDate = (keyval[2].split('=')[1].toString());
                OrgGroupId = parseInt(keyval[3].split('=')[1].toString());
                OrgId = parseInt(keyval[4].split('=')[1].toString());
                DepartmentId = parseInt(keyval[5].split('=')[1].toString());
                CommonOrgGroupBatchId = parseInt(keyval[6].split('=')[1].toString());
            }
            else
            {
               
                UpToDate = (keyval[1].split('=')[1].toString());
                OrgGroupId = parseInt(keyval[2].split('=')[1].toString());
                OrgId = parseInt(keyval[3].split('=')[1].toString());
                DepartmentId = parseInt(keyval[4].split('=')[1].toString());
                CommonOrgGroupBatchId = parseInt(keyval[5].split('=')[1].toString());
            }


            if (TypeId == 2) {
                StafftAttendanceDetailsOrgWiseDataBind();
            }
            if (TypeId == 3) {
                StafftDepartmentDetailsGroupWiseDataBind();
            }
            if (TypeId == 4) {
                StafftDepartmentDetailsOrgWiseDataBind();
            }
            if (TypeId == 31 || TypeId == 32 || TypeId == 33 || TypeId == 34 || TypeId == 35 || TypeId == 36 || TypeId == 37 || TypeId == 38 || TypeId == 39 || TypeId == 41 || TypeId == 42 || TypeId == 43 || TypeId == 44 || TypeId == 45 || TypeId == 46 || TypeId == 47 || TypeId == 48 || TypeId == 49) {
                StaffDepartmentDetails();
            }

        });

        function BackOrgFunction() {
            debugger;
            if ($('#StaffAttndDetailsOrgWiseHead').css('display') == "block") {
                window.location.href = "../MobileView/ConsolidateDashBoard.aspx";
            }
            else {
                history.go(-1);
            }
        }
        function StafftAttendanceDetailsOrgWiseDataBind() {
            $("#LoaderStaffAttndDetailsOrgWiseLoader").css("display", "block");
            //var d = new Date();
            //var curr_date = d.getDate();
            //var curr_month = d.getMonth() + 1; //Months are zero based
            //var curr_year = d.getFullYear();
            ////document.write(curr_year + "-" + curr_month + "-" + curr_date);
            ////var CurrentDate = curr_year + "-" + curr_month + "-" + curr_date;
            //var CurrentDate = '2018-12-11';


            $.ajax({
                //async: false,
                type: "POST",
                url: "StaffAttendanceDetailsOrgWiseDashBoard.aspx/StafftAttendanceDetailsOrgWiseDataBind",
                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) {
                    //alert(result.d);

                    var obj = (result.d);
                    var tblStaffAttndDetailsOrgWise = "";
                    //l = "";
                    ///  var total = 0;
                    // alert(obj);
                    if (obj != "") {
                        tblStaffAttndDetailsOrgWise += "<tr><th style='display:none'>DepartmentDetails</th><th style='display:none'>OrgGroupId</th><th style='display:none'>Org Group Name</th><th style='display:none'>OrgId</th><th>OrgTitle</th><th>Total</th><th>Present</th><th>Absent</th><th>Pending</th><th>Leave</th><th>Ab<10%</th><th>Continue AB</th><th>Continue Leave</th><th>100%</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>";

                            //tblStaffAttndDetailsOrgWise += "<tr><td>" + item.OrgGroupId + "</td><td>" + item.OrgGroupTitle + "</td><td>" + item.OrgId + "</td><td>" + item.OrgTitle + "</td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=31&UpToDate=" + UpToDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DepartmentId=0'>" + item.Total + "</a></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=32&UpToDate=" + UpToDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DepartmentId=0'>" + item.Present + "</a></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=33&UpToDate=" + UpToDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DepartmentId=0'>" + item.Absent + "</a></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=34&UpToDate=" + UpToDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DepartmentId=0'>" + item.Leave + "</a></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=35&UpToDate=" + UpToDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DepartmentId=0'>" + item.AB10 + "</a></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=36&UpToDate=" + UpToDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DepartmentId=0'>" + item.AB3Days + "</a></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=37&UpToDate=" + UpToDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DepartmentId=0'>" + item.Leave3Day + "</a></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=38&UpToDate=" + UpToDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DepartmentId=0'>" + item.HundredPerAttn + "</a></td></tr>";
                            tblStaffAttndDetailsOrgWise += "<tr><td style='display:none'><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=4&UpToDate=" + UpToDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=" + item.OrgId + "&DepartmentId=0&CommonOrgGroupBatchId=" + CommonOrgGroupBatchId + "'>Get</a></td><td style='display:none'>" + item.OrgGroupId + "</td><td style='display:none'>" + item.OrgGroupTitle + "</td><td style='display:none'>" + item.OrgId + "</td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=4&UpToDate=" + UpToDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=" + item.OrgId + "&DepartmentId=0&CommonOrgGroupBatchId=" + CommonOrgGroupBatchId + "'>" + item.OrgTitle + "</a></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=41&UpToDate=" + UpToDate + "&OrgGroupId=0&OrgId=" + item.OrgId + "&DepartmentId=1&CommonOrgGroupBatchId=" + CommonOrgGroupBatchId + "'>" + item.Total + "</a></td></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=42&UpToDate=" + UpToDate + "&OrgGroupId=0&OrgId=" + item.OrgId + "&DepartmentId=1&CommonOrgGroupBatchId=" + CommonOrgGroupBatchId + "'>" + item.Present + "</a></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=43&UpToDate=" + UpToDate + "&OrgGroupId=0&OrgId=" + item.OrgId + "&DepartmentId=1&CommonOrgGroupBatchId=" + CommonOrgGroupBatchId + "'>" + item.Absent + "</a></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=49&UpToDate=" + UpToDate + "&OrgGroupId=0&OrgId=" + item.OrgId + "&DepartmentId=1&CommonOrgGroupBatchId=" + CommonOrgGroupBatchId + "'>" + item.AttnNotTaken + "</a></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=44&UpToDate=" + UpToDate + "&OrgGroupId=0&OrgId=" + item.OrgId + "&DepartmentId=1&CommonOrgGroupBatchId=" + CommonOrgGroupBatchId + "'>" + item.Leave + "</a></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=45&UpToDate=" + UpToDate + "&OrgGroupId=0&OrgId=" + item.OrgId + "&DepartmentId=1&CommonOrgGroupBatchId=" + CommonOrgGroupBatchId + "'>" + item.AB10 + "</a></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=46&UpToDate=" + UpToDate + "&OrgGroupId=0&OrgId=" + item.OrgId + "&DepartmentId=1&CommonOrgGroupBatchId=" + CommonOrgGroupBatchId + "'>" + item.AB3Days + "</a></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=47&UpToDate=" + UpToDate + "&OrgGroupId=0&OrgId=" + item.OrgId + "&DepartmentId=1&CommonOrgGroupBatchId=" + CommonOrgGroupBatchId + "'>" + item.Leave3Day + "</a></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=48&UpToDate=" + UpToDate + "&OrgGroupId=0&OrgId=" + item.OrgId + "&DepartmentId=1&CommonOrgGroupBatchId=" + CommonOrgGroupBatchId + "'>" + item.HundredPerAttn + "</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 { tblStaffAttndDetailsOrgWise += "<tr><td colspan='8' class='record'>No records found..!!</td></tr>"; }

                    document.getElementById("tblStaffAttndDetailsOrgWise").innerHTML = tblStaffAttndDetailsOrgWise;
                    $("#LoaderStaffAttndDetailsOrgWiseLoader").css("display", "none");

                    //document.getElementById("tblReceiptDetail").innerHTML = tblReceiptDetail;




                    document.getElementById("StaffAttndDepartmentGroupWiseHead").style.display = "none";
                    document.getElementById("tblStaffAttndDepartmentGroup").style.display = "none";

                    document.getElementById("StaffAttndDetailsOrgWiseHead").style.display = "block";
                    document.getElementById("tblStaffAttndDetailsOrgWise").style.display = "block";


                    document.getElementById("StaffDepartmentDetailsHead").style.display = "none";
                    document.getElementById("tblStaffDepartmentDetails").style.display = "none";



                    StatusId = 1;


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

        }
        function StafftDepartmentDetailsGroupWiseDataBind() {
            debugger;
            $("#StaffAttndDetailsOrgWiseHead").css("display", "none");
            $("#StaffDepartmentDetailsHead").css("display", "none");

            $("#StaffAttndDepartmentGroupWiseHead").css("display", "block");

            $("#LoaderStaffAttndDepartmentGroupLoader").css("display", "block");
            //var d = new Date();
            //var curr_date = d.getDate();
            //var curr_month = d.getMonth() + 1; //Months are zero based
            //var curr_year = d.getFullYear();
            ////document.write(curr_year + "-" + curr_month + "-" + curr_date);
            ////var CurrentDate = curr_year + "-" + curr_month + "-" + curr_date;
            //var CurrentDate = '2018-12-11';


            $.ajax({
                //async: false,
                type: "POST",
                url: "StaffAttendanceDetailsOrgWiseDashBoard.aspx/StafftDepartmentDetailsGroupWiseDataBind",
                data: JSON.stringify({ "TypeId": parseInt(TypeId), "UpToDate": UpToDate, "OrgGroupId": parseInt(OrgGroupId), "OrgId": 0, "CommonOrgGroupBatchId": parseInt(CommonOrgGroupBatchId) }),
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (result) {
                    //alert(result.d);

                    var obj = (result.d);
                    var tblStaffAttndDepartmentGroup = "";
                    var total = 0;
                    var totalPresent = 0;
                    var totalPresent = 0;
                    var totalAbsent = 0;
                    var totalAttnNotTaken = 0;
                    var totalLeave = 0;
                    var totalAB10 = 0;
                    var totalAB3Days = 0;
                    var totalLeave3Days = 0;
                    var total100PerAttnd = 0;
                    //l = "";
                    ///  var total = 0;
                    // alert(obj);
                    if (obj != "") {
                        if (TypeId1 == 31){
                            tblStaffAttndDepartmentGroup += "<tr><th style='display:none'>DepartmentId</th><th>Department</th><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>Total</th><th>Present</th><th>Absent</th><th>Pending</th><th>Leave</th><th>Ab<10%</th><th>Continue AB</th><th>Continue Leave</th><th>100%</th></tr>";
                        }
                        if(TypeId1 == 32)
                        { tblStaffAttndDepartmentGroup += "<tr><th style='display:none'>DepartmentId</th><th>Department</th><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>Present</th></tr>"; }
                        else if (TypeId1 == 33)
                        { tblStaffAttndDepartmentGroup += "<tr><th style='display:none'>DepartmentId</th><th>Department</th><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>Absent</th></tr>"; }
                        else if (TypeId1 == 34)
                        { tblStaffAttndDepartmentGroup += "<tr><th style='display:none'>DepartmentId</th><th>Department</th><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>Pending</th></tr>"; }
                        else if (TypeId1 == 35)
                        { tblStaffAttndDepartmentGroup += "<tr><th style='display:none'>DepartmentId</th><th>Department</th><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>Leave</th></tr>"; }
                        else if (TypeId1 == 36)
                        { tblStaffAttndDepartmentGroup += "<tr><th style='display:none'>DepartmentId</th><th>Department</th><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>Ab<10%</th></tr>"; }
                        else if (TypeId1 == 37)
                        { tblStaffAttndDepartmentGroup += "<tr><th style='display:none'>DepartmentId</th><th>Department</th><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>Continue AB</th></tr>"; }
                        else if (TypeId1 == 38)
                        { tblStaffAttndDepartmentGroup += "<tr><th style='display:none'>DepartmentId</th><th>Department</th><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>Continue Leave</th></tr>"; }
                        else if (TypeId1 == 39)
                        { tblStaffAttndDepartmentGroup += "<tr><th style='display:none'>DepartmentId</th><th>Department</th><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>100%</th></tr>"; }
                       // tblStaffAttndDepartmentGroup += "<tr><th style='display:none'>DepartmentId</th><th>Department</th><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>Total</th><th>Present</th><th>Absent</th><th>AttnNotTaken</th><th>Leave</th><th>Ab<10%</th><th>Continue AB</th><th>Continue Leave</th><th>100%</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>";

                            //tblStaffAttndDetailsOrgWise += "<tr><td>" + item.OrgGroupId + "</td><td>" + item.OrgGroupTitle + "</td><td>" + item.OrgId + "</td><td>" + item.OrgTitle + "</td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=31&UpToDate=" + UpToDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DepartmentId=0'>" + item.Total + "</a></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=32&UpToDate=" + UpToDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DepartmentId=0'>" + item.Present + "</a></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=33&UpToDate=" + UpToDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DepartmentId=0'>" + item.Absent + "</a></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=34&UpToDate=" + UpToDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DepartmentId=0'>" + item.Leave + "</a></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=35&UpToDate=" + UpToDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DepartmentId=0'>" + item.AB10 + "</a></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=36&UpToDate=" + UpToDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DepartmentId=0'>" + item.AB3Days + "</a></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=37&UpToDate=" + UpToDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DepartmentId=0'>" + item.Leave3Day + "</a></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=38&UpToDate=" + UpToDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DepartmentId=0'>" + item.HundredPerAttn + "</a></td></tr>";
                           
                            if (TypeId1 == 31)
                            {
                                tblStaffAttndDepartmentGroup += "<tr><td style='display:none'>" + item.DepartmentId + "</td><td>" + item.DepartmentCode + "</td><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><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=31&TypeId1=31&UpToDate=" + UpToDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DepartmentId=" + item.DepartmentId + "&CommonOrgGroupBatchId=" + CommonOrgGroupBatchId + "'>" + item.Total + "</a></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=32&TypeId1=32&UpToDate=" + UpToDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DepartmentId=" + item.DepartmentId + "&CommonOrgGroupBatchId=" + CommonOrgGroupBatchId + "'>" + item.Present + "</a></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=33&TypeId1=33&UpToDate=" + UpToDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DepartmentId=" + item.DepartmentId + "&CommonOrgGroupBatchId=" + CommonOrgGroupBatchId + "'>" + item.Absent + "</a></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=39&TypeId1=34&UpToDate=" + UpToDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DepartmentId=" + item.DepartmentId + "&CommonOrgGroupBatchId=" + CommonOrgGroupBatchId + "'>" + item.AttnNotTaken + "</a></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=34&TypeId1=35&UpToDate=" + UpToDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DepartmentId=" + item.DepartmentId + "&CommonOrgGroupBatchId=" + CommonOrgGroupBatchId + "'>" + item.Leave + "</a></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=35&TypeId1=36&UpToDate=" + UpToDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DepartmentId=" + item.DepartmentId + "&CommonOrgGroupBatchId=" + CommonOrgGroupBatchId + "'>" + item.AB10 + "</a></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=36&TypeId1=37&UpToDate=" + UpToDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DepartmentId=" + item.DepartmentId + "&CommonOrgGroupBatchId=" + CommonOrgGroupBatchId + "'>" + item.AB3Days + "</a></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=37&TypeId1=38&UpToDate=" + UpToDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DepartmentId=" + item.DepartmentId + "&CommonOrgGroupBatchId=" + CommonOrgGroupBatchId + "'>" + item.Leave3Day + "</a></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=38&TypeId1=39&UpToDate=" + UpToDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DepartmentId=" + item.DepartmentId + "&CommonOrgGroupBatchId=" + CommonOrgGroupBatchId + "'>" + item.HundredPerAttn + "</a></td></tr>";
                                total += parseInt(item.Total);
                                totalPresent += parseInt(item.Present);
                                totalAbsent += parseInt(item.Absent);
                                totalAttnNotTaken += parseInt(item.AttnNotTaken);
                                totalLeave += parseFloat(item.Leave);
                                totalAB10 += parseInt(item.AB10);
                                totalAB3Days += parseInt(item.AB3Days);
                                totalLeave3Days += parseInt(item.Leave3Day);
                                total100PerAttnd += parseInt(item.HundredPerAttn);
                            }

                            if (TypeId1 == 32)
                            {
                                tblStaffAttndDepartmentGroup += "<tr><td style='display:none'>" + item.DepartmentId + "</td><td>" + item.DepartmentCode + "</td><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><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=31&TypeId1=32&UpToDate=" + UpToDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DepartmentId=" + item.DepartmentId + "&CommonOrgGroupBatchId=" + CommonOrgGroupBatchId + "'>" + item.Present + "</a></td></tr>"; totalPresent += parseInt(item.Present);
                            }
                            else if (TypeId1 == 33)
                            {
                                tblStaffAttndDepartmentGroup += "<tr><td style='display:none'>" + item.DepartmentId + "</td><td>" + item.DepartmentCode + "</td><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><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=32&TypeId1=33&UpToDate=" + UpToDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DepartmentId=" + item.DepartmentId + "&CommonOrgGroupBatchId=" + CommonOrgGroupBatchId + "'>" + item.Absent + "</a></td></tr>"; totalAbsent += parseInt(item.Absent);
                            }
                            else if (TypeId1 == 34)
                            {
                                tblStaffAttndDepartmentGroup += "<tr><td style='display:none'>" + item.DepartmentId + "</td><td>" + item.DepartmentCode + "</td><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><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=39&TypeId1=34&UpToDate=" + UpToDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DepartmentId=" + item.DepartmentId + "&CommonOrgGroupBatchId=" + CommonOrgGroupBatchId + "'>" + item.AttnNotTaken + "</a></td></tr>"; totalAttnNotTaken += parseInt(item.AttnNotTaken);
                            }
                            else if (TypeId1 == 35)
                            {
                                tblStaffAttndDepartmentGroup += "<tr><td style='display:none'>" + item.DepartmentId + "</td><td>" + item.DepartmentCode + "</td><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><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=34&TypeId1=35&UpToDate=" + UpToDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DepartmentId=" + item.DepartmentId + "&CommonOrgGroupBatchId=" + CommonOrgGroupBatchId + "'>" + item.Leave + "</a></td></tr>"; totalLeave += parseFloat(item.Leave);
                            }
                            else if (TypeId1 == 36)
                            { tblStaffAttndDepartmentGroup += "<tr><td style='display:none'>" + item.DepartmentId + "</td><td>" + item.DepartmentCode + "</td><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><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=35&TypeId1=36&UpToDate=" + UpToDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DepartmentId=" + item.DepartmentId + "&CommonOrgGroupBatchId=" + CommonOrgGroupBatchId + "'>" + item.AB10 + "</a></td></tr>"; totalAB10 += parseInt(item.AB10); }
                            else if (TypeId1 == 37)
                            { tblStaffAttndDepartmentGroup += "<tr><td style='display:none'>" + item.DepartmentId + "</td><td>" + item.DepartmentCode + "</td><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><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=36&TypeId1=37&UpToDate=" + UpToDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DepartmentId=" + item.DepartmentId + "&CommonOrgGroupBatchId=" + CommonOrgGroupBatchId + "'>" + item.AB3Days + "</a></td></tr>"; totalAB3Days += parseInt(item.AB3Days); }
                            else if (TypeId1 == 38)
                            { tblStaffAttndDepartmentGroup += "<tr><td style='display:none'>" + item.DepartmentId + "</td><td>" + item.DepartmentCode + "</td><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><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=37&TypeId1=38&UpToDate=" + UpToDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DepartmentId=" + item.DepartmentId + "&CommonOrgGroupBatchId=" + CommonOrgGroupBatchId + "'>" + item.Leave3Day + "</a></td></tr>"; totalLeave3Days += parseInt(item.Leave3Day); }
                            else if (TypeId1 == 39)
                            { tblStaffAttndDepartmentGroup += "<tr><td style='display:none'>" + item.DepartmentId + "</td><td>" + item.DepartmentCode + "</td><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><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=38&TypeId1=39&UpToDate=" + UpToDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DepartmentId=" + item.DepartmentId + "&CommonOrgGroupBatchId=" + CommonOrgGroupBatchId + "'>" + item.HundredPerAttn + "</a></td></tr>"; total100PerAttnd += parseInt(item.HundredPerAttn); }
                           
                            //total += parseInt(item.StudentCount);
                        });

                        if (TypeId1 == 31) {
                            tblStaffAttndDepartmentGroup += "<tr><td colspan='' style='font-weight:bold'>Total</td><td style='font-weight:bold'>" + total + "</td><td style='font-weight:bold'>" + totalPresent + "</td><td style='font-weight:bold'>" + totalAbsent + "</td><td style='font-weight:bold'>" + totalAttnNotTaken + "</td><td style='font-weight:bold'>" + totalLeave + "</td><td style='font-weight:bold'>" + totalAB10 + "</td><td style='font-weight:bold'>" + totalAB3Days + "</td><td style='font-weight:bold'>" + totalLeave3Days + "</td><td style='font-weight:bold'>" + total100PerAttnd + "</td></tr>";
                        }

                        if (TypeId1 == 32) {
                            tblStaffAttndDepartmentGroup += "<tr><td colspan='' style='font-weight:bold'>Total</td><td style='font-weight:bold'>" + totalPresent + "</td></tr>";
                        }
                        else if (TypeId1 == 33) {
                            tblStaffAttndDepartmentGroup += "<tr><td colspan='' style='font-weight:bold'>Total</td><td style='font-weight:bold'>" + totalAbsent + "</td></tr>";
                        }
                        else if (TypeId1 == 34) {
                            tblStaffAttndDepartmentGroup += "<tr><td colspan='' style='font-weight:bold'>Total</td><td style='font-weight:bold'>" + totalAttnNotTaken + "</td></tr>";
                        }
                        else if (TypeId1 == 35) {
                            tblStaffAttndDepartmentGroup += "<tr><td colspan='' style='font-weight:bold'>Total</td><td style='font-weight:bold'>" + totalLeave + "</td></tr>";
                        }
                        else if (TypeId1 == 36)
                        { tblStaffAttndDepartmentGroup += "<tr><td colspan='' style='font-weight:bold'>Total</td><td style='font-weight:bold'>" + totalAB10 + "</td></tr>"; }
                        else if (TypeId1 == 37)
                        { tblStaffAttndDepartmentGroup += "<tr><td colspan='' style='font-weight:bold'>Total</td><td style='font-weight:bold'>" + totalAB3Days + "</td></tr>"; }
                        else if (TypeId1 == 38)
                        { tblStaffAttndDepartmentGroup += "<tr><td colspan='' style='font-weight:bold'>Total</td><td style='font-weight:bold'>" + totalLeave3Days + "</td></tr>"; }
                        else if (TypeId1 == 39)
                        { tblStaffAttndDepartmentGroup += "<tr><td colspan='' style='font-weight:bold'>Total</td><td style='font-weight:bold'>" + total100PerAttnd + "</td></tr>"; }


                        //tblStaffAttndDepartmentGroup += "<tr><td colspan='' style='font-weight:bold'>Total</td><td style='font-weight:bold'>" + total + "</td><td style='font-weight:bold'>" + totalPresent + "</td><td style='font-weight:bold'>" + totalAbsent + "</td><td style='font-weight:bold'>" + totalAttnNotTaken + "</td><td style='font-weight:bold'>" + totalLeave + "</td><td style='font-weight:bold'>" + totalAB10 + "</td><td style='font-weight:bold'>" + totalAB3Days + "</td><td style='font-weight:bold'>" + totalLeave3Days + "</td><td style='font-weight:bold'>" + total100PerAttnd + "</td></tr>";
                        //tblFeeStatus += "<tr><td style='font-weight:bold'>Total</td><td style='font-weight:bold'>" + total + "</td></tr>";
                    }
                    else { tblStaffAttndDepartmentGroup += "<tr><td colspan='9' class='record'>No records found..!!</td></tr>"; }
                    $("#LoaderStaffAttndDepartmentGroupLoader").css("display", "none");
                    document.getElementById("tblStaffAttndDepartmentGroup").innerHTML = tblStaffAttndDepartmentGroup;


                    //document.getElementById("tblReceiptDetail").innerHTML = tblReceiptDetail;

                    document.getElementById("StaffAttndDepartmentGroupWiseHead").style.display = "block";
                    document.getElementById("tblStaffAttndDepartmentGroup").style.display = "block";

                    document.getElementById("StaffAttndDetailsOrgWiseHead").style.display = "none";
                    document.getElementById("tblStaffAttndDetailsOrgWise").style.display = "none";


                    document.getElementById("StaffDepartmentDetailsHead").style.display = "none";
                    document.getElementById("tblStaffDepartmentDetails").style.display = "none";




                    StatusId = 2;


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


        }
        function StafftDepartmentDetailsOrgWiseDataBind() {

            $("#StaffAttndDetailsOrgWiseHead").css("display", "none");
            $("#StaffDepartmentDetailsHead").css("display", "none");

            $("#StaffAttndDepartmentGroupWiseHead").css("display", "block");
            $("#LoaderStaffAttndDepartmentGroupLoader").css("display", "block");
            //var d = new Date();
            //var curr_date = d.getDate();
            //var curr_month = d.getMonth() + 1; //Months are zero based
            //var curr_year = d.getFullYear();
            ////document.write(curr_year + "-" + curr_month + "-" + curr_date);
            ////var CurrentDate = curr_year + "-" + curr_month + "-" + curr_date;
            //var CurrentDate = '2018-12-11';


            $.ajax({
                //async: false,
                type: "POST",
                url: "StaffAttendanceDetailsOrgWiseDashBoard.aspx/StafftDepartmentDetailsGroupWiseDataBind",
                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) {
                    //alert(result.d);

                    var obj = (result.d);
                    var tblStaffAttndDepartmentGroup = "";
                    var total = 0;
                    var totalPresent = 0;
                    var totalAttnNotTaken = 0;
                    var totalAbsent = 0;
                    var total100PerAttnd = 0;
                    var totalLeave = 0;
                    var totalAB10 = 0;
                    var totalAB3Days = 0;
                    var totalLeave3Days = 0;
                    var total100PerAttnd = 0;
                    //l = "";
                    ///  var total = 0;
                    // alert(obj);
                    if (obj != "") {
                        tblStaffAttndDepartmentGroup += "<tr><th style='display:none'>DepartmentId</th><th>Department</th><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>Total</th><th>Present</th><th>Absent</th><th>Pending</th><th>Leave</th><th>Ab<10%</th><th>Continue AB</th><th>Continue Leave</th><th>100%</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>";

                            //tblStaffAttndDetailsOrgWise += "<tr><td>" + item.OrgGroupId + "</td><td>" + item.OrgGroupTitle + "</td><td>" + item.OrgId + "</td><td>" + item.OrgTitle + "</td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=31&UpToDate=" + UpToDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DepartmentId=0'>" + item.Total + "</a></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=32&UpToDate=" + UpToDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DepartmentId=0'>" + item.Present + "</a></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=33&UpToDate=" + UpToDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DepartmentId=0'>" + item.Absent + "</a></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=34&UpToDate=" + UpToDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DepartmentId=0'>" + item.Leave + "</a></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=35&UpToDate=" + UpToDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DepartmentId=0'>" + item.AB10 + "</a></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=36&UpToDate=" + UpToDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DepartmentId=0'>" + item.AB3Days + "</a></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=37&UpToDate=" + UpToDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DepartmentId=0'>" + item.Leave3Day + "</a></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=38&UpToDate=" + UpToDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DepartmentId=0'>" + item.HundredPerAttn + "</a></td></tr>";
                            //tblStaffAttndDepartmentGroup += "<tr><td>" + item.DepartmentId + "</td><td>" + item.DepartmentCode + "</td><td>" + item.OrgGroupId + "</td><td>" + item.OrgGroupTitle + "</td><td>" + item.OrgId + "</td><td>" + item.OrgTitle + "</td><td>" + item.Total + "</td><td>" + item.Present + "</td><td>" + item.Absent + "</td><td>" + item.Leave + "</td><td>" + item.AB10 + "</td><td>" + item.AB3Days + "</td><td>" + item.Leave3Day + "</td><td>" + item.HundredPerAttn + "</td></tr>";

                            tblStaffAttndDepartmentGroup += "<tr><td style='display:none'>" + item.DepartmentId + "</td><td>" + item.DepartmentCode + "</td><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><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=41&UpToDate=" + UpToDate + "&OrgGroupId=0&OrgId=" + item.OrgId + "&DepartmentId=" + item.DepartmentId + "&CommonOrgGroupBatchId=" + CommonOrgGroupBatchId + "'>" + item.Total + "</a></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=42&UpToDate=" + UpToDate + "&OrgGroupId=0&OrgId=" + item.OrgId + "&DepartmentId=" + item.DepartmentId + "&CommonOrgGroupBatchId=" + CommonOrgGroupBatchId + "'>" + item.Present + "</a></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=43&UpToDate=" + UpToDate + "&OrgGroupId=0&OrgId=" + item.OrgId + "&DepartmentId=" + item.DepartmentId + "&CommonOrgGroupBatchId=" + CommonOrgGroupBatchId + "'>" + item.Absent + "</a></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=49&UpToDate=" + UpToDate + "&OrgGroupId=0&OrgId=" + item.OrgId + "&DepartmentId=" + item.DepartmentId + "&CommonOrgGroupBatchId=" + CommonOrgGroupBatchId + "'>" + item.AttnNotTaken + "</a></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=44&UpToDate=" + UpToDate + "&OrgGroupId=0&OrgId=" + item.OrgId + "&DepartmentId=" + item.DepartmentId + "&CommonOrgGroupBatchId=" + CommonOrgGroupBatchId + "'>" + item.Leave + "</a></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=45&UpToDate=" + UpToDate + "&OrgGroupId=0&OrgId=" + item.OrgId + "&DepartmentId=" + item.DepartmentId + "&CommonOrgGroupBatchId=" + CommonOrgGroupBatchId + "'>" + item.AB10 + "</a></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=46&UpToDate=" + UpToDate + "&OrgGroupId=0&OrgId=" + item.OrgId + "&DepartmentId=" + item.DepartmentId + "&CommonOrgGroupBatchId=" + CommonOrgGroupBatchId + "'>" + item.AB3Days + "</a></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=47&UpToDate=" + UpToDate + "&OrgGroupId=0&OrgId=" + item.OrgId + "&DepartmentId=" + item.DepartmentId + "&CommonOrgGroupBatchId=" + CommonOrgGroupBatchId + "'>" + item.Leave3Day + "</a></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=48&UpToDate=" + UpToDate + "&OrgGroupId=0&OrgId=" + item.OrgId + "&DepartmentId=" + item.DepartmentId + "&CommonOrgGroupBatchId=" + CommonOrgGroupBatchId + "'>" + item.HundredPerAttn + "</a></td></tr>";


                            total += parseInt(item.Total);
                            totalPresent += parseInt(item.Present);
                            totalAbsent += parseInt(item.Absent);
                            totalAttnNotTaken += parseInt(item.AttnNotTaken);
                            totalLeave += parseFloat(item.Leave);
                            totalAB10 += parseInt(item.AB10);
                            totalAB3Days += parseInt(item.AB3Days);
                            totalLeave3Days += parseInt(item.Leave3Day);
                            total100PerAttnd += parseInt(item.HundredPerAttn);


                            //total += parseInt(item.StudentCount);
                        });
                        tblStaffAttndDepartmentGroup += "<tr><td colspan='1' style='font-weight:bold'>Total</td><td style='font-weight:bold'>" + total + "</td><td style='font-weight:bold'>" + totalPresent + "</td><td style='font-weight:bold'>" + totalAbsent + "</td><td style='font-weight:bold'>" + totalAttnNotTaken + "</td><td style='font-weight:bold'>" + totalLeave + "</td><td style='font-weight:bold'>" + totalAB10 + "</td><td style='font-weight:bold'>" + totalAB3Days + "</td><td style='font-weight:bold'>" + totalLeave3Days + "</td><td style='font-weight:bold'>" + total100PerAttnd + "</td></tr>";
                        //tblFeeStatus += "<tr><td style='font-weight:bold'>Total</td><td style='font-weight:bold'>" + total + "</td></tr>";
                    }
                    else { tblStaffAttndDepartmentGroup += "<tr><td colspan='8' class='record'>No records found..!!</td></tr>"; }
                    $("#LoaderStaffAttndDepartmentGroupLoader").css("display", "none");
                    document.getElementById("tblStaffAttndDepartmentGroup").innerHTML = tblStaffAttndDepartmentGroup;


                    //document.getElementById("tblReceiptDetail").innerHTML = tblReceiptDetail;



                    document.getElementById("StaffAttndDepartmentGroupWiseHead").style.display = "block";
                    document.getElementById("tblStaffAttndDepartmentGroup").style.display = "block";

                    document.getElementById("StaffAttndDetailsOrgWiseHead").style.display = "none";
                    document.getElementById("tblStaffAttndDetailsOrgWise").style.display = "none";


                    document.getElementById("StaffDepartmentDetailsHead").style.display = "none";
                    document.getElementById("tblStaffDepartmentDetails").style.display = "none";



                    StatusId = 3;


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

        }

        function StaffDepartmentDetails() {

            //var d = new Date();
            //var curr_date = d.getDate();
            //var curr_month = d.getMonth() + 1; //Months are zero based
            //var curr_year = d.getFullYear();
            //document.write(curr_year + "-" + curr_month + "-" + curr_date);
            //var CurrentDate = curr_year + "-" + curr_month + "-" + curr_date;
            //var CurrentDate = '2018-12-11';


            $.ajax({
                //async: false,
                type: "POST",
                url: "StaffAttendanceDetailsOrgWiseDashBoard.aspx/StaffDepartmentDetails",
                data: JSON.stringify({ "TypeId": parseInt(TypeId), "UpToDate": UpToDate, "OrgGroupId": parseInt(OrgGroupId), "OrgId": parseInt(OrgId), "DepartmentId": parseInt(DepartmentId) , "CommonOrgGroupBatchId": parseInt(CommonOrgGroupBatchId) }),
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (result) {
                    //alert(result.d);

                    var obj = (result.d);
                    var tblStaffDepartmentDetails = "";
                    var alreadyAdded = [];
                    //l = "";
                    ///  var total = 0;
                    // alert(obj);
                    if (obj != "") {
                        tblStaffDepartmentDetails += "<tr><th>Department</th><th style='display:none'>EmployeeID</th><th>Id</th><th>Employee</th><th>Contact</th></tr>";
                        $.each(obj, function (i, item1) {


                            if (alreadyAdded.indexOf(item1.OrgTitle) >= 0)
                            { }
                            else
                            {
                                tblStaffDepartmentDetails += "<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><a onclick='AdmissionClassWise(" + item.InquiryStatusId + ",\"" + item.OrgId + "\")'>" + item.StatusCount + "</a></td></tr>";
                                        tblStaffDepartmentDetails += "<tr><td>" + item.DepartmentCode + "</td><td style='display:none'>" + item.EmployeeID + "</td><td>" + item.EmployeeCode + "</td><td>" + item.EmployeeName + "</td><td>" + item.ContactNo + "</td></tr>";
                                        //totaladmissionorgwise += parseInt(item.StatusCount);
                                    }
                                    else {
                                    }
                                });
                                alreadyAdded.push(item1.OrgTitle);
                            }
                            //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>";

                            //tblStaffAttndDetailsOrgWise += "<tr><td>" + item.OrgGroupId + "</td><td>" + item.OrgGroupTitle + "</td><td>" + item.OrgId + "</td><td>" + item.OrgTitle + "</td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=31&UpToDate=" + UpToDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DepartmentId=0'>" + item.Total + "</a></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=32&UpToDate=" + UpToDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DepartmentId=0'>" + item.Present + "</a></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=33&UpToDate=" + UpToDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DepartmentId=0'>" + item.Absent + "</a></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=34&UpToDate=" + UpToDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DepartmentId=0'>" + item.Leave + "</a></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=35&UpToDate=" + UpToDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DepartmentId=0'>" + item.AB10 + "</a></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=36&UpToDate=" + UpToDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DepartmentId=0'>" + item.AB3Days + "</a></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=37&UpToDate=" + UpToDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DepartmentId=0'>" + item.Leave3Day + "</a></td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=38&UpToDate=" + UpToDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DepartmentId=0'>" + item.HundredPerAttn + "</a></td></tr>";
                            //tblStaffAttndDepartmentGroup += "<tr><td>" + item.DepartmentId + "</td><td>" + item.DepartmentCode + "</td><td>" + item.OrgGroupId + "</td><td>" + item.OrgGroupTitle + "</td><td>" + item.OrgId + "</td><td>" + item.OrgTitle + "</td><td>" + item.Total + "</td><td>" + item.Present + "</td><td>" + item.Absent + "</td><td>" + item.Leave + "</td><td>" + item.AB10 + "</td><td>" + item.AB3Days + "</td><td>" + item.Leave3Day + "</td><td>" + item.HundredPerAttn + "</td></tr>";

                         /////   tblStaffDepartmentDetails += "<tr><td>" + item.DepartmentCode + "</td><td style='display:none'>" + item.EmployeeID + "</td><td>" + item.EmployeeCode + "</td><td>" + item.EmployeeName + "</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 { tblStaffDepartmentDetails += "<tr><td colspan='8' class='record'>No records found..!!</td></tr>"; }
                    document.getElementById("tblStaffDepartmentDetails").innerHTML = tblStaffDepartmentDetails;


                    //document.getElementById("tblReceiptDetail").innerHTML = tblReceiptDetail;
                    document.getElementById("StaffAttndDepartmentGroupWiseHead").style.display = "none";
                    document.getElementById("tblStaffAttndDepartmentGroup").style.display = "none";

                    document.getElementById("StaffAttndDetailsOrgWiseHead").style.display = "none";
                    document.getElementById("tblStaffAttndDetailsOrgWise").style.display = "none";


                    document.getElementById("StaffDepartmentDetailsHead").style.display = "block";
                    document.getElementById("tblStaffDepartmentDetails").style.display = "block";


                    StatusId = 4;


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

        }
    </script>


    <asp:UpdatePanel ID="DoctorScheduleUpdatePanel" runat="server">
        <ContentTemplate>
            <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="StaffAttndDetailsOrgWiseHead">
                            <h3 class="table-topic">Staff Attendance</h3>
                            <%-- <asp:PlaceHolder ID="DepartMentPlaceHolder" runat="server" /> --%>
                            <div class='himsBoxContent'>
                                <div class='table-responsive'>
                                    <img id="LoaderStaffAttndDetailsOrgWiseLoader" style="display: none; position: relative; left: 16%; top: 0px;" src="../../Images/Loading1.gif" />
                                    <table id='tblDropdown' class='table table-striped table-bordered mb-0'>
                                    </table>
                                    <table id='tblStaffAttndDetailsOrgWise' 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="StaffAttndDepartmentGroupWiseHead" style="display: none">
                            <h3 class="table-topic">Staff Attendance - Department Wise</h3>
                            <%-- <asp:PlaceHolder ID="DepartMentPlaceHolder" runat="server" /> --%>
                            <div class='himsBoxContent'>
                                <div class='table-responsive'>
                                    <img id="LoaderStaffAttndDepartmentGroupLoader" style="display: none; position: relative; left: 16%; top: 0px;" src="../../Images/Loading1.gif" />
                                    <table id='tblDropdown' class='table table-striped table-bordered mb-0'>
                                    </table>
                                    <table id='tblStaffAttndDepartmentGroup' 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="StaffDepartmentDetailsHead" style="display: none">
                            <h3 class="table-topic">Department Details</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>
                                    <table id='tblStaffDepartmentDetails' class='table table-striped table-bordered'>
                                    </table>
                                </div>
                            </div>
                            <div class="se-pre-con" id="LoaderDiv1" style="display: none"></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>

