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

<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
    <script>
        var Header = [];
        var ReHeader;
        var OrgGroupId = 0;
        var CollectionGroupId = 0;
        $(document).ready(function () {
            var myurl = window.location.href;
            var keyval = myurl.split('?')[1].split('&');
            OrgGroupId = parseInt(keyval[0].split('=')[1].toString());
            CollectionGroupId = parseInt(keyval[1].split('=')[1].toString());
            GetOrgId();
            PendingFeeCollectionGroupDashboard();
        });

        function PageName() {

            window.location.href = "../MobileView/AlertInnerdashboard.aspx";
        }

        function GetOrgId() {
            $.ajax({
                type: "POST",
                url: "CancelReceipt.aspx/GetOrgId",
                data: JSON.stringify({ "OrgId": OrgGroupId }),
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (result) {
                    var obj = (result.d);
                    Header[0] = "<h5 class='page-title'><a href='#' onclick='PageName()'>" + obj[0].Title + "</a></h5><div class='cBoth'></div><h5 class='page-title' >Fee - More Pending Fee</h5>";
                    $("#HeaderLabel").text("Attention Dashboard");
                    document.getElementById("HeaderTitle").innerHTML = Header;
                    ReHeader = document.getElementById("HeaderTitle").innerHTML;
                }
            });
        }
        function PendingFeeCollectionGroupDashboard() {
            $.ajax({
                type: "POST",
                url: "FeeDetailDashboard.aspx/PendingFeeCollectionGroupDashboard",
                data: JSON.stringify({ "OrgGroupId": OrgGroupId, "CollectionGroupId": CollectionGroupId }),
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (result) {
                    var obj = (result.d);
                    var tblPendingFeeCollectionGroupDashboard = "";
                    var TotalPendingAmount = 0;
                    if (obj != "") {
                        tblPendingFeeCollectionGroupDashboard += "<tr><th>Class - Division</th><th>Code</th><th>Student Name</th><th>Pending Amount</th></tr>";
                        $.each(obj, function (i, item) {
                            tblPendingFeeCollectionGroupDashboard += "<tr><td>" + item.ClassDivision + "</td><td>" + item.Code + "</td><td>" + item.Name + "</td><td>" + item.PendingAmount + "</td></tr>";
                            TotalPendingAmount += parseInt(item.PendingAmount);
                        });
                        tblPendingFeeCollectionGroupDashboard += "<tr><td style='font-weight:bold'>&nbsp;</td><td style='font-weight:bold'>&nbsp;</td><td style='font-weight:bold'>Total</td><td style='font-weight:bold'>" + TotalPendingAmount + "</td></tr>";
                    }
                    else { tblPendingFeeCollectionGroupDashboard += "<tr><td colspan='8' class='record'>No records found..!!</td></tr>"; }
                    document.getElementById("tblPendingFeeCollectionGroupDashboard").innerHTML = tblPendingFeeCollectionGroupDashboard;
                }

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


        function BackOrgFunction() {
            window.location.href = "../MobileView/AlertInnerdashboard.aspx?OrgGroupId=" + OrgGroupId;
        }
    </script>
    <asp:UpdatePanel ID="DoctorScheduleUpdatePanel" runat="server">
        <ContentTemplate>
            <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>
                <label class="header-topic justify-content-center" id="HeaderLabel"></label>
                <input type="button" value="&#xf3e5;" id="bntBackOrg" onclick="BackOrgFunction()" skinid="0" class="float-right btn btn-back btn-icon fas" />
            </div>
            <div class="page-header row mb20">
                <div class="col-xl-12 col-sm-12 col-xs-12 border-bottom-inline xs-padd0">
                    <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">
                        <div class="himssuHeader1WireBox col-md-12 pTop5" id="OrgHead">
                            <h3 class="table-topic">Fee List</h3>
                            <div class='himsBoxContent'>
                                <div class='table-responsive'>
                                    <table id='tblPendingFeeCollectionGroupDashboard' class='table table-striped table-bordered'>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
