
@{
    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">
                        <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: 'supplier_name', title: '供应商名称', width: '180', sortable: true, formatter: function (idx, data) {
                        return '<div class="mules" title="' + data.supplier_name + '">' + data.supplier_name + '</div>';
                    }
                },
                {
                    field: 'pay_company_name', title: '公司主体', width: '180', sortable: false, formatter: function (idx, data) {
                        return '<div class="mules" title="' + data.pay_company_name + '">' + data.pay_company_name + '</div>';
                    }
                },
                { field: 'start_amount', title: '期初金额', width: '100', sortable: true },
                { field: 'borrow_amount', title: '借方发生额', width: '110', sortable: false },
                { field: 'loan_amount', title: '贷方发生额', width: '110', sortable: false },
                { field: 'end_amount', title: '期末金额', width: '100', sortable: true },
                { field: 'day', title: '日期', width: '90', sortable: true }
            ];

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

    </script>

}


