<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta name="decorator" content="base"/>
    <link rel="stylesheet" href="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/style/admin.css" media="all">
    <link rel="stylesheet" href="${ctxPlugin}/static/css/reset.css" media="all">
    <style>
        .layui-form-select dl{
            max-height:200px;
            width: 80%;
        }
        html {
            background-color: #fff;
        }
        .layui-table td, .layui-table th {
            text-align: center;
        }
        .hx_l{
            position: relative;
        }
        .hx_l>span{position: absolute; right: 10px; top: 5px}
        .hx_del{ font-size: 12px; color: #0e8ee7; position: relative; top: 4px; display: none}
        #attachFile>li{height: 26px}
        #attachFile>li:hover .hx_del{ display: inline-block}
        .hx_ts{
            font-size: 12px;
            color: red;
        }
        .layui-word-aux{
            padding: 7px 0 !important;
        }
        .totalAmount{
            color: #0099cc;
        }
        .totalDiff{
            color: #ff0000;
        }
    </style>
</head>
<body>
<div class="aaa">
    <div class="layui-form">
        <div class="layui-card-body over pt-20 pb-40 h-350" action="" id="detailSet">
            <div class="layui-col-xs12 mb-10 pr-30">
                <div class="layui-inline layui-col-xs4">
                    <label class="layui-form-label w-130"><i class="red">*</i>盘点对象：</label>
                    <div class="layui-input-block ">
                        <select name="inventoryType" lay-verify="required" lay-filter="inventoryType" disabled>
                            <option value="">请选择</option>
                            <option value="1" ${order.inventoryType eq '1' ? 'selected' : ''}>供应链</option>
                            <option value="3" ${order.inventoryType eq '3' ? 'selected' : ''}>供应商</option>
                            <option value="2" ${order.inventoryType eq '2' ? 'selected' : ''}>代理商</option>
                        </select>
                    </div>
                </div>
                <div class="layui-inline layui-col-xs4">
                    <label class="layui-form-label w-130"><i class="red">*</i>盘点仓库：</label>
                    <div class="layui-input-block w-200">
                        <select name="warehouseId" lay-verify="required" id="warehouseId" lay-filter="warehouseId" disabled>
                            <option value="">请选择</option>
                            <c:forEach items="${warehouseList}" var="warehouse">
                                <option value="${warehouse.columns.id}" ${warehouse.columns.id eq order.warehouseId ? 'selected' : ''}>${warehouse.columns.name}</option>
                            </c:forEach>
                        </select>
                    </div>
                </div>
            </div>
            <div class="layui-col-xs12 mb-20 pr-30 mt-20">
                <table class="layui-table">
                    <thead>
                    <tr>
                        <th>序号</th>
                        <th>物料代码</th>
                        <th>物料类型</th>
                        <th>单位</th>
                        <th>物料描述</th>
                        <th>当前库存</th>
                        <th>盘点数量</th>
                        <th>盘盈/盘亏</th>
                    </tr>
                    </thead>
                    <tbody id="materialTable">
                    <c:forEach items="${details}" varStatus="vs" var="material">
                        <tr>
                            <td>${vs.count}</td>
                            <td>${material.columns.material_code}</td>
                            <td>${material.columns.material_type}</td>
                            <td>${material.columns.material_unit}</td>
                            <td>${material.columns.material_remarks}</td>
                            <td><fmt:formatNumber value="${material.columns.stock}" pattern="#"/></td>
                            <td><fmt:formatNumber value="${material.columns.amount}" pattern="#"/></td>
                            <td>
                                <c:set value="${material.columns.amount - material.columns.stock}" var="diff"></c:set>
                                <c:if test="${diff > 0}">+</c:if>
                                <fmt:formatNumber value="${material.columns.amount - material.columns.stock}" pattern="#"/>
                            </td>
                        </tr>
                    </c:forEach>
                    </tbody>
                </table>
            </div>
            <div class="layui-inline layui-col-xs2">
                <label class="layui-form-label w-130">本次盘点数量：</label>
                <div class="layui-input-block "><div class="layui-form-mid layui-word-aux"><b class="totalAmount"><fmt:formatNumber value="${order.amount}" pattern="#"/></b></div></div>
            </div>
            <div class="layui-inline layui-col-xs2">
                <label class="layui-form-label w-130">盘亏/盘盈：</label>
                <div class="layui-input-block "><div class="layui-form-mid layui-word-aux"><b class="totalDiff">${order.differenceAmount > 0 ? '+' : ''}<fmt:formatNumber value="${order.differenceAmount}" pattern="#"/></b></div></div>
            </div>
        </div>
        <div class="layui-form-item operate-footer" style="text-align: center;">
            <button type="button" class="layui-btn layui-btn-primary " onclick="closeDiv();">取消</button>
        </div>
    </div>
</div>
<div id="lookImg" class="hide pos-r">
    <div style="position:relative;width:90%;height:450px;">
        <div class="w-500 h-450 lookImg">
            <img src="" width="80%" id="image">
        </div>
    </div>
</div>
<script src="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/layui/layui.js"></script>
<script type="text/javascript">
    //初始数据
    var $form;
    var form;
    var upload;
    var $;
    var imgs='';
    var myreg=/^[1][3,4,5,6,7,8,9][0-9]{9}$/;
    var type='${type}';
    layui.use(['form', 'table', 'upload', 'jquery'], function () {
        $ = layui.jquery;
        form = layui.form;
        upload = layui.upload;
        $form = $('form');

    })

    function  closeDiv() {
        var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
        parent.layer.close(index);
    }

    function isBlank(val) {
        if (val == null || val == '' || val == undefined) {
            return true;
        }
        return false;
    }

</script>
</body>
</html>

