
@{
    ViewData["Title"] = "动态库存分析";
    Layout = "~/Pages/Shared/_MainLayout.cshtml";
    ViewBag.Nav = new string[] { "逻辑仓库", "动态库存分析" };

}

<div class="row">
    <div class="col-sm-12">
        <div class="ibox-content m-b-sm border-bottom" style="display:none;">
            <form id="toolbar">
                <div class="form-inline" style="line-height:40px;">
                    <div class="form-group">
                        <label>平台类型：</label>
                        <select id="platform" name="platform" class="form-control">
                            <option value="">选择平台</option>
                        </select>
                    </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>
                    </div>
                </div>
            </form>
        </div>
        <div class="ibox-content m-b-sm border-bottom">
            <table id="roletable" class="table table-hover table-bordered table-condensed table-striped">
                <thead>
                    <tr>
                        <th></th>
                        <th>SKU数</th>
                        <th>库存件数</th>
                        <th>库存金额</th>
                    </tr>
                </thead>
                <tbody id="tb"></tbody>
            </table>
        </div>
    </div>
</div>
    @section scripts{
        <script>
        $(document).ready(function () {
            list();
        })

        function list() {
            $.submit({
                type:'POST',
                url: '@Url.Content("~/Reports/Warehouse/DynamicStockAnalyseJson")',
                paramData: 'warehouse_code=@(ViewBag.warehouse_code)',
                func: function (result) {
                    if (result.success) {
                        $('#tb').html('');

                        for (var i in result.data) {
                            var s = '<tr onclick="showDetail(\'' + result.data[i].item1 + '\',\''+result.data[i].item5+'\')" style="cursor:pointer;">';
                            s += '<td>' + result.data[i].item1 + '</td>';
                            s += '<td>' + result.data[i].item2 + '</td>';
                            s += '<td>' + result.data[i].item3 + '</td>';
                            s += '<td>' + result.data[i].item4 + '</td>';
                            $('#tb').append(s);
                        }
                    }
                }
            })
            }

            function showDetail(name, type) {
                layer_show(name + ' 可用库存的SKU明细', '@Url.Content("~/Reports/Warehouse/ListWareHouseSku?code=" + ViewBag.warehouse_code)'+'&available_days='+type,'90%','90%');
            }

        </script>
    }


