
@{
    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 id="start" name="start" type="text" class="form-control" style="width:130px;" value="@(ViewBag.start)" />
                        <span>至</span>
                        <input id="end" name="end" type="text" class="form-control" style="width:130px;" value="@(ViewBag.end)" />
                    </div>
                    <div class="form-group">
                        <button type="button" class="btn btn-success" onclick="list();">搜索</button>
                        <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 type="text/javascript">
        var tb;
        $(document).ready(function () {
            laydate.render({ elem: '#start' });
            laydate.render({ elem: '#end' });

            var height = document.body.clientHeight;
            $("#roletable").attr("data-height", (height - 170));

            list();
        })

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

            if (start == '') {
                alert('请选择开始日期');
                return false;
            }

            if (end == '') {
                alert('请选择结束日期');
                return false;
            }

            var columns = [
                { field: 'receiveUnit', title: '被出纳公司名', width: '160' },
                { field: 'reason', title: '原因', width: '130' },
                { field: 'payTime', title: '出纳时间', width: '130' },
                { field: 'departmentName', title: '部门', width: '130' },
                { field: 'companyName', title: '付款主体', width: '150' },
                { field: 'feeSuperType', title: '费用主类型', width: '120' },
                { field: 'feeSubType', title: '费用子类型', width: '130' },
                { field: 'amountRmb', title: '人民币金额', width: '110' }
            ];

            var url = '@Url.Content("~/Reports/Finance/ListPayLogisticJson")' + '?start=' + start + '&end='+end;

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

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

            if (start == '') {
                alert('请选择开始日期');
                return false;
            }

            if (end == '') {
                alert('请选择结束日期');
                return false;
            }

            window.open('@Url.Content("~/Reports/Finance/ExportListPayLogistic?start=")' + start + '&end=' + end, '_blank');
        }

    </script>
}

