瀏覽代碼

发票管理作废流程

user5 4 年之前
父節點
當前提交
c1c116adcd

+ 2 - 0
src/main/java/com/jeeplus/modules/workinvoice/dao/WorkInvoiceDao.java

@@ -29,5 +29,7 @@ public interface WorkInvoiceDao extends CrudDao<WorkInvoice> {
 	 * @return
 	 */
 	public int updateProcessInstanceId(WorkInvoice workInvoice);
+
+	void cancellationDelete(WorkInvoice workInvoice);
 	
 }

+ 9 - 0
src/main/java/com/jeeplus/modules/workinvoice/entity/WorkInvoice.java

@@ -72,6 +72,7 @@ public class WorkInvoice extends ActEntity<WorkInvoice> {
 	private String receiptMoney;		// 是否收款
 	private String cancellation;		// 作废判断
 	private String adminFlag;		// 管理员判断
+	private String cancellationRemark;		// 作废原因
 	private List<WorkInvoiceDetail> workAccountList = Lists.newArrayList();//发票明细
 	public String getOfficeId() {
 		return officeId;
@@ -474,4 +475,12 @@ public class WorkInvoice extends ActEntity<WorkInvoice> {
 	public void setAdminFlag(String adminFlag) {
 		this.adminFlag = adminFlag;
 	}
+
+	public String getCancellationRemark() {
+		return cancellationRemark;
+	}
+
+	public void setCancellationRemark(String cancellationRemark) {
+		this.cancellationRemark = cancellationRemark;
+	}
 }

+ 395 - 8
src/main/java/com/jeeplus/modules/workinvoice/service/WorkInvoiceService.java

@@ -501,10 +501,10 @@ public class WorkInvoiceService extends CrudService<WorkInvoiceDao, WorkInvoice>
 	}
 	@Transactional(readOnly = false)
 	public void delete(WorkInvoice workInvoice) {
-		super.delete(workInvoice);
-		for (WorkInvoiceDetail workAccount : workInvoice.getWorkAccountList()){
+		dao.deleteByLogic(workInvoice);
+		/*for (WorkInvoiceDetail workAccount : workInvoice.getWorkAccountList()){
 			workInvoiceDetailDao.delete(workAccount);
-		}
+		}*/
 	}
 
 	public Page<WorkClientInfo> findPageByclient(Page<WorkClientInfo> page, WorkClientInfo client) {
@@ -1329,6 +1329,59 @@ public class WorkInvoiceService extends CrudService<WorkInvoiceDao, WorkInvoice>
 		}
 	}
 
+
+
+	/**
+	 * 强制发票作废撤销
+	 * @param workInvoice
+	 */
+	@Transactional(readOnly = false)
+	public void conditionCancelInvalidate(WorkInvoice workInvoice) {
+		String invalidateProcessInstanceId = workInvoice.getProcessInstanceId();
+		try {
+			//将流程图中尚未走到的task的流程追踪信息逻辑删除,添加一条"撤销"流程追踪信息
+			WorkActivityProcess process = new WorkActivityProcess();
+			process.setProcessInstanceId(workInvoice.getProcessInstanceId());
+			process.setIsApproval("0");
+			WorkActivityProcess workActivityProcess = new WorkActivityProcess();
+			workActivityProcess.setProcessInstanceId(workInvoice.getProcessInstanceId());
+			List<WorkActivityProcess> processList = workActivityProcessService.findList(workActivityProcess);
+			WorkProjectNotify notify = new WorkProjectNotify();
+			notify.setNotifyId(workInvoice.getId());
+			workProjectNotifyService.readByNotifyId(notify);
+			if (processList != null && processList.size() > 0) {
+				for (int i = 0; i < processList.size(); i++) {
+					WorkActivityProcess p = processList.get(i);
+					if (StringUtils.isNotBlank(p.getIsApproval()) && "0".equals(p.getIsApproval())) {
+						p.setDelFlag("1");
+						p.setIsApproval("-1");
+						workActivityProcessDao.updateDelFlagAndIsApproval(p);
+					}
+				}
+				WorkActivityProcess pro = new WorkActivityProcess();
+				pro.setId("");
+				pro.preInsert();
+				pro.setDelFlag("0");
+				pro.setRemarks("[强制撤销]");
+				pro.setProcessKey(processList.get(0).getProcessKey());
+				pro.setIsApproval("1");
+				pro.setProcessInstanceId(processList.get(0).getProcessInstanceId());
+				pro.setCount(0);
+				workActivityProcessDao.insert(pro);
+			}
+			//结束该流程,设为"撤销"状态
+			actTaskService.endProcessInstance(invalidateProcessInstanceId, "发票作废-撤销");
+			workInvoice.setInvoiceState("11");
+			workInvoice.preUpdate();
+			workInvoiceDao.update(workInvoice);
+		} catch (ActivitiObjectNotFoundException e) {
+			System.err.println("撤销发票作废申请异常,因为这个流程已不存在!");
+			e.printStackTrace();
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+
 	/**
 	 * 读取流程信息
 	 * @param page
@@ -1449,11 +1502,6 @@ public class WorkInvoiceService extends CrudService<WorkInvoiceDao, WorkInvoice>
 			}
 			workProjectNotify.setId("");
 		} else {
-			//variables.put("fpglyList", fpglys);
-			if (fpglys.size()==0 ){
-				workInvoice.setInvoiceState("1");//暂存
-				this.save(workInvoice);
-			}
 			if (fpglys.size()==0){
 				return "流程审批人不能为空,财务部门下无用户,请联系管理员!";
 			}
@@ -1506,4 +1554,343 @@ public class WorkInvoiceService extends CrudService<WorkInvoiceDao, WorkInvoice>
 		}
 		return "";
 	}
+
+
+
+	/**
+	 * 审核流程
+	 * @param workInvoice
+	 */
+	@Transactional(readOnly = false)
+	public String cancellationSaveAudit(WorkInvoice workInvoice,List<User> auditUsers) {
+		//所属部门
+		Office office = officeService.get(workInvoice.getOffice().getId());
+		String userName = UserUtils.get(workInvoice.getCreateBy().getId()).getName();
+		String  str = "发票申请编号:"+workInvoice.getNumber()+",实际开票单位:"+workInvoice.getClient().getName()+",创建人:"+userName+",所属部门:"+office.getName();
+		String title = "实际开票单位:"+workInvoice.getClient().getName();
+		// 对不同环节的业务逻辑进行操作
+		String taskDefKey = workInvoice.getAct().getTaskDefKey();
+		if("fpgly".equals(taskDefKey)){
+			updateWorkInvoiceInfo(workInvoice);
+			actTaskService.claim(workInvoice.getAct().getTaskId(), UserUtils.getUser().getId());
+		}else if (!"modifyApply".equals(taskDefKey)) {
+			actTaskService.claim(workInvoice.getAct().getTaskId(), UserUtils.getUser().getId());
+		}else {
+			workInvoice.getAct().setFlag("yes");
+			updateWorkInvoiceInfo(workInvoice);
+		}
+		String comment = "";
+		if (workInvoice.getInvoiceState().equals("9")){
+			comment = ("yes".equals(workInvoice.getAct().getFlag())?"[重新申请] ":"[已撤销] ");
+		}else {
+			comment = ("yes".equals(workInvoice.getAct().getFlag())?"[同意] ":"[驳回] ")+workInvoice.getAct().getComment();
+		}
+		//yes 的时候状态为审核通过 否则为未通过
+		//6 作废审批中 9 作废驳回
+		workInvoice.setInvoiceState(("yes".equals(workInvoice.getAct().getFlag()) ? "6" : "9"));
+		Map<String, Object> vars = Maps.newHashMap();
+		//业务逻辑对应的条件表达式
+		String exp = "";
+		String taskCount = "";
+		String notifyRole = "";
+		int key = 0;
+		String enname = "";
+		List<Activity> activitieList = activityService.getByProcessInstanceId(workInvoice.getProcessInstanceId());
+		WorkActivityMenu workActivityMenu = new WorkActivityMenu();
+		if (activitieList != null && activitieList.size() != 0) {
+			workActivityMenu.setProcessType(activitieList.get(0).getProcessKey());
+			workActivityMenu.setActivities(activitieList);
+		}
+
+		WorkActivityProcess workActivityProcess = new WorkActivityProcess();
+		WorkActivityProcess selectProcess = new WorkActivityProcess();
+		selectProcess.setProcessInstanceId(workInvoice.getProcessInstanceId());
+		List<WorkActivityProcess> workActivityProcesses = workActivityProcessService.findList(selectProcess);
+		List<Activity> activities = workActivityMenu.getActivities();
+		if (StringUtils.isNotBlank(workActivityMenu.getProcessType()) && !workActivityMenu.getProcessType().equals("newWorkInvoiceBranch")) {
+			key = 1;
+			for (int i = 0; i < workActivityProcesses.size(); i++) {
+				WorkActivityProcess activityProcess = workActivityProcesses.get(i);
+				if (taskDefKey.equals(activityProcess.getActivityTask()) && !taskDefKey.equals("modifyApply")) {
+					taskCount = activityProcess.getCount()+"";
+					workActivityProcess = activityProcess;
+					if (!workActivityProcess.getIsApproval().equals("0")) {
+						workActivityProcess.setId("");
+					}
+					exp = "pass";
+					if (!"yes".equals(workInvoice.getAct().getFlag())) {
+						workInvoice.setInvoiceState("9");
+						workActivityProcess.setIsApproval("2");
+						String returnBack = "-1";
+						for (Activity activity : activities) {
+							if (activity.getCount() == activityProcess.getCount()) {
+								notifyRole = activity.getName();
+								returnBack = activity.getReturnBack();
+								break;
+							}
+						}
+						if (returnBack.equals("0")) {
+							workActivityProcess.setId("");
+						}
+
+					} else {
+						workActivityProcess.setIsApproval("1");
+					}
+				}else if(taskDefKey.equals("modifyApply")){
+					taskCount = "0";
+					notifyRole = "调整申请";
+					exp = "pass";
+					workActivityProcess.setId("");
+					workActivityProcess.setCount(0);
+					if (!"yes".equals(workInvoice.getAct().getFlag())) {
+						workInvoice.setInvoiceState("3");
+						workActivityProcess.setIsApproval("2");
+					} else {
+						workActivityProcess.setIsApproval("1");
+					}
+					break;
+				}
+			}
+		} else {
+			workActivityMenu.setProcessType("newWorkInvoiceBranch");
+			for (int i = 0; i < workActivityProcesses.size(); i++) {
+				WorkActivityProcess activityProcess = workActivityProcesses.get(i);
+				String count = activityProcess.getCount() + "";
+				workActivityProcess = activityProcess;
+				if (!workActivityProcess.getIsApproval().equals("0")) {
+					workActivityProcess.setId("");
+				}
+				// 审核环节
+				//if ("bmzr".equals(taskDefKey) && count.contains("1")) {
+				if ("fpgly".equals(taskDefKey) && count.contains("1")) {
+					taskCount = "1";
+					exp = "pass";
+					if ("yes".equals(workInvoice.getAct().getFlag()) &&("0").equals(workInvoice.getExt())) {
+						workActivityProcessService.insertAuditsByType(auditUsers,workInvoice.getProcessInstanceId(),2,1);
+						//分公司流程
+						//notifyRole = "财务主任审批";
+						notifyRole = "审批通过";
+						workActivityProcess.setIsApproval("1");
+							/*enname = "fpgly";
+							vars.put("fpglyList", auditUsers);
+							vars.put("fpglycount",auditUsers.size());*/
+					}else {
+						notifyRole = "调整申请";
+						workActivityProcess.setIsApproval("2");
+					}
+					break;
+				}  else if ("fpgly".equals(taskDefKey) && count.contains("2")) {
+					taskCount = "2";
+					exp = "pass";
+					if ("yes".equals(workInvoice.getAct().getFlag())) {
+						notifyRole = "审批通过";
+						workActivityProcess.setIsApproval("1");
+					} else {
+						notifyRole = "调整申请";
+						workActivityProcess.setIsApproval("2");
+					}
+					break;
+				}  else if ("modifyApply".equals(taskDefKey)&& count.contains("0")) {
+					taskCount = "0";
+					notifyRole = "财务部门审批";
+					exp = "pass";
+					workActivityProcess.setCount(0);
+					enname = "cwygevod";
+					if (!"yes".equals(workInvoice.getAct().getFlag())) {
+						workInvoice.setInvoiceState("3");
+					}
+					break;
+				} else if ("apply_end".equals(taskDefKey)) {
+				}
+
+			}
+		}
+		// 设置意见
+		workInvoice.getAct().setComment(("yes".equals(workInvoice.getAct().getFlag()) ? "[同意] " : "[驳回] ") + workInvoice.getAct().getComment());
+		workInvoice.preUpdate();
+		// 提交流程任务
+		vars.put(exp, "yes".equals(workInvoice.getAct().getFlag()) ? true : false);
+		vars.put("passs", true);
+		workActivityProcessService.updateProcess(workActivityProcess,workActivityMenu,key,taskCount,workInvoice.getProcessInstanceId(),taskDefKey,"modifyApply",workInvoice.getAct().getFlag(),comment, activities);
+		// 提交流程任务
+		actTaskService.complete(workInvoice.getAct().getTaskId(), workInvoice.getAct().getProcInsId(), workInvoice.getAct().getComment(), vars);
+		boolean state = actTaskService.isProcessEnd(workInvoice.getAct().getProcInsId());
+		List<User> users = new ArrayList<>();
+		List<User> userList = new ArrayList<>();
+		if (!state) {
+			str = "发票申请编号:"+workInvoice.getNumber()+",实际开票单位:"+workInvoice.getClient().getName();
+			title = "实际开票单位:"+workInvoice.getClient().getName();
+			users.add(workInvoice.getCreateBy());
+			if ("yes".equals(workInvoice.getAct().getFlag())) {
+				workInvoice.setInvoiceState("7");
+				WorkProjectNotify notify = new WorkProjectNotify();
+				notify.setNotifyId(workInvoice.getId());
+				userList = workProjectNotifyService.readByNotifyId(notify);
+				workProjectNotifyService
+						.save(UtilNotify
+								.saveNotify(workInvoice.getId(),
+										workInvoice.getCreateBy(),
+										workInvoice.getCompanyId(),
+										title,
+										str,
+										"211",
+										"0",
+										"待通知",
+										notifyRole));
+
+			} else {
+				WorkProjectNotify notify = new WorkProjectNotify();
+				notify.setNotifyId(workInvoice.getId());
+				userList = workProjectNotifyService.readByNotifyId(notify);
+				if (StringUtils.isNotBlank(workInvoice.getInvoiceState()) && !workInvoice.getInvoiceState().equals("3")){
+					workInvoice.setInvoiceState("9");
+					workProjectNotifyService
+							.save(UtilNotify
+									.saveNotify(workInvoice.getId(),
+											workInvoice.getCreateBy(),
+											workInvoice.getCompanyId(),
+											title,
+											str,
+											"211",
+											"0",
+											"待通知",
+											notifyRole));
+				}
+			}
+			workActivityProcessService.deleteProcessIdAuditUsers(workInvoice.getProcessInstanceId());
+		} else {
+			if (StringUtils.isNotBlank(workActivityMenu.getProcessType()) && !workActivityMenu.getProcessType().equals("newWorkInvoiceBranch")) {
+				WorkProjectNotify notify = new WorkProjectNotify();
+				notify.setNotifyId(workInvoice.getId());
+				userList = workProjectNotifyService.readByNotifyId(notify);
+				WorkProjectNotify workProjectNotify = UtilNotify
+						.saveNotify(workInvoice.getId(),
+								new User(),
+								workInvoice.getCompanyId(),
+								title,
+								str,
+								"211",
+								"0",
+								"待审批",
+								notifyRole);
+				List<WorkProjectNotify> workProjectNotifys = activityService.getByFlagAndTaskDefKeyList(
+						activities,
+						workProjectNotify,
+						taskDefKey,
+						workInvoice.getAct().getFlag(),
+						taskCount,
+						workInvoice.getCreateBy(),
+						workInvoice.getOfficeId(),
+						"5");
+				for (WorkProjectNotify workProjectNotify1:workProjectNotifys){
+					users.add(workProjectNotify1.getUser());
+					workProjectNotify1.setId("");
+					workProjectNotify1.setIsNewRecord(false);
+					workProjectNotifyService
+							.save(workProjectNotify1);
+					if (!"modifyApply".equals(taskDefKey)){
+						Map<String,Object> extras = new HashMap<>();
+						if ("fpgly".equals(taskDefKey) ){
+							extras.put("type","7001");
+						}else {
+							extras.put("type","7002");
+						}
+						extras.put("id",workProjectNotify.getId());
+						extras.put("procDefKey","211");
+						UserUtils.pushInfoToApp(title,str,extras,workProjectNotify1.getUser().getId());
+
+					}
+				}
+
+			} else {
+				if (!"yes".equals(workInvoice.getAct().getFlag())) {
+					WorkProjectNotify notify = new WorkProjectNotify();
+					notify.setNotifyId(workInvoice.getId());
+					userList = workProjectNotifyService.readByNotifyId(notify);
+					workProjectNotifyService
+							.save(UtilNotify
+									.saveNotify(workInvoice.getId(),
+											workInvoice.getCreateBy(),
+											workInvoice.getCompanyId(),
+											title,
+											str,
+											"211",
+											"0",
+											"重新申请",
+											notifyRole));
+					users.add( workInvoice.getCreateBy());
+				} else {
+					if (StringUtils.isNotBlank(enname)) {
+						WorkProjectNotify notify = new WorkProjectNotify();
+						notify.setNotifyId(workInvoice.getId());
+						userList = workProjectNotifyService.readByNotifyId(notify);
+						WorkProjectNotify workProjectNotify = UtilNotify
+								.saveNotify(workInvoice.getId(),
+										new User(),
+										workInvoice.getCompanyId(),
+										title,
+										str,
+										"211",
+										"0",
+										"待审批",
+										notifyRole);
+						for (User user1:auditUsers){
+							users.add(user1);
+							workProjectNotify.setUser(user1);
+							workProjectNotify.setId("");
+							workProjectNotify.setIsNewRecord(false);
+							workProjectNotifyService
+									.save(workProjectNotify);
+							if (!"modifyApply".equals(taskDefKey)){
+								Map<String,Object> extras = new HashMap<>();
+								if ("fpgly".equals(taskDefKey)){
+									extras.put("type","7001");
+								}else {
+									extras.put("type","7002");
+								}
+								extras.put("id",workProjectNotify.getId());
+								extras.put("procDefKey","211");
+								UserUtils.pushInfoToApp(title,str,extras,user1.getId());
+
+							}
+						}
+					}else {
+						WorkProjectNotify notify = new WorkProjectNotify();
+						notify.setNotifyId(workInvoice.getId());
+						userList = workProjectNotifyService.readByNotifyId(notify);
+						users.addAll(userList);
+						users.add(workInvoice.getCreateBy());
+						workProjectNotifyService
+								.save(UtilNotify
+										.saveNotify(workInvoice.getId(),
+												workInvoice.getCreateBy(),
+												workInvoice.getCompanyId(),
+												title,
+												str,
+												"211",
+												"0",
+												"重新申请",
+												notifyRole));
+					}
+				}
+			}
+		}
+		if (users!=null && users.size()!=0) {
+			for (User u : users) {
+				UserUtils.pushIm(u.getId(),str);
+			}
+		}
+		if (userList!=null && userList.size()!=0) {
+			for (User u : userList) {
+				UserUtils.pushMeIm(u.getId());
+			}
+		}
+		workInvoiceDao.update(workInvoice);
+		return "保存审核意见成功!";
+	}
+
+	@Transactional(readOnly = false)
+	public void cancellationDelete(WorkInvoice workInvoice) {
+		dao.cancellationDelete(workInvoice);
+	}
 }

+ 85 - 2
src/main/java/com/jeeplus/modules/workinvoice/web/WorkInvoiceController.java

@@ -330,7 +330,7 @@ public class WorkInvoiceController extends BaseController {
 				act.setProcInsId(taskInfok.getProcessInstanceId());
 				act.setTask(taskInfok);
 				workInvoice.setAct(act);
-				view = "workInvoiceModify";
+				view = "conditionWorkInvoiceModify";
 			}
 		}
 		// 环节编号
@@ -371,7 +371,7 @@ public class WorkInvoiceController extends BaseController {
 		//启动流程
 		workInvoice.setInvoiceState("6");
 		String processInstanceId ="";
-		if (user!=null && StringUtils.isNotBlank(user.getId()) && StringUtils.isNotBlank(invoiceState) && "3".equals(invoiceState)){
+		if (user!=null && StringUtils.isNotBlank(user.getId()) && StringUtils.isNotBlank(invoiceState) && "9".equals(invoiceState)){
 			processInstanceId = workInvoiceService.get(workInvoice.getId()).getProcessInstanceId();
 		}
 //		try {
@@ -408,6 +408,68 @@ public class WorkInvoiceController extends BaseController {
 		return "redirect:"+Global.getAdminPath()+"/workinvoice/workInvoice/?repage";
 	}
 
+
+	/**
+	 * 工单执行(完成任务)
+	 * @param
+	 * @param model
+	 * @return
+	 */
+	@RequestMapping(value = "cancellationSaveAudit")
+	public String cancellationSaveAudit(WorkInvoice workInvoice, Model model,
+							RedirectAttributes redirectAttributes) {
+//		try{
+		// 对不同环节的业务逻辑进行操作
+		String taskDefKey = workInvoice.getAct().getTaskDefKey();
+		List<User> users = null;
+		//所属部门
+		Office office = officeService.get(workInvoice.getOffice().getId());
+		if ("bmzr".equals(taskDefKey)){
+			if(("1").equals(workInvoice.getExt())) {
+				users = UserUtils.getByProssType(workInvoice.getProcessInstanceId(), 2);
+				if (users == null)
+					users = UserUtils.getByRoleActivityEnname("scfgld", 1, office.getId(), "5", workInvoice.getCreateBy());
+			}else{
+				users = UserUtils.getByProssType(workInvoice.getProcessInstanceId(),3);
+				if (users==null )
+					users = UserUtils.getByRoleActivityEnname("cwzg",3,office.getId(),"5",workInvoice.getCreateBy());
+			}
+		}else  if ("scbzr".equals(taskDefKey)){
+			users = UserUtils.getByProssType(workInvoice.getProcessInstanceId(),3);
+			if (users==null )
+				users = UserUtils.getByRoleActivityEnname("cwzg",1,office.getId(),"5",workInvoice.getCreateBy());
+		}else  if ("fpgly".equals(taskDefKey)){
+			if(("1").equals(workInvoice.getExt())) {
+				users = UserUtils.getByProssType(workInvoice.getProcessInstanceId(), 3);
+			}else{
+				users = UserUtils.getByProssType(workInvoice.getProcessInstanceId(),1);
+			}
+		}else if ("modifyApply".equals(taskDefKey)){
+			users = UserUtils.getByProssType(workInvoice.getProcessInstanceId(), 1);
+		}
+		String flag = workInvoice.getAct().getFlag();
+		if ("yes".equals(flag) && (users==null || users.size()==0)){
+			addMessage(redirectAttributes, "审批失败,审批人为空,请联系管理员!");
+		}else {
+			String str = "";
+			if(("1").equals(workInvoice.getExt())){
+				str = workInvoiceService.cancellationSaveAudit(workInvoice,users);
+			}else if(("0").equals(workInvoice.getExt())){
+				str = workInvoiceService.cancellationSaveAudit(workInvoice,users);
+			}
+			addMessage(redirectAttributes, str);
+		}
+//		}catch (Exception e){
+//			addMessage(redirectAttributes, "审批失败:");
+//		}
+
+		if (StringUtils.isNotBlank(workInvoice.getHome()) && "home".equals(workInvoice.getHome())){
+			return "redirect:" + Global.getAdminPath() + "/home/?repage";
+		}else {
+			return "redirect:"+Global.getAdminPath()+"/workinvoice/workInvoice/?repage";
+		}
+	}
+
 	/**
 	 * 保存开票管理
 	 */
@@ -1061,4 +1123,25 @@ public class WorkInvoiceController extends BaseController {
 	}
 /*--------------------------分割线---------------------------------*/
 
+
+
+	/**
+	 * 作废撤销
+	 */
+	@RequestMapping("conditionCancelInvalidate")
+	public String conditionCancelInvalidate(WorkInvoice workInvoice,RedirectAttributes redirectAttributes){
+		workInvoiceService.conditionCancelInvalidate(workInvoice);
+		return "redirect:"+Global.getAdminPath()+"/workinvoice/workInvoice/?repage";
+	}
+
+	/**
+	 * 作废删除
+	 */
+	@RequestMapping(value = "cancellationDelete")
+	public String cancellationDelete(WorkInvoice workInvoice, RedirectAttributes redirectAttributes) {
+		workInvoiceService.cancellationDelete(workInvoice);
+		addMessage(redirectAttributes, "作废发票删除成功");
+		return "redirect:"+Global.getAdminPath()+"/workinvoice/workInvoice/?repage";
+	}
+
 }

+ 15 - 4
src/main/resources/mappings/modules/workinvoice/WorkInvoiceDao.xml

@@ -59,7 +59,8 @@
 		prd.number as "project.reportData.number",
 		p.area_name as "project.county",
 		a.receipt_money_date as "receiptMoneyDate",
-		(case when a.receipt_money = '0' then '否' when a.receipt_money = '1' then '是' else '否' end) as receiptMoney
+		(case when a.receipt_money = '0' then '否' when a.receipt_money = '1' then '是' else '否' end) as receiptMoney,
+		a.cancellation_remark as "cancellationRemark"
 	</sql>
 	
 	<sql id="workInvoiceJoins">
@@ -346,7 +347,8 @@
 			officee_id,
 			province,
 			ext,
-			billing_content
+			billing_content,
+			cancellation_remark
 		) VALUES (
 			#{id},
 			#{number},
@@ -384,7 +386,8 @@
 			#{officeId},
 			#{province},
 			#{ext},
-			#{billingContent}
+			#{billingContent},
+			#{cancellationRemark}
 		)
 	</insert>
 	
@@ -422,7 +425,8 @@
 			officee_id=#{officeId},
 			province = #{province},
 			ext = #{ext},
-			billing_content = #{billingContent}
+			billing_content = #{billingContent},
+			cancellation_remark = #{cancellationRemark}
 		WHERE id = #{id}
 	</update>
 	
@@ -439,6 +443,13 @@
 			del_flag = #{DEL_FLAG_DELETE}
 		WHERE id = #{id}
 	</update>
+
+	<!--逻辑删除-->
+	<update id="cancellationDelete">
+		UPDATE work_invoice SET
+			invoice_state=5
+		WHERE id = #{id}
+	</update>
 	
 	
 	<!-- 根据实体名称和字段名称和字段值获取唯一记录 -->

+ 2 - 1
src/main/webapp/static/common/jeeplus.js

@@ -508,9 +508,10 @@ function getAuditState(id)
         case "5":result.label = "signed";result.status="已完成";break;
         case "6":result.label = "discarding";result.status="作废中";break;
         case "7":result.label = "discarded";result.status="已作废";break;
-        case "9":result.label = "discarded";result.status="作废驳回";break;
+        case "9":result.label = "reject";result.status="作废驳回";break;
         case "8":result.label = "changing";result.status="变更中";break;
         case "10":result.label = "unknown";result.status="待发起";result.action = false;break;
+        case "11":result.label = "cancel";result.status="作废撤回";break;
         default:
             result.label = "unknown";result.status="未知";break;
     }

+ 12 - 15
src/main/webapp/webpage/modules/workinvoice/conditionWorkInvoiceAudit.jsp

@@ -41,7 +41,7 @@
 <body>
 <div class="single-form">
 	<div class="container">
-	<form:form id="inputForm" modelAttribute="workInvoice" action="${ctx}/workinvoice/workInvoice/saveAudit" method="post" class="form-horizontal">
+	<form:form id="inputForm" modelAttribute="workInvoice" action="${ctx}/workinvoice/workInvoice/cancellationSaveAudit" method="post" class="form-horizontal">
 		<form:hidden path="id"/>
 		<form:hidden path="home"/>
 		<form:hidden path="act.taskId"/>
@@ -55,36 +55,33 @@
 		<div class="form-group layui-row first lw14">
 			<div class="form-group-label"><h2>基本信息</h2></div>
 			<div class="layui-item layui-col-sm6">
-				<label class="layui-form-label"><span class="require-item">*</span>项目名称:</label>
+				<label class="layui-form-label">项目名称:</label>
 				<div class="layui-input-block">
 					<input htmlEscape="false" readonly="true"   class="form-control layui-input" value="${workInvoice.project.projectName}"/>
 				</div>
 			</div>
 			<div class="layui-item layui-col-sm6">
-				<label class="layui-form-label"><span class="require-item">*</span>发票申请编号:</label>
+				<label class="layui-form-label">发票申请编号:</label>
 				<div class="layui-input-block">
 					<div class="input-group">
 						<input htmlEscape="false" readonly="true"   class="form-control layui-input" value="${workInvoice.number}"/>
-						<span class="input-group-btn">
-							<label class="form-status"><c:choose><c:when test="${ empty workInvoice.invoiceState}">新添</c:when><c:otherwise>${fns:getDictLabel(workInvoice.invoiceState, 'audit_state','')}</c:otherwise>	</c:choose></label>
-						</span>
 					</div>
 				</div>
 			</div>
 			<div class="layui-item layui-col-sm6">
-				<label class="layui-form-label"><span class="require-item">*</span>合同名称:</label>
+				<label class="layui-form-label">合同名称:</label>
 				<div class="layui-input-block">
 					<input htmlEscape="false" readonly="true"   class="form-control layui-input" value="${workInvoice.project.workContractInfo.name}"/>
 				</div>
 			</div>
 			<div class="layui-item layui-col-sm6">
-				<label class="layui-form-label"><span class="require-item">*</span>项目编号:</label>
+				<label class="layui-form-label">项目编号:</label>
 				<div class="layui-input-block">
 					<input htmlEscape="false" readonly="true"   class="form-control layui-input" value="${workInvoice.project.projectId}"/>
 				</div>
 			</div>
 			<div class="layui-item layui-col-sm6">
-				<label class="layui-form-label"><span class="require-item">*</span>委托方:</label>
+				<label class="layui-form-label">委托方:</label>
 				<div class="layui-input-block">
 					<input htmlEscape="false" readonly="true"   class="form-control layui-input" value="${workInvoice.project.workContractInfo.client.name}"/>
 				</div>
@@ -99,19 +96,19 @@
 		<div class="form-group layui-row first lw14">
 			<div class="form-group-label"><h2>发票详情</h2></div>
 			<div class="layui-item layui-col-sm6">
-				<label class="layui-form-label"><span class="require-item">*</span>上级/本公司开票:</label>
+				<label class="layui-form-label">上级/本公司开票:</label>
 				<div class="layui-input-block">
 					<input htmlEscape="false" readonly="true"   class="form-control layui-input" value="<c:choose><c:when test="${workInvoice.ext eq '0'}">本公司开票	</c:when><c:when test="${workInvoice.ext eq '1'}">上级公司开票</c:when></c:choose>"/>
 				</div>
 			</div>
 			<div class="layui-item layui-col-sm6">
-				<label class="layui-form-label"><span class="require-item">*</span>发票类型:</label>
+				<label class="layui-form-label">发票类型:</label>
 				<div class="layui-input-block">
 					<input htmlEscape="false" readonly="true"   class="form-control layui-input" value="<c:choose><c:when test="${workInvoice.invoiceType eq '1'}">专票</c:when><c:when test="${workInvoice.invoiceType eq '2'}">普票</c:when></c:choose>"/>
 				</div>
 			</div>
 			<div class="layui-item layui-col-sm6">
-				<label class="layui-form-label"><span class="require-item">*</span>实际开票单位:</label>
+				<label class="layui-form-label">实际开票单位:</label>
 				<div class="layui-input-block">
 					<input htmlEscape="false" readonly="true"   class="form-control layui-input" value="${workInvoice.client.name}"/>
 				</div>
@@ -147,7 +144,7 @@
 				</div>
 			</div>
 			<div class="layui-item layui-col-sm6">
-				<label class="layui-form-label"><span class="require-item">*</span>价税合计(元):</label>
+				<label class="layui-form-label">价税合计(元):</label>
 				<div class="layui-input-block">
 					<input htmlEscape="false" readonly="true"   class="form-control layui-input" value="<fmt:formatNumber value="${workInvoice.money}" pattern="#,#00.00"/>"/>
 				</div>
@@ -158,10 +155,10 @@
 					<input htmlEscape="false" readonly="true"   class="form-control layui-input" value="${workInvoice.content}"/>
 				</div>
 			</div>
-			<div class="layui-item layui-col-sm6">
+			<div class="layui-item layui-col-sm12 with-textarea">
 				<label class="layui-form-label">作废原因:</label>
 				<div class="layui-input-block">
-					<form:textarea path="remarks" readonly="true" htmlEscape="false" rows="4"  maxlength="255"  class="form-control required"/>
+					<form:textarea path="remarks" readonly="true"  class="form-control" htmlEscape="false" rows="4"  maxlength="255"/>
 				</div>
 			</div>
                 <div class="layui-item layui-col-sm12 with-textarea">

+ 1 - 4
src/main/webapp/webpage/modules/workinvoice/conditionWorkInvoiceForm.jsp

@@ -318,9 +318,6 @@
 					<div class="layui-input-block">
 						<div class="input-group">
 							<input htmlEscape="false" readonly="true"   class="form-control layui-input" value="${workInvoice.number}"/>
-							<span class="input-group-btn">
-							<label class="form-status"><c:choose><c:when test="${ empty workInvoice.invoiceState}">新添</c:when><c:otherwise>${fns:getDictLabel(workInvoice.invoiceState, 'audit_state','')}</c:otherwise>	</c:choose></label>
-						</span>
 						</div>
 					</div>
 				</div>
@@ -427,7 +424,7 @@
 				<div class="layui-item layui-col-sm12">
 					<label class="layui-form-label"><span class="require-item">*</span>作废原因:</label>
 					<div class="layui-input-block">
-						<form:textarea path="remarks" htmlEscape="false" rows="4"  maxlength="255"  class="form-control required"/>
+						<form:textarea path="cancellationRemark" htmlEscape="false" rows="4"  maxlength="255"  class="form-control required"/>
 					</div>
 				</div>
 			</div>

+ 365 - 432
src/main/webapp/webpage/modules/workinvoice/conditionWorkInvoiceModify.jsp

@@ -4,334 +4,303 @@
 <head>
 	<title>发票管理</title>
 	<meta name="decorator" content="default"/>
+	<%--<script src="${ctxStatic}/layer-v2.3/laydate/laydate.js"></script>--%>
+	<style>
+		#contractTypeDoc-error{
+			top:80px;
+			left:0;
+		}
+	</style>
 	<script type="text/javascript">
-        var validateForm;
-        function doSubmit(obj){//回调函数,在编辑和保存动作时,供openDialog调用提交表单。
-            //debugger
-            if(validateForm.form()){
-                if(obj == 2){
-                    $("#flag").val("no");
-                }else{
-                    $("#flag").val("yes");
-                }
-                $("#inputForm").submit();
-                return true;
-            }
-            return false;
-        }
-        $(document).ready(function() {
-            /*$('#money').keyup(function(){
+		var validateForm;
+		function doSubmit(obj){//回调函数,在编辑和保存动作时,供openDialog调用提交表单。
+			//debugger
+			if(validateForm.form()){
+				$("#inputForm").submit();
+				return true;
+			}
+			return false;
+		}
+		$(document).ready(function() {
+			/*$('#money').keyup(function(){
                 var c=$(this);
                 if(/[^\d]/.test(c.val())){//替换非数字字符
                     var temp_amount=c.val().replace(/[^\d]/g,'');
                     $(this).val(temp_amount);
                 }
             })*/
-            jQuery.validator.addMethod("isUscCode", function(value, element) {
-                if (this.optional(element)){
-                    return true;
-                }
-                var uscCode = /^((\w{15})|(\w{18})|(\w{20}))$/;
-                return uscCode.test(value);
-            }, "请填写正确的纳税人识别号");
-
-            $("input[name='ext']").on('ifChecked', function(event){
-                var radioVal = $(this).val();
-                if(radioVal == 0){
-                    $("#td1").removeClass("hide");
-                    $("#td2").addClass("hide");
-                    $("#tr1").show()
-                }else{
-                    $("#td1").addClass("hide");
-                    $("#td2").removeClass("hide");
-                    $("#tr1").hide()
-                }
-            });
-            if("${workInvoice.ext}" == "1"){
-                $("#ext1").iCheck('check')
-            }else{
-                $("#ext").iCheck('check')
-            }
-            if("${workInvoice.invoiceType}" == "1"){
-                $("#invoiceType1").iCheck('check');
-                $(".invoicetype").show();
-            }else{
-                $("#invoiceType").iCheck('check');
-                $(".invoicetype").hide();
-            }
-            validateForm = $("#inputForm").validate({
-                submitHandler: function(form){
-                    loading('正在提交,请稍等...');
-                    form.submit();
-                },
-                errorContainer: "#messageBox",
-                errorPlacement: function(error, element) {
-                    $("#messageBox").text("输入有误,请先更正。");
-                    if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
-                        error.appendTo(element.parent().parent());
-                    } else {
-                        error.insertAfter(element);
-                    }
-                }
-            });
+			jQuery.validator.addMethod("isUscCode", function(value, element) {
+				if (this.optional(element)){
+					return true;
+				}
+				var uscCode = /^((\w{15})|(\w{18})|(\w{20}))$/;
+				return uscCode.test(value);
+			}, "请填写正确的纳税人识别号");
 
-            $("input[name='invoiceType']").on('ifChecked', function(event){
-                var radioVal = $(this).val();
-                //专票必填
-                if(radioVal == 1){
-                    $(".invoicetype").show();
-                    $("#bank").attr("class","form-control required layui-input");
-                    $("#bankNumber").attr("class","form-control number required layui-input");
-                    $("#orUnicode").attr("class","form-control isUscCode required layui-input");
-                    $("#address").attr("class","form-control required layui-input");
-                    $("#telephone").attr("class","form-control isTel required layui-input");
-                }else if(radioVal == 2){
-                    $(".invoicetype").hide();
-                    $("#bank").attr("class","form-control layui-input");
-                    $("#bankNumber").attr("class","form-control number layui-input");
-                    $("#orUnicode").attr("class","form-control isUscCode layui-input");
-                    $("#address").attr("class","form-control layui-input");
-                    $("#telephone").attr("class","form-control isTel layui-input");
-                }
-            });
+			/* $("input[name='ext']").on('ifChecked', function(event){
+                 var radioVal = $(this).val();
+                 if(radioVal == 0){
+                     $("#td1").removeClass("hide");
+                     $("#td2").addClass("hide");
+                     $("#tr1").show()
+                 }else{
+                     $("#td1").addClass("hide");
+                     $("#td2").removeClass("hide");
+                     $("#tr1").hide()
+                 }
+             });*/
+			if("${workInvoice.ext}" == "1"){
+				$("#ext1").iCheck('check')
+			}else{
+				$("#ext").iCheck('check')
+			}
+			if("${workInvoice.invoiceType}" == "1"){
+				$("#invoiceType1").iCheck('check');
+				$(".invoicetype").show();
+			}else{
+				$("#invoiceType").iCheck('check');
+				$(".invoicetype").hide();
+			}
+			validateForm = $("#inputForm").validate({
+				submitHandler: function(form){
+					loading('正在提交,请稍等...');
+					form.submit();
+				},
+				errorContainer: "#messageBox",
+				errorPlacement: function(error, element) {
+					$("#messageBox").text("输入有误,请先更正。");
+					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
+						error.appendTo(element.parent().parent());
+					} else {
+						error.insertAfter(element);
+					}
+				}
+			});
 
-        });
-        function setValuee(obj){
-            $.ajax({
-                type:'post',
-                url:'${ctx}/workinvoice/workInvoice/getWorkClientInfo',
-                data:{
-                    "obj":obj
-                },
-                success:function(data){
-                    var d = JSON.parse(data);
-                    $("#bank").val(d.bank);
-                    $("#orUnicode").val(d.orUnicode);
-                    $("#bankNumber").val(d.bankNumber);
-                    $("#telephone").val(d.telephone);
-                    $("#address").val(d.adress);
-                    $("#ids").val(d.ids);
-                }
-            })
-        }
-        function setDp(obj){
-            $.ajax({
-                type:'post',
-                url:'${ctx}/workinvoice/workInvoice/getUserDp',
-                data:{
-                    "obj":obj
-                },
-                success:function(data){
-                    var d = JSON.parse(data);
-                    $("#dp").val(d.dp);
-                }
-            })
-        }
-        function setPNumber(obj){
-            $.ajax({
-                type:'post',
-                url:'${ctx}/workinvoice/workInvoice/getPNumber',
-                data:{
-                    "obj":obj
-                },
-                success:function(data){
-                    var d = JSON.parse(data);
-                    $("#pNumber").val(d.pNumber);
-                    $("#cInfoName").val(d.cInfoName);
-                    $("#cName").val(d.cName);
-                    $("#officeName").val(d.officeName);
-                    $("#officeId").val(d.officeId);
-                }
-            })
-        }
+			$("input[name='invoiceType']").on('ifChecked', function(event){
+				var radioVal = $(this).val();
+				//专票必填
+				if(radioVal == 1){
+					$(".invoicetype").show();
+					$("#bank").attr("class","form-control required layui-input");
+					$("#bankNumber").attr("class","form-control number required layui-input");
+					$("#orUnicode").attr("class","form-control isUscCode required layui-input");
+					$("#address").attr("class","form-control required layui-input");
+					$("#telephone").attr("class","form-control isTel required layui-input");
+				}else if(radioVal == 2){
+					$(".invoicetype").hide();
+					$("#bank").attr("class","form-control layui-input");
+					$("#bankNumber").attr("class","form-control number layui-input");
+					$("#orUnicode").attr("class","form-control isUscCode layui-input");
+					$("#address").attr("class","form-control layui-input");
+					$("#telephone").attr("class","form-control isTel layui-input");
+				}
+			});
+			/*--------------*/
 
-        function addRow(list, idx, tpl, row){
-            var idx1 = $("#workAccountList tr").length;
-            if(list == '#workAccountList' && idx1 < 100){
-                bornTemplete(list, idx, tpl, row, idx1);
-            }
-        }
-        function bornTemplete(list, idx, tpl, row, idx1){
-            $(list).append(Mustache.render(tpl, {
-                idx: idx, delBtn: true, row: row,
-                order:idx1 + 1
-            }));
-            $(list+idx).find("select").each(function(){
-                $(this).val($(this).attr("data-value"));
-            });
-            $(list+idx).find("input[type='checkbox'], input[type='radio']").each(function(){
-                var ss = $(this).attr("data-value").split(',');
-                for (var i=0; i<ss.length; i++){
-                    if($(this).val() == ss[i]){
-                        $(this).attr("checked","checked");
-                    }
-                }
-            });
-        }
-        /*function delRow(obj, prefix) {
-            var id = $(prefix + "_id");
-            var delFlag = $(prefix + "_delFlag");
-            if (id.val() == "") {
-                $(obj).parent().parent().remove();
-            } else if (delFlag.val() == "0") {
-                delFlag.val("1");
-                $(obj).html("&divide;").attr("title", "撤回删除");
-                $(obj).parent().parent().addClass("error");
-                $(obj).parent().parent().addClass("hide");
-            } else if (delFlag.val() == "1") {
-                delFlag.val("0");
-                $(obj).html("&times;").attr("title", "删除");
-                $(obj).parent().parent().removeClass("error");
-            }
-            // var idx1 = $("#workAccountList tr").length; //tr 总数
-            // for (var i = 0; i < idx1; i++) {
-            //     $("#workAccountList tr").eq(i).find("td").eq(1).html(i + 1);
-            // }
-        }*/
-        function provinceForShort(province){
-            if(province == "北京市")
-                return "京";
-            else if(province == "天津市")
-                return "津";
-            else if(province == "重庆市")
-                return "渝";
-            else if(province == "上海市")
-                return "沪";
-            else if(province == "河北省")
-                return "冀";
-            else if(province == "山西省")
-                return "晋";
-            else if(province == "辽宁省")
-                return "辽";
-            else if(province == "吉林省")
-                return "吉";
-            else if(province == "黑龙江省")
-                return "黑";
-            else if(province == "江苏省")
-                return "苏";
-            else if(province == "浙江省")
-                return "浙";
-            else if(province == "安徽省")
-                return "皖";
-            else if(province == "福建省")
-                return "闽";
-            else if(province == "江西省")
-                return "赣";
-            else if(province == "山东省")
-                return "鲁";
-            else if(province == "河南省")
-                return "豫";
-            else if(province == "湖北省")
-                return "鄂";
-            else if(province == "湖南省")
-                return "湘";
-            else if(province == "广东省")
-                return "粤";
-            else if(province == "海南省")
-                return "琼";
-            else if(province == "四川省")
-                return "川/蜀";
-            else if(province == "贵州省")
-                return "黔/贵";
-            else if(province == "云南省")
-                return "云/滇";
-            else if(province == "陕西省")
-                return "陕/秦";
-            else if(province == "甘肃省")
-                return "甘/陇";
-            else if(province == "青海省")
-                return "青";
-            else if(province == "台湾省")
-                return "台";
-            else if(province == "内蒙古自治区")
-                return "内蒙古";
-            else if(province == "广西壮族自治区")
-                return "桂";
-            else if(province == "宁夏回族自治区")
-                return "宁";
-            else if(province == "新疆维吾尔自治区 ")
-                return "新";
-            else if(province == "西藏自治区")
-                return "藏";
-            else if(province == "香港特别行政区")
-                return "港";
-            else if(province == "澳门特别行政区")
-                return "澳";
-        }
+		});
+		function setValuee(obj){
+			$.ajax({
+				type:'post',
+				url:'${ctx}/workinvoice/workInvoice/getWorkClientInfo',
+				data:{
+					"obj":obj
+				},
+				success:function(data){
+					var d = JSON.parse(data);
+					$("#bank").val(d.bank);
+					$("#orUnicode").val(d.orUnicode);
+					$("#bankNumber").val(d.bankNumber);
+					$("#telephone").val(d.telephone);
+					$("#address").val(d.adress);
+					$("#ids").val(d.ids);
+				}
+			})
+		}
+		function setDp(obj){
+			$.ajax({
+				type:'post',
+				url:'${ctx}/workinvoice/workInvoice/getUserDp',
+				data:{
+					"obj":obj
+				},
+				success:function(data){
+					var d = JSON.parse(data);
+					$("#dp").val(d.dp);
+				}
+			})
+		}
+		function setPNumber(obj){
+			$.ajax({
+				type:'post',
+				url:'${ctx}/workinvoice/workInvoice/getPNumber',
+				data:{
+					"obj":obj
+				},
+				success:function(data){
+					var d = JSON.parse(data);
+					$("#pNumber").val(d.pNumber);
+					$("#cInfoName").val(d.cInfoName);
+					$("#cName").val(d.cName);
+					$("#officeName").val(d.officeName);
+					$("#officeId").val(d.officeId);
+				}
+			})
+		}
 
-        function setVs(obj){
-            var a = $(obj).attr("id");
-            var b = a.replace('allPrice','proportion');
-            var value = obj.value;
-            var p = $("#price").val() || 0;
-            if(!p || p == 0){
-                parent.layer.msg("请先填写造价指标,且不能为零",{icon:5});
-                return;
-            }
-            var num = value/p ;
-            if(!/^\d+(\.\d{1,2})?$/.test( value )){
-                parent.layer.msg("合价必须输入数字",{icon:5});
-            }else{
-                $("#" +  b ).val(parseFloat(num.toFixed(2)));
-            }
-        }
-        function setTaxMoney(obj){
-            var a = $(obj).attr("id");
-            var b = a.replace('tax','taxMoney');
-            var t = a.replace('tax','totalMoney');
-            var tr = a.replace('tax','taxRate');
-            var value = obj.value || 0;
-            console.log("-value----"+value);
-            var tax = 1 + value/100;
-            console.log("-tax----"+tax);
-            var p = $("#" +  t ).val() || 0;//获取价税合计
-            console.log("-----"+p);
-            if(!p || p == 0){
-                parent.layer.msg("请先填写价税合计,且不能为零",{icon:5});
-                return;
-            }
-            var num = p/tax || 0;
-            console.log("-----"+num);
-            if(!/^\d+(\.\d{1,2})?$/.test( tax )){
-                parent.layer.msg("税率必须输入数字",{icon:5});
-            }else{
-                $("#" +  b ).val(parseFloat(num.toFixed(2)));
-                var taxRate = p - num;
-                $("#" +  tr ).val(parseFloat(taxRate.toFixed(2)));
-            }
-        }
+		function addRow(list, idx, tpl, row){
+			var idx1 = $("#workAccountList tr").length;
+			if(list == '#workAccountList' && idx1 < 100){
+				bornTemplete(list, idx, tpl, row, idx1);
+			}
+		}
+		function bornTemplete(list, idx, tpl, row, idx1){
+			$(list).append(Mustache.render(tpl, {
+				idx: idx, delBtn: true, row: row,
+				order:idx1 + 1
+			}));
+			$(list+idx).find("select").each(function(){
+				$(this).val($(this).attr("data-value"));
+			});
+			$(list+idx).find("input[type='checkbox'], input[type='radio']").each(function(){
+				var ss = $(this).attr("data-value").split(',');
+				for (var i=0; i<ss.length; i++){
+					if($(this).val() == ss[i]){
+						$(this).attr("checked","checked");
+					}
+				}
+			});
+		}
+		function provinceForShort(province){
+			if(province == "北京市")
+				return "京";
+			else if(province == "天津市")
+				return "津";
+			else if(province == "重庆市")
+				return "渝";
+			else if(province == "上海市")
+				return "沪";
+			else if(province == "河北省")
+				return "冀";
+			else if(province == "山西省")
+				return "晋";
+			else if(province == "辽宁省")
+				return "辽";
+			else if(province == "吉林省")
+				return "吉";
+			else if(province == "黑龙江省")
+				return "黑";
+			else if(province == "江苏省")
+				return "苏";
+			else if(province == "浙江省")
+				return "浙";
+			else if(province == "安徽省")
+				return "皖";
+			else if(province == "福建省")
+				return "闽";
+			else if(province == "江西省")
+				return "赣";
+			else if(province == "山东省")
+				return "鲁";
+			else if(province == "河南省")
+				return "豫";
+			else if(province == "湖北省")
+				return "鄂";
+			else if(province == "湖南省")
+				return "湘";
+			else if(province == "广东省")
+				return "粤";
+			else if(province == "海南省")
+				return "琼";
+			else if(province == "四川省")
+				return "川/蜀";
+			else if(province == "贵州省")
+				return "黔/贵";
+			else if(province == "云南省")
+				return "云/滇";
+			else if(province == "陕西省")
+				return "陕/秦";
+			else if(province == "甘肃省")
+				return "甘/陇";
+			else if(province == "青海省")
+				return "青";
+			else if(province == "台湾省")
+				return "台";
+			else if(province == "内蒙古自治区")
+				return "内蒙古";
+			else if(province == "广西壮族自治区")
+				return "桂";
+			else if(province == "宁夏回族自治区")
+				return "宁";
+			else if(province == "新疆维吾尔自治区 ")
+				return "新";
+			else if(province == "西藏自治区")
+				return "藏";
+			else if(province == "香港特别行政区")
+				return "港";
+			else if(province == "澳门特别行政区")
+				return "澳";
+		}
 
-        /*function setV(obj){
-            var a =  $(obj).attr("id");
-            var b = $("#province").val();
-            var c = provinceForShort(b);//开票单位所在省/直辖市简称
-            var date=new Date;
-            var year=date.getFullYear();
-            var month=date.getMonth()+1;
-            month =(month<10 ? "0"+month:month);
-            var mydate = (year.toString()+month.toString());
-            var timestamp="["+mydate+"]";//获取固定格式年月
+		function setVs(obj){
+			var a = $(obj).attr("id");
+			var b = a.replace('allPrice','proportion');
+			var value = obj.value;
+			var p = $("#price").val() || 0;
+			if(!p || p == 0){
+				parent.layer.msg("请先填写造价指标,且不能为零",{icon:5});
+				return;
+			}
+			var num = value/p ;
+			if(!/^\d+(\.\d{1,2})?$/.test( value )){
+				parent.layer.msg("合价必须输入数字",{icon:5});
+			}else{
+				$("#" +  b ).val(parseFloat(num.toFixed(2)));
+			}
+		}
+		function setTaxMoney(obj){
+			var a = $(obj).attr("id");
+			var b = a.replace('tax','taxMoney');
+			var t = a.replace('tax','totalMoney');
+			var tr = a.replace('tax','taxRate');
+			var value = obj.value || 0;
+			console.log("-value----"+value);
+			var tax = 1 + value/100;
+			console.log("-tax----"+tax);
+			var p = $("#" +  t ).val() || 0;//获取价税合计
+			console.log("-----"+p);
+			if(!p || p == 0){
+				parent.layer.msg("请先填写价税合计,且不能为零",{icon:5});
+				return;
+			}
+			var num = p/tax || 0;
+			console.log("-----"+num);
+			if(!/^\d+(\.\d{1,2})?$/.test( tax )){
+				parent.layer.msg("税率必须输入数字",{icon:5});
+			}else{
+				$("#" +  b ).val(parseFloat(num.toFixed(2)));
+				var taxRate = p - num;
+				$("#" +  tr ).val(parseFloat(taxRate.toFixed(2)));
+			}
+		}
+		function setV(obj){
+			var a =  $(obj).attr("id");
+			var c = "京";
+			var date=new Date;
+			var year=date.getFullYear();
+			var month=date.getMonth()+1;
+			month =(month<10 ? "0"+month:month);
+			var mydate = (year.toString()+month.toString());
+			var timestamp="["+mydate+"]";//获取固定格式年月
 			var number = c+timestamp;
-            $("#" +  a ).val(number);
-        }*/
-        function setV(obj){
-            var a =  $(obj).attr("id");
-            var c = "京";
-            var date=new Date;
-            var year=date.getFullYear();
-            var month=date.getMonth()+1;
-            month =(month<10 ? "0"+month:month);
-            var mydate = (year.toString()+month.toString());
-            var timestamp="["+mydate+"]";//获取固定格式年月
-            var number = c+timestamp;
-            $("#" +  a ).val(number);
-        }
+			$("#" +  a ).val(number);
+		}
 	</script>
 </head>
 <body>
 <div class="single-form">
 	<div class="container">
-		<form:form id="inputForm" modelAttribute="workInvoice" action="${ctx}/workinvoice/workInvoice/saveAudit" method="post" class="form-horizontal">
+		<form:form id="inputForm" modelAttribute="workInvoice" action="${ctx}/workinvoice/workInvoice/cancellationSaveAudit" method="post" class="form-horizontal">
 			<form:hidden path="id"/>
 			<form:hidden path="invoiceDate"/>
 			<form:hidden path="home"/>
@@ -342,162 +311,134 @@
 			<form:hidden path="act.procDefId"/>
 			<form:hidden id="flag" path="act.flag"/>
 			<form:hidden path="province" id="province"/>
-			<%--<form:hidden path="invoiceNumber"/>--%>
 
-			<div class="form-group layui-row first lw14">
+			<div class="form-group layui-row first">
 				<div class="form-group-label"><h2>基本信息</h2></div>
 				<div class="layui-item layui-col-sm6">
 					<label class="layui-form-label"><span class="require-item">*</span>项目名称:</label>
-					<div class="layui-input-block  with-icon">
-						<input type="hidden" value="" id ="ids">
-						<sys:gridselectcallprojectt url="${ctx}/workinvoice/workInvoice/selectproject" id="project" name="project.id"  value="${workInvoice.project.id}"  title="选择所属项目" labelName="workInvoice.project.projectName"
-													labelValue="${workInvoice.project.projectName}" cssClass="form-control required layui-input" fieldLabels="项目" fieldKeys="projectName" searchLabel="项目名称" searchKey="projectName" ></sys:gridselectcallprojectt>
+					<div class="layui-input-block">
+						<input htmlEscape="false" readonly="true"   class="form-control layui-input" value="${workInvoice.project.projectName}"/>
 					</div>
 				</div>
 				<div class="layui-item layui-col-sm6">
-					<label class="layui-form-label">发票申请编号:</label>
+					<label class="layui-form-label"><span class="require-item">*</span>发票申请编号:</label>
 					<div class="layui-input-block">
 						<div class="input-group">
-							<form:input path="number" htmlEscape="false" readonly="true"   class="form-control layui-input"/>
-							<span class="input-group-btn">
-								<label class="form-status"><c:choose><c:when test="${ empty workInvoice.invoiceState}">新添</c:when><c:otherwise>${fns:getDictLabel(workInvoice.invoiceState, 'audit_state','')}</c:otherwise>	</c:choose></label>
-							</span>
+							<input htmlEscape="false" readonly="true"   class="form-control layui-input" value="${workInvoice.number}"/>
 						</div>
 					</div>
 				</div>
 				<div class="layui-item layui-col-sm6">
 					<label class="layui-form-label"><span class="require-item">*</span>合同名称:</label>
 					<div class="layui-input-block">
-						<form:input id ="cInfoName" path="project.workContractInfo.name" htmlEscape="false"  readonly="true" class="form-control layui-input"/>
+						<input htmlEscape="false" readonly="true"   class="form-control layui-input" value="${workInvoice.project.workContractInfo.name}"/>
 					</div>
 				</div>
 				<div class="layui-item layui-col-sm6">
 					<label class="layui-form-label"><span class="require-item">*</span>项目编号:</label>
 					<div class="layui-input-block">
-						<form:input id ="pNumber" path="project.projectId" htmlEscape="false"  readonly="true" class="form-control layui-input"/>
+						<input htmlEscape="false" readonly="true"   class="form-control layui-input" value="${workInvoice.project.projectId}"/>
 					</div>
 				</div>
 				<div class="layui-item layui-col-sm6">
 					<label class="layui-form-label"><span class="require-item">*</span>委托方:</label>
 					<div class="layui-input-block">
-						<form:input id ="cName" path="project.workContractInfo.client.name" htmlEscape="false"  readonly="true" class="form-control layui-input"/>
+						<input htmlEscape="false" readonly="true"   class="form-control layui-input" value="${workInvoice.project.workContractInfo.client.name}"/>
 					</div>
 				</div>
-				<%--<div class="layui-item layui-col-sm6">--%>
-					<%--<label class="layui-form-label"><span class="require-item">*</span>所属部门:</label>--%>
-					<%--<div class="layui-input-block">--%>
-						<%--<form:input id ="officeName" path="office.name" htmlEscape="false"  readonly="true" class="form-control layui-input"/>--%>
-						<%--<form:hidden path="office.id" id ="officeId" />--%>
-					<%--</div>--%>
-				<%--</div>--%>
 			</div>
-			<div class="form-group layui-row first lw14">
+			<div class="form-group layui-row first">
 				<div class="form-group-label"><h2>发票详情</h2></div>
 				<div class="layui-item layui-col-sm6">
 					<label class="layui-form-label"><span class="require-item">*</span>上级/本公司开票:</label>
 					<div class="layui-input-block">
-						<c:choose>
-							<c:when test="${workInvoice.invoiceState == 4}">
-								<c:choose>
-									<c:when test="${workInvoice.ext ==0}">
-										<input value = "本公司开票" readonly="true" class="form-control layui-input"/>
-									</c:when>
-									<c:otherwise>
-										<input value = "上级公司开票" readonly="true"  class="form-control layui-input"/>
-									</c:otherwise>
-								</c:choose>
-							</c:when>
-							<c:otherwise>
-								<input type="radio" class="i-checks" name="ext" checked id="ext" value="0">
-								<label for="ext">本公司开票</label>
-								<input type="radio" class="i-checks" name="ext" id="ext1" value="1">
-								<label for="ext1">上级公司开票</label>
-							</c:otherwise>
-						</c:choose>
+						<input htmlEscape="false" readonly="true"   class="form-control layui-input" value="<c:choose><c:when test="${workInvoice.ext eq '0'}">本公司开票	</c:when><c:when test="${workInvoice.ext eq '1'}">上级公司开票</c:when></c:choose>"/>
 					</div>
 				</div>
 				<div class="layui-item layui-col-sm6">
 					<label class="layui-form-label"><span class="require-item">*</span>发票类型:</label>
 					<div class="layui-input-block">
-						<input type="radio" class="i-checks" name="invoiceType" checked id="invoiceType1" value="1">
-						<label for="invoiceType1">专票</label>
-						<input type="radio" class="i-checks" name="invoiceType" id="invoiceType" value="2">
-						<label for="invoiceType">普票</label>
+						<input htmlEscape="false" readonly="true"   class="form-control layui-input" value="<c:choose><c:when test="${workInvoice.invoiceType eq '1'}">专票</c:when><c:when test="${workInvoice.invoiceType eq '2'}">普票</c:when></c:choose>"/>
 					</div>
 				</div>
 				<div class="layui-item layui-col-sm6">
 					<label class="layui-form-label"><span class="require-item">*</span>实际开票单位:</label>
-					<div class="layui-input-block with-icon">
-						<sys:gridselect url="${ctx}/workinvoice/workInvoice/selectclient" id="client" name="client.id"  value="${workInvoice.client.id}"  title="选择开票单位" labelName="workInvoice.client.name"
-										labelValue="${workInvoice.client.name}" cssClass="form-control required layui-input" fieldLabels="单位" fieldKeys="name" searchLabel="客户名称" searchKey="name" ></sys:gridselect>
-						</td>
+					<div class="layui-input-block">
+						<input htmlEscape="false" readonly="true"   class="form-control layui-input" value="${workInvoice.client.name}"/>
 					</div>
 				</div>
 				<div class="layui-item layui-col-sm6">
-					<label class="layui-form-label"><span class="require-item invoicetype">*</span>纳税人识别号:</label>
+					<label class="layui-form-label">纳税人识别号:</label>
 					<div class="layui-input-block">
-						<form:input id="orUnicode" path="orUnicode" htmlEscape="false"    class="form-control isUscCode layui-input"/>
+						<input htmlEscape="false" readonly="true"   class="form-control layui-input" value="${workInvoice.orUnicode}"/>
 					</div>
 				</div>
 				<div class="layui-item layui-col-sm6">
-					<label class="layui-form-label"><span class="require-item invoicetype">*</span>地址:</label>
+					<label class="layui-form-label">地址:</label>
 					<div class="layui-input-block">
-						<form:input id="address" path="address" htmlEscape="false"    class="form-control layui-input"/>
+						<input htmlEscape="false" readonly="true"   class="form-control layui-input" value="${workInvoice.address}"/>
 					</div>
 				</div>
 				<div class="layui-item layui-col-sm6">
-					<label class="layui-form-label"><span class="require-item invoicetype">*</span>电话:</label>
+					<label class="layui-form-label">电话:</label>
 					<div class="layui-input-block">
-						<form:input id="telephone" path="telephone" htmlEscape="false"    class="form-control isTel layui-input"/>
+						<input htmlEscape="false" readonly="true"   class="form-control layui-input" value="${workInvoice.telephone}"/>
 					</div>
 				</div>
 				<div class="layui-item layui-col-sm6">
-					<label class="layui-form-label"><span class="require-item invoicetype">*</span>开户银行:</label>
-					<div class="layui-input-block">
-						<form:input id ="bank"  path="bank" htmlEscape="false"   class="form-control layui-input"/>
+					<label class="layui-form-label">开户银行:</label>
+					<div class="layui-input-block  ">
+						<input htmlEscape="false" readonly="true"   class="form-control layui-input" value="${workInvoice.bank}"/>
 					</div>
 				</div>
 				<div class="layui-item layui-col-sm6">
-					<label class="layui-form-label"><span class="require-item invoicetype">*</span>银行账号:</label>
+					<label class="layui-form-label">银行账号:</label>
 					<div class="layui-input-block">
-						<form:input id="bankNumber" path="bankNumber" htmlEscape="false"   class="form-control number layui-input"/>
+						<input htmlEscape="false" readonly="true"   class="form-control layui-input" value="${workInvoice.bankNumber}"/>
 					</div>
 				</div>
-				<div class="layui-item layui-col-sm12">
+				<div class="layui-item layui-col-sm6">
 					<label class="layui-form-label"><span class="require-item">*</span>价税合计(元):</label>
 					<div class="layui-input-block">
-						<input name="money" htmlEscape="false"  value="<fmt:formatNumber value="${workInvoice.money}" pattern="#.00#"/>" class="form-control required number layui-input"/>
+						<input htmlEscape="false" readonly="true"   class="form-control layui-input" value="<fmt:formatNumber value="${workInvoice.money}" pattern="#,#00.00"/>"/>
 					</div>
 				</div>
-				<div class="layui-item layui-col-sm12 with-textarea">
+				<div class="layui-item layui-col-sm6">
 					<label class="layui-form-label">开票内容要求:</label>
 					<div class="layui-input-block">
-						<form:textarea path="content" id="contractTypeDoc" htmlEscape="false" rows="4"    class="form-control"/>
+						<input htmlEscape="false" readonly="true"   class="form-control layui-input" value="${workInvoice.content}"/>
 					</div>
 				</div>
 				<div class="layui-item layui-col-sm6">
 					<label class="layui-form-label">开票人:</label>
 					<div class="layui-input-block">
-						<form:input id=""  path="" htmlEscape="false" readonly="true"  class="form-control layui-input"/>
+						<input htmlEscape="false" readonly="true"   class="form-control layui-input" value="${workInvoice.drawerName}"/>
 					</div>
 				</div>
 				<div class="layui-item layui-col-sm6">
 					<label class="layui-form-label">开票时间:</label>
 					<div class="layui-input-block">
-						<form:input id=""  path="" htmlEscape="false" readonly="true" class="form-control layui-input"/>
+						<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="<fmt:formatDate value="${workInvoice.invoiceDate}" pattern="yyyy-MM-dd"/>"/>
 					</div>
 				</div>
-				<div class="layui-item layui-col-sm6">
+				<div class="layui-item layui-col-sm12">
 					<label class="layui-form-label">领票时间:</label>
 					<div class="layui-input-block">
-						<form:input id=""  path="" htmlEscape="false" readonly="true" class="form-control layui-input"/>
+						<input htmlEscape="false"  readonly="true" class="form-control layui-input" value="<fmt:formatDate value="${workInvoice.takeDate}" pattern="yyyy-MM-dd"/>"/>
+					</div>
+				</div>
+
+				<div class="layui-item layui-col-sm12">
+					<label class="layui-form-label"><span class="require-item">*</span>作废原因:</label>
+					<div class="layui-input-block">
+						<form:textarea path="cancellationRemark" htmlEscape="false" rows="4"  maxlength="255"  class="form-control required"/>
 					</div>
 				</div>
 			</div>
 			<div class="form-group layui-row">
 				<div class="form-group-label"><h2>发票明细</h2></div>
 				<div class="layui-item layui-col-xs12 form-table-container">
-					<table id="contentTable" class="table table-bordered table-condensed can-edit">
+					<table id="contentTable" class="table table-bordered table-condensed details">
 						<thead>
 						<tr>
 							<th><span class="require-item">*</span>发票代码</th>
@@ -507,69 +448,61 @@
 							<th><span class="require-item">*</span>金额</th>
 							<th><span class="require-item">*</span>税额</th>
 							<th><span class="require-item">*</span>累计登记金额</th>
-							<th width="150px">操作</th>
+							<th><span class="require-item">*</span>发票状态</th><%--正常--%>
+							<th><span class="require-item">*</span>被退标记</th>
+								<%--<th><span class="require-item">*</span>被退票号</th>
+                                <th><span class="require-item">*</span>开票日期</th>--%>
 						</tr>
 						</thead>
 						<tbody id="workAccountList">
-						</tbody>
-					</table>
-					<script type="text/template" id="workAccountListTpl">//<!--
-                                    <tr id="workAccountList{{idx}}">
-                                        <td class="hide">
-                                            <input id="workAccountList{{idx}}_id" name="workAccountList[{{idx}}].id" type="hidden" value="{{row.id}}"/>
-                                            <input id="workAccountList{{idx}}_delFlag" name="workAccountList[{{idx}}].delFlag" type="hidden" value="0"/>
-                                        </td>
-                                    	<td>
-                                        	<input id="workAccountList{{idx}}_code" name="workAccountList[{{idx}}].code" type="text" value="{{row.code}}"    class="form-control required"/>
-                                   		 </td>
-                                    	 <td>
-                                        	<input id="workAccountList{{idx}}_number" name="workAccountList[{{idx}}].number" type="text" value="{{row.number}}"    class="form-control required"/>
-                                   		 </td>
-                                    	<td>
-                                            <input id="workAccountList{{idx}}_totalMoney"  name="workAccountList[{{idx}}].totalMoney" type="text" value="{{row.totalMoney}}"    class="form-control required"/>
-                                        </td>
-                                        <td>
-                                        <div class="input-group">
-                                            <input id="workAccountList{{idx}}_tax" onblur="setTaxMoney(this)" name="workAccountList[{{idx}}].tax" type="text" value="{{row.tax}}"    class="form-control number required"/><span class="input-group-addon">%</span>
-                                            </div>
-
-                                        </td>
-                                        <td>
-                                            <input id="workAccountList{{idx}}_taxMoney" name="workAccountList[{{idx}}].taxMoney" type="text" value="{{row.taxMoney}}"    class="form-control required"/>
-                                        </td>
-										<td>
-                                            <input id="workAccountList{{idx}}_taxRate" name="workAccountList[{{idx}}].taxRate" type="text" value="{{row.taxRate}}"    class="form-control required"/>
-                                        </td>
-                                        <td>
-                                            <input id="workAccountList{{idx}}_incomeMoney" name="workAccountList[{{idx}}].incomeMoney" type="text" value="0"  readonly="true"  class="form-control required"/>
-                                        </td>
-
-                                            <input id="workAccountList{{idx}}_state" name="workAccountList[{{idx}}].state"  type="hidden" value="正常"   class="form-control"/>
-
-                                            <input id="workAccountList{{idx}}_backSign" name="workAccountList[{{idx}}].backSign"  type="hidden" value="正常"  readonly="true"  class="form-control required"/>
-
-                                            <input id="workAccountList{{idx}}_backNumber" name="workAccountList[{{idx}}].backNumber"  type="hidden" value=""  readonly="true"  class="form-control required"/>
+						<c:if test="${not empty workInvoice.workAccountList}">
+							<c:forEach items="${workInvoice.workAccountList}" var="workAccount" varStatus="index">
+								<tr id="workAccountList${index.index}">
+									<td title="${workAccount.code}">
+											${workAccount.code}
+									</td>
+									<td title="${workAccount.number}">
+											${workAccount.number}
+									</td>
 
-
-                                        <td class="text-center" width="10">
-                                            {{#delBtn}}<span class="close" onclick="delRow(this, '#workAccountList{{idx}}')" title="删除">&times;</span>{{/delBtn}}
+									<td title="<fmt:formatNumber value="${workAccount.totalMoney}" pattern="#,#00.00"/>">
+										<fmt:formatNumber value="${workAccount.totalMoney}" pattern="#,#00.00"/>
+									</td>
+									<td title="${workAccount.tax}">
+											${workAccount.tax}
+									</td>
+									<td title="<fmt:formatNumber value="${workAccount.taxMoney}" pattern="#,#00.00"/>">
+										<fmt:formatNumber value="${workAccount.taxMoney}" pattern="#,#00.00"/>
+									</td>
+									<td title="<fmt:formatNumber value="${workAccount.taxRate}" pattern="#,#00.00"/>">
+										<fmt:formatNumber value="${workAccount.taxRate}" pattern="#,#00.00"/>
+									</td>
+									<td title="<fmt:formatNumber value="${workAccount.incomeMoney}" pattern="#,#00.00"/>">
+										<fmt:formatNumber value="${workAccount.incomeMoney}" pattern="#,#00.00"/>
+									</td>
+									<td title="${workAccount.state}">
+											${workAccount.state}
+									</td>
+									<td title="${workAccount.backSign}">
+											${workAccount.backSign}
+									</td>
+										<%--<td title="${workAccount.backNumber}">
+                                                ${workAccount.backNumber}
                                         </td>
-                                    </tr>//-->
-					</script>
-					<script type="text/javascript">
-                        var workAccountListRowIdx = 0, workAccountListTpl = $("#workAccountListTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
-                        $(document).ready(function() {
-                            var data = ${fns:toJson(workInvoice.workAccountList)};
-                            for (var i=0; i<data.length; i++){
-                                addRow('#workAccountList', workAccountListRowIdx, workAccountListTpl, data[i]);
-                                workAccountListRowIdx = workAccountListRowIdx + 1;
-                            }
-                        });
-					</script></div>
+                                        <td title="<fmt:formatDate value="${workInvoice.invoiceDate}" pattern="yyyy-MM-dd"/>">
+                                            <fmt:formatDate value="${workInvoice.invoiceDate}" pattern="yyyy-MM-dd"/>
+                                        </td>--%>
+								</tr>
+							</c:forEach>
+						</c:if>
+						</tbody>
+					</table>
+				</div>
 			</div>
 			<div class="form-group layui-row page-end"></div>
 		</form:form>
 	</div>
 </div>
+
 </body>
 </html>

+ 20 - 0
src/main/webapp/webpage/modules/workinvoice/workInvoiceList.jsp

@@ -395,6 +395,22 @@
 						{
 							xml +="<a href=\"javascript:void(0)\" onclick=\"openDialogreplay('作废发票', '${ctx}/workinvoice/workInvoice/cancellationForm?id=" + d.id + "&tabId=3','95%','95%')\" class=\"op-btn op-btn-invalid\" ><i class=\"fa fa-trash-o\"></i> 作废</a>";
 						}
+						if(d.conditionCanedit != undefined && d.conditionCanedit =="1")
+						{
+							xml +="<a href=\"javascript:void(0)\" onclick=\"openDialogreplay('作废修改发票', '${ctx}/workinvoice/workInvoice/cancellationForm?id=" + d.id + "&tabId=3','95%','95%')\" class=\"op-btn op-btn-edit\" ><i class=\"fa fa-edit\"></i> 修改</a>";
+						}
+						if(d.conditionCanedit3 != undefined && d.conditionCanedit3 =="1")
+						{
+							xml +="<a href=\"javascript:void(0)\" onclick=\"openDialogreplay('重新申请发票', '${ctx}/workinvoice/workInvoice/cancellationForm?id=" + d.id + "&tabId=4','95%','95%')\" class=\"op-btn op-btn-edit\" ><i class=\"fa fa-edit\"></i> 修改</a>";
+						}
+						if(d.conditionCandelete != undefined && d.conditionCandelete =="1")
+						{
+							xml += "<a href=\"${ctx}/workinvoice/workInvoice/cancellationDelete?id=" + d.id + "\" onclick=\"return confirmx('确认要删除该发票作废记录吗?', this.href)\"   class=\"op-btn op-btn-delete\"><i class=\"fa fa-trash\"></i> 删除</a>";
+						}
+						if(d.conditionCancancel != undefined && d.conditionCancancel =="1")
+						{
+							xml += "<a href=\"${ctx}/workinvoice/workInvoice/conditionCancelInvalidate?id="+ d.id +"\" onclick=\"return confirmx('确认要强制撤回?', this.href)\" class=\"op-btn op-btn-cancel\" ><i class=\"glyphicon glyphicon-share-alt\"></i> 作废撤回</a>";
+						}
 
 						if(d.adminFlag != undefined && d.adminFlag =="1")
 						{
@@ -430,9 +446,13 @@
                     ,"receiptMoneyDate":"<fmt:formatDate value="${workInvoice.receiptMoneyDate}" pattern="yyyy-MM-dd"/>"
                     <c:if test="${workInvoice.invoiceState == 1 && fns:getUser().id == workInvoice.createBy.id}"><shiro:hasPermission name="workinvoice:workInvoice:edit">,"canedit1":"1"</shiro:hasPermission></c:if><%--暂存-修改--%>
                     <c:if test="${workInvoice.invoiceState == '4' && fns:getUser().id == workInvoice.createBy.id}">,"canedit2":"1"</c:if><%--驳回--修改--%>
+                    <c:if test="${workInvoice.invoiceState == '9' && fns:getUser().id == workInvoice.createBy.id}">,"conditionCanedit":"1"</c:if><%--驳回--修改--%>
+                    <c:if test="${workInvoice.invoiceState == '11' && fns:getUser().id == workInvoice.createBy.id}">,"conditionCanedit3":"1"</c:if><%--作废撤回--修改--%>
                     <c:if test="${workInvoice.invoiceState == '3' && fns:getUser().id == workInvoice.createBy.id}">,"canedit3":"1"</c:if><%--撤回--修改--%>
                     <c:if test="${fns:getUser().id == workInvoice.createBy.id}"><c:if test="${workInvoice.invoiceState == '1' or workInvoice.invoiceState == '3' or workInvoice.invoiceState == '4'}"><shiro:hasPermission name="workinvoice:workInvoice:del">,"candelete":"1"</shiro:hasPermission></c:if></c:if>
+                    <c:if test="${fns:getUser().id == workInvoice.createBy.id}"><c:if test="${workInvoice.invoiceState == '9' || workInvoice.invoiceState == '11' }">,"conditionCandelete":"1"</c:if></c:if>
                     <c:if test="${workInvoice.invoiceState == '2' && fns:getUser().id == workInvoice.createBy.id}">,"cancancel":"1"</c:if>
+                    <c:if test="${workInvoice.invoiceState == '6' && fns:getUser().id == workInvoice.createBy.id}">,"conditionCancancel":"1"</c:if>
 					<shiro:hasPermission name="workinvoice:workInvoice:alteredit">
                     <c:if test="${workInvoice.invoiceState == '5'}">,"canalter":"1"</c:if>
                     </shiro:hasPermission>