<%@ 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 == 1){
                  $('#flag').val('yes');
              }else{
                  $('#flag').val('no');
              }
			  $("#inputForm").submit();
			  return true;
		  }else {
              parent.layer.msg("信息未填写完整!", {icon: 5});
          }
	
		  return false;
		}
		$(document).ready(function() {
            if (${workReimbursement.ext == 0}){
                $(".td1").removeClass("hide");
                $(".project_reimbursement_div").show();
                $(".not_project_reimbursement_div").hide();
            }else {
                $(".td1").addClass("hide");
                $(".project_reimbursement_div").hide();
                $(".not_project_reimbursement_div").show();
            }
            if (${workReimbursement.isPublic =='0'}){
                $(".isPublic").addClass("hide");
            }else {
                $(".isPublic").removeClass("hide");
            }
			$("#name").focus();
			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);
					}
				}
			});
		});
	</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="workReimbursement" enctype="multipart/form-data" action="${ctx}/workreimbursement/workReimbursement/saveAudit" method="post" class="form-horizontal">
		<form:hidden path="id"/>
		<form:hidden path="home"/>
		<form:hidden path="act.taskId"/>
		<form:hidden path="act.taskName"/>
		<form:hidden path="act.taskDefKey"/>
		<form:hidden path="act.procInsId"/>
		<form:hidden path="act.procDefId"/>
		<form:hidden id="flag" path="act.flag"/>

		<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">
					<form:input path="submitterName" htmlEscape="false"  id="submitterName"  class="form-control layui-input" value = "${workReimbursement.submitterName}"/>
				</div>
			</div>
			<div class="layui-item layui-col-sm6">
				<label class="layui-form-label">报销编号：</label>
				<div class="layui-input-block">
					<div class="input-group">
						<input htmlEscape="false"  readonly="true"  class="form-control layui-input" value="${workReimbursement.number}"/>
						<span class="input-group-btn">
                        <label class="form-status"><c:choose><c:when test="${not empty workReimbursement.status}">${fns:getDictLabel(workReimbursement.status, 'audit_state', '')}</c:when><c:otherwise>新添</c:otherwise></c:choose></label>
                     </span>
					</div>
				</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 = "${workReimbursement.officeName}"/>
				</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 = "${workReimbursement.bankCard}"/>
				</div>
			</div>
			<div class="layui-item layui-col-sm6">
				<label class="layui-form-label">报销类型：</label>
				<div class="layui-input-block">
					<input readonly="true" htmlEscape="false" class="form-control layui-input"
						   value="<c:choose><c:when test="${workReimbursement.ext == 0}">项目报销</c:when><c:otherwise>非项目报销</c:otherwise></c:choose>"/>
				</div>
			</div>

			<div class="layui-item layui-col-sm6 td1">
				<label class="layui-form-label">报销项目：</label>
				<div class="layui-input-block">
					<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="${workReimbursement.project.projectName}"/>
				</div>
			</div>
				<%--<div class="layui-item layui-col-sm6 td1">
                    <label class="layui-form-label">项目负责人：</label>
                    <div class="layui-input-block">
                        <input htmlEscape="false"  readonly="true"  class="form-control layui-input" value="${workReimbursement.projectMasterName}"/>
                    </div>
                </div>--%>
			<div class="layui-item layui-col-sm6">
				<label class="layui-form-label double-line">是否对公报销：</label>
				<div class="layui-input-block">
					<input readonly="true" htmlEscape="false" class="form-control layui-input"
						   value="<c:choose><c:when test="${workReimbursement.isPublic == '0'}">否</c:when><c:otherwise>是</c:otherwise></c:choose>"/>
				</div>
			</div>
			<div class="layui-item layui-col-sm6 isPublic">
				<label class="layui-form-label">公司名称：</label>
				<div class="layui-input-block">
					<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="${workReimbursement.comname}"/>
				</div>
			</div>
			<div class="layui-item layui-col-sm6 isPublic">
				<label class="layui-form-label">开户行：</label>
				<div class="layui-input-block">
					<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="${workReimbursement.bank}"/>
				</div>
			</div>
			<div class="layui-item layui-col-sm6 isPublic">
				<label class="layui-form-label">银行账号：</label>
				<div class="layui-input-block">
					<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="${workReimbursement.bankNo}"/>
				</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="${workReimbursement.submitterName}"/>
				</div>
			</div>

			<div class="layui-item layui-col-sm6">
				<label class="layui-form-label">报销日期：</label>
				<div class="layui-input-block">
					<input readonly="readonly" class="form-control layui-input" value="<fmt:formatDate value="${workReimbursement.submitterDate}" 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="contentTable3" class="table table-bordered table-condensed can-edit no-bottom-margin">
					<thead>
					<tr>
						<th width="190px">借款日期</th>
						<th width="190px">借款类型</th>
						<th width="190px">借款项目</th>
						<th width="190px">借款金额</th>
						<th width="180px">未还金额</th>
						<th width="100px">本次还款</th>
						<th width="120px">借款编号</th>
					</tr>
					</thead>
					<tbody id="reimbursementBackList">
					<c:if test="${not empty workReimbursement.reimbursementBackList}">
						<c:forEach items="${workReimbursement.reimbursementBackList}" var="reimbursementBack" varStatus="index">
							<tr id="reimbursementBackList${index.index}">
								<td class="hide">
									<input id="reimbursementBackList${index.index}_id" name="reimbursementBackList[${index.index}].id" type="hidden" value="${reimbursementBack.id}"/>
									<input id="reimbursementBackList${index.index}_workLoanId" name="reimbursementBackList[${index.index}].workLoan.id" type="hidden" value="${reimbursementBack.workLoan.id}"/>
									<input id="reimbursementBackList${index.index}_delFlag" name="reimbursementBackList[${index.index}].delFlag" type="hidden" value="0"/>
								</td>
								<td>
									<input id="reimbursementBackList${index.index}_1"   type="text" maxlength="20"  readonly="true" class=" form-control layui-input"
										   value="<fmt:formatDate value="${reimbursementBack.workLoan.loanDate}" pattern="yyyy-MM-dd"/>"/>
									</input>
								</td>
								<td>
									<input id="reimbursementBackList${index.index}_2"  readonly="true" type="text" value="${reimbursementBack.workLoan.type}"   class="form-control"/>
								</td>
								<td>
									<input id="reimbursementBackList${index.index}_3"  readonly="true" type="text" value="${reimbursementBack.workLoan.projectRecords.projectName}"   class="form-control"/>
								</td>
								<td>
									<input id="reimbursementBackList${index.index}_4"  readonly="true" type="text" value="${reimbursementBack.workLoan.money}"   class="form-control"/>
								</td>
								<td>
									<input id="reimbursementBackList${index.index}_5"  readonly="true" type="text" value="${reimbursementBack.workLoan.notRepay}"   class="form-control"/>
								</td>
								<td>
									<input id="reimbursementBackList${index.index}_6" readonly="true"  name="reimbursementBackList[${index.index}].money" type="text" value="${reimbursementBack.money}"   class="form-control number "/>
								</td>
								<td>
									<input id="reimbursementBackList${index.index}_7"  readonly="true" type="text" value="${reimbursementBack.workLoan.num}"   class="form-control"/>
								</td>
							</tr>
						</c:forEach>
					</c:if>
					</tbody>
				</table>
				<table id="contentMoneys1" class="table table-bordered table-condensed can-edit summary">
					<tr>
						<td  style="width:190px;vertical-align:middle;text-align: center;"><label><font color="red">*</font>合计</label></td>
						<td  width="190px" style="vertical-align:middle;text-align: center;">
							-
						</td >
						<td  width="190px" style="vertical-align:middle;text-align: center;">
							-
						</td>
						<td  width="190px" style="vertical-align:middle;text-align: center;">
							-
						</td>
						<td width="180px" style="vertical-align:middle;text-align: center;">
							-
						</td>
						<td width="100px" style="vertical-align:middle;text-align: center;">
							<input  id="backmoney" value="${workReimbursement.backmoney}" name="backmoney" htmlEscape="false" readonly="true"   maxlength="12"  class="form-control "/>
						</td>
						<td  width="120px" style="vertical-align:middle;text-align: center;">
							-
						</td>
					</tr>
				</table>
			</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 no-bottom-margin details">
					<thead>
					<tr>
						<th width="200px">财务科目</th>
						<th>报销费用摘要</th>
						<th width="150px">发票类型</th>
						<th width="150px">报销费用（元）</th>
						<th>备注</th>
					</tr>
					</thead>
					<tbody id="workAccountList">
					<c:if test="${not empty workReimbursement.workAccountList}">
						<c:forEach items="${workReimbursement.workAccountList}" var="workAccount" varStatus="index">
							<tr id="workAccountList${index.index}">
								<td class="hide">
								</td>
								<td>
									<div class="project_reimbursement_div">
											${fns:getMainDictLabel(workAccount.financialSubjects, 'project_reimbursement', '')}
									</div>
									<div class="not_project_reimbursement_div" style="display:none;">
											${fns:getMainDictLabel(workAccount.financialSubjectss, 'not_project_reimbursement', '')}
									</div>
								</td>
								<td title="${workAccount.moneyAbstract}">
										${workAccount.moneyAbstract}
								</td>
								<td title="${workAccount.invoiceType}">
										${workAccount.invoiceType}
								</td>
								<td>
									<fmt:formatNumber value="${workAccount.money}" pattern="#,#00.00"/>
								</td>
								<td title="${workAccount.remarks}">
										${workAccount.remarks}
								</td>

							</tr>
						</c:forEach>

					</c:if>
					</tbody>
				</table>
				<table id="contentMoneys" class="table table-bordered table-condensed summary">
					<tr>
						<td width="200px" style="vertical-align:middle;text-align: center;padding: 0px;"><label>总报销费用(元)：</label></td>
						<td >
							<fmt:formatNumber value="${workReimbursement.money}" pattern="#,#00.00"/>
						</td>
					</tr>
				</table>
			</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="contentTable2" class="table table-bordered table-condensed no-bottom-margin details">
					<thead>
					<tr>
						<th width="300px">发票代码</th>
						<th width="200px">发票号</th>
						<th width="200px">金额</th>
						<th width="200px">税额</th>
						<th width="200px">价税合计</th>
					</tr>
					</thead>
					<tbody id="reimbursementVATTaxes">
					<c:if test="${not empty workReimbursement.reimbursementVATTaxes}">
						<c:forEach items="${workReimbursement.reimbursementVATTaxes}" var="reimbursementVATTaxe" varStatus="index">
							<tr>
								<td class="hide">
								</td>
								<td>
										${reimbursementVATTaxe.invoiceCode}
								</td>

								<td>
										${reimbursementVATTaxe.invoiceNumber}
								</td>
								<td>
										${reimbursementVATTaxe.money}
								</td>
								<td>
										${reimbursementVATTaxe.taxAmount}
								</td>
								<td>
										${reimbursementVATTaxe.sumMoney}
								</td>
							</tr>
						</c:forEach>
					</c:if>
					</tbody>
				</table>
			</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="upTable" class="table table-bordered table-condensed details">
					<thead>
					<tr>
							<%-- <th>序号</th>--%>
						<th>文件预览</th>
						<th>上传人</th>
						<th>上传时间</th>
						<th width="150px">操作</th>
					</tr>
					</thead>
					<tbody id="file_attachment">
						<c:forEach items="${workReimbursement.workAttachments}" var = "workClientAttachment" varStatus="status">
							<tr>
									<%-- <td>${status.index + 1}</td>--%>
								<c:choose>
									<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpg')
																   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'png')
																   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'gif')
																   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'bmp')
																   or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jpeg')}">
										<td><img src="${workClientAttachment.url}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${workClientAttachment.url}','90%','90%')" alt="${workClientAttachment.attachmentName}">
									</c:when>
									<c:otherwise>
										<c:choose>
											<c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
												<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%','1')">${workClientAttachment.attachmentName}</a></td>
											</c:when>
											<c:otherwise>
												<td><a class="attention-info" href="javascript:void(0)" onclick="preview('预览','${workClientAttachment.url}','90%','90%')">${workClientAttachment.attachmentName}</a></td>
											</c:otherwise>
										</c:choose>
									</c:otherwise>
								</c:choose>
								<td>${workClientAttachment.createBy.name}</td>
								<td><fmt:formatDate value="${workClientAttachment.createDate}" type="both"/></td>
								<td class="op-td">
									<div class="op-btn-box" >
										<a href="javascript:location.href='${ctx}/workfullmanage/workFullManage/downLoadAttach?file='+encodeURIComponent('${workClientAttachment.url}');" class="op-btn op-btn-download"><i class="fa fa-download"></i>&nbsp;下载</a>
										<%--<c:if test="${workClientAttachment.createBy.id eq fns:getUser().id}">
											<a href="javascript:void(0)" onclick="deleteFileFromAliyun(this,'${ctx}/sys/workattachment/deleteFileFromAliyun?url=${workClientAttachment.url}&id=${workClientAttachment.id}&type=2','addFile')" class="op-btn op-btn-delete" ><i class="fa fa-trash"></i>&nbsp;删除</a>
										</c:if>--%>
									</div>
								</td>
							</tr>
						</c:forEach>
					</tbody>
				</table>
			</div>
		</div>
		<div class="form-group layui-row">
			<div class="form-group-label"><h2>审批意见</h2></div>
			<div class="layui-item layui-col-xs12 with-textarea" >
					<label class="layui-form-label">审批意见：</label>
					<div class="layui-input-block">
						<form:textarea path="act.comment" class="form-control" rows="4" maxlength="127" />
						<input type="file" name="upload_files" style="display: none;">
					</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" >
		<act:flowChart procInsId="${workReimbursement.act.procInsId}"/>
		<act:histoicFlow procInsId="${workReimbursement.act.procInsId}"/>
			</div>
		</div>

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

