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

<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">

    <script>
        var TypeId = 0;
        var UpToDate = '';
        var OrgGroupId = 0;

        var Count = 0;
        var drpOrgGroup = '';
        var drpBatch = '';
        var OrgBatchId = 0;
        var StatusId;
        $(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());

            //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();
            StudentAttendanceDivisionDetailsDataBind();

            // ReceiptBookCollectionDataBind();


        });
        
        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 StudentAttendanceDivisionDetailsDataBind() {

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

                    var obj = (result.d);
                    var tblStudentAttndDivisionDetails = "";
                    l = "";
                    ///  var total = 0;
                    if (obj != "") {
                        tblStudentAttndDivisionDetails += "<tr><th>Org Group Title</th><th>Division Title</th><th>Division Code</th><th>Total Students</th><th>Male</th><th>Female</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>";

                            tblStudentAttndDivisionDetails += "<tr><td>" + item.OrgGroupTile + "</td><td>" + item.DivisionId + "</td><td>" + item.DivisionCode + "</td><td>" + item.TotalStudents + "</td><td>" + item.Male + "</td><td>" + item.Female + "</td></tr>";



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



                },
                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>
            <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="StudentAttndDivisionDetailsHead">
                            <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>
                                    <table id='tblStudentAttndDivisionDetails' 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>

