
@{
    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>
                </tr>
            </thead>
            @if (ViewBag.list.Count > 0)
            {
                foreach (var item in ViewBag.list)
                {
                    <tr>
                        <td>@item.company_name</td>
                        <td>@item.bank_card</td>
                        <td>@item.bank_name</td>
                        <td>@item.bank_card_user</td>
                        <td>@item.creditor</td>
                        <td>@item.balance_rmb.ToString("###,###.##")</td>
                        <td>@item.statistical_time.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 css{
    <style>
        .mules {
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
    </style>
}
@section scripts{
    <script>
        var tb;
        $(document).ready(function () {
            var height = document.body.clientHeight;
            $("#roletable").attr("data-height", (height - 100));

            list();
        })

        function list() {
            var columns = [
                {
                    field: 'company_name', title: '借入公司主体名称', width: '160', sortable: true, formatter: function (idx, data) {
                    return '<div class="mules" title="' + data.company_name + '">' + data.company_name + '</div>';
                }
                },
                {
                    field: 'bank_card', title: '借款帐号', width: '130', sortable: true, formatter: function (idx, data) {
                        return '<div class="mules" title="' + data.bank_card + '">' + data.bank_card + '</div>';
                    }
                },
                {
                    field: 'bank_name', title: '借款银行名称', width: '130', sortable: true, formatter: function (idx, data) {
                        return '<div class="mules" title="' + data.bank_name + '">' + data.bank_name + '</div>';
                    }
                },
                {
                    field: 'bank_card_user', title: '借款银行持卡人', width: '130', sortable: true, formatter: function (idx, data) {
                        return '<div class="mules" title="' + data.bank_card_user + '">' + data.bank_card_user + '</div>';
                    }
                },
                {
                    field: 'creditor', title: '债权方', width: '160', sortable: true, formatter: function (idx, data) {
                        return '<div class="mules" title="' + data.creditor + '">' + data.creditor + '</div>';
                    }
                },
                { field: 'balance_rmb', title: '借款余额', width: '100', sortable: true },
                { field: 'statistical_time', title: '日期', width: '110', sortable: false },
            ];

            var url = '@Url.Content("~/Reports/Finance/ShortBorrowJson")' + '?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/ExportShortBorrow?date=")' + '@(ViewBag.date)&paycompanyid=@(ViewBag.paycompanyid)', "_blank");
        }

    </script>

}


