<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2020/9/11
  Time: 12:54
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="com.censoft.common.base.Pub" %>
<%@ page import="com.censoft.common.db.ConnectionFactory" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.sql.SQLException" %>
<%@ page import="java.util.*" %>
<%
    Connection conn = null;
    Vector v_list;
    Hashtable ht = new Hashtable();
    Pub pub = new Pub();
    ConnectionFactory cf = new ConnectionFactory();
    String update_id = pub.trimNull(request.getParameter("update_id"));
    String action="add";
    if(!"".equals(update_id)){
        action="update";
    }
    try {
        conn = com.censoft.db.DBUtil.getConnection();
        v_list=cf.doQuery(conn,"select * from zc_register where reg_id=? ",null,new Object[]{update_id});
        if (v_list == null) {
            out.println("查询出错");
            return;
        }
        if (v_list.size() > 0) {
            ht = (Hashtable) v_list.get(0);
        }
    } catch (Exception e) {
        try {
            if(conn != null){
                conn.rollback();
            }
        } catch (SQLException e1) {
            e1.printStackTrace();
        }
        return;
    } finally {
        if (conn != null) {
            try {
                conn.close();
            } catch (Exception e) {
            }
        }
    }
%>
<style>
    .col-sm-1{width: 12%;}
</style>
<article class="page-container" style="overflow: hidden;">
    <form class="form form-horizontal" id="form-admin-add">
        <input type="hidden" name="action" value="<%=action%>"/>
        <input type="hidden" name="update_id" value="<%=update_id%>"/>
        <div class="cl pd-5  bk-gray divOverflow" style="overflow:hidden;margin-bottom: 20px;">
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-1">资产名称：</label>
                <div class="formControls col-xs-8 col-sm-2">
                    <input type="text" name="zc_name" id="zc_name"  value="<%=pub.trimNull((String)ht.get("zc_name"))%>" class="input-text ">
                </div>
                <label class="form-label col-xs-4 col-sm-1">国标大类：</label>
                <div class="formControls col-xs-8 col-sm-2">
                    <select name="zc_gj_type" class="input-text ">
                        <option  value="">请选择</option>
                        <option >11</option>
                    </select>
                </div>
                <label class="form-label col-xs-4 col-sm-1">资产分类：</label>
                <div class="formControls col-xs-8 col-sm-2">
                    <select name="zc_fl" class="input-text ">
                        <option  value="">请选择</option>
                        <option >11</option>
                    </select>
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-1">资产分类代码：</label>
                <div class="formControls col-xs-8 col-sm-2">
                    <input type="text" name="zc_fl_code" id="zc_fl_code" value="<%=pub.trimNull((String)ht.get("zc_fl_code"))%>" class="input-text ">
                </div>
                <label class="form-label col-xs-4 col-sm-1">设备类型：</label>
                <div class="formControls col-xs-8 col-sm-2">
                    <select name="sb_type" class="input-text ">
                        <option  value="">请选择</option>
                        <option >11</option>
                    </select>
                </div>
                <label class="form-label col-xs-4 col-sm-1">品牌：</label>
                <div class="formControls col-xs-8 col-sm-2">
                    <input type="text" name="pinpai" value="<%=pub.trimNull((String)ht.get("pinpai"))%>" class="input-text">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-1">规格型号：</label>
                <div class="formControls col-xs-8 col-sm-2">
                    <input type="text" name="gg_type" id="gg_type" value="<%=pub.trimNull((String)ht.get("gg_type"))%>" class="input-text ">
                </div>
                <label class="form-label col-xs-4 col-sm-1">价值类型：</label>
                <div class="formControls col-xs-8 col-sm-2">
                    <input type="text" name="jz_type" id="jz_type" value="<%=pub.trimNull((String)ht.get("jz_type"))%>" class="input-text">
                </div>
                <label class="form-label col-xs-4 col-sm-1">价   值：</label>
                <div class="formControls col-xs-8 col-sm-2">
                    <input type="text" name="jiazhi" value="<%=pub.trimNull((String)ht.get("jiazhi"))%>" class="input-text">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-1">价格：</label>
                <div class="formControls col-xs-8 col-sm-2">
                    <input type="text" name="jiage" value="<%=pub.trimNull((String)ht.get("jiage"))%>" class="input-text ">
                </div>
                <label class="form-label col-xs-4 col-sm-1">数量：</label>
                <div class="formControls col-xs-8 col-sm-2">
                    <input type="text" name="counts" value="<%=pub.trimNull((String)ht.get("counts"))%>" class="input-text ">
                </div>
                <label class="form-label col-xs-4 col-sm-1">管理部门：</label>
                <div class="formControls col-xs-8 col-sm-2">
                    <input type="text" name="dept" value="<%=pub.trimNull((String)ht.get("dept"))%>" class="input-text">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-1">出厂日期：</label>
                <div class="formControls col-xs-8 col-sm-2">
                    <input type="text" name="chuchang_date" class="input-text Wdate"  autocomplete="off" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" value="<%=pub.trimNull((String)ht.get("chuchang_date"))%>" >
                </div>
                <label class="form-label col-xs-4 col-sm-1">财务入账日期：</label>
                <div class="formControls col-xs-8 col-sm-2">
                    <input type="text" name="cw_date" value="<%=pub.trimNull((String)ht.get("cw_date"))%>" class="input-text Wdate"  autocomplete="off" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})">
                </div>
                <label class="form-label col-xs-4 col-sm-1">会计凭证号：</label>
                <div class="formControls col-xs-8 col-sm-2">
                    <input type="text" name="kj_id" value="<%=pub.trimNull((String)ht.get("kj_id"))%>" class="input-text">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-1">财政性资金：</label>
                <div class="formControls col-xs-8 col-sm-2">
                    <input type="text" name="czx_money" value="<%=pub.trimNull((String)ht.get("czx_money"))%>" class="input-text ">
                </div>
                <label class="form-label col-xs-4 col-sm-1">非财政性资金：</label>
                <div class="formControls col-xs-8 col-sm-2">
                    <input type="text" name="fczx_money" value="<%=pub.trimNull((String)ht.get("fczx_money"))%>" class="input-text">
                </div>
                <label class="form-label col-xs-4 col-sm-1">累计折旧：</label>
                <div class="formControls col-xs-8 col-sm-2">
                    <input type="text" name="ljzj" value="<%=pub.trimNull((String)ht.get("ljzj"))%>" class="input-text">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-1">净    值：</label>
                <div class="formControls col-xs-8 col-sm-2">
                    <input type="text" name="jingzhi" value="<%=pub.trimNull((String)ht.get("jingzhi"))%>" class="input-text">
                </div>
                <label class="form-label col-xs-4 col-sm-1">已提月折旧：</label>
                <div class="formControls col-xs-8 col-sm-2">
                    <input type="text" name="ytyzj" value="<%=pub.trimNull((String)ht.get("ytyzj"))%>" class="input-text">
                </div>
                <label class="form-label col-xs-4 col-sm-1">是否利旧：</label>
                <div class="formControls col-xs-8 col-sm-2">
                    <input type="text" name="is_lj" value="<%=pub.trimNull((String)ht.get("is_lj"))%>" class="input-text ">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-1">备注：</label>
                <div class="formControls col-xs-8 col-sm-9">
                <textarea name="beizhu" cols="" rows="2" class="textarea" placeholder=""
                          dragonfly="true"><%=pub.trimNull((String) ht.get("beizhu"))%></textarea>
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-1">车辆识别号：</label>
                <div class="formControls col-xs-8 col-sm-2">
                    <input type="text" name="car_id" value="<%=pub.trimNull((String)ht.get("car_id"))%>" class="input-text">
                </div>
                <label class="form-label col-xs-4 col-sm-1">车辆用途分类：</label>
                <div class="formControls col-xs-8 col-sm-2">
                    <input type="text" name="car_type" value="<%=pub.trimNull((String)ht.get("car_type"))%>" class="input-text">
                </div>
                <label class="form-label col-xs-4 col-sm-1">发动机号：</label>
                <div class="formControls col-xs-8 col-sm-2">
                    <input type="text" name="car_fdj_id" value="<%=pub.trimNull((String)ht.get("car_fdj_id"))%>" class="input-text ">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-1">存放地：</label>
                <div class="formControls col-xs-8 col-sm-2">
                    <input type="text" name="car_address" value="<%=pub.trimNull((String)ht.get("car_address"))%>" class="input-text ">
                </div>
            </div>
        </div>
    </form>
    <div class="cl mb-10  bk-gray " style="height: 50px;">
        <div class="col-sm-3 pd-10" style="width:100%;text-align: center;">
            <input class="btn btn-primary radius btn-green" type="button" onclick="javascript:saveForm();" value="&nbsp;&nbsp;保存&nbsp;&nbsp;">
        </div>
    </div>
</article>
<script>
    function saveForm(){
        $.ajax({
            type: "POST",
            url: "./action.jsp",
            data: $('#form-admin-add').serialize(),
            success: function (msg) {
                if (msg.indexOf("success") >= 0) {
                    layer.msg('操作成功!', {icon: 1, time: 1000},
                        function () {
                            parent.searchModel();
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.layer.close(index);
                        });
                } else {
                    layer.msg('操作失败', {
                        icon: 5,
                        time: 2000 //2秒关闭（如果不配置，默认是3秒）
                    }, function () {
                    });
                }
            }
        });
    }
</script>