
@{
    ViewData["Title"] = "利息支出明细";
    Layout = "~/Pages/Shared/_MainLayout.cshtml";
}


<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">
                        <label>付款时间</label>
                        <input class="form-control layer-date" id="start" style="width:120px;" placeholder="付款开始时间" value="@ViewBag.start.ToString("yyyy-MM-dd")" />
                        <input class="form-control layer-date" id="end" style="width:120px" placeholder="付款结束时间" value="@ViewBag.end.ToString("yyyy-MM-dd")" />
                    </div>
                    <div class="form-group">
                        <label>&nbsp;</label>
                        <button type="button" class="btn btn-primary" onclick="list();"><i class="fa fa-search"></i>&nbsp;查询</button>
                        <button type="button" class="btn btn-success" onclick="ExportCSV()">导出</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 type="text/javascript">
        var companyid = @ViewBag.paycompanyid;
        var headname = '@Html.Raw(ViewBag.headname)';
        var categoryname = '@Html.Raw(ViewBag.categoryname)';
        var type = @ViewBag.type;
        var issub = @ViewBag.isSub;

        var tb;
        $(document).ready(function () {
            list();
        })

        function list() {

            var start = $('#start').val();
            var end = $('#end').val();

            var columns = [
                {
                    field: 'Company', title: '借入公司主体名称'
                },
                { field: 'BankCard', title: '借款帐号' },
                { field: 'BankCardUser', title: '借款银行名称', },
                { field: 'BankName', title: '借款银行持卡人' },
                { field: 'Creditor', title: '债权方' },
                { field: 'RepayInterest',title: '本期归还利息' },
                { field: 'RepayInterestRMB', title: '本期归还利息RMB' },
                { field: 'ActualRepayTime', title: '实际还款时间' }
            ];

            var url = '@Url.Content("~/Reports/Finance/ListInterestExpenseJson")' + '?paycompanyid=' + companyid + '&headname=' + headname + '&categoryname=' + categoryname + '&start=' + start + '&end=' + end + '&type=' + type + '&issub=' + issub;

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

        function ExportCSV() {
            var start = $('#start').val();
            var end = $('#end').val();

            window.open('@Url.Content("~/Reports/Finance/ExportListInterestExpense")' + '?paycompanyid=' + companyid + '&headname=' + headname + '&categoryname=' + categoryname + '&start=' + start + '&end=' + end + '&type=' + type + '&issub=' + issub, '_blank');

        }

    </script>
}

