<%@ 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());

            }*/



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


        });


        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;
        }

	</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 view-form">
		<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" readonly="true"  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>
						<%--<form:input path="officeName" htmlEscape="false"  readonly="true" id="officeName"  class="form-control required 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}">--%>
					</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" readonly="true"  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 class="layui-item layui-col-sm6">
					<label class="layui-form-label">计划状态：</label>
					<div class="layui-input-block">
						<input path="planStatus" htmlEscape="false"  readonly="true" id="planStatus"  class="form-control required layui-input"  <c:if test="${workMonthlyPlan.planStatus eq '0'}">value="未审定"</c:if> <c:if test="${workMonthlyPlan.planStatus eq '1'}">value="已审定"</c:if>/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">修改日期：</label>
					<div class="layui-input-block">

						<input id="updateDate" name="updateDate" type="text"  readonly="true"  maxlength="20" class="laydate-icondate form-control layer-date required layui-input laydate-icon"
							   value="<fmt:formatDate value="${workMonthlyPlan.updateDate}" 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 layui-col-xs12 form-table-container" >
					<table id="contentTable" class="table table-bordered table-condensed can-edit no-bottom-margin">
						<thead>
						<tr>
							<th width="200px">委托方</th>
							<th width="200px">年度收款计划（元）</th>
							<th width="150px">本月前已收账款</th>
							<th width="200x">剩余计划（元）</th>
							<th width="200x">本月计划收款（元）</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}_delFlag" name="workMonthlyPlanThisList[${index.index}].delFlag" type="hidden" value="0"/>
									</td>
									<td>
										<input id="workMonthlyPlanThisList${index.index}_clientName" name="workMonthlyPlanThisList[${index.index}].clientName" type="text" value="${workMonthlyPlanThis.clientName}"/>
									</td>
									<td>
										<input id="workMonthlyPlanThisList${index.index}_annualCollectionPlan"   name="workMonthlyPlanThisList[${index.index}].annualCollectionPlan" type="text" value="${workMonthlyPlanThis.annualCollectionPlan}"   class="form-control required"/>
									</td>

									<td>
										<input id="workMonthlyPlanThisList${index.index}_beforeThisMonthMoney"  name="workMonthlyPlanThisList[${index.index}].beforeThisMonthMoney" type="text" value="${workMonthlyPlanThis.beforeThisMonthMoney}"     class="form-control number required"/>
									</td>
									<td>
										<input id="workMonthlyPlanThisList${index.index}_remainingPlan"  name="workMonthlyPlanThisList[${index.index}].remainingPlan" type="text" value="${workMonthlyPlanThis.remainingPlan}"    class="form-control"/>
									</td>
									<td>
										<input id="workMonthlyPlanThisList${index.index}_thisMonthPlanMoney"  name="workMonthlyPlanThisList[${index.index}].thisMonthPlanMoney" type="text" value="${workMonthlyPlanThis.thisMonthPlanMoney}"    class="form-control"/>
									</td>
								</tr>
							</c:forEach>
						</c:if>
						</tbody>
					</table>
					<table id="contentMoneys" class="table table-bordered table-condensed can-edit summary">
						<tr>
							<td width="200px" style="vertical-align:middle;text-align: center;"><label><font color="red">*</font>合计(元)：</label></td>
							<td  width="200px">
								<form:input path="yearSumMoney" id="money1"  htmlEscape="false" readonly="true"   class="form-control required"/>
							</td>
							<td  width="150px">
								<form:input path="beforeSumMoney" id="money2"  htmlEscape="false" readonly="true"   class="form-control required"/>
							</td>
							<td  width="200px">
								<form:input path="remainingSumMoney" id="money3"  htmlEscape="false" readonly="true"   class="form-control required"/>
							</td>
							<td  width="200px">
								<form:input path="thisSumMoney" id="money4"  htmlEscape="false" readonly="true"   class="form-control required"/>
							</td>

						</tr>
					</table>


				</div>
			</div>


			<div class="form-group layui-row page-end"></div>
		</form:form>
	</div>
</div>

</body>
</html>