Преглед изворни кода

数电票报销功能调整

user5 пре 1 година
родитељ
комит
ac6db9905d

+ 7 - 0
src/main/java/com/jeeplus/modules/workreimbursement/dao/WorkReimbursementDao.java

@@ -70,4 +70,11 @@ public interface WorkReimbursementDao extends CrudDao<WorkReimbursement> {
 	 */
 	ReimbursementVATTax getEffectiveDataByinvoiceNumber(@Param("invoiceNumber")String invoiceNumber, @Param("id")String id);
 
+
+	/**
+	 * 根据报销数电发票number进行删除
+	 * @param invoiceNumber
+	 * @return
+	 */
+	Integer deleteReimbursementVatTaxByNumber(String invoiceNumber);
 }

+ 39 - 1
src/main/java/com/jeeplus/modules/workreimbursement/entity/ReimbursementVATTax.java

@@ -37,6 +37,10 @@ public class ReimbursementVATTax extends DataEntity<ReimbursementVATTax> {
 
 	private String submitterName;		// 报销人
 	private String submitterDate;		// 报销时间
+	private String status;		// 报销状态
+	private String reimbursementId;		// 报销id
+	private String processInstanceId;		// 报销流程id
+	private String handlingPerson;		// 处理人员
 
 	private String remarks;
 
@@ -189,7 +193,7 @@ public class ReimbursementVATTax extends DataEntity<ReimbursementVATTax> {
 		this.submitterDate = submitterDate;
 	}
 
-	@ExcelField(title="备注", align=2, sort=12)
+	@ExcelField(title="备注", align=2, sort=14)
 	@Override
 	public String getRemarks() {
 		return remarks;
@@ -199,4 +203,38 @@ public class ReimbursementVATTax extends DataEntity<ReimbursementVATTax> {
 	public void setRemarks(String remarks) {
 		this.remarks = remarks;
 	}
+
+	@ExcelField(title="审核状态", dictType="reimburse_audit_state", align=2, sort=12)
+	public String getStatus() {
+		return status;
+	}
+
+	public void setStatus(String status) {
+		this.status = status;
+	}
+
+	public String getReimbursementId() {
+		return reimbursementId;
+	}
+
+	public void setReimbursementId(String reimbursementId) {
+		this.reimbursementId = reimbursementId;
+	}
+
+	public String getProcessInstanceId() {
+		return processInstanceId;
+	}
+
+	public void setProcessInstanceId(String processInstanceId) {
+		this.processInstanceId = processInstanceId;
+	}
+
+	@ExcelField(title="当前节点审核人员", align=2, sort=13)
+	public String getHandlingPerson() {
+		return handlingPerson;
+	}
+
+	public void setHandlingPerson(String handlingPerson) {
+		this.handlingPerson = handlingPerson;
+	}
 }

+ 146 - 0
src/main/java/com/jeeplus/modules/workreimbursement/service/WorkReimbursementService.java

@@ -7,6 +7,7 @@ import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import com.jeeplus.common.persistence.Page;
 import com.jeeplus.common.service.CrudService;
+import com.jeeplus.common.utils.Collections3;
 import com.jeeplus.common.utils.FtlUtils;
 import com.jeeplus.common.utils.MenuStatusEnum;
 import com.jeeplus.common.utils.StringUtils;
@@ -25,8 +26,10 @@ import com.jeeplus.modules.statement.entity.StatementCompanyComprehensiveInfo;
 import com.jeeplus.modules.statement.service.StatementCompanyComprehensiveService;
 import com.jeeplus.modules.sys.entity.MainDictDetail;
 import com.jeeplus.modules.sys.entity.Office;
+import com.jeeplus.modules.sys.entity.SysRoleActivity;
 import com.jeeplus.modules.sys.entity.User;
 import com.jeeplus.modules.sys.service.OfficeService;
+import com.jeeplus.modules.sys.service.SystemService;
 import com.jeeplus.modules.sys.service.WorkattachmentService;
 import com.jeeplus.modules.sys.utils.DictUtils;
 import com.jeeplus.modules.sys.utils.UserUtils;
@@ -85,6 +88,7 @@ import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
+import java.util.stream.Collectors;
 
 /**
  * 财务报销Service
@@ -152,6 +156,8 @@ public class WorkReimbursementService extends CrudService<WorkReimbursementDao,
     private ProjectReportDataService projectReportDataService;
     @Autowired
     private WorkReimbursementTypeService workReimbursementTypeService;
+    @Autowired
+    private SystemService systemService;
 
     private static byte[] SYN_BYTE = new byte[0];
 
@@ -1823,6 +1829,50 @@ public class WorkReimbursementService extends CrudService<WorkReimbursementDao,
      */
     public List<ReimbursementVATTax> getElectronicInvoiceList(List<String> idList) {
         List<ReimbursementVATTax> electronicInvoiceList = workReimbursementDao.getElectronicInvoiceList(idList);
+        //对导出数据进行处理
+        Set<String> setProcessInstanceId = new HashSet();
+        //对导出数据对应的报销单id进行去重处理(要求,审核结束的不进行记入)
+        for (ReimbursementVATTax reimbursementVATTax : electronicInvoiceList) {
+            if("2".equals(reimbursementVATTax.getStatus())){
+                setProcessInstanceId.add(reimbursementVATTax.getProcessInstanceId());
+            }else if("5".equals(reimbursementVATTax.getStatus())){
+                reimbursementVATTax.setHandlingPerson("结束");
+            }else{
+                reimbursementVATTax.setHandlingPerson(reimbursementVATTax.getSubmitterName());
+            }
+        }
+        Map<String,String> assigneeNameMap = new HashMap<>();
+        if(setProcessInstanceId.size()>0){
+            //报销流程id
+            List<String> processInstanceIdList = new ArrayList<>(setProcessInstanceId);
+            for (String processInstanceId : processInstanceIdList) {
+                List<Act> list = this.histoicFlowList(processInstanceId);
+
+                if(list.size()>0){
+                    for (Act processAct : list) {
+                        if(null != processAct.getBeginDate() && null == processAct.getEndDate()){
+                            assigneeNameMap.put(processInstanceId,processAct.getAssigneeName());
+                            break;
+                        }else{
+                            assigneeNameMap.put(processInstanceId,"");
+                        }
+                    }
+                }else{
+                    assigneeNameMap.put(processInstanceId,"");
+                }
+            }
+
+        }
+        for (ReimbursementVATTax reimbursementVATTax : electronicInvoiceList) {
+            for(String key : assigneeNameMap.keySet()) {
+                if(reimbursementVATTax.getProcessInstanceId().equals(key)){
+                    String value = assigneeNameMap.get(key);
+                    reimbursementVATTax.setHandlingPerson(value);
+                }
+
+            }
+        }
+
         if(electronicInvoiceList.size()>0){
             //获取专业类型
             List<MainDictDetail> certificateMajor = DictUtils.getMainDictList("invoiceReimbursementType");
@@ -1839,6 +1889,84 @@ public class WorkReimbursementService extends CrudService<WorkReimbursementDao,
         return electronicInvoiceList;
     }
 
+    public List<Act> histoicFlowList(String processInstanceId) {
+
+        List<Act> histoicFlows = new ArrayList<>();
+
+        WorkActivityProcess workActivityProcess = new WorkActivityProcess();
+        workActivityProcess.setProcessInstanceId(processInstanceId);
+        workActivityProcess.setIsApproval("0");
+        List<WorkActivityProcess> lists = workActivityProcessService.findByProcInsIdAudit(workActivityProcess);
+
+        Integer flag = 0;
+        Boolean insertBool = false;
+        Date endDate = new Date();
+
+        for (int i =0;i<lists.size();i++){
+            insertBool = false;
+            WorkActivityProcess activityProcess = lists.get(i);
+            Act a = new Act();
+            if (activityProcess.getActivity() ==null) {
+                a.setAssigneeName(UserUtils.get(lists.get(lists.size() - 1).getCreateBy().getId()).getName());
+                if("销假申请".equals(activityProcess.getRemarks())||"续假申请".equals(activityProcess.getRemarks())){
+                    a.setTaskName("开始");
+                }else{
+                    if("结案人驳回".equals(activityProcess.getRemarks())){
+                        insertBool = true;
+                    }
+                    a.setTaskName("重申|撤销");
+                }
+            }else if (activityProcess.getActivity().getUser()!=null && org.apache.commons.lang3.StringUtils.isNotBlank(activityProcess.getActivity().getUser().getId())){
+                String id = activityProcess.getActivity().getUser().getId();
+                if ("1".equals(id)){
+                    a.setRoleName("负责人");
+                }else {
+                    a.setAssigneeName(UserUtils.get(activityProcess.getActivity().getUser().getId()).getName());
+                }
+                a.setTaskName(activityProcess.getActivity().getName());
+            }else{
+                flag++;
+                SysRoleActivity role = activityProcess.getActivity().getRole();
+                String buffer = UserUtils.getRoleActivityEnname(UserUtils.getSelectCompany().getId(),UserUtils.getUser());
+                if (activityProcess.getProcessUserList()!=null && activityProcess.getProcessUserList().size()!=0){
+                    a.setAssigneeName(Collections3.extractToString(activityProcess.getProcessUserList(), "name", ","));
+                }
+                if("master".equals(role.getEnname())){
+                    a.setRoleName("负责人");
+                }else if("qyr".equals(role.getEnname())){
+                    a.setRoleName("签约人");
+                }else if("sqr".equals(role.getEnname())){
+                    a.setRoleName("申请人");
+                    a.setAssigneeName(UserUtils.get(lists.get(lists.size() - 1).getCreateBy().getId()).getName());
+                }else {
+                    if (role.getEnname().contains(buffer)){
+                        SysRoleActivity r = systemService.getRoleActivityByEnname(role.getEnname());
+                        a.setRoleName(r.getName());
+                    }else {
+                        //如果流程中指定的角色为董事长dsz,而该公司下没有这样角色,则r=null,空指针
+                        SysRoleActivity r = systemService.getRoleActivityByEnname(buffer+role.getEnname());
+                        a.setRoleName(r!=null?r.getName():"");
+                    }
+                }
+                a.setTaskName(activityProcess.getActivity().getName());
+            }
+
+            a.setComment(activityProcess.getRemarks());
+            if (i==0){
+                a.setBeginDate(endDate);
+            }
+            if(org.apache.commons.lang3.StringUtils.isNotBlank(a.getTaskName())){
+                if(flag == 1) {
+                    a.setBeginDate(endDate);
+                }
+                if(!insertBool){
+                    histoicFlows.add(a);
+                }
+            }
+        }
+        return histoicFlows;
+    }
+
     /**
      * 根据电子发票号码查询电子发票信息
      * @param invoiceNumber
@@ -1961,4 +2089,22 @@ public class WorkReimbursementService extends CrudService<WorkReimbursementDao,
         }
         return map;
     }
+
+    /**
+     * 根据id修改报销详情中喝项目的关联关系信息
+     * @param id
+     * @return
+     */
+    @Transactional(readOnly = false)
+    public Map<String,Object> updateAccountInfoById(String invoiceNumber){
+        Map<String,Object> map = new HashMap<>();
+        //删除电子发票信息
+        Integer deleteResult = dao.deleteReimbursementVatTaxByNumber(invoiceNumber);
+        if(1 == deleteResult){
+            map.put("success",true);
+        }else{
+            map.put("success",false);
+        }
+        return map;
+    }
 }

+ 19 - 0
src/main/java/com/jeeplus/modules/workreimbursement/web/WorkReimbursementController.java

@@ -1138,11 +1138,30 @@ public class WorkReimbursementController extends BaseController {
 				}else{
 					map.put("flag",false);
 				}
+			}else{
+				map.put("flag",true);
+				map.put("message","上传的数电发票格式错误,请确认后重新上传");
+
 			}
 
 		} catch (Exception e) {
 			e.printStackTrace();
+			map.put("flag",true);
+			map.put("message","上传的数电发票格式错误,请确认后重新上传");
 		}
 		return map;
 	}
+
+
+
+	/**
+	 * 根据id修改报销详情中喝项目的关联关系信息
+	 * @param id
+	 * @return
+	 */
+	@RequestMapping(value = "updateAccountInfoById", method=RequestMethod.POST)
+	@ResponseBody
+	public Map<String,Object> updateAccountInfoById(String invoiceNumber) {
+		return workReimbursementService.updateAccountInfoById(invoiceNumber);
+	}
 }

+ 10 - 1
src/main/resources/mappings/modules/workreimbursement/WorkReimbursementDao.xml

@@ -932,6 +932,9 @@
 		rvt.invoice_project_name as "invoiceProjectName",
 		rvt.remarks as "remarks",
 		su.name as "submitterName",
+		a.status as "status",
+		a.id as "reimbursementId",
+		a.process_instance_id as "processInstanceId",
 		date_format(a.submitter_date,'%Y-%m-%d') as "submitterDate"
 		FROM reimbursement_vat_tax rvt
 		left join work_reimbursement a on rvt.work_reimbursement_id =a.id
@@ -975,11 +978,17 @@
 			and rvt.reimbursement_type = 1
 			and rvt.invoice_number = #{invoiceNumber}
 			<if test="id != null and id != ''">
-				and a.work_reimbursement_id != #{id}
+				and rvt.work_reimbursement_id != #{id}
 			</if>
 		</where>
 		order by a.number desc,rvt.update_date desc,rvt.invoice_number desc
 		limit 1
 	</select>
 
+
+	<update id="deleteReimbursementVatTaxByNumber">
+		update reimbursement_vat_tax set
+		del_flag = 1
+		where invoice_number = #{invoiceNumber}
+	</update>
 </mapper>

+ 62 - 4
src/main/webapp/webpage/modules/workreimbursement/new/workReimbursementNewAudit.jsp

@@ -6,6 +6,7 @@
 	<meta name="decorator" content="default"/>
 	<script type="text/javascript" src="${ctxStatic}/layui/layui.js"></script>
 	<link rel='stylesheet' type="text/css" href="${ctxStatic}/layui/css/layui.css"/>
+	<script src="${ctxStatic}/common/html/js/script.js"></script>
 	<script type="text/javascript">
 		var validateForm;
 		function doSubmit(obj){//回调函数,在编辑和保存动作时,供openDialog调用提交表单。
@@ -70,6 +71,42 @@
 					}
 				}
 			});
+			var invoiceVATTaxes = $("#reimbursementElectronicInvoiceVATTaxes tr").length;
+			var reimbursementElectronicInvoiceVATTaxesMoneys = "";
+			var reimbursementElectronicInvoiceVATTaxesTaxAmount = "";
+			var reimbursementElectronicInvoiceVATTaxesSumMoney = "";
+			for(var i = 0;i < invoiceVATTaxes;i++){
+				var moneys = $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(5).find("input").eq(0).val();
+				var taxAmount = $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(6).find("input").eq(0).val();
+				var rsumMoney = $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(7).find("input").eq(0).val();
+
+				if (moneys!=undefined && !isNaN(moneys)){
+					if(reimbursementElectronicInvoiceVATTaxesMoneys==""){
+						reimbursementElectronicInvoiceVATTaxesMoneys = parseFloat(moneys).toFixed(2);
+					}else {
+						reimbursementElectronicInvoiceVATTaxesMoneys = (parseFloat(reimbursementElectronicInvoiceVATTaxesMoneys) + parseFloat(moneys)).toFixed(2);
+					}
+				}
+				if (taxAmount!=undefined && !isNaN(taxAmount)){
+					if(reimbursementElectronicInvoiceVATTaxesTaxAmount==""){
+						reimbursementElectronicInvoiceVATTaxesTaxAmount = parseFloat(taxAmount).toFixed(2);
+					}else {
+						reimbursementElectronicInvoiceVATTaxesTaxAmount = (parseFloat(reimbursementElectronicInvoiceVATTaxesTaxAmount) + parseFloat(taxAmount)).toFixed(2);
+					}
+				}
+				if (rsumMoney!=undefined && !isNaN(rsumMoney)){
+					if(reimbursementElectronicInvoiceVATTaxesSumMoney==""){
+						reimbursementElectronicInvoiceVATTaxesSumMoney = parseFloat(rsumMoney).toFixed(2);
+					}else {
+						reimbursementElectronicInvoiceVATTaxesSumMoney = (parseFloat(reimbursementElectronicInvoiceVATTaxesSumMoney) + parseFloat(rsumMoney)).toFixed(2);
+					}
+				}
+			}
+			$("#reimbursementElectronicInvoiceVATTaxesMoneys").val(reimbursementElectronicInvoiceVATTaxesMoneys);
+			$("#reimbursementElectronicInvoiceVATTaxesTaxAmount").val(reimbursementElectronicInvoiceVATTaxesTaxAmount);
+			$("#reimbursementElectronicInvoiceVATTaxesSumMoney").val(reimbursementElectronicInvoiceVATTaxesSumMoney);
+
+
 		});
 	</script>
 	<style>
@@ -405,7 +442,7 @@
 		<div class="form-group layui-row count2">
 			<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">
+				<table id="contentTable3" class="table table-bordered table-condensed can-edit no-bottom-margin">
 					<thead>
 					<tr>
 						<th width="200px"><font color="red">*</font>发票类型</th>
@@ -464,6 +501,27 @@
 					</c:if>
 					</tbody>
 				</table>
+				<table id="contentTable4" class="table table-bordered table-condensed can-edit no-bottom-margin">
+					<thead>
+					<tr >
+						<td width="200px" style="vertical-align:middle;text-align: center;"><label>费用汇总(元):</label></td>
+						<td width="200px"></td>
+						<td width="200px"></td>
+						<td width="200px"></td>
+						<td width="200px"></td>
+						<td width="200px" style="border: 0px">
+							<input htmlEscape="false" style="border: 0px; font-weight: bold;" id="reimbursementElectronicInvoiceVATTaxesMoneys" name="reimbursementElectronicInvoiceVATTaxesMoneys" readonly="true" class="form-control layui-input" value=""/>
+						</td>
+						<td width="200px">
+							<input htmlEscape="false" style="border: 0px; font-weight: bold;" id="reimbursementElectronicInvoiceVATTaxesTaxAmount" name="reimbursementElectronicInvoiceVATTaxesTaxAmount" readonly="true" class="form-control layui-input" value=""/>
+						</td>
+						<td width="200px">
+							<input htmlEscape="false" style="border: 0px; font-weight: bold;" id="reimbursementElectronicInvoiceVATTaxesSumMoney" name="reimbursementElectronicInvoiceVATTaxesSumMoney" readonly="true" class="form-control layui-input" value=""/>
+						</td>
+						<td width="200px"></td>
+					</tr>
+					</thead>
+				</table>
 			</div>
 		</div>
 
@@ -484,7 +542,7 @@
 					<thead>
 					<tr>
 							<%-- <th>序号</th>--%>
-						<th>文件预览</th>
+						<th>数电发票文件预览</th>
 						<th>上传人</th>
 						<th>上传时间</th>
 						<th width="200px">操作</th>
@@ -640,9 +698,9 @@
 											<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:otherwise>
 									</c:choose>
-									<c:if test="${workClientAttachment.collectFlag != 1}">
+									<%--<c:if test="${workClientAttachment.collectFlag != 1}">
 										<a href="javascript:void(0)" onclick="collectingAccessory(this,'${ctx}/projectAccessory/projectAccessory/saveCollectAccessory','${workClientAttachment.url}','${workClientAttachment.createBy.id}','${workClientAttachment.fileSize}')" class="op-btn op-btn-delete" style="background-color: #FFB800"><i class="layui-icon layui-icon-rate"></i>&nbsp;收藏</a>
-									</c:if>
+									</c:if>--%>
 
 								</div>
 							</td>

+ 520 - 153
src/main/webapp/webpage/modules/workreimbursement/new/workReimbursementNewFormAdd.jsp

@@ -94,6 +94,9 @@
             $("#attachment_btn").click(function () {
                 $("#attachment_file").click();
             });
+            $("#attachment_btn_xml").click(function () {
+                $("#attachment_InvoiceReimbursement_file").click();
+            });
             // getRandom();
 
             laydate.render({
@@ -110,6 +113,43 @@
                     type : 'datetime'
                 });
             }
+
+            var invoiceVATTaxes = $("#reimbursementElectronicInvoiceVATTaxes tr").length;
+            var reimbursementElectronicInvoiceVATTaxesMoneys = "";
+            var reimbursementElectronicInvoiceVATTaxesTaxAmount = "";
+            var reimbursementElectronicInvoiceVATTaxesSumMoney = "";
+            for(var i = 0;i < invoiceVATTaxes;i++){
+                var moneys = $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(6).find("input").eq(0).val();
+                var taxAmount = $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(7).find("input").eq(0).val();
+                var rsumMoney = $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(8).find("input").eq(0).val();
+
+                if (moneys!=undefined && isNumber(moneys)){
+                    if(reimbursementElectronicInvoiceVATTaxesMoneys==""){
+                        reimbursementElectronicInvoiceVATTaxesMoneys = parseFloat(moneys).toFixed(2);
+                    }else {
+                        reimbursementElectronicInvoiceVATTaxesMoneys = (parseFloat(reimbursementElectronicInvoiceVATTaxesMoneys) + parseFloat(moneys)).toFixed(2);
+                    }
+                }
+                if (taxAmount!=undefined && isNumber(taxAmount)){
+                    if(reimbursementElectronicInvoiceVATTaxesTaxAmount==""){
+                        reimbursementElectronicInvoiceVATTaxesTaxAmount = parseFloat(taxAmount).toFixed(2);
+                    }else {
+                        reimbursementElectronicInvoiceVATTaxesTaxAmount = (parseFloat(reimbursementElectronicInvoiceVATTaxesTaxAmount) + parseFloat(taxAmount)).toFixed(2);
+                    }
+                }
+                if (rsumMoney!=undefined && isNumber(rsumMoney)){
+                    if(reimbursementElectronicInvoiceVATTaxesSumMoney==""){
+                        reimbursementElectronicInvoiceVATTaxesSumMoney = parseFloat(rsumMoney).toFixed(2);
+                    }else {
+                        reimbursementElectronicInvoiceVATTaxesSumMoney = (parseFloat(reimbursementElectronicInvoiceVATTaxesSumMoney) + parseFloat(rsumMoney)).toFixed(2);
+                    }
+                }
+            }
+            $("#reimbursementElectronicInvoiceVATTaxesMoneys").val(reimbursementElectronicInvoiceVATTaxesMoneys);
+            $("#reimbursementElectronicInvoiceVATTaxesTaxAmount").val(reimbursementElectronicInvoiceVATTaxesTaxAmount);
+            $("#reimbursementElectronicInvoiceVATTaxesSumMoney").val(reimbursementElectronicInvoiceVATTaxesSumMoney);
+
+
         });
 
         function doSubmit(obj){//回调函数,在编辑和保存动作时,供openDialog调用提交表单。
@@ -144,7 +184,7 @@
 
                 if(reimbursementType == '1'){
                     var leng = $("#file_attachment_InvoiceReimbursement tr").length;
-                    if(leng.length == 0){
+                    if(leng === 0){
                         parent.layer.msg("请上传数电发票xml文件!", {icon: 5});
                         flags= false;
                     }
@@ -152,41 +192,11 @@
 
                 var electronicInvoiceArr = $("#reimbursementElectronicInvoiceVATTaxes tr:visible");
                 if(electronicInvoiceArr.length>0){
-                    var flag = false;
-                    var countFlag = 0;
-                    var list = "${workReimbursement.workAttachments}";
-                    var size = (list.split('url')).length-1;
-                    /*var files = $("#attachment_file")[0].files;
-                    for(var i = 0;i<files.length;i++) {
-                        var file = files[i];
-                        //如果文件以xml文件结尾,则需要将该文件上传到后台进行数据处理后返回数据
-                        const spliceLength2 = file.name.lastIndexOf(".");
-                        var fileNameSuffix = file.name.slice(spliceLength2 + 1);
-                        if(fileNameSuffix === "xml" ) {
-                            flag = true;
-                            countFlag ++;
-                        }
-                    }
-                    if(!flag){
-                        var data = ${fns:toJson(workReimbursement.workAttachments)};//后端获取值
-                        for (var i=0; i<data.length; i++){
-                            //如果文件以xml文件结尾,则需要将该文件上传到后台进行数据处理后返回数据
-                            const spliceLength2 = data[i].attachmentName.lastIndexOf(".");
-                            var fileNameSuffix = data[i].attachmentName.slice(spliceLength2 + 1);
-                            if(fileNameSuffix === "xml" ) {
-                                flag = true;
-                                countFlag ++;
-                            }
-                        }
-                    }
-                    if(!flag){
-                        parent.layer.msg("已填写电子发票信息,请上传对应发票的xml文件!", {icon: 5});
-                        flags= false;
-                    }*/
-                    /*if(countFlag < electronicInvoiceArr.length){
+                    var leng = $("#file_attachment_InvoiceReimbursement tr").length;
+                    if(leng != electronicInvoiceArr.length){
                         parent.layer.msg("填写电子发票数据量与上传发票xml文件数量不符,请重新上传!", {icon: 5});
                         flags= false;
-                    }*/
+                    }
                 }
 
                 if (flags){
@@ -401,8 +411,11 @@
 
         }
         function delRowA(obj, prefix){
+            console.log("obj:",obj)
+            console.log("prefix:",prefix)
             var id = $(prefix+"_id");
             var delFlag = $(prefix+"_delFlag");
+            var invoiceNumber = $(prefix+"_invoiceNumber").val();
             if (id.val() == ""){
                 delFlag.val("1");
                 $(obj).parent().parent().remove();
@@ -443,107 +456,269 @@
             var size = (list.split('url')).length-1;
             var files = $("#attachment_file")[0].files;
 
+            for(var i = 0;i<files.length;i++) {                var file = files[i];
+                var attachmentId = "";
+                var attachmentFlag = "6";
+                var timestamp=new Date().getTime();
+
+                var storeAs = "wrkReimbursement";
+                var uploadPath="http://gangwan-app.oss-cn-hangzhou.aliyuncs.com/"+storeAs;/*将这段字符串存到数据库即可*/
+                var divId = "_attachment";
+                $("#addFile"+divId).show();
+                multipartUploadWithSts(storeAs, file,attachmentId,attachmentFlag,uploadPath,divId,size);}
+
+        }
+
+        function insertTitleInvoiceReimbursement(tValue){
+            var id = "${workReimbursement.id}";
+            var list = "${workReimbursement.workAttachmentInvoiceReimbursements}";
+            var size = (list.split('url')).length-1;
+            var files = $("#attachment_InvoiceReimbursement_file")[0].files;
             //判断报销类型是否为电子报销
-            var reimbursementType=$('input:radio[name="reimbursementType"]:checked').val();
-            if(reimbursementType === "1"){
-                for(var i = 0;i<files.length;i++) {
-                    var file = files[i];
-                    //如果文件以xml文件结尾,则需要将该文件上传到后台进行数据处理后返回数据
-                    const spliceLength2 = file.name.lastIndexOf(".");
-                    var fileNameSuffix = file.name.slice(spliceLength2 + 1);
-                    if(fileNameSuffix === "xml" ) {
-                        var formdata = new FormData();
-                        formdata.append("multipartFile",file);
-                        $.ajax({
-                            type:'post',
-                            url:"${ctx}/workreimbursement/workReimbursement/disposeXmlFile",
-                            data:formdata,
-                            contentType: false,
-                            processData: false,
-                            success:function (data) {
-                                if(data.flag){
-                                    top.layer.msg(data.message,{icon:2});
-                                }else{
-                                    //创建判断值,若行信息存在相同的发票号,则进行数据检查调整,若不存在发票号,则新增行,并将信息写入
-                                    var includeFlag = false;
-                                    //xml文件处理
-                                    //首先查询专用发票信息中对应发票号是否存在,并对应其数据是否正确
-                                    //获取专用发票信息 行数
-                                    var trlen = $("#reimbursementElectronicInvoiceVATTaxes tr").length;
-                                    for(var i = 0;i < trlen;i++){
-                                        var id = $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(0).find("input").eq(0).val();
-                                        var delFlag = $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(0).find("input").eq(1).val();
-                                        var invoiceType = $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(1).find("select").eq(0).val();
-                                        var invoiceNumber = $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(2).find("input").eq(0).val();
-                                        var invoiceDate = $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(3).find("input").eq(0).val();
-                                        var invoiceUnit = $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(4).find("input").eq(0).val();
-                                        var money = $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(5).find("input").eq(0).val();
-                                        var taxAmount = $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(6).find("input").eq(0).val();
-                                        var sumMoney = $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(7).find("input").eq(0).val();
-                                        var remarks = $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(8).find("input").eq(0).val();
-
-                                        if(invoiceNumber === data.InvoiceNumber && data.InvoiceNumber){
-                                            includeFlag = true
-                                            //数据处理
-                                            $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(1).find("select").eq(0).val(data.InherentLabelGeneralOrSpecialVATLabelCode);
-                                            $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(2).find("input").eq(0).val(data.IssuItemInformationItemName);
-                                            $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(3).find("input").eq(0).val(data.InvoiceNumber);
-                                            $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(4).find("input").eq(0).val(data.BasicInformationRequestTime);
-                                            $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(5).find("input").eq(0).val(data.BuyerInformationBuyerName);
-                                            $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(6).find("input").eq(0).val(data.BasicInformationTotalAmWithoutTax);
-                                            $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(7).find("input").eq(0).val(data.BasicInformationTotalTaxAm);
-                                            $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(8).find("input").eq(0).val(data.BasicInformationTotalTaxincludedAmount);
-                                            $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(9).find("input").eq(0).val("");
+            for(var i = 0;i<files.length;i++) {
+                var file = files[i];
+                //如果文件以xml文件结尾,则需要将该文件上传到后台进行数据处理后返回数据
+                const spliceLength2 = file.name.lastIndexOf(".");
+                var fileNameSuffix = file.name.slice(spliceLength2 + 1);
+                if(fileNameSuffix === "xml" ) {
+                    var formdata = new FormData();
+                    formdata.append("multipartFile",file);
+                    formdata.append("id",id);
+                    $.ajax({
+                        type:'post',
+                        url:"${ctx}/workreimbursement/workReimbursement/disposeXmlFile",
+                        data:formdata,
+                        contentType: false,
+                        async: false,
+                        processData: false,
+                        success:function (data) {
+                            console.log(data)
+                            if(data.flag){
+                                top.layer.msg(data.message,{icon:2});
+                            }else{
+                                console.log(3123124)
+                                //获取专用发票信息 行数
+                                var trlen = $("#reimbursementElectronicInvoiceVATTaxes tr").length;
+                                console.log("trlen:" , trlen)
+                                //创建判断值,若行信息存在相同的发票号,则进行数据检查调整,若不存在发票号,则新增行,并将信息写入
+                                var includeFlag = false;
+                                //xml文件处理
+                                //首先查询专用发票信息中对应发票号是否存在,并对应其数据是否正确
+                                //获取专用发票信息 行数
+                                for(var i = 0;i < trlen;i++){
+                                    var invoiceNumber = $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(3).find("input").eq(0).val();
+
+                                    if(invoiceNumber === data.InvoiceNumber && data.InvoiceNumber){
+                                        includeFlag = true
+                                        //数据处理
+                                        $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(0).find("input").eq(2).val(data.InherentLabelGeneralOrSpecialVATLabelCode);
+                                        $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(1).find("input").eq(0).val(data.InherentLabelGeneralOrSpecialVATLabelName);
+                                        $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(2).find("input").eq(0).val(data.IssuItemInformationItemName);
+                                        $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(3).find("input").eq(0).val(data.InvoiceNumber);
+                                        $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(4).find("input").eq(0).val(data.IssueTime);
+                                        $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(5).find("input").eq(0).val(data.SellerInformationSellerName);
+                                        $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(6).find("input").eq(0).val(data.BasicInformationTotalAmWithoutTax);
+                                        $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(7).find("input").eq(0).val(data.BasicInformationTotalTaxAm);
+                                        $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(8).find("input").eq(0).val(data.BasicInformationTotalTaxincludedAmount);
+                                        $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(9).find("input").eq(0).val("");
+                                        $("#reimbursementElectronicInvoiceVATTaxes" + i + "_delFlag").val("0")
+                                        $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).show();
+                                        break;
+                                    }
+                                }
+                                //若发票号不存在。则新增行将对应信息添加进去
+                                if(!includeFlag  && data.InvoiceNumber){
+                                    addRow('#reimbursementElectronicInvoiceVATTaxes', reimbursementElectronicInvoiceVATTaxesRowIdx, reimbursementElectronicInvoiceVATTaxesTpl);
+
+                                    $("#reimbursementElectronicInvoiceVATTaxes tr").eq(trlen).find("td").eq(0).find("input").eq(0).val("");
+                                    $("#reimbursementElectronicInvoiceVATTaxes tr").eq(trlen).find("td").eq(0).find("input").eq(1).val(0);
+                                    $("#reimbursementElectronicInvoiceVATTaxes tr").eq(trlen).find("td").eq(0).find("input").eq(2).val(data.InherentLabelGeneralOrSpecialVATLabelCode);
+                                    $("#reimbursementElectronicInvoiceVATTaxes tr").eq(trlen).find("td").eq(1).find("input").eq(0).val(data.InherentLabelGeneralOrSpecialVATLabelName);
+                                    $("#reimbursementElectronicInvoiceVATTaxes tr").eq(trlen).find("td").eq(2).find("input").eq(0).val(data.IssuItemInformationItemName);
+                                    $("#reimbursementElectronicInvoiceVATTaxes tr").eq(trlen).find("td").eq(3).find("input").eq(0).val(data.InvoiceNumber);
+                                    $("#reimbursementElectronicInvoiceVATTaxes tr").eq(trlen).find("td").eq(4).find("input").eq(0).val(data.IssueTime);
+                                    $("#reimbursementElectronicInvoiceVATTaxes tr").eq(trlen).find("td").eq(5).find("input").eq(0).val(data.SellerInformationSellerName);
+                                    $("#reimbursementElectronicInvoiceVATTaxes tr").eq(trlen).find("td").eq(6).find("input").eq(0).val(data.BasicInformationTotalAmWithoutTax);
+                                    $("#reimbursementElectronicInvoiceVATTaxes tr").eq(trlen).find("td").eq(7).find("input").eq(0).val(data.BasicInformationTotalTaxAm);
+                                    $("#reimbursementElectronicInvoiceVATTaxes tr").eq(trlen).find("td").eq(8).find("input").eq(0).val(data.BasicInformationTotalTaxincludedAmount);
+                                    $("#reimbursementElectronicInvoiceVATTaxes tr").eq(trlen).find("td").eq(9).find("input").eq(0).val("");
+
+                                    reimbursementElectronicInvoiceVATTaxesRowIdx = reimbursementElectronicInvoiceVATTaxesRowIdx + 1;
+                                }
+
+                                var attachmentFileLength = $("#file_attachment_InvoiceReimbursement tr").length;
+                                var attachmentFile = $("#file_attachment_InvoiceReimbursement tr");
+                                var fileName = "";
+                                var fileNameFlag = true;
+                                for(var i = 0 ; i<attachmentFileLength; i++){
+                                    // 获取当前行中的第一个<td>元素
+                                    var firstTd = attachmentFile[i].getElementsByTagName("td")[0];
+                                    // 检查第一个<td>元素是否存在
+                                    if (firstTd) {
+                                        // 获取第一个<td>元素中的第一个<a>标签
+                                        var firstA = firstTd.getElementsByTagName("a")[0];
+                                        // 检查第一个<a>标签是否存在
+                                        if (firstA) {
+                                            // 获取<a>标签中的文本信息
+                                            fileName = firstA.textContent || firstA.innerText;
+                                        } else {
+                                            console.log("在当前行中的第一个<td>元素中未找到<a>标签");
                                         }
+                                    } else {
+                                        console.log("在当前行中未找到<td>元素");
                                     }
-                                    //若发票号不存在。则新增行将对应信息添加进去
-                                    if(!includeFlag && data.InvoiceNumber){
-                                        addRow('#reimbursementElectronicInvoiceVATTaxes', reimbursementElectronicInvoiceVATTaxesRowIdx, reimbursementElectronicInvoiceVATTaxesTpl);
-
-                                        $("#reimbursementElectronicInvoiceVATTaxes tr").eq(reimbursementElectronicInvoiceVATTaxesRowIdx).find("td").eq(0).find("input").eq(0).val("");
-                                        $("#reimbursementElectronicInvoiceVATTaxes tr").eq(reimbursementElectronicInvoiceVATTaxesRowIdx).find("td").eq(0).find("input").eq(1).val(0);
-                                        $("#reimbursementElectronicInvoiceVATTaxes tr").eq(reimbursementElectronicInvoiceVATTaxesRowIdx).find("td").eq(1).find("select").eq(0).val(data.InherentLabelGeneralOrSpecialVATLabelCode);
-                                        $("#reimbursementElectronicInvoiceVATTaxes tr").eq(reimbursementElectronicInvoiceVATTaxesRowIdx).find("td").eq(2).find("input").eq(0).val(data.IssuItemInformationItemName);
-                                        $("#reimbursementElectronicInvoiceVATTaxes tr").eq(reimbursementElectronicInvoiceVATTaxesRowIdx).find("td").eq(3).find("input").eq(0).val(data.InvoiceNumber);
-                                        $("#reimbursementElectronicInvoiceVATTaxes tr").eq(reimbursementElectronicInvoiceVATTaxesRowIdx).find("td").eq(4).find("input").eq(0).val(data.BasicInformationRequestTime);
-                                        $("#reimbursementElectronicInvoiceVATTaxes tr").eq(reimbursementElectronicInvoiceVATTaxesRowIdx).find("td").eq(5).find("input").eq(0).val(data.BuyerInformationBuyerName);
-                                        $("#reimbursementElectronicInvoiceVATTaxes tr").eq(reimbursementElectronicInvoiceVATTaxesRowIdx).find("td").eq(6).find("input").eq(0).val(data.BasicInformationTotalAmWithoutTax);
-                                        $("#reimbursementElectronicInvoiceVATTaxes tr").eq(reimbursementElectronicInvoiceVATTaxesRowIdx).find("td").eq(7).find("input").eq(0).val(data.BasicInformationTotalTaxAm);
-                                        $("#reimbursementElectronicInvoiceVATTaxes tr").eq(reimbursementElectronicInvoiceVATTaxesRowIdx).find("td").eq(8).find("input").eq(0).val(data.BasicInformationTotalTaxincludedAmount);
-                                        $("#reimbursementElectronicInvoiceVATTaxes tr").eq(reimbursementElectronicInvoiceVATTaxesRowIdx).find("td").eq(9).find("input").eq(0).val("");
-
-                                        reimbursementElectronicInvoiceVATTaxesRowIdx = reimbursementElectronicInvoiceVATTaxesRowIdx + 1;
+
+                                    if(fileName == file.name){
+                                        fileNameFlag = false;
+                                        break;
                                     }
+
+                                }
+
+                                if(fileNameFlag){
                                     var attachmentId = "";
-                                    var attachmentFlag = "6";
+                                    var attachmentFlag = "workInvoiceReimbursement";
                                     var timestamp=new Date().getTime();
 
-                                    var storeAs = "wrkReimbursement";
+                                    var storeAs = "workInvoiceReimbursement";
                                     var uploadPath="http://gangwan-app.oss-cn-hangzhou.aliyuncs.com/"+storeAs;/*将这段字符串存到数据库即可*/
-                                    var divId = "_attachment";
+                                    var divId = "_attachment_InvoiceReimbursement";
                                     $("#addFile"+divId).show();
-                                    multipartUploadWithSts(storeAs, file,attachmentId,attachmentFlag,uploadPath,divId,size);
+                                    console.log(file)
+                                    invoiceReimbursementMultipartUploadWithSts(storeAs, file,attachmentId,attachmentFlag,uploadPath,divId,size);
+                                }else{
+                                    parent.layer.msg("该电子发票xml文件已经上传,无法重复上传!", {icon: 5});
+                                    return false;
                                 }
 
+
+                                var invoiceVATTaxes = $("#reimbursementElectronicInvoiceVATTaxes tr").length;
+                                var reimbursementElectronicInvoiceVATTaxesMoneys = "";
+                                var reimbursementElectronicInvoiceVATTaxesTaxAmount = "";
+                                var reimbursementElectronicInvoiceVATTaxesSumMoney = "";
+                                for(var i = 0;i < invoiceVATTaxes;i++){
+                                    var delFalg = $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(0).find("input").eq(1).val();
+                                    var moneys = $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(6).find("input").eq(0).val();
+                                    var taxAmount = $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(7).find("input").eq(0).val();
+                                    var rsumMoney = $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(8).find("input").eq(0).val();
+
+                                    if (moneys!=undefined && isNumber(moneys) && 1 != delFalg){
+                                        if(reimbursementElectronicInvoiceVATTaxesMoneys==""){
+                                            reimbursementElectronicInvoiceVATTaxesMoneys = parseFloat(moneys).toFixed(2);
+                                        }else {
+                                            reimbursementElectronicInvoiceVATTaxesMoneys = (parseFloat(reimbursementElectronicInvoiceVATTaxesMoneys) + parseFloat(moneys)).toFixed(2);
+                                        }
+                                    }
+                                    if (taxAmount!=undefined && isNumber(taxAmount) && 1 != delFalg){
+                                        if(reimbursementElectronicInvoiceVATTaxesTaxAmount==""){
+                                            reimbursementElectronicInvoiceVATTaxesTaxAmount = parseFloat(taxAmount).toFixed(2);
+                                        }else {
+                                            reimbursementElectronicInvoiceVATTaxesTaxAmount = (parseFloat(reimbursementElectronicInvoiceVATTaxesTaxAmount) + parseFloat(taxAmount)).toFixed(2);
+                                        }
+                                    }
+                                    if (rsumMoney!=undefined && isNumber(rsumMoney) && 1 != delFalg){
+                                        if(reimbursementElectronicInvoiceVATTaxesSumMoney==""){
+                                            reimbursementElectronicInvoiceVATTaxesSumMoney = parseFloat(rsumMoney).toFixed(2);
+                                        }else {
+                                            reimbursementElectronicInvoiceVATTaxesSumMoney = (parseFloat(reimbursementElectronicInvoiceVATTaxesSumMoney) + parseFloat(rsumMoney)).toFixed(2);
+                                        }
+                                    }
+                                }
+                                $("#reimbursementElectronicInvoiceVATTaxesMoneys").val(reimbursementElectronicInvoiceVATTaxesMoneys);
+                                $("#reimbursementElectronicInvoiceVATTaxesTaxAmount").val(reimbursementElectronicInvoiceVATTaxesTaxAmount);
+                                $("#reimbursementElectronicInvoiceVATTaxesSumMoney").val(reimbursementElectronicInvoiceVATTaxesSumMoney);
                             }
-                        });
+
+                        }
+                    });
+                }
+                else{
+                    parent.layer.msg("请上传xml格式文件!", {icon: 5});
+                    return false;
+                }
+            }
+
+        }
+
+
+        function deleteInvoiceReimbursementByNumber(number){
+            if (number){
+                console.log("invoiceNumber:",number)
+                //xml文件处理
+                //首先查询专用发票信息中对应发票号是否存在,并对应其数据是否正确
+                //获取专用发票信息 行数
+                var trlen = $("#reimbursementElectronicInvoiceVATTaxes tr").length;
+                for(var i = 0;i < trlen;i++){
+                    var id = $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(0).find("input").eq(0).val();
+                    var delFlag = $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(1).find("input").eq(1).val();
+                    var invoiceType = $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(2).find("select").eq(0).val();
+                    var invoiceNumber = $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(3).find("input").eq(0).val();
+                    var invoiceDate = $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(4).find("input").eq(0).val();
+                    var invoiceUnit = $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(5).find("input").eq(0).val();
+                    var money = $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(6).find("input").eq(0).val();
+                    var taxAmount = $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(7).find("input").eq(0).val();
+                    var sumMoney = $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(8).find("input").eq(0).val();
+                    var remarks = $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(9).find("input").eq(0).val();
+
+                    if(invoiceNumber === number){
+                        //数据处理
+                        $("#reimbursementElectronicInvoiceVATTaxes" + i + "_delFlag").val("1")
+                        $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).hide();
+                        //删除数据表中的数据
+
+                        $.ajax({
+                            url:"${ctx}/workreimbursement/workReimbursement/updateAccountInfoById",
+                            type : "post",
+                            dataType:"json",
+                            data:{invoiceNumber:number},
+                            success:function (data) {
+                                if(data.success){
+                                    parent.layer.msg("删除成功!!!",{icon:6});
+                                }
+                            }
+                        })
                     }
                 }
-            }else{
-                for(var i = 0;i<files.length;i++) {                var file = files[i];
-                    var attachmentId = "";
-                    var attachmentFlag = "6";
-                    console.log(file);
-                    var timestamp=new Date().getTime();
-
-                    var storeAs = "wrkReimbursement";
-                    var uploadPath="http://gangwan-app.oss-cn-hangzhou.aliyuncs.com/"+storeAs;/*将这段字符串存到数据库即可*/
-                    var divId = "_attachment";
-                    $("#addFile"+divId).show();
-                    multipartUploadWithSts(storeAs, file,attachmentId,attachmentFlag,uploadPath,divId,size);}
+                var invoiceVATTaxes = $("#reimbursementElectronicInvoiceVATTaxes tr").length;
+                var reimbursementElectronicInvoiceVATTaxesMoneys = "";
+                var reimbursementElectronicInvoiceVATTaxesTaxAmount = "";
+                var reimbursementElectronicInvoiceVATTaxesSumMoney = "";
+                for(var i = 0;i < invoiceVATTaxes;i++){
+                    var delFalg = $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(0).find("input").eq(1).val();
+                    var moneys = $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(6).find("input").eq(0).val();
+                    var taxAmount = $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(7).find("input").eq(0).val();
+                    var rsumMoney = $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(8).find("input").eq(0).val();
+
+                    if (moneys!=undefined && isNumber(moneys) && 1 != delFalg){
+                        if(reimbursementElectronicInvoiceVATTaxesMoneys==""){
+                            reimbursementElectronicInvoiceVATTaxesMoneys = parseFloat(moneys).toFixed(2);
+                        }else {
+                            reimbursementElectronicInvoiceVATTaxesMoneys = (parseFloat(reimbursementElectronicInvoiceVATTaxesMoneys) + parseFloat(moneys)).toFixed(2);
+                        }
+                    }
+                    if (taxAmount!=undefined && isNumber(taxAmount) && 1 != delFalg){
+                        if(reimbursementElectronicInvoiceVATTaxesTaxAmount==""){
+                            reimbursementElectronicInvoiceVATTaxesTaxAmount = parseFloat(taxAmount).toFixed(2);
+                        }else {
+                            reimbursementElectronicInvoiceVATTaxesTaxAmount = (parseFloat(reimbursementElectronicInvoiceVATTaxesTaxAmount) + parseFloat(taxAmount)).toFixed(2);
+                        }
+                    }
+                    if (rsumMoney!=undefined && isNumber(rsumMoney) && 1 != delFalg){
+                        if(reimbursementElectronicInvoiceVATTaxesSumMoney==""){
+                            reimbursementElectronicInvoiceVATTaxesSumMoney = parseFloat(rsumMoney).toFixed(2);
+                        }else {
+                            reimbursementElectronicInvoiceVATTaxesSumMoney = (parseFloat(reimbursementElectronicInvoiceVATTaxesSumMoney) + parseFloat(rsumMoney)).toFixed(2);
+                        }
+                    }
+                }
+                $("#reimbursementElectronicInvoiceVATTaxesMoneys").val(reimbursementElectronicInvoiceVATTaxesMoneys);
+                $("#reimbursementElectronicInvoiceVATTaxesTaxAmount").val(reimbursementElectronicInvoiceVATTaxesTaxAmount);
+                $("#reimbursementElectronicInvoiceVATTaxesSumMoney").val(reimbursementElectronicInvoiceVATTaxesSumMoney);
             }
 
         }
+
+
         function insertTitleCollection(tValue){
             var list = "${workReimbursement.workAttachments}";
             var size = (list.split('url')).length-1;
@@ -1014,12 +1189,13 @@
         </div>
 
         <div class="form-group layui-row count2">
-            <div class="form-group-label"><h2>数电发票信息<span style="color: red;font-size: 14px"> (可通过上传数电发票xml文件自动填写数电发票信息)</span></h2></div>
+            <div class="form-group-label"><h2>数电发票信息<span style="color: red;font-size: 14px"> (可通过上传数电发票xml格式的附件自动获取发票信息)</span></h2></div>
             <div class="layui-item nav-btns">
-                <a class="nav-btn nav-btn-add" onclick="addRow('#reimbursementElectronicInvoiceVATTaxes', reimbursementElectronicInvoiceVATTaxesRowIdx, reimbursementElectronicInvoiceVATTaxesTpl);reimbursementElectronicInvoiceVATTaxesRowIdx = reimbursementElectronicInvoiceVATTaxesRowIdx + 1;" title="新增"><i class="fa fa-plus"></i>&nbsp;新增</a>
+                <%--<a class="nav-btn nav-btn-add" onclick="addRow('#reimbursementElectronicInvoiceVATTaxes', reimbursementElectronicInvoiceVATTaxesRowIdx, reimbursementElectronicInvoiceVATTaxesTpl);reimbursementElectronicInvoiceVATTaxesRowIdx = reimbursementElectronicInvoiceVATTaxesRowIdx + 1;" title="新增"><i class="fa fa-plus"></i>&nbsp;新增</a>--%>
+                <a id="attachment_btn_xml" class="nav-btn nav-btn-add" title="上传数电发票xml文件"><i class="fa fa-plus"></i>&nbsp;上传xml文件</a>
             </div>
             <div class="layui-item layui-col-xs12 form-table-container">
-                <table id="contentTable3" class="table table-bordered table-condensed can-edit">
+                <table id="contentTable3" class="table table-bordered table-condensed can-edit no-bottom-margin">
                     <thead>
                     <tr>
                         <th width="150px"><font color="red">*</font>发票类型</th>
@@ -1031,7 +1207,7 @@
                         <th width="150px"><font color="red">*</font>税额</th>
                         <th width="150px"><font color="red">*</font>价税合计</th>
                         <th width="200px">备注</th>
-                        <th width="150px">操作</th>
+                        <%--<th width="150px">操作</th>--%>
                     </tr>
                     </thead>
                     <tbody id="reimbursementElectronicInvoiceVATTaxes">
@@ -1041,39 +1217,36 @@
                                 <td class="hide">
                                     <input id="reimbursementElectronicInvoiceVATTaxes${index.index}_id" name="reimbursementElectronicInvoiceVATTaxes[${index.index}].id" type="hidden" value="${reimbursementElectronicInvoiceVATTaxes.id}"/>
                                     <input id="reimbursementElectronicInvoiceVATTaxes${index.index}_delFlag" name="reimbursementElectronicInvoiceVATTaxes[${index.index}].delFlag" type="hidden" value="0"/>
+                                    <input id="reimbursementElectronicInvoiceVATTaxes${index.index}_invoiceType" name="reimbursementElectronicInvoiceVATTaxes[${index.index}].invoiceType" type="hidden" value="${reimbursementElectronicInvoiceVATTaxes.invoiceType}"/>
+
                                 </td>
                                     <%--发票类型--%>
                                 <td>
-                                    <select name="reimbursementElectronicInvoiceVATTaxes[${index.index}].invoiceType" id="reimbursementElectronicInvoiceVATTaxes${index.index}_invoiceType" class="form-control judgment">
-                                        <option value=""></option>
-                                        <c:forEach items="${fns:getMainDictList('invoiceReimbursementType')}" var="var">
-                                            <option value="${var.value}" <c:if test="${reimbursementElectronicInvoiceVATTaxes.invoiceType eq var.value}">selected</c:if>>${var.label}</option>
-                                        </c:forEach>
-                                    </select>
+                                    <input id="reimbursementElectronicInvoiceVATTaxes${index.index}_invoiceTypeStr" onmouseover="this.title=this.value" readOnly="true" maxlength="50" name="reimbursementElectronicInvoiceVATTaxes[${index.index}].invoiceTypeStr" type="text" value="${reimbursementElectronicInvoiceVATTaxes.invoiceTypeStr}" onmouseover="this.title=this.value"  class="form-control judgment "/>
                                 </td>
                                     <%--发票项目名--%>
                                 <td>
-                                    <input id="reimbursementElectronicInvoiceVATTaxes${index.index}_invoiceProjectName" onmouseover="this.title=this.value" maxlength="500" name="reimbursementElectronicInvoiceVATTaxes[${index.index}].invoiceProjectName" type="text" value="${reimbursementElectronicInvoiceVATTaxes.invoiceProjectName}" onmouseover="this.title=this.value" placeholder="请输入发票项目名"  class="form-control judgment "/>
+                                    <input id="reimbursementElectronicInvoiceVATTaxes${index.index}_invoiceProjectName" onmouseover="this.title=this.value" maxlength="500" readOnly="true" name="reimbursementElectronicInvoiceVATTaxes[${index.index}].invoiceProjectName" type="text" value="${reimbursementElectronicInvoiceVATTaxes.invoiceProjectName}" onmouseover="this.title=this.value" placeholder="请输入发票项目名"  class="form-control judgment "/>
                                 </td>
                                     <%--发票号--%>
                                 <td>
-                                    <input id="reimbursementElectronicInvoiceVATTaxes${index.index}_invoiceNumber" onmouseover="this.title=this.value" maxlength="30" name="reimbursementElectronicInvoiceVATTaxes[${index.index}].invoiceNumber" type="text" value="${reimbursementElectronicInvoiceVATTaxes.invoiceNumber}" onmouseover="this.title=this.value" placeholder="请输入发票号"  class="form-control judgment number "/>
+                                    <input id="reimbursementElectronicInvoiceVATTaxes${index.index}_invoiceNumber" onmouseover="this.title=this.value" maxlength="30" readOnly="true" name="reimbursementElectronicInvoiceVATTaxes[${index.index}].invoiceNumber" type="text" value="${reimbursementElectronicInvoiceVATTaxes.invoiceNumber}" onmouseover="this.title=this.value" placeholder="请输入发票号"  class="form-control judgment number "/>
                                 </td>
                                     <%--开票日期--%>
                                 <td>
-                                    <input lay-verify="date" placeholder="yyyy-MM-dd HH:mm:ss" readonly onmouseover="this.title=this.value" autocomplete="off" id="reimbursementElectronicInvoiceVATTaxes${index.index}_invoiceDate" name="reimbursementElectronicInvoiceVATTaxes[${index.index}].invoiceDate" type="text" value="${reimbursementElectronicInvoiceVATTaxes.invoiceDateStr}"  onmouseover="this.title=this.value" class="form-control judgment datetime"/>
+                                    <input disabled readonly onmouseover="this.title=this.value" autocomplete="off" readOnly="true" id="reimbursementElectronicInvoiceVATTaxes${index.index}_invoiceDate" name="reimbursementElectronicInvoiceVATTaxes[${index.index}].invoiceDate" type="text" value="${reimbursementElectronicInvoiceVATTaxes.invoiceDateStr}"  onmouseover="this.title=this.value" class="form-control judgment datetime"/>
                                 </td>
                                     <%--开票单位--%>
                                 <td>
-                                    <input id="reimbursementElectronicInvoiceVATTaxes${index.index}_invoiceUnit" onmouseover="this.title=this.value" maxlength="30" name="reimbursementElectronicInvoiceVATTaxes[${index.index}].invoiceUnit" type="text" value="${reimbursementElectronicInvoiceVATTaxes.invoiceUnit}"  placeholder="请输入开票单位"  onmouseover="this.title=this.value" class="form-control judgment "/>
+                                    <input id="reimbursementElectronicInvoiceVATTaxes${index.index}_invoiceUnit" onmouseover="this.title=this.value" maxlength="30" readOnly="true" name="reimbursementElectronicInvoiceVATTaxes[${index.index}].invoiceUnit" type="text" value="${reimbursementElectronicInvoiceVATTaxes.invoiceUnit}"  placeholder="请输入开票单位"  onmouseover="this.title=this.value" class="form-control judgment "/>
                                 </td>
                                     <%--金额--%>
                                 <td>
-                                    <input id="reimbursementElectronicInvoiceVATTaxes${index.index}_money" onmouseover="this.title=this.value" onchange="getMoneyElectronicInvoiceVATT(${index.index})" name="reimbursementElectronicInvoiceVATTaxes[${index.index}].money" type="text" maxlength="32" value="${reimbursementElectronicInvoiceVATTaxes.money}"  placeholder="请输入金额"  onmouseover="this.title=this.value" class="form-control judgment number "/>
+                                    <input id="reimbursementElectronicInvoiceVATTaxes${index.index}_money" onmouseover="this.title=this.value" readOnly="true" onchange="getMoneyElectronicInvoiceVATT(${index.index})" name="reimbursementElectronicInvoiceVATTaxes[${index.index}].money" type="text" maxlength="32" value="${reimbursementElectronicInvoiceVATTaxes.money}"  placeholder="请输入金额"  onmouseover="this.title=this.value" class="form-control judgment number "/>
                                 </td>
                                     <%--税额--%>
                                 <td>
-                                    <input id="reimbursementElectronicInvoiceVATTaxes${index.index}_taxAmount" onmouseover="this.title=this.value" onchange="getMoneyElectronicInvoiceVATT(${index.index})" name="reimbursementElectronicInvoiceVATTaxes[${index.index}].taxAmount" type="text" maxlength="32" value="${reimbursementElectronicInvoiceVATTaxes.taxAmount}"  placeholder="请输入税额"  onmouseover="this.title=this.value" class="form-control judgment number "/>
+                                    <input id="reimbursementElectronicInvoiceVATTaxes${index.index}_taxAmount" onmouseover="this.title=this.value" readOnly="true" onchange="getMoneyElectronicInvoiceVATT(${index.index})" name="reimbursementElectronicInvoiceVATTaxes[${index.index}].taxAmount" type="text" maxlength="32" value="${reimbursementElectronicInvoiceVATTaxes.taxAmount}"  placeholder="请输入税额"  onmouseover="this.title=this.value" class="form-control judgment number "/>
                                 </td>
                                     <%--合计价税--%>
                                 <td>
@@ -1081,54 +1254,71 @@
                                 </td>
                                     <%--备注--%>
                                 <td>
-                                    <input id="reimbursementElectronicInvoiceVATTaxes${index.index}_remarks" onmouseover="this.title=this.value" readOnly="true"  name="reimbursementElectronicInvoiceVATTaxes[${index.index}].remarks" type="text" maxlength="255" value="${reimbursementElectronicInvoiceVATTaxes.remarks}"    class="form-control input"/>
-                                </td>
-                                <td class="text-center op-td">
-                                    <span class="op-btn op-btn-delete" onclick="delRowA(this, '#reimbursementElectronicInvoiceVATTaxes${index.index}')" title="删除"><i class="glyphicon glyphicon-remove"></i>&nbsp;删除</span>
+                                    <input id="reimbursementElectronicInvoiceVATTaxes${index.index}_remarks" onmouseover="this.title=this.value" name="reimbursementElectronicInvoiceVATTaxes[${index.index}].remarks" type="text" maxlength="255" value="${reimbursementElectronicInvoiceVATTaxes.remarks}"    class="form-control input"/>
                                 </td>
+                                    <%--<td class="text-center op-td">
+                                        <span class="op-btn op-btn-delete" onclick="delRowA(this, '#reimbursementElectronicInvoiceVATTaxes${index.index}')" title="删除"><i class="glyphicon glyphicon-remove"></i>&nbsp;删除</span>
+                                    </td>--%>
                             </tr>
                         </c:forEach>
                     </c:if>
                     </tbody>
                 </table>
+                <table id="contentTable4" class="table table-bordered table-condensed can-edit no-bottom-margin">
+                    <thead>
+                    <tr >
+                        <td width="150px" style="vertical-align:middle;text-align: center;"><label>费用汇总(元):</label></td>
+                        <td width="200px"></td>
+                        <td width="200px"></td>
+                        <td width="200px"></td>
+                        <td width="200px"></td>
+                        <td width="150px" style="border: 0px">
+                            <input htmlEscape="false" style="border: 0px; font-weight: bold;" id="reimbursementElectronicInvoiceVATTaxesMoneys" name="reimbursementElectronicInvoiceVATTaxesMoneys" readonly="true" class="form-control layui-input" value=""/>
+                        </td>
+                        <td width="150px">
+                            <input htmlEscape="false" style="border: 0px; font-weight: bold;" id="reimbursementElectronicInvoiceVATTaxesTaxAmount" name="reimbursementElectronicInvoiceVATTaxesTaxAmount" readonly="true" class="form-control layui-input" value=""/>
+                        </td>
+                        <td width="150px">
+                            <input htmlEscape="false" style="border: 0px; font-weight: bold;" id="reimbursementElectronicInvoiceVATTaxesSumMoney" name="reimbursementElectronicInvoiceVATTaxesSumMoney" readonly="true" class="form-control layui-input" value=""/>
+                        </td>
+                        <td width="200px"></td>
+                    </tr>
+                    </thead>
+                </table>
                 <script type="text/template" id="reimbursementElectronicInvoiceVATTaxesTpl">//<!--
                     <tr id="reimbursementElectronicInvoiceVATTaxes{{idx}}">
                         <td class="hide">
                             <input id="reimbursementElectronicInvoiceVATTaxes{{idx}}_id" name="reimbursementElectronicInvoiceVATTaxes[{{idx}}].id" type="hidden" value="{{row.id}}"/>
                             <input id="reimbursementElectronicInvoiceVATTaxes{{idx}}_delFlag" name="reimbursementElectronicInvoiceVATTaxes[{{idx}}].delFlag" type="hidden" value="0"/>
+                            <input id="reimbursementElectronicInvoiceVATTaxes{{idx}}_invoiceType" name="reimbursementElectronicInvoiceVATTaxes[{{idx}}].invoiceType" type="hidden" value="{{row.invoiceType}}"/>
                         </td>
                             <%--发票类型--%>
                         <td>
-                            <select name="reimbursementElectronicInvoiceVATTaxes[{{idx}}].invoiceType" id="reimbursementElectronicInvoiceVATTaxes{{idx}}_invoiceType" class="form-control judgment">
-                                <option value=""></option>
-                                <c:forEach items="${fns:getMainDictList('invoiceReimbursementType')}" var="var">
-                                    <option value="${var.value}">${var.label}</option>
-                                </c:forEach>
-                            </select>
+                            <input id="reimbursementElectronicInvoiceVATTaxes{{idx}}_invoiceTypeStr" readOnly="true" onmouseover="this.title=this.value" maxlength="50" name="reimbursementElectronicInvoiceVATTaxes[{{idx}}].invoiceTypeStr" type="text" value="{{row.invoiceTypeStr}}" onmouseover="this.title=this.value"  class="form-control judgment "/>
                         </td>
                             <%--发票项目名--%>
                         <td>
-                            <input id="reimbursementElectronicInvoiceVATTaxes{{idx}}_invoiceProjectName" onmouseover="this.title=this.value" maxlength="500" name="reimbursementElectronicInvoiceVATTaxes[{{idx}}].invoiceProjectName" type="text" value="{{row.invoiceNumber}}" onmouseover="this.title=this.value" placeholder="请输入发票项目名"  class="form-control judgment "/>
+                            <input id="reimbursementElectronicInvoiceVATTaxes{{idx}}_invoiceProjectName" readOnly="true" onmouseover="this.title=this.value" maxlength="500" name="reimbursementElectronicInvoiceVATTaxes[{{idx}}].invoiceProjectName" type="text" value="{{row.invoiceNumber}}" onmouseover="this.title=this.value" placeholder="请输入发票项目名"  class="form-control judgment "/>
                         </td>
                             <%--发票号--%>
                         <td>
-                            <input id="reimbursementElectronicInvoiceVATTaxes{{idx}}_invoiceNumber" maxlength="30" name="reimbursementElectronicInvoiceVATTaxes[{{idx}}].invoiceNumber" type="text" value="{{row.invoiceNumber}}" onmouseover="this.title=this.value" maxlength="32" placeholder="请输入发票号"  class="form-control judgment number "/>
+                            <input id="reimbursementElectronicInvoiceVATTaxes{{idx}}_invoiceNumber" readOnly="true" maxlength="30" name="reimbursementElectronicInvoiceVATTaxes[{{idx}}].invoiceNumber" type="text" value="{{row.invoiceNumber}}" onmouseover="this.title=this.value" maxlength="32" placeholder="请输入发票号"  class="form-control judgment number "/>
                         </td>
                             <%--开票日期--%>
                         <td>
-                            <input lay-verify="date" placeholder="yyyy-MM-dd HH:mm:ss" readonly autocomplete="off" id="reimbursementElectronicInvoiceVATTaxes{{idx}}_invoiceDate" name="reimbursementElectronicInvoiceVATTaxes[{{idx}}].invoiceDate" type="text" value="{{row.invoiceDate}}"  onmouseover="this.title=this.value" class="form-control required datetime"/>
+                            <input readOnly="true" id="reimbursementElectronicInvoiceVATTaxes{{idx}}_invoiceDate" name="reimbursementElectronicInvoiceVATTaxes[{{idx}}].invoiceDate" type="text" value="{{row.invoiceDate}}"  onmouseover="this.title=this.value" class="form-control required"/>
                         </td>
                             <%--开票单位--%>
                         <td>
-                            <input id="reimbursementElectronicInvoiceVATTaxes{{idx}}_invoiceUnit" maxlength="30" name="reimbursementElectronicInvoiceVATTaxes[{{idx}}].invoiceUnit" type="text" value="{{row.invoiceUnit}}" maxlength="32" placeholder="请输入开票单位"  onmouseover="this.title=this.value" class="form-control judgment "/>
+                            <input id="reimbursementElectronicInvoiceVATTaxes{{idx}}_invoiceUnit" maxlength="30" readOnly="true" name="reimbursementElectronicInvoiceVATTaxes[{{idx}}].invoiceUnit" type="text" value="{{row.invoiceUnit}}" maxlength="32" placeholder="请输入开票单位"  onmouseover="this.title=this.value" class="form-control judgment "/>
                         </td>
                             <%--金额--%>
                          <td>
-                            <input id="reimbursementElectronicInvoiceVATTaxes{{idx}}_money" onchange="getMoneyElectronicInvoiceVATT({{idx}})" name="reimbursementElectronicInvoiceVATTaxes[{{idx}}].money" type="text" value="{{row.money}}" maxlength="32" placeholder="请输入金额"  onmouseover="this.title=this.value" class="form-control number judgment"/>
+                            <input id="reimbursementElectronicInvoiceVATTaxes{{idx}}_money" onchange="getMoneyElectronicInvoiceVATT({{idx}})" readOnly="true" name="reimbursementElectronicInvoiceVATTaxes[{{idx}}].money" type="text" value="{{row.money}}" maxlength="32" placeholder="请输入金额"  onmouseover="this.title=this.value" class="form-control number judgment"/>
                         </td>
                             <%--税额--%>
                         <td>
-                            <input id="reimbursementElectronicInvoiceVATTaxes{{idx}}_taxAmount"  onchange="getMoneyElectronicInvoiceVATT({{idx}})"name="reimbursementElectronicInvoiceVATTaxes[{{idx}}].taxAmount" type="text" value="{{row.taxAmount}}" maxlength="32" placeholder="请输入税额"  onmouseover="this.title=this.value" class="form-control number judgment"/>
+                            <input id="reimbursementElectronicInvoiceVATTaxes{{idx}}_taxAmount" readOnly="true"  onchange="getMoneyElectronicInvoiceVATT({{idx}})" name="reimbursementElectronicInvoiceVATTaxes[{{idx}}].taxAmount" type="text" value="{{row.taxAmount}}" maxlength="32" placeholder="请输入税额"  onmouseover="this.title=this.value" class="form-control number judgment"/>
                         </td>
                             <%--合计价税--%>
                          <td>
@@ -1138,9 +1328,9 @@
                          <td>
                             <input id="reimbursementElectronicInvoiceVATTaxes{{idx}}_remarks"  name="reimbursementElectronicInvoiceVATTaxes[{{idx}}].remarks" type="text" value="{{row.remarks}}" maxlength="255"  onmouseover="this.title=this.value" class="form-control"/>
                         </td>
-                        <td class="text-center op-td">
+                        <%--<td class="text-center op-td">
                             {{#delBtn}}<span class="op-btn op-btn-delete" onclick="delRowA(this, '#reimbursementElectronicInvoiceVATTaxes{{idx}}')" title="删除"><i class="glyphicon glyphicon-remove"></i>&nbsp;删除</span>{{/delBtn}}
-                        </td>
+                        </td>--%>
                     </tr>//-->
                 </script>
                 <script type="text/javascript">
@@ -1163,9 +1353,186 @@
             </div>
         </div>
 
+        <div class="form-group layui-row count2">
+            <input id="attachment_InvoiceReimbursement_file" type="file" multiple="multiple" style="display: none;" onChange="if(this.value)insertTitleInvoiceReimbursement(this.value);"/>
+            <span id="attachment_title"></span>
+            <div class="layui-item layui-col-xs12" style="padding:0 16px;">
+                <table id="listAttachment" class="table table-bordered table-condensed details">
+                    <thead>
+                    <tr>
+                            <%-- <th>序号</th>--%>
+                        <th>数电发票文件预览</th>
+                        <th>上传人</th>
+                        <th>上传时间</th>
+                        <th width="200px">操作</th>
+                    </tr>
+                    </thead>
+                    <tbody id="file_attachment_InvoiceReimbursement">
+                    <c:forEach items="${workReimbursement.workAttachmentInvoiceReimbursements}" var = "workClientAttachment" varStatus="status">
+                        <tr>
+
+                                <%-- <td>${status.index + 1}</td>--%>
+                            <c:choose>
+                                <c:when test="${workReimbursement.uploadMode == 2}">
+                                    <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.temporaryUrl}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${workClientAttachment.temporaryUrl}','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="openPreview('${workClientAttachment.temporaryUrl}',1)">${workClientAttachment.attachmentName}</a></td>
+                                                </c:when>
+                                                <c:otherwise>
+                                                    <c:choose>
+                                                        <c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'rar')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'zip')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jar')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'7z')}">
+                                                            <td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.temporaryUrl}',3)">${workClientAttachment.attachmentName}</a></td>
+                                                        </c:when>
+                                                        <c:otherwise>
+                                                            <td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.temporaryUrl}',2)">${workClientAttachment.attachmentName}</a></td>
+                                                        </c:otherwise>
+                                                    </c:choose>
+                                                </c:otherwise>
+                                            </c:choose>
+                                        </c:otherwise>
+                                    </c:choose>
+                                </c:when>
+                                <c:otherwise>
+                                    <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="openPreview('${workClientAttachment.url}',1)">${workClientAttachment.attachmentName}</a></td>
+                                                </c:when>
+                                                <c:otherwise>
+                                                    <c:choose>
+                                                        <c:when test="${workReimbursement.uploadMode == 2}">
+                                                            <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.temporaryUrl}" width="50" height="50" onclick="openDialogView('预览','${ctx}/sys/picturepreview/picturePreview?url=${workClientAttachment.temporaryUrl}','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="openPreview('${workClientAttachment.temporaryUrl}',1)">${workClientAttachment.attachmentName}</a></td>
+                                                                        </c:when>
+                                                                        <c:otherwise>
+                                                                            <c:choose>
+                                                                                <c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'rar')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'zip')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jar')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'7z')}">
+                                                                                    <td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.temporaryUrl}',3)">${workClientAttachment.attachmentName}</a></td>
+                                                                                </c:when>
+                                                                                <c:otherwise>
+                                                                                    <td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.temporaryUrl}',2)">${workClientAttachment.attachmentName}</a></td>
+                                                                                </c:otherwise>
+                                                                            </c:choose>
+                                                                        </c:otherwise>
+                                                                    </c:choose>
+                                                                </c:otherwise>
+                                                            </c:choose>
+                                                        </c:when>
+                                                        <c:otherwise>
+                                                            <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 href="javascript:void(0)" onclick="openPreview('${workClientAttachment.url}',1)">${workClientAttachment.attachmentName}</a></td>
+                                                                        </c:when>
+                                                                        <c:otherwise>
+                                                                            <c:choose>
+                                                                                <c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'rar')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'zip')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'jar')
+                                                       or fn:containsIgnoreCase(workClientAttachment.attachmentName,'7z')}">
+                                                                                    <td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.url}',3)">${workClientAttachment.attachmentName}</a></td>
+                                                                                </c:when>
+                                                                                <c:otherwise>
+                                                                                    <td><a class="attention-info" href="javascript:void(0)" onclick="openPreview('${workClientAttachment.url}',2)">${workClientAttachment.attachmentName}</a></td>
+                                                                                </c:otherwise>
+                                                                            </c:choose>
+                                                                        </c:otherwise>
+                                                                    </c:choose>
+                                                                </c:otherwise>
+                                                            </c:choose>
+                                                        </c:otherwise>
+                                                    </c:choose>
+                                                </c:otherwise>
+                                            </c:choose>
+                                        </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" >
+                                        <%--附件下载删除--%>
+                                    <c:choose>
+                                        <c:when test="${workReimbursement.uploadMode == 2}">
+                                            <c:choose>
+                                                <c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'pdf')}">
+                                                    <a href="${workClientAttachment.temporaryUrl}" target="_blank" class="op-btn op-btn-download"><i class="fa fa-download"></i>&nbsp;下载</a>
+                                                </c:when>
+                                                <c:otherwise>
+                                                    <c:choose>
+                                                        <c:when test="${fn:containsIgnoreCase(workClientAttachment.attachmentName,'xml')}">
+                                                            <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:when>
+                                                        <c:otherwise>
+                                                            <a href="${workClientAttachment.temporaryUrl}" class="op-btn op-btn-download"><i class="fa fa-download"></i>&nbsp;下载</a>
+                                                        </c:otherwise>
+                                                    </c:choose>
+                                                </c:otherwise>
+                                            </c:choose>
+                                        </c:when>
+                                        <c:otherwise>
+                                            <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:otherwise>
+                                    </c:choose>
+                                    <c:if test="${workClientAttachment.createBy.id eq fns:getUser().id}">
+                                        <a href="javascript:void(0)" onclick="deleteFileFromAliyunByInvoiceReimbursement(this,'${ctx}/sys/workattachment/deleteFileFromAliyunByInvoiceReimbursement?url=${workClientAttachment.url}&id=${workClientAttachment.id}&type=2','addFile_attachment_InvoiceReimbursement','_attachment_InvoiceReimbursement')" 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="form-group-label"><h2>附件信息</h2></div>
             <div class="layui-item nav-btns">
                 <a id="attachment_btn" class="nav-btn nav-btn-add" title="添加附件"><i class="fa fa-plus"></i>&nbsp;添加附件</a>
                 <sys:collectSelect  id="linkman" url="${ctx}/workclientinfo/workClientInfo/linkmanList"

+ 203 - 64
src/main/webapp/webpage/modules/workreimbursement/new/workReimbursementNewModifyApply.jsp

@@ -137,6 +137,45 @@
                 });
             }*/
 
+
+
+            var invoiceVATTaxes = $("#reimbursementElectronicInvoiceVATTaxes tr").length;
+            var reimbursementElectronicInvoiceVATTaxesMoneys = "";
+            var reimbursementElectronicInvoiceVATTaxesTaxAmount = "";
+            var reimbursementElectronicInvoiceVATTaxesSumMoney = "";
+            for(var i = 0;i < invoiceVATTaxes;i++){
+                var moneys = $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(6).find("input").eq(0).val();
+                var taxAmount = $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(7).find("input").eq(0).val();
+                var rsumMoney = $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(8).find("input").eq(0).val();
+
+                if (moneys!=undefined && isNumber(moneys)){
+                    if(reimbursementElectronicInvoiceVATTaxesMoneys==""){
+                        reimbursementElectronicInvoiceVATTaxesMoneys = parseFloat(moneys).toFixed(2);
+                    }else {
+                        reimbursementElectronicInvoiceVATTaxesMoneys = (parseFloat(reimbursementElectronicInvoiceVATTaxesMoneys) + parseFloat(moneys)).toFixed(2);
+                    }
+                }
+                if (taxAmount!=undefined && isNumber(taxAmount)){
+                    if(reimbursementElectronicInvoiceVATTaxesTaxAmount==""){
+                        reimbursementElectronicInvoiceVATTaxesTaxAmount = parseFloat(taxAmount).toFixed(2);
+                    }else {
+                        reimbursementElectronicInvoiceVATTaxesTaxAmount = (parseFloat(reimbursementElectronicInvoiceVATTaxesTaxAmount) + parseFloat(taxAmount)).toFixed(2);
+                    }
+                }
+                if (rsumMoney!=undefined && isNumber(rsumMoney)){
+                    if(reimbursementElectronicInvoiceVATTaxesSumMoney==""){
+                        reimbursementElectronicInvoiceVATTaxesSumMoney = parseFloat(rsumMoney).toFixed(2);
+                    }else {
+                        reimbursementElectronicInvoiceVATTaxesSumMoney = (parseFloat(reimbursementElectronicInvoiceVATTaxesSumMoney) + parseFloat(rsumMoney)).toFixed(2);
+                    }
+                }
+            }
+            $("#reimbursementElectronicInvoiceVATTaxesMoneys").val(reimbursementElectronicInvoiceVATTaxesMoneys);
+            $("#reimbursementElectronicInvoiceVATTaxesTaxAmount").val(reimbursementElectronicInvoiceVATTaxesTaxAmount);
+            $("#reimbursementElectronicInvoiceVATTaxesSumMoney").val(reimbursementElectronicInvoiceVATTaxesSumMoney);
+
+
+
         });
         function doSubmit(obj){//回调函数,在编辑和保存动作时,供openDialog调用提交表单。
             var idArr = $("#workAccountList tr:visible");
@@ -155,44 +194,14 @@
                 }
             }
 
-            /*var electronicInvoiceArr = $("#reimbursementElectronicInvoiceVATTaxes tr:visible");
+            var electronicInvoiceArr = $("#reimbursementElectronicInvoiceVATTaxes tr:visible");
             if(electronicInvoiceArr.length>0){
-                var flag = false;
-                var countFlag = 0;
-                var list = "${workReimbursement.workAttachments}";
-                var size = (list.split('url')).length-1;
-                var files = $("#attachment_file")[0].files;
-                for(var i = 0;i<files.length;i++) {
-                    var file = files[i];
-                    //如果文件以xml文件结尾,则需要将该文件上传到后台进行数据处理后返回数据
-                    const spliceLength2 = file.name.lastIndexOf(".");
-                    var fileNameSuffix = file.name.slice(spliceLength2 + 1);
-                    if(fileNameSuffix === "xml" ) {
-                        flag = true;
-                        countFlag ++;
-                    }
-                }
-                if(!flag){
-                    var data = ${fns:toJson(workReimbursement.workAttachments)};//后端获取值
-                    for (var i=0; i<data.length; i++){
-                        //如果文件以xml文件结尾,则需要将该文件上传到后台进行数据处理后返回数据
-                        const spliceLength2 = data[i].attachmentName.lastIndexOf(".");
-                        var fileNameSuffix = data[i].attachmentName.slice(spliceLength2 + 1);
-                        if(fileNameSuffix === "xml" ) {
-                            flag = true;
-                            countFlag ++;
-                        }
-                    }
-                }
-                if(!flag){
-                    parent.layer.msg("已填写电子发票信息,请上传对应发票的xml文件!", {icon: 5});
-                    flags= false;
-                }
-                /!*if(countFlag < electronicInvoiceArr.length){
+                var leng = $("#file_attachment_InvoiceReimbursement tr").length;
+                if(leng != electronicInvoiceArr.length){
                     parent.layer.msg("填写电子发票数据量与上传发票xml文件数量不符,请重新上传!", {icon: 5});
                     flags= false;
-                }*!/
-            }*/
+                }
+            }
 
             var trlen = $("#workAccountList tr").length;
             var tdlen = $("#workAccountList tr td").length;
@@ -592,16 +601,86 @@
 
                                     reimbursementElectronicInvoiceVATTaxesRowIdx = reimbursementElectronicInvoiceVATTaxesRowIdx + 1;
                                 }
-                                var attachmentId = "";
-                                var attachmentFlag = "workInvoiceReimbursement";
-                                var timestamp=new Date().getTime();
-
-                                var storeAs = "workInvoiceReimbursement";
-                                var uploadPath="http://gangwan-app.oss-cn-hangzhou.aliyuncs.com/"+storeAs;/*将这段字符串存到数据库即可*/
-                                var divId = "_attachment_InvoiceReimbursement";
-                                $("#addFile"+divId).show();
-                                console.log(file)
-                                invoiceReimbursementMultipartUploadWithSts(storeAs, file,attachmentId,attachmentFlag,uploadPath,divId,size);
+                                var attachmentFileLength = $("#file_attachment_InvoiceReimbursement tr").length;
+                                var attachmentFile = $("#file_attachment_InvoiceReimbursement tr");
+                                var fileName = "";
+                                var fileNameFlag = true;
+                                for(var i = 0 ; i<attachmentFileLength; i++){
+                                    // 获取当前行中的第一个<td>元素
+                                    var firstTd = attachmentFile[i].getElementsByTagName("td")[0];
+                                    // 检查第一个<td>元素是否存在
+                                    if (firstTd) {
+                                        // 获取第一个<td>元素中的第一个<a>标签
+                                        var firstA = firstTd.getElementsByTagName("a")[0];
+                                        // 检查第一个<a>标签是否存在
+                                        if (firstA) {
+                                            // 获取<a>标签中的文本信息
+                                            fileName = firstA.textContent || firstA.innerText;
+                                        } else {
+                                            console.log("在当前行中的第一个<td>元素中未找到<a>标签");
+                                        }
+                                    } else {
+                                        console.log("在当前行中未找到<td>元素");
+                                    }
+
+                                    if(fileName == file.name){
+                                        fileNameFlag = false;
+                                        break;
+                                    }
+
+                                }
+
+                                if(fileNameFlag){
+                                    var attachmentId = "";
+                                    var attachmentFlag = "workInvoiceReimbursement";
+                                    var timestamp=new Date().getTime();
+
+                                    var storeAs = "workInvoiceReimbursement";
+                                    var uploadPath="http://gangwan-app.oss-cn-hangzhou.aliyuncs.com/"+storeAs;/*将这段字符串存到数据库即可*/
+                                    var divId = "_attachment_InvoiceReimbursement";
+                                    $("#addFile"+divId).show();
+                                    console.log(file)
+                                    invoiceReimbursementMultipartUploadWithSts(storeAs, file,attachmentId,attachmentFlag,uploadPath,divId,size);
+                                }else{
+                                    parent.layer.msg("该电子发票xml文件已经上传,无法重复上传!", {icon: 5});
+                                    return false;
+                                }
+
+                                var invoiceVATTaxes = $("#reimbursementElectronicInvoiceVATTaxes tr").length;
+                                var reimbursementElectronicInvoiceVATTaxesMoneys = "";
+                                var reimbursementElectronicInvoiceVATTaxesTaxAmount = "";
+                                var reimbursementElectronicInvoiceVATTaxesSumMoney = "";
+                                for(var i = 0;i < invoiceVATTaxes;i++){
+                                    var delFalg = $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(0).find("input").eq(1).val();
+                                    var moneys = $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(6).find("input").eq(0).val();
+                                    var taxAmount = $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(7).find("input").eq(0).val();
+                                    var rsumMoney = $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(8).find("input").eq(0).val();
+
+                                    if (moneys!=undefined && isNumber(moneys) && 1 != delFalg){
+                                        if(reimbursementElectronicInvoiceVATTaxesMoneys==""){
+                                            reimbursementElectronicInvoiceVATTaxesMoneys = parseFloat(moneys).toFixed(2);
+                                        }else {
+                                            reimbursementElectronicInvoiceVATTaxesMoneys = (parseFloat(reimbursementElectronicInvoiceVATTaxesMoneys) + parseFloat(moneys)).toFixed(2);
+                                        }
+                                    }
+                                    if (taxAmount!=undefined && isNumber(taxAmount) && 1 != delFalg){
+                                        if(reimbursementElectronicInvoiceVATTaxesTaxAmount==""){
+                                            reimbursementElectronicInvoiceVATTaxesTaxAmount = parseFloat(taxAmount).toFixed(2);
+                                        }else {
+                                            reimbursementElectronicInvoiceVATTaxesTaxAmount = (parseFloat(reimbursementElectronicInvoiceVATTaxesTaxAmount) + parseFloat(taxAmount)).toFixed(2);
+                                        }
+                                    }
+                                    if (rsumMoney!=undefined && isNumber(rsumMoney) && 1 != delFalg){
+                                        if(reimbursementElectronicInvoiceVATTaxesSumMoney==""){
+                                            reimbursementElectronicInvoiceVATTaxesSumMoney = parseFloat(rsumMoney).toFixed(2);
+                                        }else {
+                                            reimbursementElectronicInvoiceVATTaxesSumMoney = (parseFloat(reimbursementElectronicInvoiceVATTaxesSumMoney) + parseFloat(rsumMoney)).toFixed(2);
+                                        }
+                                    }
+                                }
+                                $("#reimbursementElectronicInvoiceVATTaxesMoneys").val(reimbursementElectronicInvoiceVATTaxesMoneys);
+                                $("#reimbursementElectronicInvoiceVATTaxesTaxAmount").val(reimbursementElectronicInvoiceVATTaxesTaxAmount);
+                                $("#reimbursementElectronicInvoiceVATTaxesSumMoney").val(reimbursementElectronicInvoiceVATTaxesSumMoney);
                             }
 
                         }
@@ -641,8 +720,56 @@
                         //数据处理
                         $("#reimbursementElectronicInvoiceVATTaxes" + i + "_delFlag").val("1")
                         $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).hide();
+
+                        $.ajax({
+                            url:"${ctx}/workreimbursement/workReimbursement/updateAccountInfoById",
+                            type : "post",
+                            dataType:"json",
+                            data:{invoiceNumber:number},
+                            success:function (data) {
+                                if(data.success){
+                                    parent.layer.msg("删除成功!!!",{icon:6});
+                                }
+                            }
+                        })
                     }
                 }
+                var invoiceVATTaxes = $("#reimbursementElectronicInvoiceVATTaxes tr").length;
+                var reimbursementElectronicInvoiceVATTaxesMoneys = "";
+                var reimbursementElectronicInvoiceVATTaxesTaxAmount = "";
+                var reimbursementElectronicInvoiceVATTaxesSumMoney = "";
+                for(var i = 0;i < invoiceVATTaxes;i++){
+                    var delFalg = $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(0).find("input").eq(1).val();
+                    var moneys = $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(6).find("input").eq(0).val();
+                    var taxAmount = $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(7).find("input").eq(0).val();
+                    var rsumMoney = $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(8).find("input").eq(0).val();
+
+                    if (moneys!=undefined && isNumber(moneys) && 1 != delFalg){
+                        if(reimbursementElectronicInvoiceVATTaxesMoneys==""){
+                            reimbursementElectronicInvoiceVATTaxesMoneys = parseFloat(moneys).toFixed(2);
+                        }else {
+                            reimbursementElectronicInvoiceVATTaxesMoneys = (parseFloat(reimbursementElectronicInvoiceVATTaxesMoneys) + parseFloat(moneys)).toFixed(2);
+                        }
+                    }
+                    if (taxAmount!=undefined && isNumber(taxAmount) && 1 != delFalg){
+                        if(reimbursementElectronicInvoiceVATTaxesTaxAmount==""){
+                            reimbursementElectronicInvoiceVATTaxesTaxAmount = parseFloat(taxAmount).toFixed(2);
+                        }else {
+                            reimbursementElectronicInvoiceVATTaxesTaxAmount = (parseFloat(reimbursementElectronicInvoiceVATTaxesTaxAmount) + parseFloat(taxAmount)).toFixed(2);
+                        }
+                    }
+                    if (rsumMoney!=undefined && isNumber(rsumMoney) && 1 != delFalg){
+                        if(reimbursementElectronicInvoiceVATTaxesSumMoney==""){
+                            reimbursementElectronicInvoiceVATTaxesSumMoney = parseFloat(rsumMoney).toFixed(2);
+                        }else {
+                            reimbursementElectronicInvoiceVATTaxesSumMoney = (parseFloat(reimbursementElectronicInvoiceVATTaxesSumMoney) + parseFloat(rsumMoney)).toFixed(2);
+                        }
+                    }
+                }
+                $("#reimbursementElectronicInvoiceVATTaxesMoneys").val(reimbursementElectronicInvoiceVATTaxesMoneys);
+                $("#reimbursementElectronicInvoiceVATTaxesTaxAmount").val(reimbursementElectronicInvoiceVATTaxesTaxAmount);
+                $("#reimbursementElectronicInvoiceVATTaxesSumMoney").val(reimbursementElectronicInvoiceVATTaxesSumMoney);
+
             }
 
         }
@@ -1323,12 +1450,15 @@
         </div>
 
         <div class="form-group layui-row count2">
-            <div class="form-group-label"><h2>数电发票信息<span style="color: red;font-size: 14px"> 可通过上传数电发票xml格式的附件自动获取发票信息</span></h2></div>
+            <div class="form-group-label"><h2>数电发票信息<span style="color: red;font-size: 14px"> (可通过上传数电发票xml格式的附件自动获取发票信息)</span></h2></div>
             <%--<div class="layui-item nav-btns">
                 <a class="nav-btn nav-btn-add" onclick="addRow('#reimbursementElectronicInvoiceVATTaxes', reimbursementElectronicInvoiceVATTaxesRowIdx, reimbursementElectronicInvoiceVATTaxesTpl);reimbursementElectronicInvoiceVATTaxesRowIdx = reimbursementElectronicInvoiceVATTaxesRowIdx + 1;" title="新增"><i class="fa fa-plus"></i>&nbsp;新增</a>
             </div>--%>
+            <div class="layui-item nav-btns">
+                <a id="attachment_btn_InvoiceReimbursement" class="nav-btn nav-btn-add" title="上传数电发票xml文件"><i class="fa fa-plus"></i>&nbsp;上传xml文件</a>
+            </div>
             <div class="layui-item layui-col-xs12 form-table-container">
-                <table id="contentTable3" class="table table-bordered table-condensed can-edit">
+                <table id="contentTable3" class="table table-bordered table-condensed can-edit no-bottom-margin">
                     <thead>
                     <tr>
                         <th width="150px"><font color="red">*</font>发票类型</th>
@@ -1367,7 +1497,7 @@
                                 </td>
                                     <%--开票日期--%>
                                 <td>
-                                    <input lay-verify="date" placeholder="yyyy-MM-dd HH:mm:ss" readonly onmouseover="this.title=this.value" autocomplete="off" readOnly="true" id="reimbursementElectronicInvoiceVATTaxes${index.index}_invoiceDate" name="reimbursementElectronicInvoiceVATTaxes[${index.index}].invoiceDate" type="text" value="${reimbursementElectronicInvoiceVATTaxes.invoiceDateStr}"  onmouseover="this.title=this.value" class="form-control judgment datetime"/>
+                                    <input disabled readonly onmouseover="this.title=this.value" autocomplete="off" readOnly="true" id="reimbursementElectronicInvoiceVATTaxes${index.index}_invoiceDate" name="reimbursementElectronicInvoiceVATTaxes[${index.index}].invoiceDate" type="text" value="${reimbursementElectronicInvoiceVATTaxes.invoiceDateStr}"  onmouseover="this.title=this.value" class="form-control judgment datetime"/>
                                 </td>
                                     <%--开票单位--%>
                                 <td>
@@ -1397,6 +1527,27 @@
                     </c:if>
                     </tbody>
                 </table>
+                <table id="contentTable4" class="table table-bordered table-condensed can-edit no-bottom-margin">
+                    <thead>
+                    <tr >
+                        <td width="150px" style="vertical-align:middle;text-align: center;"><label>费用汇总(元):</label></td>
+                        <td width="200px"></td>
+                        <td width="200px"></td>
+                        <td width="200px"></td>
+                        <td width="200px"></td>
+                        <td width="150px" style="border: 0px">
+                            <input htmlEscape="false" style="border: 0px; font-weight: bold;" id="reimbursementElectronicInvoiceVATTaxesMoneys" name="reimbursementElectronicInvoiceVATTaxesMoneys" readonly="true" class="form-control layui-input" value=""/>
+                        </td>
+                        <td width="150px">
+                            <input htmlEscape="false" style="border: 0px; font-weight: bold;" id="reimbursementElectronicInvoiceVATTaxesTaxAmount" name="reimbursementElectronicInvoiceVATTaxesTaxAmount" readonly="true" class="form-control layui-input" value=""/>
+                        </td>
+                        <td width="150px">
+                            <input htmlEscape="false" style="border: 0px; font-weight: bold;" id="reimbursementElectronicInvoiceVATTaxesSumMoney" name="reimbursementElectronicInvoiceVATTaxesSumMoney" readonly="true" class="form-control layui-input" value=""/>
+                        </td>
+                        <td width="200px"></td>
+                    </tr>
+                    </thead>
+                </table>
                 <script type="text/template" id="reimbursementElectronicInvoiceVATTaxesTpl">//<!--
                     <tr id="reimbursementElectronicInvoiceVATTaxes{{idx}}">
                         <td class="hide">
@@ -1418,7 +1569,7 @@
                         </td>
                             <%--开票日期--%>
                         <td>
-                            <input lay-verify="date" placeholder="yyyy-MM-dd HH:mm:ss" readonly autocomplete="off" id="reimbursementElectronicInvoiceVATTaxes{{idx}}_invoiceDate" name="reimbursementElectronicInvoiceVATTaxes[{{idx}}].invoiceDate" type="text" value="{{row.invoiceDate}}"  onmouseover="this.title=this.value" class="form-control required datetime"/>
+                            <input disabled readonly autocomplete="off" id="reimbursementElectronicInvoiceVATTaxes{{idx}}_invoiceDate" name="reimbursementElectronicInvoiceVATTaxes[{{idx}}].invoiceDate" type="text" value="{{row.invoiceDate}}"  onmouseover="this.title=this.value" class="form-control required datetime"/>
                         </td>
                             <%--开票单位--%>
                         <td>
@@ -1466,18 +1617,6 @@
         </div>
 
         <div class="form-group layui-row count2">
-            <div class="form-group-label"><h2><span class="require-item">*</span>数电发票附件信息<span style="color: red;font-size: 14px"> 上传报销的数电发票xml文件</span></h2></div>
-            <div class="layui-item nav-btns">
-                <a id="attachment_btn_InvoiceReimbursement" class="nav-btn nav-btn-add" title="添加附件"><i class="fa fa-plus"></i>&nbsp;添加附件</a>
-            </div>
-            <div id="addFile_attachment_InvoiceReimbursement" style="display: none" class="upload-progress">
-                <span id="fileName_attachment_InvoiceReimbursement" ></span>
-                <b><span id="baifenbi_attachment_InvoiceReimbursement" ></span></b>
-                <div class="progress">
-                    <div id="jindutiao_attachment_InvoiceReimbursement" class="progress-bar" style="width: 0%" aria-valuenow="0">
-                    </div>
-                </div>
-            </div>
             <input id="attachment_InvoiceReimbursement_file" name="attachment_InvoiceReimbursement_file" type="file" multiple="multiple" style="display: none;" onChange="if(this.value)insertTitleInvoiceReimbursement(this.value);"/>
             <span id="attachment_title"></span>
             <div class="layui-item layui-col-xs12" style="padding:0 16px;">
@@ -1485,7 +1624,7 @@
                     <thead>
                     <tr>
                             <%-- <th>序号</th>--%>
-                        <th>文件预览</th>
+                        <th>数电发票文件预览</th>
                         <th>上传人</th>
                         <th>上传时间</th>
                         <th width="200px">操作</th>
@@ -1641,9 +1780,9 @@
                                             <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:otherwise>
                                     </c:choose>
-                                    <c:if test="${workClientAttachment.collectFlag != 1}">
+                                    <%--<c:if test="${workClientAttachment.collectFlag != 1}">
                                         <a href="javascript:void(0)" onclick="collectingAccessory(this,'${ctx}/projectAccessory/projectAccessory/saveCollectAccessory','${workClientAttachment.url}','${workClientAttachment.createBy.id}','${workClientAttachment.fileSize}')" class="op-btn op-btn-delete" style="background-color: #FFB800"><i class="layui-icon layui-icon-rate"></i>&nbsp;收藏</a>
-                                    </c:if>
+                                    </c:if>--%>
                                     <c:if test="${workClientAttachment.createBy.id eq fns:getUser().id}">
                                         <a href="javascript:void(0)" onclick="deleteFileFromAliyunByInvoiceReimbursement(this,'${ctx}/sys/workattachment/deleteFileFromAliyunByInvoiceReimbursement?url=${workClientAttachment.url}&id=${workClientAttachment.id}&type=2','addFile_attachment_InvoiceReimbursement','_attachment_InvoiceReimbursement')" class="op-btn op-btn-delete" ><i class="fa fa-trash"></i>&nbsp;删除</a>
                                     </c:if>

+ 66 - 13
src/main/webapp/webpage/modules/workreimbursement/workReimbursementFormDetail.jsp

@@ -4,6 +4,9 @@
 <head>
     <title>报销单管理</title>
     <meta name="decorator" content="default"/>
+    <script type="text/javascript" src="${ctxStatic}/layui/layui.js"></script>
+    <link rel='stylesheet' type="text/css" href="${ctxStatic}/layui/css/layui.css"/>
+    <script src="${ctxStatic}/common/html/js/script.js"></script>
     <script type="text/javascript">
         var validateForm;
         $(document).ready(function() {
@@ -65,6 +68,44 @@
             $("#attachment_btn").click(function () {
                 $("#attachment_file").click();
             });
+
+            var invoiceVATTaxes = $("#reimbursementElectronicInvoiceVATTaxes tr").length;
+            var reimbursementElectronicInvoiceVATTaxesMoneys = "";
+            var reimbursementElectronicInvoiceVATTaxesTaxAmount = "";
+            var reimbursementElectronicInvoiceVATTaxesSumMoney = "";
+            for(var i = 0;i < invoiceVATTaxes;i++){
+                var moneys = $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(5).find("input").eq(0).val();
+                var taxAmount = $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(6).find("input").eq(0).val();
+                var rsumMoney = $("#reimbursementElectronicInvoiceVATTaxes tr").eq(i).find("td").eq(7).find("input").eq(0).val();
+
+                if (moneys!=undefined && !isNaN(moneys)){
+                    if(reimbursementElectronicInvoiceVATTaxesMoneys==""){
+                        reimbursementElectronicInvoiceVATTaxesMoneys = parseFloat(moneys).toFixed(2);
+                    }else {
+                        reimbursementElectronicInvoiceVATTaxesMoneys = (parseFloat(reimbursementElectronicInvoiceVATTaxesMoneys) + parseFloat(moneys)).toFixed(2);
+                    }
+                }
+                if (taxAmount!=undefined && !isNaN(taxAmount)){
+                    if(reimbursementElectronicInvoiceVATTaxesTaxAmount==""){
+                        reimbursementElectronicInvoiceVATTaxesTaxAmount = parseFloat(taxAmount).toFixed(2);
+                    }else {
+                        reimbursementElectronicInvoiceVATTaxesTaxAmount = (parseFloat(reimbursementElectronicInvoiceVATTaxesTaxAmount) + parseFloat(taxAmount)).toFixed(2);
+                    }
+                }
+                if (rsumMoney!=undefined && !isNaN(rsumMoney)){
+                    if(reimbursementElectronicInvoiceVATTaxesSumMoney==""){
+                        reimbursementElectronicInvoiceVATTaxesSumMoney = parseFloat(rsumMoney).toFixed(2);
+                    }else {
+                        reimbursementElectronicInvoiceVATTaxesSumMoney = (parseFloat(reimbursementElectronicInvoiceVATTaxesSumMoney) + parseFloat(rsumMoney)).toFixed(2);
+                    }
+                }
+            }
+            $("#reimbursementElectronicInvoiceVATTaxesMoneys").val(reimbursementElectronicInvoiceVATTaxesMoneys);
+            $("#reimbursementElectronicInvoiceVATTaxesTaxAmount").val(reimbursementElectronicInvoiceVATTaxesTaxAmount);
+            $("#reimbursementElectronicInvoiceVATTaxesSumMoney").val(reimbursementElectronicInvoiceVATTaxesSumMoney);
+
+
+
         });
 
     </script>
@@ -461,7 +502,7 @@
     <div class="form-group layui-row count2">
         <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">
+            <table id="contentTable3" class="table table-bordered table-condensed can-edit no-bottom-margin">
                 <thead>
                 <tr>
                     <th width="200px"><font color="red">*</font>发票类型</th>
@@ -520,19 +561,31 @@
                 </c:if>
                 </tbody>
             </table>
+            <table id="contentTable4" class="table table-bordered table-condensed can-edit no-bottom-margin">
+                <thead>
+                <tr >
+                    <td width="200px" style="vertical-align:middle;text-align: center;"><label>费用汇总(元):</label></td>
+                    <td width="200px"></td>
+                    <td width="200px"></td>
+                    <td width="200px"></td>
+                    <td width="200px"></td>
+                    <td width="200px" style="border: 0px">
+                        <input htmlEscape="false" style="border: 0px; font-weight: bold;" id="reimbursementElectronicInvoiceVATTaxesMoneys" name="reimbursementElectronicInvoiceVATTaxesMoneys" readonly="true" class="form-control layui-input" value=""/>
+                    </td>
+                    <td width="200px">
+                        <input htmlEscape="false" style="border: 0px; font-weight: bold;" id="reimbursementElectronicInvoiceVATTaxesTaxAmount" name="reimbursementElectronicInvoiceVATTaxesTaxAmount" readonly="true" class="form-control layui-input" value=""/>
+                    </td>
+                    <td width="200px">
+                        <input htmlEscape="false" style="border: 0px; font-weight: bold;" id="reimbursementElectronicInvoiceVATTaxesSumMoney" name="reimbursementElectronicInvoiceVATTaxesSumMoney" readonly="true" class="form-control layui-input" value=""/>
+                    </td>
+                    <td width="200px"></td>
+                </tr>
+                </thead>
+            </table>
         </div>
     </div>
 
     <div class="form-group layui-row count2">
-        <div class="form-group-label"><h2>数电发票附件信息</h2></div>
-        <div id="addFile_attachment_InvoiceReimbursement" style="display: none" class="upload-progress">
-            <span id="fileName_attachment_InvoiceReimbursement" ></span>
-            <b><span id="baifenbi_attachment_InvoiceReimbursement" ></span></b>
-            <div class="progress">
-                <div id="jindutiao_attachment_InvoiceReimbursement" class="progress-bar" style="width: 0%" aria-valuenow="0">
-                </div>
-            </div>
-        </div>
         <input id="attachment_InvoiceReimbursement_file" type="file" multiple="multiple" style="display: none;" onChange="if(this.value)insertTitleInvoiceReimbursement(this.value);"/>
         <span id="attachment_title"></span>
         <div class="layui-item layui-col-xs12" style="padding:0 16px;">
@@ -540,7 +593,7 @@
                 <thead>
                 <tr>
                         <%-- <th>序号</th>--%>
-                    <th>文件预览</th>
+                    <th>数电发票文件预览</th>
                     <th>上传人</th>
                     <th>上传时间</th>
                     <th width="200px">操作</th>
@@ -696,9 +749,9 @@
                                         <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:otherwise>
                                 </c:choose>
-                                <c:if test="${workClientAttachment.collectFlag != 1}">
+                                <%--<c:if test="${workClientAttachment.collectFlag != 1}">
                                     <a href="javascript:void(0)" onclick="collectingAccessory(this,'${ctx}/projectAccessory/projectAccessory/saveCollectAccessory','${workClientAttachment.url}','${workClientAttachment.createBy.id}','${workClientAttachment.fileSize}')" class="op-btn op-btn-delete" style="background-color: #FFB800"><i class="layui-icon layui-icon-rate"></i>&nbsp;收藏</a>
-                                </c:if>
+                                </c:if>--%>
 
                             </div>
                         </td>