
@{
    ViewData["Title"] = "ListSkuDiffWeigh";
    Layout = "~/Pages/Shared/_MainLayout.cshtml";
    ViewBag.Nav = new string[] { "Sku", "Sku发货重量差异" };
}

<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="shipstart" name="shipstart" type="text" class="form-control" style="width:130px;" placeholder="发货开始时间" value="@(DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"))" />
                        <span>至</span>
                        <input id="shipend" name="shipend" type="text" class="form-control" style="width:130px;" placeholder="发货结束时间" value="@(DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"))" />
                    </div>
                    <div class="form-group">
                        <label>差异范围</label>
                        <input id="min" name="min" type="number" class="form-control" style="width:140px" placeholder="差异范围开始值" />
                        <span>至</span>
                        <input id="max" name="max" type="number" class="form-control" style="width:140px" placeholder="差异范围结束值" />
                    </div> 
                    <div class="form-group">
                        <label>sku</label>
                        <input type="text" id="sku" name="sku" class="form-control" style="width:130px" placeholder="sku编码" />
                    </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="exportxls();">导出</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 tb;
        $(document).ready(function () {
            laydate.render({ elem: '#shipstart' });
            laydate.render({ elem: '#shipend' });
            list();
        })

        function list() {
            var columns = [
                {
                    field: 'day', title: '日期', width: '160'
                },
                {
                    field: 'pick_order_id', title: '配货单号', width: '160'
                },
                {
                    field: 'bailun_sku', title: 'sku编码', width: '160'
                },
                { field: 'weight', title: 'sku重量g', width: '130', sortable: true },
                { field: 'bailun_sku_outbound_weight', title: '发货重量g', width: '130', sortable: true, iscount: true },
                { field: 'diffweigh', title: '差异值g', width: '130', sortable: true }
            ];

            var url = '@Url.Content("~/Reports/Sku/ListSkuDiffWeighJson")' + '?' + $("#toolbar").serialize();

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

        function exportxls() {
            window.open("@Url.Content("~/Reports/Sku/ExportSkuDiffWeigh")" + '?' + $("#toolbar").serialize(), '_blank');
        }
        
    </script>

}

