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

<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
    <script type="text/javascript">
        $(document).ready(function () {

            //AssignPermission();
            FeeStatusDataBind();
        });


        function AssignPermission() {
            $.ajax({
                type: "POST",
                url: "ConsolidateDashboardStaffAttnd.aspx/AssignPermission",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (result) {
                    var obj = (result.d);
                    var OrgGroupId = "";
                    $.each(obj, function (i, item) {
                        if (item.RoleDashletId == 67 && item.IsCheck == true) {
                            document.getElementById("FeeStatusHead").style.display = "block";
                        }
                        else if (item.RoleDashletId == 68 && item.IsCheck == true) {
                            document.getElementById("ReceiptDetailHead").style.display = "block";
                        }
                        else if (item.RoleDashletId == 70 && item.IsCheck == true) {
                            document.getElementById("StudentAttndGroupWiseDetailHead").style.display = "block";
                        }
                        else if (item.RoleDashletId == 71 && item.IsCheck == true) {
                            document.getElementById("StaffAttndGroupWiseDetailHead").style.display = "block";
                        }
                    });
                    //GetOrgId();
                    //FeeStatusDataBind();
                },
                error: function (xhr, status, error) {
                    var err = eval("(" + xhr.responseText + ")");
                    console.log(err.Message);
                }
            });
        }
        function FeeStatusDataBind() {
            //$("#LoaderDiv1").show();
            $.ajax({
                async: false,
                type: "POST",
                url: "ConsolidateDashboardStaffAttnd.aspx/FeeStatusDataBind",
                // data: JSON.stringify({}),

                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (result) {
                    //alert(result.d);
                    var obj = (result.d);
                    var tblFeeStatus = "";
                    ///  var total = 0;

                    if (obj != "") {
                        tblFeeStatus += "<tr><th>Organization Name</th><th>Paid Amount</th><th>Pending Amount</th><th>Total Amount</th></tr>";
                        $.each(obj, function (i, item) {
                            tblFeeStatus += "<tr><td>" + item.OrgGroupName + "</td><td><a href='../MobileView/ConsolidateFeeStatusDashBoard.aspx?OrgId=" + item.OrgGroupId + "&Count=1'>" + item.PaidCount + "</a></td><td><a href='../MobileView/ConsolidateFeeStatusDashBoard.aspx?OrgId=" + item.OrgGroupId + "&Count=2'>" + item.PendingCount + "</a></td><td><a href='../MobileView/ConsolidateFeeStatusDashBoard.aspx?OrgId=" + item.OrgGroupId + "&Count=3'>" + item.TotalCount + "</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 { tblFeeStatus += "<tr><td colspan='8' class='record'>No records found..!!</td></tr>"; }
                    document.getElementById("tblFeeStatus").innerHTML = tblFeeStatus;
                    ReceiptDetailDataBind();
                    // console.log(Header);
                },
                error: function (xhr, status, error) {
                    var err = eval("(" + xhr.responseText + ")");
                    console.log(err.Message);
                    $("#LoaderDiv1").hide();
                }
            });
        }
        function ReceiptDetailDataBind() {
            //$("#LoaderDiv").show();
            $.ajax({
                async: false,
                type: "POST",
                url: "ConsolidateDashboardStaffAttnd.aspx/ReceiptDetailDataBind",
                // data: JSON.stringify({}),

                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (result) {
                    //alert(result.d);
                    var obj = (result.d);
                    var tblReceiptDetail = "";
                    ///  var total = 0;
                    if (obj != "") {
                        tblReceiptDetail += "<tr><th>Organization Name</th><th>ReceiptCount</th><th>ReceiptAmount</th><th>CancelReceipt</th></tr>";
                        $.each(obj, function (i, item) {
                            tblReceiptDetail += "<tr><td>" + item.OrgGroupName + "</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>";
                            //total += parseInt(item.StudentCount);
                        });
                        //tblFeeStatus += "<tr><td style='font-weight:bold'>Total</td><td style='font-weight:bold'>" + total + "</td></tr>";
                    }
                    else { tblReceiptDetail += "<tr><td colspan='8' class='record'>No records found..!!</td></tr>"; }
                    document.getElementById("tblReceiptDetail").innerHTML = tblReceiptDetail;
                    StudentAttndDetailsGroupWiseDataBind();
                    // $("#LoaderDiv1").hide();
                    // console.log(Header);
                },
                error: function (xhr, status, error) {
                    var err = eval("(" + xhr.responseText + ")");
                    console.log(err.Message);
                    // $("#LoaderDiv1").hide();
                }
            });
        }

        function StudentAttndDetailsGroupWiseDataBind() {
            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-11-27';
            //alert(CurrentDate);
            $.ajax({
                async: false,
                type: "POST",
                url: "ConsolidateDashboardStudentAttnd.aspx/StudentAttndDetailsGroupWiseDataBind",
                data: JSON.stringify({ "TypeId": 1, "UpTodate": CurrentDate }),

                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (result) {
                    //alert(result.d);

                    var obj = (result.d);


                    l = "";
                    ///  var total = 0;
                    if (obj != "") {
                        tblStudentAttndGroupWiseDetail += "<tr><th>OrgGroupId</th><th>OrgGroupTitle</th><th>OrgGroupId</th><th>OrgTitle</th><th>Total</th><th>Present Student</th><th>Absent Student</th><th>Less Then 70</th><th>Hundred Persent</th><th>Absent</th><th>Leave Request</th><th>AttnNotTakenClass</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>";

                            //tblStudentAttndGroupWiseDetail += "<tr><td>" + item.OrgGroupId + "</td><td><a href='../MobileView/StudentAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=2&UpToDate=" + CurrentDate + "&OrgGroupId=" + item.OrgGroupId + "'>" + item.OrgTitle + "</a></td><td><a href='../MobileView/StudentAttendanceDivisionDetails.aspx?TypeId=11&UpToDate=" + CurrentDate + "&OrgGroupId=" + item.OrgGroupId + "'>" + item.Total + "</a></td><td>" + item.PresentStudent + "</td><td>" + item.AbsentStudent + "</td><td>" + item.LessThen70 + "</td><td>" + item.HundredPer + "</td><td>" + item.AbsentCount + "</td><td>" + item.LeaveRequest + "</td><td>" + item.AttnNotTakenClass + "</td></tr>";
                            tblStudentAttndGroupWiseDetail += "<tr><td>" + item.OrgGroupId + "</td><td>" + item.OrgGroupTitle + "</td><td>" + item.OrgId + "</td><td><a href='../MobileView/StudentAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=2&UpToDate=" + CurrentDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DivisionId=0&GenderType=0'>" + item.OrgGroupTitle + "</a></td><td><a href='../MobileView/StudentAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=11&UpToDate=" + CurrentDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DivisionId=0&GenderType=0'>" + item.Total + "</a></td><td><a href='../MobileView/StudentAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=12&UpToDate=" + CurrentDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DivisionId=0&GenderType=0'>" + item.PresentStudent + "</a></td><td><a href='../MobileView/StudentAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=13&UpToDate=" + CurrentDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0'>" + item.AbsentStudent + "</a></td><td><a href='../MobileView/StudentAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=14&UpToDate=" + CurrentDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DivisionId=0&GenderType=0'>" + item.LessThen70 + "</a></td><td><a href='../MobileView/StudentAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=15&UpToDate=" + CurrentDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DivisionId=0&GenderType=0'>" + item.HundredPer + "</a></td><td><a href='../MobileView/StudentAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=17&UpToDate=" + CurrentDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DivisionId=0&GenderType=0'>" + item.AbsentCount + "</a></td><td><a href='../MobileView/StudentAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=16&UpToDate=" + CurrentDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DivisionId=0&GenderType=0'>" + item.LeaveRequest + "</a></td><td><a href='../MobileView/StudentAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=18&UpToDate=" + CurrentDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DivisionId=0&GenderType=0'>" + item.AttnNotTakenClass + "</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 { tblStudentAttndGroupWiseDetail += "<tr><td colspan='8' class='record'>No records found..!!</td></tr>"; }
                    document.getElementById("tblStudentAttndGroupWiseDetail").innerHTML = tblStudentAttndGroupWiseDetail;
                    StaffAttndDetailsGroupWiseDataBind();





                }
            });

        }
        function StaffAttndDetailsGroupWiseDataBind() {

            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: "ConsolidateDashboardStaffAttnd.aspx/StaffAttndDetailsGroupWiseDataBind",
                data: JSON.stringify({ "TypeId": 1, "UpTodate": CurrentDate }),

                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (result) {
                    //alert(result.d);

                    var obj = (result.d);


                    l = "";
                    ///  var total = 0;
                    if (obj != "") {
                        tblStaffAttndGroupWiseDetail += "<tr><th>DepartmentDetails</th><th>OrgGroupId</th><th>OrgGroupTitle</th><th>Total</th><th>Present</th><th>Absent</th><th>Leave</th><th>AB10</th><th>AB3Days</th><th>Leave3Day</th><th>HundredPerAttn</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>";

                            //tblStudentAttndGroupWiseDetail += "<tr><td>" + item.OrgGroupId + "</td><td><a href='../MobileView/StudentAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=2&UpToDate=" + CurrentDate + "&OrgGroupId=" + item.OrgGroupId + "'>" + item.OrgTitle + "</a></td><td><a href='../MobileView/StudentAttendanceDivisionDetails.aspx?TypeId=11&UpToDate=" + CurrentDate + "&OrgGroupId=" + item.OrgGroupId + "'>" + item.Total + "</a></td><td>" + item.PresentStudent + "</td><td>" + item.AbsentStudent + "</td><td>" + item.LessThen70 + "</td><td>" + item.HundredPer + "</td><td>" + item.AbsentCount + "</td><td>" + item.LeaveRequest + "</td><td>" + item.AttnNotTakenClass + "</td></tr>";
                            tblStaffAttndGroupWiseDetail += "<tr><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=3&UpToDate=" + CurrentDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DepartmentId=0'>Get</a></td><td>" + item.OrgGroupId + "</td><td><a href='../MobileView/StaffAttendanceDetailsOrgWiseDashBoard.aspx?TypeId=2&UpToDate=" + CurrentDate + "&OrgGroupId=" + item.OrgGroupId + "&OrgId=0&DepartmentId=0'>" + item.OrgGroupTitle + "</a></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>";

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



                }
            });

        }
        function BackOrgFunction() {
            debugger;
            //parent.history.back();
            //return false;
            // window.location.href(document.referrer.toString());
            window.location = document.referrer;
        }
    </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="FeeStatusHead" style="display: none">
                            <h3 class="table-topic">Fee Status</h3>
                            <%-- <asp:PlaceHolder ID="DepartMentPlaceHolder" runat="server" /> --%>
                            <div class='himsBoxContent'>
                                <div class='table-responsive'>
                                    <table id='tblFeeStatus' 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="ReceiptDetailHead" style="display: none">
                            <h3 class="table-topic">Receipt Detail</h3>
                            <%-- <asp:PlaceHolder ID="DepartMentPlaceHolder" runat="server" /> --%>
                            <div class='himsBoxContent'>
                                <div class='table-responsive'>
                                    <table id='tblReceiptDetail' class='table table-striped table-bordered'>
                                    </table>
                                </div>
                            </div>
                        </div>
                        <div class="himssuHeader1WireBox col-md-12 pTop5" id="ClassHead" style="display: none">
                            <h3 class="table-topic">Class Wise Student</h3>
                            <%-- <asp:PlaceHolder ID="DepartMentPlaceHolder" runat="server" /> --%>
                            <div class='himsBoxContent'>
                                <div class='table-responsive'>
                                    <table id='tblClss' 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 Wise Student</h3>
                            <%-- <asp:PlaceHolder ID="DepartMentPlaceHolder" runat="server" /> --%>
                            <div class='himsBoxContent'>
                                <div class='table-responsive'>
                                    <table id='tblDivision' class='table table-striped table-bordered'>
                                    </table>
                                </div>
                            </div>
                        </div>
                        <div class="himssuHeader1WireBox col-md-12 pTop5" id="StudentHead" style="display: none">
                            <h3 class="table-topic">Student List </h3>
                            <%-- <asp:PlaceHolder ID="DepartMentPlaceHolder" runat="server" /> --%>
                            <div class='himsBoxContent'>
                                <div class='table-responsive'>
                                    <table id='tblstudent' class='table table-striped table-bordered'>
                                    </table>
                                </div>
                            </div>
                        </div>
                        <div class="himssuHeader1WireBox col-md-12 pTop5" id="StudentAttndGroupWiseDetailHead" style="display: block">
                            <h3 class="table-topic">Student Attendance</h3>
                            <%-- <asp:PlaceHolder ID="DepartMentPlaceHolder" runat="server" /> --%>
                            <div class='himsBoxContent'>
                                <div class='table-responsive'>
                                    <table id='tblStudentAttndGroupWiseDetail' class='table table-striped table-bordered'>
                                    </table>
                                </div>
                            </div>
                        </div>
                        <div class="himssuHeader1WireBox col-md-12 pTop5" id="StaffAttndGroupWiseDetailHead" style="display: block">
                            <h3 class="table-topic">Staff Attendance</h3>
                            <%-- <asp:PlaceHolder ID="DepartMentPlaceHolder" runat="server" /> --%>
                            <div class='himsBoxContent'>
                                <div class='table-responsive'>
                                    <table id='tblStaffAttndGroupWiseDetail' 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>

