<%@ 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;
		function doSubmit(obj){//回调函数，在编辑和保存动作时，供openDialog调用提交表单。
		  if(validateForm.form()){
              if(obj == 2){
                  $("#inputForm").attr("action","${ctx}/workinvoicereturnalter/workInvoiceReturnAlter/store");
              }else{
                  $("#inputForm").attr("action","${ctx}/workinvoicereturnalter/workInvoiceReturnAlter/save");
              }
			  $("#inputForm").submit();
			  return true;
		  }
	
		  return false;
		}
		$(document).ready(function() {

            if("${workInvoiceReturnAlter.cancleReturn}" == "2"){
                $("#cancleReturn1").iCheck('check')
            }else{
                $("#cancleReturn").iCheck('check')
            }
            if("${workInvoiceReturnAlter.returnType}" == "2"){
                $("#returnType1").iCheck('check')
            }else{
                $("#returnType").iCheck('check')
            }

			validateForm = $("#inputForm").validate({
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				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);
					}
				}
			});
		});

        function setValue(obj){
            $.ajax({
                type:'post',
                url:'${ctx}/workinvoicedetail/workInvoiceDetail/getWorkInvoice',
                data:{
                    "obj":obj
                },
                success:function(data){
                    var d = JSON.parse(data);
                    $("#cInfoName").val(d.cInfoName);
                    $("#pNumber").val(d.pNumber);
                    $("#cName").val(d.cName);
                    $("#clientName").val(d.clientName);
                    $("#leaderName").val(d.leaderName);
                    $("#officeName").val(d.officeName);
                    $("#invoiceType").val(d.invoiceType);
                    $("#invoiceCName").val(d.invoiceCName);
                    $("#orUnicode").val(d.orUnicode);
                    $("#address").val(d.address);
                    $("#telephone").val(d.telephone);
                    $("#bank").val(d.bank);
                    $("#bankNumber").val(d.bankNumber);
                    $("#startDate").val(d.startDate);
                    $("#totalMoney").val(d.totalMoney);
                    $("#tax").val(d.tax);
                    $("#taxMoney").val(d.taxMoney);
                    $("#taxRate").val(d.taxRate);
                }
            })
        }
	</script>
</head>
<body>
<div class="single-form view-form">
	<div class="container">
		<form:form id="inputForm" modelAttribute="workInvoiceReturnAlter" action="${ctx}/workinvoicereturnalter/workInvoiceReturnAlter/save" method="post" class="form-horizontal">
		<form:hidden path="id"/>

			<div class="form-group layui-row first lw12">
				<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  with-icon">
						<input htmlEscape="false" readonly="true"   class="form-control layui-input" value="${workInvoiceReturnAlter.invoiceDetail.number}"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">退票申请编号：</label>
					<div class="layui-input-block">
						<input htmlEscape="false" readonly="true"   class="form-control layui-input" value="${workInvoiceReturnAlter.returnNumber}"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">项目名称：</label>
					<div class="layui-input-block">
						<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="${workInvoiceReturnAlter.invoiceDetail.workInvoice.project.projectName}"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">项目编号：</label>
					<div class="layui-input-block">
						<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="${workInvoiceReturnAlter.invoiceDetail.workInvoice.project.projectId}"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">合同名称：</label>
					<div class="layui-input-block">
						<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="${workInvoiceReturnAlter.invoiceDetail.workInvoice.project.workContractInfo.name}"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">所属部门：</label>
					<div class="layui-input-block">
						<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="${workInvoiceReturnAlter.invoiceDetail.workInvoice.office.name}"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">委托方：</label>
					<div class="layui-input-block">
						<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="${workInvoiceReturnAlter.invoiceDetail.workInvoice.project.workContractInfo.client.name}"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">项目负责人：</label>
					<div class="layui-input-block">
						<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="${workInvoiceReturnAlter.invoiceDetail.workInvoice.project.leaderNameStr}"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">发票类型：</label>
						<c:if test="${workInvoiceReturnAlter.invoiceDetail.workInvoice.invoiceType eq 1}">
							<div class="layui-input-block">
								<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="专票"/>
							</div>
						</c:if>
						<c:if test="${workInvoiceReturnAlter.invoiceDetail.workInvoice.invoiceType eq 2}">
							<div class="layui-input-block">
								<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="普票"/>
							</div>
						</c:if>
						<c:if test="${empty workInvoiceReturnAlter.invoiceDetail.workInvoice.invoiceType}">
							<div class="layui-input-block">
								<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="${workInvoiceReturnAlter.invoiceDetail.workInvoice.invoiceType}"/>
							</div>
						</c:if>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">实际开票单位：</label>
					<div class="layui-input-block">
						<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="${workInvoiceReturnAlter.invoiceDetail.workInvoice.client.name}"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">纳税人识别号：</label>
					<div class="layui-input-block">
						<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="${workInvoiceReturnAlter.invoiceDetail.workInvoice.orUnicode}"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">地址：</label>
					<div class="layui-input-block">
						<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="${workInvoiceReturnAlter.invoiceDetail.workInvoice.address}"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">电话：</label>
					<div class="layui-input-block">
						<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="${workInvoiceReturnAlter.invoiceDetail.workInvoice.telephone}"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">开户银行：</label>
					<div class="layui-input-block">
						<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="${workInvoiceReturnAlter.invoiceDetail.workInvoice.bank}"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">银行账号：</label>
					<div class="layui-input-block">
						<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="${workInvoiceReturnAlter.invoiceDetail.workInvoice.bankNumber}"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">开票时间：</label>
					<div class="layui-input-block">
						<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="<fmt:formatDate value="${workInvoiceReturnAlter.invoiceDetail.workInvoice.invoiceDate}" 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 htmlEscape="false"  readonly="true" class="form-control layui-input" value="${workInvoiceReturnAlter.invoiceDetail.totalMoney}"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">税率：</label>
					<div class="layui-input-block">
						<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="${workInvoiceReturnAlter.invoiceDetail.tax}"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">金额：</label>
					<div class="layui-input-block">
						<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="${workInvoiceReturnAlter.invoiceDetail.taxMoney}"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm6">
					<label class="layui-form-label">税额：</label>
					<div class="layui-input-block">
						<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="${workInvoiceReturnAlter.invoiceDetail.taxRate}"/>
					</div>
				</div>
				<div class="layui-item layui-col-sm12 with-textarea">
					<label class="layui-form-label"><span class="require-item">*</span>退票原因：</label>
					<div class="layui-input-block">
						<textarea htmlEscape="false" rows="4" readonly="true"    class="form-control required">${workInvoiceReturnAlter.reason}</textarea>
					</div>
				</div>
			</div>

			<div class="form-group layui-row first lw12">
				<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 htmlEscape="false"  readonly="true" class="form-control layui-input" value="<c:if test="${1 eq workInvoiceReturnAlter.cancleReturn}">退票</c:if><c:if test="${2 eq workInvoiceReturnAlter.cancleReturn}">作废</c:if>"/>
					</div>
				</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  htmlEscape="false" readonly="true" class="form-control layui-input" value="<c:if test="${1 eq workInvoiceReturnAlter.returnType}">是</c:if><c:if test="${2 eq workInvoiceReturnAlter.returnType}">否</c:if>"/>
					</div>
				</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  htmlEscape="false" readonly="true" class="form-control layui-input" value="${workInvoiceReturnAlter.code}"/>
					</div>
				</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  htmlEscape="false" readonly="true" class="form-control layui-input" value="${workInvoiceReturnAlter.number}"/>
					</div>
				</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 htmlEscape="false"  readonly="true" class="form-control required layui-input" value="${workInvoiceReturnAlter.uname}"/>
					</div>
				</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 htmlEscape="false"  readonly="true" class="form-control required layui-input" value="<fmt:formatDate value="${workInvoiceReturnAlter.returnDate}" pattern="yyyy年MM月dd日"/>"/>
					</div>
				</div>
			</div>

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