<%@ page language="java" errorPage="/error.jsp" pageEncoding="UTF-8"
	contentType="text/html; charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
<title>账单信息管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- bootstrap 3.0.2 -->
<link href="<c:url value='/styles/lib/bootstrap.min.css'/>"
	rel="stylesheet" type="text/css" />
<link href="<c:url value='/styles/lib/font-awesome.min.css'/>"
	rel="stylesheet" type="text/css" />
<link href='<c:url value='/styles/lib/ionicons.min.css' />'
	rel="stylesheet" type="text/css" />
<link
	href="<c:url value='/styles/lib/datatables/dataTables.bootstrap.css' />"
	rel="stylesheet" type="text/css" />
<link href="<c:url value='/styles/AdminLTE.css?ver=4.0'/>"
	rel="stylesheet" type="text/css" />
<link href="<c:url value='/styles/bill/bill.css?ver=4.3'/>"
	rel="stylesheet" type="text/css" />
<script src="${ctx }/scripts/lib/jquery-1.8.2.min.js"></script>
<script type="text/javascript"
	src="<c:url value='/scripts/bootstrap.min.js'/>"></script>
<script type="text/javascript"
	src="<c:url value='/scripts/My97DatePicker/WdatePicker.js'/>"></script>
<script type="text/javascript"
	src="<c:url value='/plugin/layer/layer.js'/>"></script>
<script type="text/javascript"
	src="<c:url value='/scripts/admin/bill/generalBillsEidt.js?ver=4.5'/>"></script>
<style type="text/css">
.row {
	padding-top: 25px;
	text-align: center;
}

.col-sm-3 {
	width: 15%
}
</style>
</head>
<body>
	<input type="hidden" id="funcid" value="${funcid}">
	<input type="hidden" value="${ctx}" id="contextPath">
	<input type="hidden"  value="${virtualId}" id="virtualId">
	<input type="hidden"  value="${generalBillsId}" id="generalBillsId">
	<div class="billwrap clearfix" style="margin-top: 10px;">
		<h3>${virtualArchitecture.name }账单</h3>
		<form action="" class="billform form-inline" role="form">
			<div class="entryinput clearfix">
				<div class="form-group form-left">
					<label>客户名称</label> <input type="text" id="virtualName" value="${virtualArchitecture.name }" readonly="readonly"/>
				</div>
				<div class="form-group form-right">
					<label>本期费用总额</label> <em>￥</em> <input type="text" id="totalFee" value="${generalBills.totalFee  }" readonly="readonly"/>
				</div>
			</div>
			<div class="entryinput clearfix">
				<div class="form-group form-left">
					<label>客户编码</label> <input type="text" id="customerNumber" value="${virtualArchitecture.customerNumber }" readonly="readonly"/>
				</div>
				<div class="form-group form-right">
					<label>预付款余额</label> <em>￥</em> <input type="text" id="reserveBalance" value="${virtualArchitecture.reserveBalance }" readonly="readonly"/>
				</div>
			</div>
			<div class="entryinput clearfix">
				<div class="form-group form-left">
					<label>客户地址</label> <input type="text" id="address" value="${virtualArchitecture.address }" readonly="readonly"/>
				</div>
				<div class="form-group form-right">
					<label>历史欠缴</label> <em>￥</em> <input type="text" id="sumOwed" value="${sumOwed }" readonly="readonly"/>
				</div>
			</div>
			<div class="entryinput clearfix">
				<div class="form-group form-time">
					<label>计费周期</label> <input value="${startTime }" style="width: 95px;"
						class="Wdate" id="startTime"
						onfocus="WdatePicker({firstDayOfWeek:1,dateFmt:'yyyy-MM-dd'})"
						readonly="true" /> - <input value="${endTime }" id="endTime" style="width: 95px;"
						class="Wdate"
						onfocus="WdatePicker({firstDayOfWeek:1,dateFmt:'yyyy-MM-dd'})"
						readonly="true" />
				</div>
				<div class="form-group form-right" id="payableDiv">
					<c:if test="${payable<0 }">
					<label>剩余应缴</label> <em>￥</em> <input type="text" id="payable" value="0.00" readonly="readonly"/>
					</c:if>
					<c:if test="${payable>0 }">
					<label>剩余应缴</label> <em>￥</em> <input type="text" id="payable" value="${payable }" readonly="readonly"/>
					</c:if>
				</div>
			</div>
			<div class="addsevice clearfix">
				<a href="javascript: void(0);"
					class=" btn btn-success js_seviceitem" onclick="addGeneralBillsService()">新增服务项</a>
			</div>
			<div class="table-form">
				<h4>本期消费明细</h4>
				<div class="tabletit">
					<span>服务项</span> <span>日期</span> <span class="sevicecon">服务内容</span>
					<span>数量</span> <span>金额</span> <span>操作</span>
				</div>
				<c:forEach items="${generalbillServiceList }" var="model">
					<div class="seviceitem" id="seviceitem${model.id }">
					<input type="hidden" value="${model.id }" name="billServiceId" id="billServiceId${model.id }"/>
					<div class="seviceitemtit">
						<div class="selectwrap">
								<select  id="serviceCode${model.id }" name="serviceName" onchange="validateSelectService('${model.id }')">
									<c:forEach items="${signingServiceGroup }" var="obc">
										<option value="">请选择服务项</option>
										<c:choose>
											<c:when test="${obc.itemcode==model.serviceCode }">
												<option value="${obc.itemcode }_${model.id }" selected="selected">${obc.itemname }</option>
											</c:when>
											<c:otherwise>
												<option value="${obc.itemcode }_${model.id }">${obc.itemname }</option>
											</c:otherwise>
										</c:choose>
									</c:forEach>
								</select>
						</div>

						<div class="seviceright">
							<div class="form-group seviceinputright">
								<label>优惠</label> <em>￥</em> <input onkeyup="youhuiPrice('${model.id}')" type="text" id="freeFee${model.id }" value="${model.freeFee }"/>
							</div>
							<div class="form-group seviceinputright">
								<label>合计</label> <em>￥</em> <input type="text" id="totalFee${model.id }" value="${model.totalFee}" readonly="readonly"/>
							</div>
							<div class="seviceadditem">
								<a href="javascript: void(0);"
									class="btn-small btn-success js_subseviceitem" onclick="addGeneralBillsOrders('${model.id}')">添加</a>
								<a href="javascript: void(0);" class="btn-small btn-red js_deletesevice" onclick="delGeneralBillsService('${model.id}')">删除</a>
							</div>
						</div>
					</div>
					<table class="billtable table" id="table${model.id}">
						<tbody>
							<c:forEach items="${model.list }" var="obj">
							<input type="hidden"  name="orderId" id="orderId${model.id }_${obj.id}" value="${model.id }_${obj.id}"/>
							<tr id="orderTr${model.id }_${obj.id}">
								<td class="datetd">
									<div class="form-group">
										<label for="" class="sr-only">日期</label> <input id="orderTime${model.id }_${obj.id}" value="<fmt:formatDate pattern="yyyy-MM-dd" value="${obj.orderTime}" />"
											style="width: 120px;" class="Wdate"
											onfocus="WdatePicker({firstDayOfWeek:1,dateFmt:'yyyy-MM-dd'})"
											readonly="true" />
									</div>
								</td>
								<td class="contd">
									<div class="form-group">
										<label for="" class="sr-only">服务内容</label> <input id="goodName${model.id }_${obj.id}" type="text" value="${obj.goodName }"/>
									</div>
								</td>
								<td class="billtabletd">
									<div class="form-group">
										<label for="" class="sr-only">数量</label> <input id="amount${model.id }_${obj.id}" type="text" value="${obj.amount }"/>
									</div>
								</td>
								<td class="billtabletd billmoneytd">
									<div class="form-group">
										<label for="">￥</label> <input id="totalFee${model.id }_${obj.id}" type="text" value="${obj.totalFee }" onkeyup="orderEidtPrice('${model.id}_${obj.id }')"/>
									</div>
								</td>
								<td>
									<div class="seviceadditem">
										<a href="javascript: void(0);"
											class="btn-small btn-red js_subdeletesevice" onclick="delGeneralBillsOrders('${model.id}_${obj.id }')">删除</a>
									</div>
								</td>
							</tr>
							</c:forEach>
						</tbody>
					</table>
				</div>
				</c:forEach>
			</div>
			<div class="makingorder">
				<div class="form-group makingtime">
					<label>制单人</label> <input type="text" id="makePerson" value="${generalBills.makePerson }"/>
				</div>
				<div class="form-group">
					<label>制单时间</label> <input value="${generalBills.makeTime }" id="makeTime"
											style="width: 120px;" class="Wdate"
											onfocus="WdatePicker({firstDayOfWeek:1,dateFmt:'yyyy-MM-dd'})"
											readonly="true" />
				</div>
			</div>
			<div class="billbtns">
				<div class="wrapbtn">
					<input type="button" value="确定" class="btn btn-primary"  onclick="saveUpdateBill()"/> <input
						type="button" value="返回" class="btn btn-gray"  onclick="canel()"/>
				</div>

			</div>
		</form>
	</div>
</body>
</html>