
@{
    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 scripts{
    <script>
        var tb;
        $(document).ready(function () {
            var height = document.body.clientHeight;
            $("#roletable").attr("data-height", (height - 100));

            list();
        })

        function list() {
            var columns = [
                { field: 'warehouse_name', title: '仓库名称', width: '160', sortable: true },
                { field: 'material_code', title: 'Sku编码', width: '160', sortable: true },
                { field: 'material_name', title: 'Sku名称', width: '160', sortable: true },
                { field: 'jit_prod_stock', title: 'jit库存', width: '120', sortable: true },
                { field: 'plan_prod_stock', title: '计划单库存', width: '120', sortable: true },
                { field: 'new_price', title: '最新报价', width: '120', sortable: true },
                { field: 'record_time', title: '统计日期', width: '110', sortable: false }
            ];

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

    </script>

}

