<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp"%>
<html>
<head>
	<title>报销单管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
        var validateForm;
        var count = 0;
        $(document).ready(function() {

            if($("#createDate").val()==null || $("#createDate").val()==''){
                $("#createDate").val(getNowFormatDate());
            }
            if($("#planMonthly").val()==null || $("#planMonthly").val()==''){
                $("#planMonthly").val(getNowFormatDateMon());

            }

            //页面加载查询本部门最大月份
            $.ajax({
                type:'post',
                url:'${ctx}/workmonthlyplan/workMonthlyPlan/getThisMaxMonthly',
                success:function(data){
					laydate.render({
                        elem: '#planMonthly', //目标元素。由于laydate.js封装了一个轻量级的选择器引擎，因此elem还允许你传入class、tag但必须按照这种方式 '#id .class'
                        format: 'yyyy-MM',
                        min: data,
                        type : 'month',
                        change: function(value, date, endDate){
                            var idx1 = $("#workMonthlyPlanThisList tr").length;
                            if(idx1!=0){
                                layer.confirm('改变计划月份需重新选择合同，您确定吗？', {btn: ['确定','取消']}, function() {

                                    for(var i=0;i<workMonthlyPlanThisListRowIdx;i++){
                                        delRow($("#workMonthlyPlanThisList"+i+"_span"),"#workMonthlyPlanThisList"+i);
                                    }
                                    $("#money1").val(0);
                                    $("#money2").val(0);
                                    $("#money3").val(0);
                                    $("#money4").val(0);
                                    $("#money5").val(0);
                                    $("#planMonthly").val(value);
                                    layer.closeAll('dialog');
                                });
							}
                        }
                    });
                }
            })

            validateForm = $("#inputForm").validate({
                submitHandler: function(form){
                    loading('正在提交，请稍等...');
                    form.submit();
                },
                rules:{
                },
                messages:{
                },
                errorContainer: "#messageBox",
                errorPlacement: function(error, element) {
                    $("#messageBox").text("输入有误，请先更正。");
                    if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
                        error.appendTo(element.parent().parent());
                    } else {
                        error.insertAfter(element);
                    }
                }
            });

            laydate.render({
                elem: '#createDate', //目标元素。由于laydate.js封装了一个轻量级的选择器引擎，因此elem还允许你传入class、tag但必须按照这种方式 '#id .class'
                format: 'yyyy-MM-dd',
                type : 'date'
            });


        });
        function doSubmit(obj){//回调函数，在编辑和保存动作时，供openDialog调用提交表单。
            var idArr = $("#workMonthlyPlanThisList tr:visible");
            if(idArr.length<1){
                parent.layer.msg("请添加本月计划!", {icon: 5});
                return false;
            }
			if(obj == 2){
                $("#inputForm").attr("action","${ctx}/workmonthlyplan/workMonthlyPlan/save");
            }else{
                $("#inputForm").attr("action","${ctx}/workmonthlyplan/workMonthlyPlan/review");
            }
            if(validateForm.form()){
                $("#inputForm").submit();
                return true;
            }else {
                parent.layer.msg("信息未填写完整!", {icon: 5});
            }

            return false;
        }

        function deleteRow(obj,index){
            $(obj).parent().parent().remove();
            str[index] = " ";
            mon[index] = 0;
            countMoney();
        }
        function countMoney(){
            var m = 0;
            $.each(mon,function (index,item) {
                m += Number(item);
            });
            $("#mont").val(m);
        }

        function getNowFormatDate() {
            var date = new Date();
            var seperator1 = "-";
            var seperator2 = ":";
            var month = date.getMonth() + 1;
            var strDate = date.getDate();
            month = (month < 10)?"0"+month:month;
            strDate = (strDate < 10)?"0"+strDate:strDate;
            var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate;
            return currentdate;
        }
        function getNowFormatDateMon() {
            var date = new Date();
            var seperator1 = "-";
            var month = date.getMonth() + 1;
            month = (month < 10)?"0"+month:month;
            var currentdate = date.getFullYear() + seperator1 + month;
            return currentdate;
        }


        function addRow(list, idx, tpl, row){
            var idx1 = $("#workMonthlyPlanThisList tr").length;
          //tpl = tpl.replace("workMonthlyPlanThisList[0]_workClientInfoId","workMonthlyPlanThisList["+idx1+"].workClientInfoId");

                bornTemplete(list, idx, tpl, row, idx1);
        }
        function bornTemplete(list, idx, tpl, row, idx1){
            $(list).append(Mustache.render(tpl, {
                idx: idx, delBtn: true, row: row,
                order:idx1 + 1
            }));
            $(list+idx).find("select").each(function(){
                $(this).val($(this).attr("data-value"));
            });
            $(list+idx).find("input[type='checkbox'], input[type='radio']").each(function(){
                var ss = $(this).attr("data-value").split(',');
                for (var i=0; i<ss.length; i++){
                    if($(this).val() == ss[i]){
                        $(this).attr("checked","checked");
                    }
                }
            });

        }
        function delRow(obj, prefix){
            debugger;
            var id = $(prefix+"_id");
            var countmoneyArr=new Array();
            var moneyArr=new Array();
            moneyArr[0] = $("#money1").val();
            moneyArr[1] = $("#money2").val();
            moneyArr[2] = $("#money3").val();
            moneyArr[3] = $("#money4").val();
            moneyArr[4] = $("#money5").val();
            countmoneyArr[0]= $(prefix+"_"+1).val();
            countmoneyArr[1]= $(prefix+"_"+2).val();
            countmoneyArr[2]= $(prefix+"_"+3).val();
            countmoneyArr[3]= $(prefix+"_"+4).val();
            countmoneyArr[4]= $(prefix+"_"+5).val();
            for(var k=0;k<5;k++){
                if (isNumber(countmoneyArr[k])){
                    if(moneyArr[k]==""){
                        moneyArr[k] = parseFloat(countmoneyArr[k]).toFixed(2);
                    }else {
                        moneyArr[k] = (parseFloat(moneyArr[k]) - parseFloat(countmoneyArr[k])).toFixed(2);
                    }
                }
			}

           // if(moneyArr[0]>=0&&moneyArr[1]>=0&&moneyArr[2]>=0&&moneyArr[3]>=0){
                count++;
                $("#money1").val(moneyArr[0]);
                $("#money2").val(moneyArr[1]);
                $("#money3").val(moneyArr[2]);
                $("#money4").val(moneyArr[3]);
                $("#money5").val(moneyArr[4]);
                var delFlag = $(prefix+"_delFlag");
                if (id.val() == ""){
                    delFlag.val("1");
                    $(obj).parent().parent().remove();
                }else if(delFlag.val() == "0"){
                    delFlag.val("1");
                    $(obj).html("&divide;").attr("title", "撤销删除");
                    $(obj).parent().parent().addClass("error");
                    $(obj).parent().parent().addClass("hide");
                }else if(delFlag.val() == "1"){
                    delFlag.val("0");
                    $(obj).html("&times;").attr("title", "删除");
                    $(obj).parent().parent().removeClass("error");
                }
           /* }else{
                //parent.layer.msg('删除失败',{icon:2});
            }*/

        }



        function getMoney(value,j){
            var money = "0.00";
            //方法一使用id选择器进行计算。
            //获取输入的数字
            //自动计算出结果并填充在相应的输入框中
            var size = $("#workMonthlyPlanThisList tr").length+count;
            for (var i = 0;i<size;i++){
                var _annualCollectionPlan = $("#workMonthlyPlanThisList"+i+"_"+j).val();

                var delFlag = $("#workMonthlyPlanThisList"+i+"_delFlag").val();
                if (_annualCollectionPlan!=undefined && isNumber(_annualCollectionPlan) && delFlag==0){
                    if(money==""){
                        money = parseFloat(_annualCollectionPlan).toFixed(2);
                    }else {
                        money = (parseFloat(money) + parseFloat(_annualCollectionPlan)).toFixed(2);
                    }
                }
            }
            $("#money"+j).val(money);
          /*  if (money!='0.00') {
                $("#money"+j).val(money);
            }*/
        }

        function isNumber(val){
            if(val === "" || val ==null){
                return false;
            }
            var regPos = /^\d+(\.\d+)?$/; //非负浮点数
            var regNeg = /^(-(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*)))$/; //负浮点数
            if(regPos.test(val) || regNeg.test(val)){
                return true;
            }else{
                return false;
            }

        }
        //引用
        function setClientInfo(item){
            $.ajax({
                type:'post',
                url:'${ctx}/workmonthlyplan/workMonthlyPlan/getWorkMonthlyPlanThis',
                data:{
                    "id":item.id
                },
                success:function(data){
                    for(var i=0;i<data.length;i++){
                        var idArr = $("#workMonthlyPlanThisList tr:visible .workClientInfoId");
                        if(data[i].id!=''&&!hasInArr(data[i].id,idArr)){
                            addRow('#workMonthlyPlanThisList', workMonthlyPlanThisListRowIdx, workMonthlyPlanThisListTpl,data[i]);
                            setInfo(data[i].workClientInfoId,workMonthlyPlanThisListRowIdx);
                            workMonthlyPlanThisListRowIdx=workMonthlyPlanThisListRowIdx + 1
						}
					}
                    $(".money").change();
                }
            })
		};
        //累计金额与本月前金额
        function setInfo(clientId,idx){
            var planMonthly=$("#planMonthly").val();
            $.ajax({
                type:'post',
                url:'${ctx}/workmonthlyplan/workMonthlyPlan/getBeforeThisMonthMoney',
                data:{
                    "clientId":clientId,"planMonthly":planMonthly
                },
                success:function(data){
                    $("#workMonthlyPlanThisList"+idx+"_2").val(parseFloat(data.accumulativePrice/10000).toFixed(2));
                    $("#workMonthlyPlanThisList"+idx+"_2").change();
                    $("#workMonthlyPlanThisList"+idx+"_4").val(parseFloat(data.beforeThisMonthMoney/10000).toFixed(2));
                    $("#workMonthlyPlanThisList"+idx+"_4").change();
                }
            })
        };
         //选择
        function setContractInfo(obj){
            for (var i=0; i<obj.length; i++){
                var idArr = $("#workMonthlyPlanThisList tr:visible .workClientInfoId");
                if(obj[i].id!=''&&!hasInArr(obj[i].id,idArr)){
                    addRow('#workMonthlyPlanThisList', workMonthlyPlanThisListRowIdx, workMonthlyPlanThisListTpl);
                    setInfo(obj[i].id,workMonthlyPlanThisListRowIdx);
                    workMonthlyPlanThisListRowIdx=workMonthlyPlanThisListRowIdx + 1
                    var row = workMonthlyPlanThisListRowIdx - 1 ;
                    $("#"+"workMonthlyPlanThisList"+row+"_workClientInfoId").val(obj[i].id);
                    $("#"+"workMonthlyPlanThisList"+row+"_contractName").val(obj[i].name);
                    $("#"+"workMonthlyPlanThisList"+row+"_contractNum").val(obj[i].contractNum);
                    $("#"+"workMonthlyPlanThisList"+row+"_clientName").val(obj[i].clientName);
                    $("#"+"workMonthlyPlanThisList"+row+"_1").val(parseFloat(obj[i].contractPrice/10000).toFixed(2));
                    $(".money").change();
                }
            }
		}

        function hasInArr(id,idArr) {
            for(var i=0;i<idArr.length;i++){
                if(id==$(idArr[i]).val()){
                    return true;
                }
            }
            return false;
        }
	</script>
	<script src="${ctxStatic}/layer-v2.3/layui/layui.all.js" charset="utf-8"></script>
	<style>
		/*超过5个汉字，调整label的长度，以下是配套的*/
		.layui-item .layui-form-label{
			width:90px;
		}
		.form-group .layui-item .layui-input-block,
		.query .layui-input-block {
			margin-left: 116px;
		}
	</style>
</head>
<body>
<div class="single-form">
	<div class="container">
		<form:form id="inputForm" modelAttribute="workMonthlyPlan" action="${ctx}/workMonthlyPlan/workMonthlyPlan/save" method="post" class="form-horizontal" >
			<form:hidden path="id"/>
			<div class="form-group layui-row first">
				<div class="form-group-label"><h2>基本信息</h2></div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label"><span class="require-item">*</span>计划月份：</label>
					<div class="layui-input-block">
						<input id="planMonthly" name="planMonthly" type="text"  maxlength="20"  class="laydate-icondate form-control layer-date required layui-input laydate-icon"
							   value="<fmt:formatDate value="${workMonthlyPlan.planMonthly}" pattern="yyyy-MM"/>"/>

					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">所属部门：</label>
					<div class="layui-input-block">
						<div class="input-group">
							<form:input path="officeName" htmlEscape="false"  readonly="true" id="officeName"  class="form-control layui-input" value = "${workMonthlyPlan.officeName}"/>
							<input type="hidden" id="officeId" name="officeId" value="${workMonthlyPlan.officeId}">
							<input type="hidden" id="companyId" name="companyId" value="${workMonthlyPlan.companyId}">
							<span class="input-group-btn">
                            <label class="form-status"><c:if test="${workMonthlyPlan.planStatus eq '0'}">未审定</c:if> <c:if test="${workMonthlyPlan.planStatus eq '1'}">已审定</c:if></label>
                         </span>
						</div>

					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">创建人：</label>
					<div class="layui-input-block">
						<form:input path="name" htmlEscape="false"  readonly="true" id="name"  class="form-control required layui-input" value="${workMonthlyPlan.name}"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">创建日期：</label>
					<div class="layui-input-block">
						<input id="createDate" name="createDate" type="text"  maxlength="20" class="laydate-icondate form-control layer-date required layui-input laydate-icon"
							   value="<fmt:formatDate value="${workMonthlyPlan.createDate}" pattern="yyyy-MM-dd"/>"/>
					</div>
				</div>
				</div>

			<div class="form-group layui-row">
				<div class="form-group-label"><h2>本月计划表</h2></div>
				<div class="layui-item nav-btns" >
                    <sys:gridselectsInfo1 url="${ctx}/workmonthlyplan/workMonthlyPlan/clientInfoList" id="contentData1" title="选择合同"
                                        fieldLabels="" fieldKeys=""  searchLabel="" searchKey="name"></sys:gridselectsInfo1>
					<c:choose>
						<c:when test="${fns:getUser().id == workMonthlyPlan.createBy.id or workMonthlyPlan.createBy.id ==null}">
							<sys:gridselectPlan url="${ctx}/workmonthlyplan/workMonthlyPlan/selectcontentData" id="contentData" title="选择历史计划"
												fieldLabels="" fieldKeys=""  searchLabel="" searchKey="name"></sys:gridselectPlan>

                        </c:when>
						<c:otherwise>
						</c:otherwise>
					</c:choose>
					<label style="float:right;width: 80px">单位：万元</label>
				</div>

				<div class="layui-item layui-col-xs12 form-table-container" >
					<table id="contentTable" class="table table-bordered table-condensed can-edit no-bottom-margin">
						<thead>
						<tr>
							<th ><font color="red">*</font>合同名称</th>
                            <th width="150px"><font color="red">*</font>合同编号</th>
                            <th width="140px"><font color="red">*</font>主委托方</th>
                            <th width="100px"><font color="red">*</font>合同预计收费</th>
							<th width="100px"><font color="red">*</font>合同累计收费</th>
							<th width="120px"><font color="red">*</font>本年度预计收费</th>
							<th width="100px"><font color="red">*</font>本年度已收费</th>
							<th width="100px"><font color="red">*</font>本月计划收费</th>
							<th width="100px">操作</th>
						</tr>
						</thead>
						<tbody id="workMonthlyPlanThisList">
						<c:if test="${not empty workMonthlyPlan.workMonthlyPlanThisList}">
							<c:forEach items="${workMonthlyPlan.workMonthlyPlanThisList}" var="workMonthlyPlanThis" varStatus="index">
								<tr id="workMonthlyPlanThisList${index.index}">
									<td class="hide">
										<input id="workMonthlyPlanThisList${index.index}_id" name="workMonthlyPlanThisList[${index.index}].id" type="hidden" value="${workMonthlyPlanThis.id}"/>
										<input id="workMonthlyPlanThisList${index.index}_workClientInfoId" name="workMonthlyPlanThisList[${index.index}].workClientInfoId" type="hidden" value="${workMonthlyPlanThis.workClientInfoId}" class="workClientInfoId"/>
										<input id="workMonthlyPlanThisList${index.index}_delFlag" name="workMonthlyPlanThisList[${index.index}].delFlag" type="hidden" value="0"/>
									</td>
                                    <td>
                                        <input id="workMonthlyPlanThisList${index.index}_contractName" readonly="true"   name="workMonthlyPlanThisList[${index.index}].contractName"  type="text" value="${workMonthlyPlanThis.contractName}"   class="form-control  required"/>
                                    </td>
                                    <td>
                                        <input id="workMonthlyPlanThisList${index.index}_contractNum"  readonly="true"  name="workMonthlyPlanThisList[${index.index}].contractNum"  type="text" value="${workMonthlyPlanThis.contractNum}"   class="form-control  required"/>
                                    </td>
                                    <td>
                                        <input id="workMonthlyPlanThisList${index.index}_clientName" readonly="true"   name="workMonthlyPlanThisList[${index.index}].clientName"  type="text" value="${workMonthlyPlanThis.clientName}"   class="form-control  required"/>
                                    </td>

                                    <td>
                                        <input id="workMonthlyPlanThisList${index.index}_1" readonly="true"  onchange="getMoney(this.value,'1')"   name="workMonthlyPlanThisList[${index.index}].estimatePrice" maxlength="12" type="text" value="${workMonthlyPlanThis.estimatePrice}"   class="form-control  required"/>
                                    </td>
                                    <td>
                                        <input id="workMonthlyPlanThisList${index.index}_2" readonly="true"  onchange="getMoney(this.value,'2')"   name="workMonthlyPlanThisList[${index.index}].accumulativePrice" maxlength="12" type="text" value="${workMonthlyPlanThis.accumulativePrice}"   class="form-control  required"/>
                                    </td>

									<td>
										<input id="workMonthlyPlanThisList${index.index}_3"   onchange="getMoney(this.value,'3')"   name="workMonthlyPlanThisList[${index.index}].annualCollectionPlan" maxlength="12" type="text" value="${workMonthlyPlanThis.annualCollectionPlan}"   class="form-control  required"/>
									</td>
									<td>
										<input id="workMonthlyPlanThisList${index.index}_4" readonly="true"  onchange="getMoney(this.value,'4')" readonly="true"  name="workMonthlyPlanThisList[${index.index}].beforeThisMonthMoney" maxlength="12" type="text" value="${workMonthlyPlanThis.beforeThisMonthMoney}"     class="form-control  number required"/>
									</td>
									<%--<td>
										<input id="workMonthlyPlanThisList${index.index}_5" onchange="getMoney(this.value,'5')"  name="workMonthlyPlanThisList[${index.index}].remainingPlan" type="text" value="${workMonthlyPlanThis.remainingPlan}" readonly="true" maxlength="12"  class="form-control "/>
									</td>--%>
									<td>
										<input id="workMonthlyPlanThisList${index.index}_5" onblur="setMoney(this.value,${index.index})"  onchange="getMoney(this.value,'5')"  name="workMonthlyPlanThisList[${index.index}].thisMonthPlanMoney" maxlength="12" type="text" value="${workMonthlyPlanThis.thisMonthPlanMoney}"     class="form-control required"/>
									</td>
									<td class="text-center op-td" >
										<span class="op-btn op-btn-delete" id="workMonthlyPlanThisList${index.index}_span" onclick="delRow(this, '#workMonthlyPlanThisList${index.index}')" title="删除"><i class="glyphicon glyphicon-remove"></i>&nbsp;删除</span>
									</td>
								</tr>
							</c:forEach>
						</c:if>
						</tbody>
					</table>
					<table id="contentMoneys" class="table table-bordered table-condensed can-edit summary">
						<tr>
							<td  style="vertical-align:middle;text-align: center;"><label><font color="red">*</font>合计(万元)：</label></td>
                            <td  width="150px">
                                <form:input path="" id="" htmlEscape="false" readonly="true"  class="form-control"/>
                            </td>
                            <td  width="140px">
                                <form:input path="" id="" htmlEscape="false" readonly="true"   class="form-control"/>
                            </td>
                            <td  width="100px">
                                <form:input path="estimatePrice" id="money1"  htmlEscape="false" readonly="true"  maxlength="12"  class="form-control "/>
                            </td>
                            <td width="100px">
                                <form:input path="accumulativePrice" id="money2"  htmlEscape="false"  readonly="true" maxlength="12"  class="form-control "/>
                            </td>
							<td width="120px">
								<form:input path="yearSumMoney" id="money3"  htmlEscape="false" readonly="true"   maxlength="12"  class="form-control "/>
							</td>
							<td  width="100px">
								<form:input path="beforeSumMoney" id="money4"   htmlEscape="false" readonly="true" maxlength="12"  class="form-control "/>
							</td>

							<td  width="100px">
								<form:input path="thisSumMoney" id="money5"  htmlEscape="false" readonly="true" maxlength="12"  class="form-control "/>
							</td>
							<td  width="100px">
								<form:input path="" id=""   htmlEscape="false" readonly="true"   class="form-control"/>
							</td>
						</tr>
					</table>
					<script type="text/template" id="workMonthlyPlanThisListTpl">//<!--
                                    <tr id="workMonthlyPlanThisList{{idx}}">
                                        <td class="hide">
                                            <input id="workMonthlyPlanThisList{{idx}}_id" name="workMonthlyPlanThisList[{{idx}}].id" type="hidden" value="{{row.id}}"/>
                                            <input id="workMonthlyPlanThisList{{idx}}_workClientInfoId" name="workMonthlyPlanThisList[{{idx}}].workClientInfoId" type="hidden" value="{{row.workClientInfoId}}" class="workClientInfoId"/>
                                            <input id="workMonthlyPlanThisList{{idx}}_delFlag" name="workMonthlyPlanThisList[{{idx}}].delFlag" type="hidden" value="0"/>
                                        </td>
                                       <td>
                                            <input id="workMonthlyPlanThisList{{idx}}_contractName"  name="workMonthlyPlanThisList[{{idx}}].contractName"  type="text" value="{{row.contractName}}"  readonly="true"  class="form-control  required"/>
                                        </td>
                                        <td>
                                            <input id="workMonthlyPlanThisList{{idx}}_contractNum"  name="workMonthlyPlanThisList[{{idx}}].contractNum"  type="text" value="{{row.contractNum}}"  readonly="true"  class="form-control required"/>
                                        </td>
                                        <td>
                                            <input id="workMonthlyPlanThisList{{idx}}_clientName"   name="workMonthlyPlanThisList[{{idx}}].clientName"  type="text" value="{{row.clientName}}"  readonly="true"  class="form-control  required"/>
                                        </td>

                                        <td>
                                            <input id="workMonthlyPlanThisList{{idx}}_1"  onchange="getMoney(this.value,'1')"  name="workMonthlyPlanThisList[{{idx}}].estimatePrice" maxlength="12" type="text" value="{{row.estimatePrice}}"  readonly="true" class="form-control number money required"/>
                                        </td>
                                        <td>
                                            <input id="workMonthlyPlanThisList{{idx}}_2"  onchange="getMoney(this.value,'2')"  name="workMonthlyPlanThisList[{{idx}}].accumulativePrice" maxlength="12" type="text" value="{{row.accumulativePrice}}"  readonly="true"  class="form-control number money required"/>
                                        </td>
                                        <td>
                                            <input id="workMonthlyPlanThisList{{idx}}_3"  onchange="getMoney(this.value,'3')"  name="workMonthlyPlanThisList[{{idx}}].annualCollectionPlan" maxlength="12" type="text" value="{{row.annualCollectionPlan}}"  placeholder=""  class="form-control number money required"/>
                                        </td>
                                        <td>
                                            <input id="workMonthlyPlanThisList{{idx}}_4"  readonly="true" onchange="getMoney(this.value,4)" name="workMonthlyPlanThisList[{{idx}}].beforeThisMonthMoney" maxlength="12" type="text" value="{{row.beforeThisMonthMoney}}"  readonly="true"  class="form-control number money required"/>
                                        </td>

                                     <td>
                                            <input id="workMonthlyPlanThisList{{idx}}_5"   onchange="getMoney(this.value,5)" name="workMonthlyPlanThisList[{{idx}}].thisMonthPlanMoney" type="text" value="{{row.thisMonthPlanMoney}}" maxlength="12" placeholder=""  class="form-control money number  required"/>
                                        </td>
                                        <td class="text-center op-td" >
                                            {{#delBtn}}<span class="op-btn op-btn-delete" id="workMonthlyPlanThisList{{idx}}_span" onclick="delRow(this, '#workMonthlyPlanThisList{{idx}}')" title="删除"><i class="glyphicon glyphicon-remove"></i>&nbsp;删除</span>{{/delBtn}}
                                        </td>
                                    </tr>//-->
					</script>
					<script type="text/javascript">
                        var workMonthlyPlanThisListRowIdx = 0, workMonthlyPlanThisListTpl = $("#workMonthlyPlanThisListTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");

                        if($("#id").val()){
                            workMonthlyPlanThisListRowIdx = ${fn:length(workMonthlyPlan.workMonthlyPlanThisList)};
                        }
                        $(document).ready(function() {
                            /*       //年度收款计划-本月之前已收账款-本月计划收款
        function setMoney(v,i){
           /!* if(isNumber(v)&&v<0){

			}*!/
            var sunMoney=0;
            var size = $("#workMonthlyPlanThisList tr").length;
            var  td1=$("#workMonthlyPlanThisList"+i+"_1").val();
            var  td2=$("#workMonthlyPlanThisList"+i+"_2").val();
            var  td4=$("#workMonthlyPlanThisList"+i+"_4").val();
            if(isNumber(td1)&& isNumber(td2)&& isNumber(td4)){
                var  td3=parseFloat(td1)-parseFloat(td2)-parseFloat(td4);
                $("#workMonthlyPlanThisList"+i+"_3").val(td3);
                $("#workMonthlyPlanThisList"+i+"_3").change();

			}

        }*/
                        });
					</script>
				</div>
			</div>
			<div class="form-group layui-row page-end"></div>
		</form:form>
	</div>
</div>

</body>
</html>