@model Com._9pm2.ClientWeb.Models.StockOutList
@{
    ViewBag.Title = "出库单管理";
}
<script src="~/Scripts/stockcommon.js?vn=20180813"></script>
<script src="../../Scripts/stockout.js?vn=20180813"></script>
@{
    Com._9pm2.ClientWeb.Models.LoginUser user = Session["LoginUser"] as Com._9pm2.ClientWeb.Models.LoginUser;
}
<form method="post" action="/Warehouse/StockOut">
    <div class="divSearch">
        <div>                    
            @Html.DropDownList("sType", new SelectList(Model.DdlType, "ItemValue", "ItemText"))
            <div class="div-search-select2">
                @Html.DropDownList("sMaterial", new SelectList(Model.DdlMaterial, "ItemValue", "ItemText"))
                @Html.Hidden("hiddenMaterial")
            </div>
            @Html.DropDownList("sStatus", new SelectList(Model.DdlStatus, "ItemValue", "ItemText"))           
            @Html.TextBox("sBeginDate", null, new { maxlength = "50", @class = "text-date", placeholder = "出库日期" }) ~ @Html.TextBox("sEndDate", null, new { maxlength = "50", @class = "text-date", placeholder = "出库日期" })
            @Html.TextBox("sKeywords", null, new { maxlength = "50", placeholder = "关键字" })
            <button class="btn btn-default" id="btnSearch">搜索</button>
            <button id="btnNew" type="button" class="btn btn-default">新增</button>          
        </div>
    </div>
</form>

<div class="error-msg"></div>

<div class="list">
    <table id="tStockOut" class="">
        <thead>
            <tr>
                <th>
                    <input type="checkbox" id="chkAll" onclick="SelectAll();" />
                </th>
                <th>出库单编号</th>
                <th>出库类型</th>              
                <th>出库日期</th>    
                <th>审核状态</th>               
                <th>经办人</th>   
                <th style="width:120px;">操作</th>
            </tr>
        </thead>
        <tbody id="StockOutList">
            @foreach (var item in Model.List)
            {
                <tr id="@item.Id">
                    <td class="td-checkbox">
                        <input type="checkbox" onclick="SelectOne();" />
                    </td>
                    <td>@item.SN</td>
                    <td>@((Com._9pm2.ClientWeb.Common.StockOutType)item.Type)</td>
                    <td>@item.StockOutTime.ToString("yyyy-MM-dd")</td>
                    <td><span>@((Com._9pm2.ClientWeb.Common.StockOutStatus)item.Status)</span></td>
                                    
                    <td>@item.Operator</td>
                    <td style="text-align:center" class="td-last">
                        <div class="operation-btns">
                            <div>
                                <button id="select">&nbsp;</button>
                            </div>
                            <ul>                                
                                @if (item.Status != (int)Com._9pm2.ClientWeb.Common.StockOutStatus.已审核)
                                {
                                    <li><a href="javascript:void(0);" onclick="EditStockOut('@item.Id');">编辑</a></li>                                    
                                    <li><a href="javascript:void(0);" onclick="DeleteStockOut('@item.Id');">删除</a></li>
                                    if (user.PermissionList.Contains(Com._9pm2.ClientWeb.Common.PT_PermissionType.P8_出库单审核))
                                    {
                                        <li><a href="javascript:void(0);" onclick="ApproveStockOut('@item.Id');">审核出库</a></li>
                                    }
                                }
                                else
                                {
                                    if (user.PermissionList.Contains(Com._9pm2.ClientWeb.Common.PT_PermissionType.P8_出库单审核))
                                    {
                                         <li><a href="javascript:void(0);" onclick="UnApproveStockOut('@item.Id');">反审核</a></li>
                                    }
                                }
                             
                            </ul>
                        </div>
                    </td>
                </tr>            
            }
        </tbody>
    </table>
    @Html.Pager("StockOut", "Warehouse", Model.RouterDirectory, Model.PagerConfig, "pagerDiv", "pagerDiv", 8, true, false, true, true, false)
</div>  

@Html.Partial("StockOutDetail")