
@{
    ViewData["Title"] = "第三方平台余额";
    Layout = "~/Pages/Shared/_MainLayout.cshtml";
}

@*<div class="ibox-content m-b-sm border-bottom">
        <table id="tb" class="table table-hover table-bordered" style="width:100%;">
            <thead>
                <tr>
                    <th>付款主体</th>
                    <th>平台名称</th>
                    <th>帐号名称</th>
                    <th>总余额（原币）</th>
                    <th>可用余额（原币）</th>
                    <th>冻结余额（原币）</th>
                    <th>币种</th>
                    <th>总余额（人民币）</th>
                    <th>可用余额（人民币）</th>
                    <th>冻结余额（人民币）</th>
                    <th>放款日期</th>
                    <th>统计日期</th>
                </tr>
            </thead>
            @if (ViewBag.list.Count > 0)
            {
                foreach (var item in ViewBag.list)
                {
                    <tr>
                        <td>@ViewBag.PayCompanyName</td>
                        <td>@item.platformname</td>
                        <td>@item.account</td>
                        <td>@item.amount.ToString("###,###.##")</td>
                        <td>@item.userable_amount.ToString("###,###.##")</td>
                        <td>@item.freeze_amount.ToString("###,###.##")</td>
                        <td>@item.currency</td>
                        <td>@item.amount_rmb.ToString("###,###.##")</td>
                        <td>@item.userable_amount_rmb.ToString("###,###.##")</td>
                        <td>@item.freeze_amount_rmb.ToString("###,###.##")</td>
                        <td>@item.puttime.ToString("yyyy-MM-dd")</td>
                        <td>@item.day.ToString("yyyy-MM-dd")</td>
                    </tr>
                }
            }
        </table>
    </div>*@

<div class="row">
    <div class="col-sm-12">
        <div class="ibox-content m-b-sm border-bottom">
            <form id="toolbar">
                <div class="form-inline" style="line-height:40px;">
                    <div class="form-group">
                        <button type="button" class="btn btn-primary" onclick="exportFile();">导出</button>
                    </div>
                </div>
            </form>
        </div>
        <div class="ibox-content m-b-sm border-bottom">
            <table id="roletable" style="table-layout:fixed;"></table>
        </div>
    </div>
</div>

@section scripts{
    <script>
        var tb;
        $(document).ready(function () {
            var height = document.body.clientHeight;
            $("#roletable").attr("data-height", (height - 170));

            list();
        })

        function list() {
            var columns = [
                { field: 'platformname', title: '平台名称', width: '120', sortable: true },
                { field: 'account', title: '帐号名称', width: '130', sortable: true },
                {
                    field: 'amount', title: '总余额（原币）', width: '130', sortable: true
                },
                { field: 'userable_amount', title: '可用余额（原币）', width: '160', sortable: true },
                { field: 'freeze_amount', title: '冻结余额（原币）', width: '160', sortable: true },
                { field: 'currency', title: '币种', width: '80', sortable: true },
                { field: 'amount_rmb', title: '总余额（人民币）', width: '160', sortable: true },
                { field: 'userable_amount_rmb', title: '可用余额（人民币）', width: '160', sortable: true },
                { field: 'freeze_amount_rmb', title: '冻结余额（人民币）', width: '160', sortable: true },
                //{ field: 'puttime', title: '放款日期', width: '110', sortable: false },
                { field: 'day', title: '统计日期', width: '110', sortable: false },
            ];

            var url = '@Url.Content("~/Reports/Finance/PlatformBalanceJson")' + '?date=@(ViewBag.date)&paycompanyid=@(ViewBag.paycompanyid)';

            if (tb == undefined) {
                tb = OnlyTable("roletable", columns, url, "");
            }
            else {
                tb.bootstrapTable('refresh', { url: url });
            }
        }

        function exportFile() {
            window.open('@Url.Content("~/Reports/Finance/PlatformBalanceExport?date=")' + '@(ViewBag.date)&paycompanyid=@(ViewBag.paycompanyid)', "_blank");
        }

    </script>

}

