<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/webpage/include/taglib.jsp"%>

<html>
<head>
    <title>wbs</title>
    <link rel="stylesheet" href="${ctxp}/static/plugin/assets/layui/css/layui.css">
    <link rel="stylesheet" href="${ctxp}/static/plugin/assets/common.css"/>
    <script type="text/javascript" src="${ctxp}/static/plugin/assets/jquery-3.2.1.min.js"></script>
    <script src="${ctxp}/static/plugin/assets/layui/layui.js"></script>
    <%@include file="wbslist.js"%>
</head>
<style>
    .btn_out{ width: 100px; margin: 0; float: right; margin-right:2%;}
    .div_main_form{ width: 50%; margin-left: 10px;}
    .layui-icon-layer{display: none;}
    .layui-icon-file{display: none;}
    .layui-meself-img1{width: 15px;height:15px;/*padding: 2px;*/margin-bottom: 3px;line-height: 15px}
    .layui-btn-meself{ width: 70px;padding: 4px 7px;}
     .layui-table-view .layui-table {width:100%}
    .layui-table-tips-main{display:none}
    .layui-table-tips-c{display:none}
</style>
<body style="background-color: white ;height: 100%">
    <sys:message content="${message}"/>
    <div style="margin-top: 20px">
     <c:forEach items="${map.list1}" var="data1" varStatus="index">
    <div style="margin-left: 30px;float: left;font-size: 15px">
        <label>当前工程：${data1.projectName}</label>&nbsp;&nbsp;
        <label>工程编号：${data1.projectNo}</label>
        <div style="height: 5px"></div>
        <c:if test="${data1.type eq '1'}">
            <label>结算书类型：架空线路</label>&nbsp;&nbsp;
        </c:if>
        <c:if test="${data1.type eq '2'}">
            <label>结算书类型：电缆线路</label>&nbsp;&nbsp;
        </c:if>
        <c:if test="${data1.type eq '3'}">
            <label>结算书类型：变电站工程</label>&nbsp;&nbsp;
        </c:if>
        <label>当前结算书：${data1.itemName}</label>
        <div style="height: 7px"></div>
    </div>
    <div class="" style="margin-right: 30px;float: right;margin-top: 19px">
        <div class="layui-btn-group">
               <input id="type" hidden value="${data1.type}">
               <c:if test="${empty data1.projectId}">
            <a class="layui-btn layui-btn-meself" href="${ctx}/project/tolist"><img class="layui-meself-img1" src="${ctxp}/icon/back.png" alt="">&nbsp;返回</a>
               </c:if>
               <c:if test="${not empty data1.projectId}">
                   <a class="layui-btn layui-btn-meself" href="${ctx}/project/tem/tolist?projectId=${data1.projectId}"><img class="layui-meself-img1" src="${ctxp}/icon/back.png" alt="">&nbsp;返回</a>
               </c:if>
                <a class="layui-btn layui-btn-warm layui-btn-meself" href="${ctx}/jkxl/export?id=${data1.id}&type=${data1.type}"><img class="layui-meself-img1" src="${ctxp}/icon/daochu.png" alt="">&nbsp;导出</a>
        </div>
    </div>
     </c:forEach>
    </div>
    <fieldset class="layui-elem-field layui-field-title" style="width: 100%">
        <legend>结算汇总表</legend>
    </fieldset>
    <div class="" style="margin-left: 10px;margin-right: 10px;">
        <table class="layui-hide" id="settlement" lay-filter="settle"></table>
    </div>

    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
        <legend>本体部分</legend>
    </fieldset>
    <div class="" style="margin-left: 10px;margin-right: 10px;margin-top: 10px;">
            <%--<table:importExcel url="${ctx}/propertycostreminder/propertyCostReminder/import"></table:importExcel>--%>
        <table id="table1" class="layui-table" lay-filter="table1"></table>
    </div>

    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
        <legend>其他部分</legend>
    </fieldset>
    <div class="" style="margin-left: 10px;margin-right: 10px;">
        <table id="table2" class="layui-table" lay-filter="table2"></table>
    </div>

    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
        <legend>未识别部分</legend>
    </fieldset>
    <div class="" style="margin-left: 10px;width:70%;margin-right: 10px;">
        <input hidden="hidden" name="" id="newid" value=""/>
        <input hidden="hidden" name="" id="xmmc1" value=""/>
        <input hidden="hidden" name="" id="fyje1" value=""/>
        <table class="layui-hide" id="xmmc" lay-filter="freestr"></table>
    </div>
    <div class="layui-form" style="display: none;padding: 10px" id="mydiv">
        <table class="layui-table" id="show">
            <colgroup>
                <col width="150">
                <col width="150">
                <col width="200">
                <col>
            </colgroup>
            <thead>
            <tr>
                <th>表名</th>
                <th>费用名称</th>
                <th>金额</th>
            </tr>
            </thead>
            <tbody id="mytbody1">
            </tbody>
        </table>
        <span id="myspan1" style="font-weight: bold;font-size: 15px">此结算书暂时无法验证，请选择其他结算书。</span>
        <table class="layui-table" id="hide">
            <colgroup>
            <col width="150">
            <col width="150">
            <col width="200">
            <col>
            </colgroup>
            <thead>
            <tr>
                <th>表名</th>
                <th>费用名称</th>
                <th>金额</th>
            </tr>
            </thead>
            <tbody id="mytbody2">
            </tbody>
        </table>
        <span id="myspan2" style="font-weight: bold;font-size: 15px">此结算书暂时无法验证，请选择其他结算书。</span>
    </div>
    <div style="width: 100%;height: 100px"></div>
    <script type="text/html" id="barDemo">
        <a class="layui-btn  layui-btn-xs" lay-event="fttz">分摊调整</a>
        <a class="layui-btn layui-btn-xs" lay-event="ddtz">单独调整</a>
    </script>
</body>
<script>
    function div_table(data) {
        $("#mytbody1").html("");
        $("#mytbody2").html("");
        var name = data.setname;
        var arr  = data.reason.split(',');
        var count = 0;
        var tr="";
        for (var i = 0; i < arr.length;i+=3) {
            if(name=="分部分项工程费"){
                $("#hide").show();
                $("#myspan2").show();
                if (arr[i].indexOf("《工程项目竣工结算汇总表》")!=-1||arr[i].indexOf("《工程项目投标报价汇总表》")!=-1){
                    count+=1;
                }
                if(count<=1){
                    //《工程项目竣工结算汇总表》
                    if(arr[i].indexOf("范围内")!=-1) {
                        $("#myspan1").html(arr[i]);
                    }else{
                         tr  =  "<tr><td>"+arr[i]+"</td><td>"+arr[i+1]+"</td><td>"+arr[i+2]+"</td></tr>"
                        $("#mytbody1").append(tr);
                    }
                }else {
                    if(arr[i].indexOf("范围内")!=-1) {
                        $("#myspan2").html(arr[i]);
                    }else{
                         tr  =  "<tr><td>"+arr[i]+"</td><td>"+arr[i+1]+"</td><td>"+arr[i+2]+"</td></tr>"
                        $("#mytbody2").append(tr);
                    }
                }
            }else {
                $("#hide").hide();
                $("#myspan2").hide();
                if(arr[i].indexOf("范围内")!=-1) {
                    $("#myspan1").html(arr[i]);
                }else{
                    tr  =  "<tr><td>"+arr[i]+"</td><td>"+arr[i+1]+"</td><td>"+arr[i+2]+"</td></tr>"
                    $("#mytbody1").append(tr);
                }
            }
        }
        $("table#show tbody tr:first").css("background","#f9f9f9");
        $("table#hide tbody tr:first").css("background","#f9f9f9");
        if($("table#show tbody tr:last td:nth-child(2)").text()== "小计"){
            $("table#show tbody tr:last").css("background","#f9f9f9");
        }
        if($("table#hide tbody tr:last td:nth-child(2)").text()=="小计"){
            $("table#hide tbody tr:last").css("background","#f9f9f9");
        }
        return $("#mydiv");
    }
</script>
</html>
