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

发票添加负数红冲关联已开发票信息

user5 пре 10 месеци
родитељ
комит
3870c1fd26
22 измењених фајлова са 1394 додато и 71 уклоњено
  1. 13 0
      src/main/java/com/jeeplus/modules/workinvoice/dao/WorkInvoiceDao.java
  2. 37 0
      src/main/java/com/jeeplus/modules/workinvoice/entity/WorkInvoice.java
  3. 75 44
      src/main/java/com/jeeplus/modules/workinvoice/service/WorkInvoiceService.java
  4. 39 0
      src/main/java/com/jeeplus/modules/workinvoice/web/WorkInvoiceController.java
  5. 57 0
      src/main/java/com/jeeplus/modules/workinvoice/web/WorkInvoiceTwoController.java
  6. 25 0
      src/main/java/com/jeeplus/modules/workprojectnotify/web/WorkProjectNotifyController.java
  7. 1 1
      src/main/resources/mappings/modules/workcontractinfo/WorkContractInfoDao.xml
  8. 182 5
      src/main/resources/mappings/modules/workinvoice/WorkInvoiceDao.xml
  9. 79 2
      src/main/webapp/webpage/modules/workinvoice/workInvoiceAllForm.jsp
  10. 115 2
      src/main/webapp/webpage/modules/workinvoice/workInvoiceAllModify.jsp
  11. 44 2
      src/main/webapp/webpage/modules/workinvoice/workInvoiceAudit.jsp
  12. 37 0
      src/main/webapp/webpage/modules/workinvoice/workInvoiceAuditEnd.jsp
  13. 35 0
      src/main/webapp/webpage/modules/workinvoice/workInvoiceExamineAudit.jsp
  14. 35 0
      src/main/webapp/webpage/modules/workinvoice/workInvoiceExamineAuditEnd.jsp
  15. 96 3
      src/main/webapp/webpage/modules/workinvoice/workInvoiceExamineModify.jsp
  16. 93 3
      src/main/webapp/webpage/modules/workinvoice/workInvoiceModify.jsp
  17. 35 0
      src/main/webapp/webpage/modules/workinvoice/workInvoiceNotProjectAudit.jsp
  18. 36 0
      src/main/webapp/webpage/modules/workinvoice/workInvoiceNotProjectAuditEnd.jsp
  19. 124 2
      src/main/webapp/webpage/modules/workinvoice/workInvoiceNotProjectModify.jsp
  20. 79 2
      src/main/webapp/webpage/modules/workinvoice/workInvoiceTwoForm.jsp
  21. 114 3
      src/main/webapp/webpage/modules/workinvoice/workInvoiceTwoModify.jsp
  22. 43 2
      src/main/webapp/webpage/modules/workinvoice/workInvoiceView.jsp

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

@@ -193,4 +193,17 @@ public interface WorkInvoiceDao extends CrudDao<WorkInvoice> {
 	 * @return
 	 */
 	String getInvoiceMoneyByMonthAndOfficeList(@Param("beginDate")String beginDate, @Param("endDate")String endDate , @Param("officeIdList")List<String>officeIdList);
+
+
+
+	/**
+	 * 查询超期未收款的发票信息(开票日期距今超过一个月的发票信息)
+	 * @return
+	 */
+	List<WorkInvoice>  findListOnRedInvoice(WorkInvoice workInvoice);
+	/**
+	 * 查询超期未收款的发票信息(开票日期距今超过一个月的发票信息)
+	 * @return
+	 */
+	Integer queryCountOnRedInvoice(WorkInvoice workInvoice);
 }

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

@@ -126,6 +126,11 @@ public class WorkInvoice extends ActEntity<WorkInvoice> {
 
 	private Integer electronicInvoiceFlag ;	//是否已经上传电子发票信息(0:未上传;1:已上传)
 
+	private Integer redInvoiceFlag; //是否红字发票
+	private String redInvoiceRelevancyId;	//红字发票关联其他发票id
+	private String redInvoiceRelevancyNumber;	//红字发票关联其他发票编号
+	private List<String> redNotStatusList;
+
 	public String getComment() {
 		return comment;
 	}
@@ -892,4 +897,36 @@ public class WorkInvoice extends ActEntity<WorkInvoice> {
 	public void setTakeDateCpa(String takeDateCpa) {
 		this.takeDateCpa = takeDateCpa;
 	}
+
+	public Integer getRedInvoiceFlag() {
+		return redInvoiceFlag;
+	}
+
+	public void setRedInvoiceFlag(Integer redInvoiceFlag) {
+		this.redInvoiceFlag = redInvoiceFlag;
+	}
+
+	public String getRedInvoiceRelevancyId() {
+		return redInvoiceRelevancyId;
+	}
+
+	public void setRedInvoiceRelevancyId(String redInvoiceRelevancyId) {
+		this.redInvoiceRelevancyId = redInvoiceRelevancyId;
+	}
+
+	public String getRedInvoiceRelevancyNumber() {
+		return redInvoiceRelevancyNumber;
+	}
+
+	public void setRedInvoiceRelevancyNumber(String redInvoiceRelevancyNumber) {
+		this.redInvoiceRelevancyNumber = redInvoiceRelevancyNumber;
+	}
+
+	public List<String> getRedNotStatusList() {
+		return redNotStatusList;
+	}
+
+	public void setRedNotStatusList(List<String> redNotStatusList) {
+		this.redNotStatusList = redNotStatusList;
+	}
 }

+ 75 - 44
src/main/java/com/jeeplus/modules/workinvoice/service/WorkInvoiceService.java

@@ -270,6 +270,18 @@ public class WorkInvoiceService extends CrudService<WorkInvoiceDao, WorkInvoice>
 		return page;
 
 	}
+
+	public Page<WorkInvoice> findPageOnRedInvoice(Page<WorkInvoice> page, WorkInvoice workInvoice) {
+		workInvoice.getSqlMap().put("dsf", invoiceDataScopeFilter(workInvoice.getCurrentUser(), "o", "u","s", MenuStatusEnum.WORK_INVOICE.getValue()));
+		int count = dao.queryCountOnRedInvoice(workInvoice);
+		page.setCount(count);
+		page.setCountFlag(false);
+		workInvoice.setPage(page);
+		page.setList(dao.findListOnRedInvoice(workInvoice));
+		return page;
+
+	}
+
 	public Page<WorkInvoice> findListExport(Page<WorkInvoice> page, WorkInvoice workInvoice) {
 		workInvoice.getSqlMap().put("dsf", dataScopeFilter(workInvoice.getCurrentUser(), "o", "u","s", MenuStatusEnum.WORK_INVOICE.getValue()));
 		if(StringUtils.isNotBlank(workInvoice.getOfficeId())){
@@ -3679,63 +3691,82 @@ public class WorkInvoiceService extends CrudService<WorkInvoiceDao, WorkInvoice>
 		// 格式化日期(可选)
 		DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
 		String invoiceDate = previousMonthDate.format(formatter);
-
+		//查询超过一个月没有收款的数据
 		List<WorkInvoice> overDueGatheringInvoiceList = workInvoiceDao.getOverDueGatheringInvoiceList(invoiceDate);
 
+
+		Set<String> workInvoiceIdSet = new HashSet<>();
+
 		for (WorkInvoice workInvoice : overDueGatheringInvoiceList) {
+			//判定发票金额是否为负数,如果为负数,查看其关联的红冲发票id
+			if(workInvoice.getMoney()<0){
+				workInvoiceIdSet.add(workInvoice.getId());
+				if(StringUtils.isNotBlank(workInvoice.getRedInvoiceRelevancyId())){
+					workInvoiceIdSet.add(workInvoice.getRedInvoiceRelevancyId());
+				}
+			}
+		}
+		List<String> workInvoiceIdList = Lists.newArrayList(workInvoiceIdSet);
+		//发票idlist转String 方便判断
+		String workInvoiceIds = String.join(",", workInvoiceIdList);
 
-			List<WorkInvoiceProjectRelation> projectRelationList = dao.getProjectRelation(workInvoice.getId());
-			for (WorkInvoiceProjectRelation projectRelation: projectRelationList) {
-				if (null==projectRelation.getIsProject() || projectRelation.getIsProject()==1){
-					if(StringUtils.isBlank(projectRelation.getClientName())){
-						//无合同查找委托方信息
-						RuralProjectRecords records1 = ruralProjectRecordsService.get(projectRelation.getProjectId());
-						//无合同状态下,获取委托方的名称
-						if (records1.getWorkContractInfo() == null || null == records1.getWorkContractInfo().getClient() ||StringUtils.isBlank(records1.getWorkContractInfo().getClient().getName())){
-							ruralProjectRecordsService.queryLinkmanInfos(records1);
-							if (records1.getWorkClientLinkmanList() != null && records1.getWorkClientLinkmanList().size() > 0) {
-								WorkClientLinkman linkman = records1.getWorkClientLinkmanList().get(0);
-								projectRelation.setClientName(linkman.getClientId().getName());
+		for (WorkInvoice workInvoice : overDueGatheringInvoiceList) {
+			//如果发票不在红冲的数据中,则需要进行通知
+			if(!workInvoiceIds.contains(workInvoice.getId())){
+				List<WorkInvoiceProjectRelation> projectRelationList = dao.getProjectRelation(workInvoice.getId());
+				for (WorkInvoiceProjectRelation projectRelation: projectRelationList) {
+					if (null==projectRelation.getIsProject() || projectRelation.getIsProject()==1){
+						if(StringUtils.isBlank(projectRelation.getClientName())){
+							//无合同查找委托方信息
+							RuralProjectRecords records1 = ruralProjectRecordsService.get(projectRelation.getProjectId());
+							//无合同状态下,获取委托方的名称
+							if (records1.getWorkContractInfo() == null || null == records1.getWorkContractInfo().getClient() ||StringUtils.isBlank(records1.getWorkContractInfo().getClient().getName())){
+								ruralProjectRecordsService.queryLinkmanInfos(records1);
+								if (records1.getWorkClientLinkmanList() != null && records1.getWorkClientLinkmanList().size() > 0) {
+									WorkClientLinkman linkman = records1.getWorkClientLinkmanList().get(0);
+									projectRelation.setClientName(linkman.getClientId().getName());
+								}
 							}
 						}
+					}else if(projectRelation.getIsProject()==2){
+						projectRelation.setProjectName("内容");
+						projectRelation.setWorkContractName(projectRelation.getDetails());
 					}
-				}else if(projectRelation.getIsProject()==2){
-					projectRelation.setProjectName("内容");
-					projectRelation.setWorkContractName(projectRelation.getDetails());
 				}
-			}
-			workInvoice.setWorkInvoiceProjectRelationList(projectRelationList);
+				workInvoice.setWorkInvoiceProjectRelationList(projectRelationList);
 
-			//项目名称获取
-			List<String> projectNameList = getProjectNameList(workInvoice);
-			String projectNameStr = String.join(",", projectNameList);
-			WorkProjectNotify notify = new WorkProjectNotify();
-			notify.setNotifyId(workInvoice.getId());
+				//项目名称获取
+				List<String> projectNameList = getProjectNameList(workInvoice);
+				String projectNameStr = String.join(",", projectNameList);
+				WorkProjectNotify notify = new WorkProjectNotify();
+				notify.setNotifyId(workInvoice.getId());
 
-			String notifyStr = "项目【"+ projectNameStr +"】。发票申请编号:" + workInvoice.getNumber() + "未收款。";
-			String titleStr = "项目【"+ projectNameStr +"】。发票申请编号:" + workInvoice.getNumber() + "未收款。开票距今:"+workInvoice.getAdventDate() + "天。";
+				String notifyStr = "项目【"+ projectNameStr +"】。发票申请编号:" + workInvoice.getNumber() + "未收款。";
+				String titleStr = "项目【"+ projectNameStr +"】。发票申请编号:" + workInvoice.getNumber() + "未收款。开票距今:"+workInvoice.getAdventDate() + "天。";
 
-			//根据标题查询通知信息中是否存在未读的信息,有则进行更新并对重复数量进行+1操作
-			WorkProjectNotify byTitleAndUnread = workProjectNotifyService.getByTitleAndUnread(notifyStr,workInvoice.getCreateBy().getId());
+				//根据标题查询通知信息中是否存在未读的信息,有则进行更新并对重复数量进行+1操作
+				WorkProjectNotify byTitleAndUnread = workProjectNotifyService.getByTitleAndUnread(notifyStr,workInvoice.getCreateBy().getId());
 
-			if(null != byTitleAndUnread){
-				//将所有的被通知人的该条通知均调整为已读,然后将最后一条数据进行调整
-				workProjectNotifyService.deleteByNotifyUser(notifyStr,workInvoice.getCreateBy().getId());
-				byTitleAndUnread.setExigency("1");
-				byTitleAndUnread.setTitle(titleStr);
-				workProjectNotifyService.updateOverDueInfo(byTitleAndUnread);
-			}else{
-				workProjectNotifyService
-						.save(UtilNotify.saveNotify(workInvoice.getId(),
-								workInvoice.getCreateBy(),
-								workInvoice.getCompanyId(),
-								titleStr,
-								notifyStr,
-								"21",
-								"0",
-								"待通知",
-								""));
+				if(null != byTitleAndUnread){
+					//将所有的被通知人的该条通知均调整为已读,然后将最后一条数据进行调整
+					workProjectNotifyService.deleteByNotifyUser(notifyStr,workInvoice.getCreateBy().getId());
+					byTitleAndUnread.setExigency("1");
+					byTitleAndUnread.setTitle(titleStr);
+					workProjectNotifyService.updateOverDueInfo(byTitleAndUnread);
+				}else{
+					workProjectNotifyService
+							.save(UtilNotify.saveNotify(workInvoice.getId(),
+									workInvoice.getCreateBy(),
+									workInvoice.getCompanyId(),
+									titleStr,
+									notifyStr,
+									"216",
+									"0",
+									"待通知",
+									""));
+				}
 			}
+
 		}
 	}
 

+ 39 - 0
src/main/java/com/jeeplus/modules/workinvoice/web/WorkInvoiceController.java

@@ -570,6 +570,45 @@ public class WorkInvoiceController extends BaseController {
 					projectIdList.add(projectInfo.getProjectId());
 				}
 			}
+			Boolean redReturnFlag = false;
+			//对开票红冲数据做处理
+			if(0 == workInvoice.getRedInvoiceFlag()){
+				//否(不是红冲数据)
+				//判定金额是不是小于0,若是小于0,则表示应该是红冲数据,此处直接抛出
+				if(0 > workInvoice.getMoney()){
+					addMessage(redirectAttributes, "该发票金额为负数,应当为红字发票,请重新选择");
+					redReturnFlag = true;
+
+				}
+				//如果不是红冲数据,则不需要关联发票信息
+				workInvoice.setRedInvoiceRelevancyId("");
+				workInvoice.setRedInvoiceRelevancyNumber("");
+			}else if(1 == workInvoice.getRedInvoiceFlag()){
+				//是(是红冲数据)
+				//判定金额是不是 不小于0,若是不小于0,则表示不应该是红冲数据,此处直接抛出
+				if(0 <= workInvoice.getMoney()){
+					addMessage(redirectAttributes, "该发票金额为正数,不应当为红字发票,请重新选择");
+					redReturnFlag = true;
+				}
+			}
+			if(redReturnFlag){
+				switch (showFlag){
+					case "1":
+						return "redirect:"+Global.getAdminPath()+"/workinvoiceTwo/workinvoiceTwo/?repage";
+
+					case "2":
+						return "redirect:"+Global.getAdminPath()+"/workinvoiceAllTwo/workinvoiceAllTwo/?repage";
+
+					case "3":
+						return "redirect:"+Global.getAdminPath()+"/workinvoiceAll/workInvoiceAll/?repage";
+
+					default:
+						return "redirect:"+Global.getAdminPath()+"/workinvoice/workInvoice/?repage";
+
+				}
+			}
+
+
 			//1总公司0分公司
 			if(projectIdList.size()>0){
 				//根据项目id查询项目信息中的项目类别

+ 57 - 0
src/main/java/com/jeeplus/modules/workinvoice/web/WorkInvoiceTwoController.java

@@ -987,6 +987,63 @@ public class WorkInvoiceTwoController extends BaseController {
 		model.addAttribute("page", page);
 		return "modules/sys/gridInvoice";
 	}
+
+
+	/**
+	 * 选择开票单位
+	 */
+	@RequestMapping(value = "selectInvoice")
+	public String selectInvoice(WorkInvoice workInvoice, String url, String fieldLabels, String fieldKeys, String searchLabel, String searchKey, HttpServletRequest request, HttpServletResponse response, Model model) {
+		List<String> redNotStatusList = Lists.newArrayList();
+		redNotStatusList.add("1");
+		redNotStatusList.add("2");
+		redNotStatusList.add("3");
+		redNotStatusList.add("4");
+		redNotStatusList.add("7");
+		workInvoice.setRedNotStatusList(redNotStatusList);
+
+		Page<WorkInvoice> page = workInvoiceService.findPageOnRedInvoice(new Page<WorkInvoice>(request, response), workInvoice);
+		List<WorkInvoice> workInvoiceList = page.getList();
+		for (WorkInvoice invoice: workInvoiceList) {
+			invoice.setWorkInvoiceProjectRelationList(workInvoiceService.getProjectRelation(invoice));
+			List<String> projectNameList = workInvoiceService.getProjectNameList(invoice);
+			String projectNameStr = String.join(",", projectNameList);
+			if(projectNameStr.contains("\r")){
+				projectNameStr = projectNameStr.replaceAll("\r"," ");
+			}
+			if(projectNameStr.contains("\n")){
+				projectNameStr = projectNameStr.replaceAll("\n"," ");
+			}
+			invoice.setProjectName(projectNameStr);
+			List<String> reportNumber = Lists.newArrayList();
+			for (WorkInvoiceProjectRelation info : invoice.getWorkInvoiceProjectRelationList()) {
+				if(StringUtils.isNotBlank(info.getReportDataNum()))
+					reportNumber.add(info.getReportDataNum());
+			}
+			String reportNumberStr = String.join(",", reportNumber);
+			invoice.setReportNumber(reportNumberStr);
+		}
+
+		try {
+			fieldLabels = URLDecoder.decode(fieldLabels, "UTF-8");
+			fieldKeys = URLDecoder.decode(fieldKeys, "UTF-8");
+			searchLabel = URLDecoder.decode(searchLabel, "UTF-8");
+			searchKey = URLDecoder.decode(searchKey, "UTF-8");
+		} catch (UnsupportedEncodingException e) {
+			e.printStackTrace();
+			logger.error("Exception e:"+e);
+		}
+		model.addAttribute("labelNames", fieldLabels.split("\\|"));
+		model.addAttribute("labelValues", fieldKeys.split("\\|"));
+		model.addAttribute("fieldLabels", fieldLabels);
+		model.addAttribute("fieldKeys", fieldKeys);
+		model.addAttribute("url", url);
+		model.addAttribute("searchLabel", searchLabel);
+		model.addAttribute("searchKey", searchKey);
+		model.addAttribute("obj", workInvoice);
+		model.addAttribute("page", page);
+		return "modules/sys/selectInvoice";
+	}
 	/**
 	 * 选择开票项目
 	 */

+ 25 - 0
src/main/java/com/jeeplus/modules/workprojectnotify/web/WorkProjectNotifyController.java

@@ -2301,6 +2301,8 @@ public class WorkProjectNotifyController extends BaseController {
 					} else if (workProjectNotify.getRemarks().contains("重新申请") && !"1".equals(workProjectNotify.getStatus())) {
 						return "modules/workinvoice/workInvoiceModify";
 					}
+				} else if (workProjectNotify.getType().equals("216")) {    //发票超期未收款
+					getOverDueGatheringInvoiceList(workProjectNotify,model);
 				} else if (workProjectNotify.getType().equals("212")) {    //开票管理
 					WorkInvoice workInvoice = workInvoiceService.get(workProjectNotify.getNotifyId());
 					if (StringUtils.isNotBlank(workInvoice.getId())) {
@@ -10692,4 +10694,27 @@ public class WorkProjectNotifyController extends BaseController {
 		}
 	}
 
+	/**
+	 * 业务用章申请
+	 * @param workProjectNotify
+	 * @param model
+	 * @return
+	 */
+	private String getOverDueGatheringInvoiceList(WorkProjectNotify workProjectNotify,Model model) {
+
+		WorkInvoice workInvoice = workInvoiceService.get(workProjectNotify.getNotifyId());
+		if (StringUtils.isNotBlank(workInvoice.getId())) {
+			workInvoiceService.queryDetails(workInvoice);
+		}
+		if (StringUtils.isNotBlank(workProjectNotify.getHome())) {
+			workInvoice.setHome(workProjectNotify.getHome());
+		} else {
+			workInvoice.setHome("home");
+		}
+		workInvoice.setAct(getByAct(workInvoice.getProcessInstanceId()));
+		String taskDefKey = workInvoice.getAct().getTaskDefKey();
+		model.addAttribute("workInvoice", workInvoice);
+		return "modules/workinvoice/workInvoiceView";
+	}
+
 }

+ 1 - 1
src/main/resources/mappings/modules/workcontractinfo/WorkContractInfoDao.xml

@@ -1560,7 +1560,7 @@
 		a.contract_information as "contractInformation",
 		wcr.file_num as "fileNum",
 		wcr.file_num_tow as "fileNumTow",
-		a.contract_record_state as "contrractRecordStatus"
+		a.contract_record_state as "contrractRecordStatus",
 		a.describe_content AS "describeContent"
 		FROM work_contract_info a
 		<include refid="workContractInfoJoins"/>

+ 182 - 5
src/main/resources/mappings/modules/workinvoice/WorkInvoiceDao.xml

@@ -69,7 +69,10 @@
 		a.actual_drawer_id as "actualDrawerId",
 		a.electronic_invoice_flag as "electronicInvoiceFlag",
 		a.cancellation_process_instance_id as "cancellationProcessInstanceId",
-		a.cancellation_state as "cancellationState"
+		a.cancellation_state as "cancellationState",
+		a.red_invoice_flag as "redInvoiceFlag",
+		a.red_invoice_relevancy_id as "redInvoiceRelevancyId",
+		a.red_invoice_relevancy_number as "redInvoiceRelevancyNumber"
 	</sql>
 
 	<sql id="newWorkInvoiceColumns">
@@ -133,7 +136,10 @@
 		a.new_drawer as "newDrawer",
 		a.actual_drawer_email_address as "actualDrawerEmailAddress",
 		a.actual_drawer_id as "actualDrawerId",
-		a.electronic_invoice_flag as "electronicInvoiceFlag"
+		a.electronic_invoice_flag as "electronicInvoiceFlag",
+		a.red_invoice_flag as "redInvoiceFlag",
+		a.red_invoice_relevancy_id as "redInvoiceRelevancyId",
+		a.red_invoice_relevancy_number as "redInvoiceRelevancyNumber"
 	</sql>
 
 	<sql id="workInvoiceJoins">
@@ -222,7 +228,10 @@
 		a.cancellation_remark as "cancellationRemark",
 		a.account_checking_user_id as "accountCheckingUserId",
 		a.area_id as "areaId",
-		acu.name as "accountCheckingUserName"
+		acu.name as "accountCheckingUserName",
+		a.red_invoice_flag as "redInvoiceFlag",
+		a.red_invoice_relevancy_id as "redInvoiceRelevancyId",
+		a.red_invoice_relevancy_number as "redInvoiceRelevancyNumber"
 	</sql>
 
 	<resultMap type="WorkInvoice" id="InvoiceMap">
@@ -576,6 +585,12 @@
 					#{officeId}
 				</foreach>
 			</if>
+			<if test="redNotStatusList!=null and redNotStatusList.size!=0">
+				and a.invoice_state not in
+				<foreach collection="redNotStatusList" item="status" separator="," open="(" close=")">
+					#{status}
+				</foreach>
+			</if>
 			<if test="officeId == '' and officeName!=null and officeName!=''">
 				AND o.name like concat('%',#{officeName},'%')
 			</if>
@@ -660,6 +675,151 @@
 		</choose>
 	</select>
 
+	<select id="findListOnRedInvoice" resultType="WorkInvoice" >
+		SELECT
+		a.id AS "id",
+		a.number AS "number",
+		a.process_instance_id AS "processInstanceId",
+		a.client_id AS "client.id",
+		a.project_id AS "project.id",
+		a.project_name AS "projectName",
+		a.money AS "money",
+		a.money AS "moneyStr",
+		a.invoice_type AS "invoiceType",
+		(case when a.invoice_type = '1' then '专票' when a.invoice_type = '2' then '普票' else '' end) as invoiceTypeStr,
+		a.charge_type AS "chargeType",
+		a.content AS "content",
+		a.drawer_id AS "drawer.id",
+		a.office_id AS "office.id",
+		a.invoice_number AS "invoiceNumber",
+		a.invoice_date AS "invoiceDate",
+		a.drawer_name AS "drawerName",
+		a.take_date AS "takeDate",
+		a.invoice_remarks AS "invoiceRemarks",
+		a.is_invoice AS "isInvoice",
+		a.is_charge AS "isCharge",
+		a.is_invalid AS "isInvalid",
+		a.create_by AS "createBy.id",
+		a.create_date AS "createDate",
+		a.update_by AS "updateBy.id",
+		a.update_date AS "updateDate",
+		a.remarks AS "remarks",
+		a.del_flag AS "delFlag",
+		a.orUnicode AS "orUnicode",
+		a.address AS "address",
+		a.telephone AS "telephone",
+		a.bank AS "bank",
+		a.bank_number AS "bankNumber",
+		a.cancle_reason AS "cancaleReason",
+		su.name AS "createBy.name",
+		a.invoice_state AS "invoiceState",
+		a.company_id AS "companyId",
+		a.cancle_reason AS "cancleReason",
+		a.officee_id AS "officeId",
+		a.province AS "province",
+		a.ext AS "ext",
+		a.billing_content as "billingContent",
+		a.receipt_money_date as "receiptMoneyDate",
+		(case when a.receipt_money = '0' then '否' when a.receipt_money = '1' then '是' when a.receipt_money = '2' then '部分收款' else '否' end) as receiptMoney,
+		a.cancellation_remark as "cancellationRemark",
+		a.account_checking_user_id as "accountCheckingUserId",
+		a.area_id as "area.id",
+		a.new_drawer_id as "newDrawerId",
+		a.new_drawer as "newDrawer",
+		a.actual_drawer_email_address as "actualDrawerEmailAddress",
+		a.actual_drawer_id as "actualDrawerId",
+		a.electronic_invoice_flag as "electronicInvoiceFlag",
+		a.cancellation_process_instance_id as "cancellationProcessInstanceId",
+		a.cancellation_state as "cancellationState",
+		wid.number as "widNumber"
+		FROM work_invoice a
+		LEFT JOIN sys_user su ON su.id = a.create_by
+		LEFT JOIN work_invoice_detail wid ON a.id = wid.invoice_id
+		<where>
+			a.del_flag = #{DEL_FLAG_NORMAL}
+			<if test="number != null and number != ''">
+				AND a.number LIKE
+				<if test="dbName == 'oracle'">'%'||#{number}||'%'</if>
+				<if test="dbName == 'mssql'">'%'+#{number}+'%'</if>
+				<if test="dbName == 'mysql'">concat('%',#{number},'%')</if>
+			</if>
+			<if test="widNumber != null and widNumber != ''">
+				AND wid.number LIKE
+				<if test="dbName == 'oracle'">'%'||#{widNumber}||'%'</if>
+				<if test="dbName == 'mssql'">'%'+#{widNumber}+'%'</if>
+				<if test="dbName == 'mysql'">concat('%',#{widNumber},'%')</if>
+			</if>
+			<if test="money != null and money != ''">
+				AND a.money LIKE
+				<if test="dbName == 'oracle'">'%'||#{money}||'%'</if>
+				<if test="dbName == 'mssql'">'%'+#{money}+'%'</if>
+				<if test="dbName == 'mysql'">concat('%',#{money},'%')</if>
+			</if>
+
+			<if test="redNotStatusList!=null and redNotStatusList.size!=0">
+				and a.invoice_state not in
+				<foreach collection="redNotStatusList" item="status" separator="," open="(" close=")">
+					#{status}
+				</foreach>
+			</if>
+
+			${sqlMap.dsf}
+		</where>
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+				ORDER BY a.create_date DESC
+			</otherwise>
+		</choose>
+	</select>
+
+	<select id="queryCountOnRedInvoice" resultType="int" >
+		SELECT count(DISTINCT(a.id))
+		FROM work_invoice a
+		LEFT JOIN sys_user su ON su.id = a.create_by
+		LEFT JOIN work_invoice_detail wid ON a.id = wid.invoice_id
+		<where>
+			a.del_flag = #{DEL_FLAG_NORMAL}
+			<if test="number != null and number != ''">
+				AND a.number LIKE
+				<if test="dbName == 'oracle'">'%'||#{number}||'%'</if>
+				<if test="dbName == 'mssql'">'%'+#{number}+'%'</if>
+				<if test="dbName == 'mysql'">concat('%',#{number},'%')</if>
+			</if>
+			<if test="widNumber != null and widNumber != ''">
+				AND wid.number LIKE
+				<if test="dbName == 'oracle'">'%'||#{widNumber}||'%'</if>
+				<if test="dbName == 'mssql'">'%'+#{widNumber}+'%'</if>
+				<if test="dbName == 'mysql'">concat('%',#{widNumber},'%')</if>
+			</if>
+			<if test="money != null and money != ''">
+				AND a.money LIKE
+				<if test="dbName == 'oracle'">'%'||#{money}||'%'</if>
+				<if test="dbName == 'mssql'">'%'+#{money}+'%'</if>
+				<if test="dbName == 'mysql'">concat('%',#{money},'%')</if>
+			</if>
+
+			<if test="redNotStatusList!=null and redNotStatusList.size!=0">
+				and a.invoice_state not in
+				<foreach collection="redNotStatusList" item="status" separator="," open="(" close=")">
+					#{status}
+				</foreach>
+			</if>
+
+			${sqlMap.dsf}
+		</where>
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+				ORDER BY a.create_date DESC
+			</otherwise>
+		</choose>
+	</select>
+
 
 	<select id="findListNew" resultType="WorkInvoice" >
 		SELECT
@@ -1338,6 +1498,13 @@
 					#{officeId}
 				</foreach>
 			</if>
+
+			<if test="redNotStatusList!=null and redNotStatusList.size!=0">
+				and a.invoice_state not in
+				<foreach collection="redNotStatusList" item="status" separator="," open="(" close=")">
+					#{status}
+				</foreach>
+			</if>
 			<if test="officeId == '' and officeName!=null and officeName!=''">
 				AND o.name like concat('%',#{officeName},'%')
 			</if>
@@ -1667,7 +1834,10 @@
 			new_drawer_id,
 			actual_drawer_email_address,
 			new_drawer,
-			actual_drawer_id
+			actual_drawer_id,
+			red_invoice_flag,
+			red_invoice_relevancy_id,
+			red_invoice_relevancy_number
 		) VALUES (
 			#{id},
 			#{number},
@@ -1713,7 +1883,10 @@
 		    #{newDrawerId},
 		    #{actualDrawerEmailAddress},
 		    #{newDrawer},
-		    #{actualDrawerId}
+		    #{actualDrawerId},
+		    #{redInvoiceFlag},
+		    #{redInvoiceRelevancyId},
+		    #{redInvoiceRelevancyNumber}
 		)
 	</insert>
 
@@ -1769,6 +1942,9 @@
 			<if test="null != cancellationAuditPassDate">
 				,cancellation_audit_pass_date = #{cancellationAuditPassDate}
 			</if>
+			,red_invoice_flag = #{redInvoiceFlag}
+			,red_invoice_relevancy_id = #{redInvoiceRelevancyId}
+			,red_invoice_relevancy_number = #{redInvoiceRelevancyNumber}
 		WHERE id = #{id}
 	</update>
 	<update id="updateDate">
@@ -2815,6 +2991,7 @@
 			a.invoice_date &lt;= #{invoiceDate}
 			and a.del_flag = 0
 			and (a.receipt_money_date is null and a.receipt_money = 0)
+			and invoice_state != 1 and invoice_state != 2 and invoice_state != 3 and invoice_state != 4 and invoice_state != 7
 		</where>
 	</select>
 

+ 79 - 2
src/main/webapp/webpage/modules/workinvoice/workInvoiceAllForm.jsp

@@ -77,6 +77,21 @@
 						parent.layer.msg("先添加项目信息!", {icon: 5});
 						return false;
 					}
+
+
+					var money = $("#money").val();
+					var redInvoice=$('input:radio[name="redInvoiceFlag"]:checked').val();
+					if(money < 0 && redInvoice == 0){
+						parent.layer.msg("发票金额为负数,请将是否红字发票请选择是,并选择关联的发票信息",{icon:0});
+						return false;
+
+					}
+					if(money >= 0 && redInvoice == 1){
+						parent.layer.msg("发票金额为正数,不可为红字发票,请将是否红字发票请选择否",{icon:0});
+						return false;
+
+					}
+
 					if($('#actualDrawerEmailAddress').val()==null||$('#actualDrawerEmailAddress').val()=="") {
 						parent.layer.msg("请填写电子邮箱!", {icon: 5});
 						return false;
@@ -111,6 +126,15 @@
 				$(".contractType").show();
 				$("#contractTypeDoc").attr("class","form-control judgment");
 			}
+			var redInvoiceFlag = '${workInvoice.redInvoiceFlag}';//后端获取值
+			if(undefined == redInvoiceFlag || null == redInvoiceFlag || '' == redInvoiceFlag || redInvoiceFlag == "0"){
+				document.getElementsByName("redInvoiceFlag")[1].checked = true;
+				$(".redInvoice").hide();
+			}else{
+				document.getElementsByName("redInvoiceFlag")[0].checked = true;
+				$(".redInvoice").show();
+
+			}
 
 			var newDrawerRadio = '${workInvoice.newDrawer}';//后端获取值
 			if(undefined == newDrawerRadio || null == newDrawerRadio || '' == newDrawerRadio || newDrawerRadio == "1"){
@@ -147,6 +171,16 @@
 					}
 				});
 
+				form.on('radio(redInvoiceFlagRadio)',function (event) {
+					var radioVal = $(this).val();
+					if(radioVal == 1 || radioVal == 1){
+						$(".redInvoice").show();
+					}else if(radioVal == 0 || radioVal == 0){
+						$(".redInvoice").hide();
+					}
+					form.render();
+				})
+
 				form.on('radio(newDrawerRadio)',function (event) {
 					var radioVal = $(this).val();
 					console.log(radioVal);
@@ -370,6 +404,33 @@
 			})
 		}
 
+
+		function setInvoiceValue (obj){
+
+		}
+
+		function moneyChange(obj){
+			console.log("moneyChangeValue", obj.value)
+			//如果发票金额为负数,则表示为红冲金额,需要选择关联的发票信息
+			// 检查发票金额是否为数字
+			if (isNaN(obj.value)) {
+				//发票金额不是有效的数字格式,请输入正确的金额。进行抛出
+				return;
+			}
+			if (obj.value < 0) {
+				// 如果金额为负,则将红冲选择发票框进行展示,并自动将是否红字发票更新为是
+				$('input[name="redInvoiceFlag"][value="1"]').prop("checked", true);
+				$(".redInvoice").show();
+
+			}else{
+				$('input[name="redInvoiceFlag"][value="0"]').prop("checked", true);
+				$(".redInvoice").hide();
+			}
+			// 重新渲染表单,使得 layui 重新应用样式和事件
+			layui.form.render("radio");
+
+		}
+
 		function newBankShow (data){
 			$('#bank').html('<option value="">请选择开户行信息</option>')
 			//对选中开票单位的银行做级联操作
@@ -1114,11 +1175,27 @@
 					</div>
 				</div>
 
-				<div class="layui-item layui-col-sm12">
+				<div class="layui-item layui-col-sm6">
 					<label class="layui-form-label double-line"><span class="require-item">*</span>发票金额(元):</label>
 					<div class="layui-input-block">
 							<%--<form:input id=""  path="money" htmlEscape="false" class="form-control number judgment layui-input"/>--%>
-						<input name="money" htmlEscape="false" onkeyup="num(this)" maxlength="12" placeholder="请输入发票金额" value="${workInvoice.money}" class="form-control judgment number layui-input"/>
+						<input id="money" name="money" htmlEscape="false" placeholder="请输入发票金额" maxlength="12" onkeyup="num(this)" onchange="moneyChange(this)" value="${workInvoice.money}" class="form-control judgment number layui-input"/>
+					</div>
+				</div>
+
+				<div class="layui-item layui-col-sm6">
+					<label class="layui-form-label double-line"><span class="require-item">*</span>是否红字发票:</label>
+					<div class="layui-input-block">
+						<input type="radio" name="redInvoiceFlag" lay-filter="redInvoiceFlagRadio" title="是" value="1">
+						<input type="radio" name="redInvoiceFlag" lay-filter="redInvoiceFlagRadio" title="否" value="0">
+					</div>
+				</div>
+
+				<div class="layui-item layui-col-sm6 redInvoice">
+					<label class="layui-form-label double-line"><span class="require-item">*</span>关联红字发票:</label>
+					<div class="layui-input-block with-icon">
+						<sys:selectinvoice url="${ctx}/workinvoiceTwo/workinvoiceTwo/selectInvoice" id="redInvoiceRelevancyId" name="redInvoiceRelevancyId"  value="${workInvoice.redInvoiceRelevancyId}"  title="选择关联红字发票" labelName="redInvoiceRelevancyNumber" cssStyle="background-color: #fff"
+										   labelValue="${workInvoice.redInvoiceRelevancyNumber}" cssClass="form-control judgment layui-input" fieldLabels="单位" fieldKeys="number" searchLabel="红字发票" searchKey="number" ></sys:selectinvoice>
 					</div>
 				</div>
 				<div class="layui-item layui-col-sm12 with-textarea">

+ 115 - 2
src/main/webapp/webpage/modules/workinvoice/workInvoiceAllModify.jsp

@@ -37,6 +37,20 @@
 						}
 					}
 				}
+
+				var money = $("#money").val();
+				var redInvoice=$('input:radio[name="redInvoiceFlag"]:checked').val();
+				if(money < 0 && redInvoice == 0){
+					parent.layer.msg("发票金额为负数,请将是否红字发票请选择是,并选择关联的发票信息",{icon:0});
+					return false;
+
+				}
+				if(money >= 0 && redInvoice == 1){
+					parent.layer.msg("发票金额为正数,不可为红字发票,请将是否红字发票请选择否",{icon:0});
+					return false;
+
+				}
+
 				if(obj == 2){
 					$("#flag").val("no");
 
@@ -97,6 +111,15 @@
 					}
 				});
 
+				form.on('radio(redInvoiceFlagRadio)',function (event) {
+					var radioVal = $(this).val();
+					if(radioVal == 1 || radioVal == 1){
+						$(".redInvoice").show();
+					}else if(radioVal == 0 || radioVal == 0){
+						$(".redInvoice").hide();
+					}
+					form.render();
+				})
 				form.on('radio(newDrawerRadio)',function (event) {
 					var radioVal = $(this).val();
 					if(radioVal == 1 || radioVal == 1){
@@ -158,6 +181,17 @@
 				});
 			});
 
+
+			var redInvoiceFlag = '${workInvoice.redInvoiceFlag}';//后端获取值
+			if(undefined == redInvoiceFlag || null == redInvoiceFlag || '' == redInvoiceFlag || redInvoiceFlag == "0"){
+				document.getElementsByName("redInvoiceFlag")[1].checked = true;
+				$(".redInvoice").hide();
+			}else{
+				document.getElementsByName("redInvoiceFlag")[0].checked = true;
+				$(".redInvoice").show();
+
+			}
+
 			var newDrawerRadio = '${workInvoice.newDrawer}';//后端获取值
 			if(undefined == newDrawerRadio || null == newDrawerRadio || '' == newDrawerRadio || newDrawerRadio == "1"){
 				document.getElementsByName("newDrawer")[0].checked = true;
@@ -317,6 +351,35 @@
 				}
 			})
 		}
+
+
+
+		function setInvoiceValue (obj){
+
+		}
+
+		function moneyChange(obj){
+			console.log("moneyChangeValue", obj.value)
+			//如果发票金额为负数,则表示为红冲金额,需要选择关联的发票信息
+			// 检查发票金额是否为数字
+			if (isNaN(obj.value)) {
+				//发票金额不是有效的数字格式,请输入正确的金额。进行抛出
+				return;
+			}
+			if (obj.value < 0) {
+				// 如果金额为负,则将红冲选择发票框进行展示,并自动将是否红字发票更新为是
+				$('input[name="redInvoiceFlag"][value="1"]').prop("checked", true);
+				$(".redInvoice").show();
+
+			}else{
+				$('input[name="redInvoiceFlag"][value="0"]').prop("checked", true);
+				$(".redInvoice").hide();
+			}
+			// 重新渲染表单,使得 layui 重新应用样式和事件
+			layui.form.render("radio");
+
+		}
+
 		function newBankShow (data){
 			$('#bank').html('<option value="">请选择开户行信息</option>')
 			//对选中开票单位的银行做级联操作
@@ -815,6 +878,28 @@
 				multipartUploadWithStsCollection(storeAs, file, attachmentId, attachmentFlag, uploadPath, divId, size);
 			}
 		}
+
+		/**
+		 * 数字处理
+		 * arg1 inputObject
+		 **/
+		function num(obj){//用户只能输入正负数与小数
+			if(isNaN(obj.value) && !/^-$/.test(obj.value)){
+				obj.value="";
+			}
+			if(!/^[+-]?\d*\.{0,1}\d{0,1}$/.test(obj.value)){
+				obj.value=obj.value.replace(/\.\d{2,}$/,obj.value.substr(obj.value.indexOf('.'),3));
+			}
+
+			var regStrs = [
+				['^0(\\d+)$', '$1'], //禁止录入整数部分两位以上,但首位为0
+			];
+			for(var i=0; i<regStrs.length; i++){
+				var reg = new RegExp(regStrs[i][0]);
+				obj.value = obj.value.replace(reg, regStrs[i][1]);
+			}
+		}
+
 	</script>
 </head>
 <body>
@@ -933,6 +1018,18 @@
 				</div>
 
 				<div class="layui-item layui-col-sm6">
+					<label class="layui-form-label double-line">发票申请编号:</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>
+						</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">
 						<input type="radio" name="newDrawer" lay-filter="newDrawerRadio" title="企业开票" value="1">
@@ -1004,10 +1101,26 @@
 						</form:select>
 					</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" placeholder="请输入开票金额"  value="<fmt:formatNumber value="${workInvoice.money}" pattern="#.00#"/>" class="form-control judgment number layui-input"/>
+						<input id="money" name="money" htmlEscape="false" placeholder="请输入发票金额" maxlength="12" onkeyup="num(this)" onchange="moneyChange(this)" value="<fmt:formatNumber value="${workInvoice.money}" pattern="#.00#"/>" class="form-control judgment number layui-input"/>
+
+					</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" name="redInvoiceFlag" lay-filter="redInvoiceFlagRadio" title="是" value="1">
+						<input type="radio" name="redInvoiceFlag" lay-filter="redInvoiceFlagRadio" title="否" value="0">
+					</div>
+				</div>
+
+				<div class="layui-item layui-col-sm6 redInvoice">
+					<label class="layui-form-label double-line"><span class="require-item">*</span>关联红字发票:</label>
+					<div class="layui-input-block with-icon">
+						<sys:selectinvoice url="${ctx}/workinvoiceTwo/workinvoiceTwo/selectInvoice" id="redInvoiceRelevancyId" name="redInvoiceRelevancyId"  value="${workInvoice.redInvoiceRelevancyId}"  title="选择关联红字发票" labelName="redInvoiceRelevancyNumber" cssStyle="background-color: #fff"
+										   labelValue="${workInvoice.redInvoiceRelevancyNumber}" cssClass="form-control judgment layui-input" fieldLabels="单位" fieldKeys="number" searchLabel="红字发票" searchKey="number" ></sys:selectinvoice>
 					</div>
 				</div>
 				<div class="layui-item layui-col-sm12 with-textarea">

+ 44 - 2
src/main/webapp/webpage/modules/workinvoice/workInvoiceAudit.jsp

@@ -4,6 +4,8 @@
 <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 type="text/javascript">
 		var validateForm;
 		function doSubmit(obj){//回调函数,在编辑和保存动作时,供openDialog调用提交表单。
@@ -19,7 +21,20 @@
 		  return false;
 		}
 		$(document).ready(function() {
+			layui.use('form', function () {
+				var form = layui.form;
+				form.render();
+			});
 			$("#name").focus();
+			var redInvoiceFlag = '${workInvoice.redInvoiceFlag}';//后端获取值
+			if(undefined == redInvoiceFlag || null == redInvoiceFlag || '' == redInvoiceFlag || redInvoiceFlag == "0"){
+				document.getElementsByName("redInvoiceFlag")[1].checked = true;
+				$(".redInvoice").hide();
+			}else{
+				document.getElementsByName("redInvoiceFlag")[0].checked = true;
+				$(".redInvoice").show();
+
+			}
 			validateForm = $("#inputForm").validate({
 				submitHandler: function(form){
 					loading('正在提交,请稍等...');
@@ -147,9 +162,36 @@
 				</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 id="chargeType" htmlEscape="false" readonly="true"   class="form-control layui-input" value="${workInvoice.chargeType}" />
+				</div>
+			</div>
+			<div class="layui-item layui-col-sm6">
+				<label class="layui-form-label">开票内容:</label>
+				<div class="layui-input-block">
+					<input id="billingContent" htmlEscape="false" readonly="true"   class="form-control layui-input" value="${workInvoice.billingContent}" />
+				</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 id="kaipiao" 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-sm6">
+				<label class="layui-form-label"><span class="require-item">*</span>是否红字发票:</label>
+				<div class="layui-input-block">
+					<input type="radio" name="redInvoiceFlag" disabled lay-filter="redInvoiceFlagRadio" title="是" value="1">
+					<input type="radio" name="redInvoiceFlag" disabled lay-filter="redInvoiceFlagRadio" title="否" value="0">
+				</div>
+			</div>
+
+			<div class="layui-item layui-col-sm6 redInvoice">
+				<label class="layui-form-label"><span class="require-item">*</span>关联红字发票:</label>
 				<div class="layui-input-block">
-					<input htmlEscape="false" readonly="true"   class="form-control layui-input" value="<fmt:formatNumber value="${workInvoice.money}" pattern="#,#00.00"/>"/>
+					<input type="hidden" id="redInvoiceRelevancyId" name="redInvoiceRelevancyId" htmlEscape="false" readonly="true"   class="form-control layui-input" value="${workInvoice.redInvoiceRelevancyId}"/>
+					<input id="redInvoiceRelevancyNumber" name="redInvoiceRelevancyNumber" htmlEscape="false" readonly="true"   class="form-control layui-input" value="${workInvoice.redInvoiceRelevancyNumber}"/>
 				</div>
 			</div>
 			<div class="layui-item layui-col-sm6">

+ 37 - 0
src/main/webapp/webpage/modules/workinvoice/workInvoiceAuditEnd.jsp

@@ -97,6 +97,17 @@
 				}
 			});
 
+			var redInvoiceFlag = '${workInvoice.redInvoiceFlag}';//后端获取值
+			if(undefined == redInvoiceFlag || null == redInvoiceFlag || '' == redInvoiceFlag || redInvoiceFlag == "0"){
+				document.getElementsByName("redInvoiceFlag")[1].checked = true;
+				$(".redInvoice").hide();
+			}else{
+				document.getElementsByName("redInvoiceFlag")[0].checked = true;
+				$(".redInvoice").show();
+
+			}
+
+
             laydate.render({
                 elem: '#invoiceDate', //目标元素。由于laydate.js封装了一个轻量级的选择器引擎,因此elem还允许你传入class、tag但必须按照这种方式 '#id .class'
                 event: 'focus', //响应事件。如果没有传入event,则按照默认的click
@@ -597,6 +608,17 @@
 					<input htmlEscape="false" readonly="true" id="newDrawer"  class="form-control layui-input" value="<c:choose><c:when test="${workInvoice.newDrawer eq '1'}">企业开票</c:when><c:when test="${workInvoice.newDrawer eq '2'}">个人开票</c:when></c:choose>"/>
 				</div>
 			</div>
+			<div class="layui-item layui-col-sm6">
+				<label class="layui-form-label double-line">发票申请编号:</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>
+					</div>
+				</div>
+			</div>
 			<div class="layui-item layui-col-sm6 count1">
 				<label class="layui-form-label"><span class="require-item">*</span>实际开票单位:</label>
 				<div class="layui-input-block">
@@ -659,6 +681,21 @@
 				</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" name="redInvoiceFlag" disabled lay-filter="redInvoiceFlagRadio" title="是" value="1">
+					<input type="radio" name="redInvoiceFlag" disabled lay-filter="redInvoiceFlagRadio" title="否" value="0">
+				</div>
+			</div>
+
+			<div class="layui-item layui-col-sm6 redInvoice">
+				<label class="layui-form-label"><span class="require-item">*</span>关联红字发票:</label>
+				<div class="layui-input-block">
+					<input type="hidden" id="redInvoiceRelevancyId" name="redInvoiceRelevancyId" htmlEscape="false" readonly="true"   class="form-control layui-input" value="${workInvoice.redInvoiceRelevancyId}"/>
+					<input id="redInvoiceRelevancyNumber" name="redInvoiceRelevancyNumber" htmlEscape="false" readonly="true"   class="form-control layui-input" value="${workInvoice.redInvoiceRelevancyNumber}"/>
+				</div>
+			</div>
+			<div class="layui-item layui-col-sm12">
 				<label class="layui-form-label">开票内容要求:</label>
 				<div class="layui-input-block">
 					<input htmlEscape="false" readonly="true"   class="form-control layui-input" value="${workInvoice.content}"/>

+ 35 - 0
src/main/webapp/webpage/modules/workinvoice/workInvoiceExamineAudit.jsp

@@ -38,6 +38,15 @@
 				var form = layui.form;
 				form.render();
 			});
+			var redInvoiceFlag = '${workInvoice.redInvoiceFlag}';//后端获取值
+			if(undefined == redInvoiceFlag || null == redInvoiceFlag || '' == redInvoiceFlag || redInvoiceFlag == "0"){
+				document.getElementsByName("redInvoiceFlag")[1].checked = true;
+				$(".redInvoice").hide();
+			}else{
+				document.getElementsByName("redInvoiceFlag")[0].checked = true;
+				$(".redInvoice").show();
+
+			}
 			$("#name").focus();
 			validateForm = $("#inputForm").validate({
 				submitHandler: function(form){
@@ -485,6 +494,17 @@
 					</div>
 				</div>
 				<div class="layui-item layui-col-sm6">
+					<label class="layui-form-label">发票申请编号:</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>
+						</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">
 						<input htmlEscape="false" readonly="true"   class="form-control layui-input" value="${workInvoice.client.name}"/>
@@ -539,6 +559,21 @@
 					</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" name="redInvoiceFlag" disabled lay-filter="redInvoiceFlagRadio" title="是" value="1">
+						<input type="radio" name="redInvoiceFlag" disabled lay-filter="redInvoiceFlagRadio" title="否" value="0">
+					</div>
+				</div>
+
+				<div class="layui-item layui-col-sm6 redInvoice">
+					<label class="layui-form-label"><span class="require-item">*</span>关联红字发票:</label>
+					<div class="layui-input-block">
+						<input type="hidden" id="redInvoiceRelevancyId" name="redInvoiceRelevancyId" htmlEscape="false" readonly="true"   class="form-control layui-input" value="${workInvoice.redInvoiceRelevancyId}"/>
+						<input id="redInvoiceRelevancyNumber" name="redInvoiceRelevancyNumber" htmlEscape="false" readonly="true"   class="form-control layui-input" value="${workInvoice.redInvoiceRelevancyNumber}"/>
+					</div>
+				</div>
+				<div class="layui-item layui-col-sm12">
 					<label class="layui-form-label">开票内容要求:</label>
 					<div class="layui-input-block">
 						<input htmlEscape="false" readonly="true"   class="form-control layui-input" value="${workInvoice.content}"/>

+ 35 - 0
src/main/webapp/webpage/modules/workinvoice/workInvoiceExamineAuditEnd.jsp

@@ -76,6 +76,15 @@
 				var form = layui.form;
 				form.render();
 			});
+			var redInvoiceFlag = '${workInvoice.redInvoiceFlag}';//后端获取值
+			if(undefined == redInvoiceFlag || null == redInvoiceFlag || '' == redInvoiceFlag || redInvoiceFlag == "0"){
+				document.getElementsByName("redInvoiceFlag")[1].checked = true;
+				$(".redInvoice").hide();
+			}else{
+				document.getElementsByName("redInvoiceFlag")[0].checked = true;
+				$(".redInvoice").show();
+
+			}
 			$("#name").focus();
 			validateForm = $("#inputForm").validate({
 				submitHandler: function(form){
@@ -523,6 +532,17 @@
 				</div>
 			</div>
 			<div class="layui-item layui-col-sm6">
+				<label class="layui-form-label">发票申请编号:</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>
+					</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">
 					<input htmlEscape="false" readonly="true"   class="form-control layui-input" value="${workInvoice.client.name}"/>
@@ -577,6 +597,21 @@
 				</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" name="redInvoiceFlag" disabled lay-filter="redInvoiceFlagRadio" title="是" value="1">
+					<input type="radio" name="redInvoiceFlag" disabled lay-filter="redInvoiceFlagRadio" title="否" value="0">
+				</div>
+			</div>
+
+			<div class="layui-item layui-col-sm6 redInvoice">
+				<label class="layui-form-label"><span class="require-item">*</span>关联红字发票:</label>
+				<div class="layui-input-block">
+					<input type="hidden" id="redInvoiceRelevancyId" name="redInvoiceRelevancyId" htmlEscape="false" readonly="true"   class="form-control layui-input" value="${workInvoice.redInvoiceRelevancyId}"/>
+					<input id="redInvoiceRelevancyNumber" name="redInvoiceRelevancyNumber" htmlEscape="false" readonly="true"   class="form-control layui-input" value="${workInvoice.redInvoiceRelevancyNumber}"/>
+				</div>
+			</div>
+			<div class="layui-item layui-col-sm12">
 				<label class="layui-form-label">开票内容要求:</label>
 				<div class="layui-input-block">
 					<input htmlEscape="false" readonly="true"   class="form-control layui-input" value="${workInvoice.content}"/>

+ 96 - 3
src/main/webapp/webpage/modules/workinvoice/workInvoiceExamineModify.jsp

@@ -38,6 +38,21 @@
 					}
 				}
 
+
+				var money = $("#money").val();
+				var redInvoice=$('input:radio[name="redInvoiceFlag"]:checked').val();
+				if(money < 0 && redInvoice == 0){
+					parent.layer.msg("发票金额为负数,请将是否红字发票请选择是,并选择关联的发票信息",{icon:0});
+					return false;
+
+				}
+				if(money >= 0 && redInvoice == 1){
+					parent.layer.msg("发票金额为正数,不可为红字发票,请将是否红字发票请选择否",{icon:0});
+					return false;
+
+				}
+
+
 				if(obj == 2){
                     $("#flag").val("no");
                 }else{
@@ -85,8 +100,31 @@
 						$("#telephone").attr("class","form-control isTel layui-input");
 					}
 				});
+
+
+				form.on('radio(redInvoiceFlagRadio)',function (event) {
+					var radioVal = $(this).val();
+					if(radioVal == 1 || radioVal == 1){
+						$(".redInvoice").show();
+					}else if(radioVal == 0 || radioVal == 0){
+						$(".redInvoice").hide();
+					}
+					form.render();
+				})
+
 			});
-            /*$('#money').keyup(function(){
+
+			var redInvoiceFlag = '${workInvoice.redInvoiceFlag}';//后端获取值
+			if(undefined == redInvoiceFlag || null == redInvoiceFlag || '' == redInvoiceFlag || redInvoiceFlag == "0"){
+				document.getElementsByName("redInvoiceFlag")[1].checked = true;
+				$(".redInvoice").hide();
+			}else{
+				document.getElementsByName("redInvoiceFlag")[0].checked = true;
+				$(".redInvoice").show();
+
+			}
+
+			/*$('#money').keyup(function(){
                 var c=$(this);
                 if(/[^\d]/.test(c.val())){//替换非数字字符
                     var temp_amount=c.val().replace(/[^\d]/g,'');
@@ -186,6 +224,35 @@
                 }
             })
         }
+
+
+
+		function setInvoiceValue (obj){
+
+		}
+
+		function moneyChange(obj){
+			console.log("moneyChangeValue", obj.value)
+			//如果发票金额为负数,则表示为红冲金额,需要选择关联的发票信息
+			// 检查发票金额是否为数字
+			if (isNaN(obj.value)) {
+				//发票金额不是有效的数字格式,请输入正确的金额。进行抛出
+				return;
+			}
+			if (obj.value < 0) {
+				// 如果金额为负,则将红冲选择发票框进行展示,并自动将是否红字发票更新为是
+				$('input[name="redInvoiceFlag"][value="1"]').prop("checked", true);
+				$(".redInvoice").show();
+
+			}else{
+				$('input[name="redInvoiceFlag"][value="0"]').prop("checked", true);
+				$(".redInvoice").hide();
+			}
+			// 重新渲染表单,使得 layui 重新应用样式和事件
+			layui.form.render("radio");
+
+		}
+
         function setDp(obj){
             $.ajax({
                 type:'post',
@@ -801,6 +868,17 @@
 					</div>
 				</div>
 				<div class="layui-item layui-col-sm6">
+					<label class="layui-form-label double-line">发票申请编号:</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>
+						</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 readOnlyFFF with-icon">
 						<sys:gridselect url="${ctx}/workinvoice/workInvoice/selectclient" id="client" name="client.id"  value="${workInvoice.client.id}"  title="选择开票单位" labelName="workInvoice.client.name"
@@ -854,10 +932,25 @@
 						</form:select>
 					</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" placeholder="请输入开票金额"  onkeyup="num(this)" value="<fmt:formatNumber value="${workInvoice.money}" pattern="#.00#"/>" class="form-control judgment number layui-input"/>
+						<input id="money" name="money" htmlEscape="false" placeholder="请输入发票金额" maxlength="12" onkeyup="num(this)" onchange="moneyChange(this)" value="<fmt:formatNumber value="${workInvoice.money}" pattern="#.00#"/>" class="form-control judgment number layui-input"/>
+					</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" name="redInvoiceFlag" lay-filter="redInvoiceFlagRadio" title="是" value="1">
+						<input type="radio" name="redInvoiceFlag" lay-filter="redInvoiceFlagRadio" title="否" value="0">
+					</div>
+				</div>
+
+				<div class="layui-item layui-col-sm6 redInvoice">
+					<label class="layui-form-label"><span class="require-item">*</span>关联红字发票:</label>
+					<div class="layui-input-block with-icon">
+						<sys:selectinvoice url="${ctx}/workinvoiceTwo/workinvoiceTwo/selectInvoice" id="redInvoiceRelevancyId" name="redInvoiceRelevancyId"  value="${workInvoice.redInvoiceRelevancyId}"  title="选择关联红字发票" labelName="redInvoiceRelevancyNumber" cssStyle="background-color: #fff"
+										   labelValue="${workInvoice.redInvoiceRelevancyNumber}" cssClass="form-control judgment layui-input" fieldLabels="单位" fieldKeys="number" searchLabel="红字发票" searchKey="number" ></sys:selectinvoice>
 					</div>
 				</div>
 				<div class="layui-item layui-col-sm12 with-textarea">

+ 93 - 3
src/main/webapp/webpage/modules/workinvoice/workInvoiceModify.jsp

@@ -52,6 +52,19 @@
 					}
 				}
 
+				var money = $("#money").val();
+				var redInvoice=$('input:radio[name="redInvoiceFlag"]:checked').val();
+				if(money < 0 && redInvoice == 0){
+					parent.layer.msg("发票金额为负数,请将是否红字发票请选择是,并选择关联的发票信息",{icon:0});
+					return false;
+
+				}
+				if(money >= 0 && redInvoice == 1){
+					parent.layer.msg("发票金额为正数,不可为红字发票,请将是否红字发票请选择否",{icon:0});
+					return false;
+
+				}
+
 				if(obj == 2){
                     $("#flag").val("no");
 					if($('#actualDrawerEmailAddress').val()==null||$('#actualDrawerEmailAddress').val()=="") {
@@ -123,6 +136,16 @@
 					form.render();
 				})
 
+				form.on('radio(redInvoiceFlagRadio)',function (event) {
+					var radioVal = $(this).val();
+					if(radioVal == 1 || radioVal == 1){
+						$(".redInvoice").show();
+					}else if(radioVal == 0 || radioVal == 0){
+						$(".redInvoice").hide();
+					}
+					form.render();
+				})
+
 
 				window.bankShow = function (data){
 					$('#bank').html('<option value="">请选择开户行信息</option>')
@@ -181,6 +204,18 @@
 				$(".count1").hide();
 				$(".count2").show();
 			}
+
+
+			var redInvoiceFlag = '${workInvoice.redInvoiceFlag}';//后端获取值
+			if(undefined == redInvoiceFlag || null == redInvoiceFlag || '' == redInvoiceFlag || redInvoiceFlag == "0"){
+				document.getElementsByName("redInvoiceFlag")[1].checked = true;
+				$(".redInvoice").hide();
+			}else{
+				document.getElementsByName("redInvoiceFlag")[0].checked = true;
+				$(".redInvoice").show();
+
+			}
+
             /*$('#money').keyup(function(){
                 var c=$(this);
                 if(/[^\d]/.test(c.val())){//替换非数字字符
@@ -330,6 +365,34 @@
             })
         }
 
+
+
+		function setInvoiceValue (obj){
+
+		}
+
+		function moneyChange(obj){
+			console.log("moneyChangeValue", obj.value)
+			//如果发票金额为负数,则表示为红冲金额,需要选择关联的发票信息
+			// 检查发票金额是否为数字
+			if (isNaN(obj.value)) {
+				//发票金额不是有效的数字格式,请输入正确的金额。进行抛出
+				return;
+			}
+			if (obj.value < 0) {
+				// 如果金额为负,则将红冲选择发票框进行展示,并自动将是否红字发票更新为是
+				$('input[name="redInvoiceFlag"][value="1"]').prop("checked", true);
+				$(".redInvoice").show();
+
+			}else{
+				$('input[name="redInvoiceFlag"][value="0"]').prop("checked", true);
+				$(".redInvoice").hide();
+			}
+			// 重新渲染表单,使得 layui 重新应用样式和事件
+			layui.form.render("radio");
+
+		}
+
 		function newBankShow (data){
 			$('#bank').html('<option value="">请选择开户行信息</option>')
 			//对选中开票单位的银行做级联操作
@@ -962,7 +1025,17 @@
 <%--						<label for="invoiceType">普票</label>--%>
 					</div>
 				</div>
-
+				<div class="layui-item layui-col-sm6">
+					<label class="layui-form-label double-line">发票申请编号:</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>
+						</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">
@@ -1035,12 +1108,29 @@
 						</form:select>
 					</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" placeholder="请输入开票金额"  onkeyup="num(this)" value="<fmt:formatNumber value="${workInvoice.money}" pattern="#.00#"/>" class="form-control judgment number layui-input"/>
+						<input id="money" name="money" htmlEscape="false" placeholder="请输入开票金额" maxlength="12" onkeyup="num(this)" onchange="moneyChange(this)" value="<fmt:formatNumber value="${workInvoice.money}" pattern="#.00#"/>" class="form-control judgment number layui-input"/>
 					</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" name="redInvoiceFlag" lay-filter="redInvoiceFlagRadio" title="是" value="1">
+						<input type="radio" name="redInvoiceFlag" lay-filter="redInvoiceFlagRadio" title="否" value="0">
+					</div>
+				</div>
+
+				<div class="layui-item layui-col-sm6 redInvoice">
+					<label class="layui-form-label double-line"><span class="require-item">*</span>关联红字发票:</label>
+					<div class="layui-input-block with-icon">
+						<sys:selectinvoice url="${ctx}/workinvoiceTwo/workinvoiceTwo/selectInvoice" id="redInvoiceRelevancyId" name="redInvoiceRelevancyId"  value="${workInvoice.redInvoiceRelevancyId}"  title="选择关联红字发票" labelName="redInvoiceRelevancyNumber" cssStyle="background-color: #fff"
+										   labelValue="${workInvoice.redInvoiceRelevancyNumber}" cssClass="form-control judgment layui-input" fieldLabels="单位" fieldKeys="number" searchLabel="红字发票" searchKey="number" ></sys:selectinvoice>
+					</div>
+				</div>
+
 				<div class="layui-item layui-col-sm12 with-textarea">
 					<label class="layui-form-label">开票内容要求:</label>
 					<div class="layui-input-block">

+ 35 - 0
src/main/webapp/webpage/modules/workinvoice/workInvoiceNotProjectAudit.jsp

@@ -42,6 +42,15 @@
 				var form = layui.form;
 				form.render();
 			});
+			var redInvoiceFlag = '${workInvoice.redInvoiceFlag}';//后端获取值
+			if(undefined == redInvoiceFlag || null == redInvoiceFlag || '' == redInvoiceFlag || redInvoiceFlag == "0"){
+				document.getElementsByName("redInvoiceFlag")[1].checked = true;
+				$(".redInvoice").hide();
+			}else{
+				document.getElementsByName("redInvoiceFlag")[0].checked = true;
+				$(".redInvoice").show();
+
+			}
 			$("#name").focus();
 			validateForm = $("#inputForm").validate({
 				submitHandler: function(form){
@@ -537,6 +546,17 @@
 					</div>
 				</div>
 				<div class="layui-item layui-col-sm6">
+					<label class="layui-form-label">发票申请编号:</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>
+						</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">
 						<input htmlEscape="false" readonly="true"   class="form-control layui-input" value="${workInvoice.client.name}"/>
@@ -598,6 +618,21 @@
 					</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" name="redInvoiceFlag" disabled lay-filter="redInvoiceFlagRadio" title="是" value="1">
+						<input type="radio" name="redInvoiceFlag" disabled lay-filter="redInvoiceFlagRadio" title="否" value="0">
+					</div>
+				</div>
+
+				<div class="layui-item layui-col-sm6 redInvoice">
+					<label class="layui-form-label"><span class="require-item">*</span>关联红字发票:</label>
+					<div class="layui-input-block">
+						<input type="hidden" id="redInvoiceRelevancyId" name="redInvoiceRelevancyId" htmlEscape="false" readonly="true"   class="form-control layui-input" value="${workInvoice.redInvoiceRelevancyId}"/>
+						<input id="redInvoiceRelevancyNumber" name="redInvoiceRelevancyNumber" htmlEscape="false" readonly="true"   class="form-control layui-input" value="${workInvoice.redInvoiceRelevancyNumber}"/>
+					</div>
+				</div>
+				<div class="layui-item layui-col-sm12">
 					<label class="layui-form-label">开票内容要求:</label>
 					<div class="layui-input-block">
 						<input htmlEscape="false" readonly="true"   class="form-control layui-input" value="${workInvoice.content}"/>

+ 36 - 0
src/main/webapp/webpage/modules/workinvoice/workInvoiceNotProjectAuditEnd.jsp

@@ -79,6 +79,16 @@
 				var form = layui.form;
 				form.render();
 			});
+
+			var redInvoiceFlag = '${workInvoice.redInvoiceFlag}';//后端获取值
+			if(undefined == redInvoiceFlag || null == redInvoiceFlag || '' == redInvoiceFlag || redInvoiceFlag == "0"){
+				document.getElementsByName("redInvoiceFlag")[1].checked = true;
+				$(".redInvoice").hide();
+			}else{
+				document.getElementsByName("redInvoiceFlag")[0].checked = true;
+				$(".redInvoice").show();
+
+			}
 			$("#name").focus();
 			validateForm = $("#inputForm").validate({
 				submitHandler: function(form){
@@ -579,6 +589,17 @@
 					<input htmlEscape="false" readonly="true" id="invoiceType"  class="form-control layui-input" <c:choose><c:when test="${workInvoice.invoiceType eq '2'}"> style=" font-weight: bold;color: red;" </c:when></c:choose> 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">发票申请编号:</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>
+					</div>
+				</div>
+			</div>
 			<div class="layui-item layui-col-sm6 count1">
 				<label class="layui-form-label"><span class="require-item">*</span>实际开票单位:</label>
 				<div class="layui-input-block">
@@ -641,6 +662,21 @@
 				</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" name="redInvoiceFlag" disabled lay-filter="redInvoiceFlagRadio" title="是" value="1">
+					<input type="radio" name="redInvoiceFlag" disabled lay-filter="redInvoiceFlagRadio" title="否" value="0">
+				</div>
+			</div>
+
+			<div class="layui-item layui-col-sm6 redInvoice">
+				<label class="layui-form-label"><span class="require-item">*</span>关联红字发票:</label>
+				<div class="layui-input-block">
+					<input type="hidden" id="redInvoiceRelevancyId" name="redInvoiceRelevancyId" htmlEscape="false" readonly="true"   class="form-control layui-input" value="${workInvoice.redInvoiceRelevancyId}"/>
+					<input id="redInvoiceRelevancyNumber" name="redInvoiceRelevancyNumber" htmlEscape="false" readonly="true"   class="form-control layui-input" value="${workInvoice.redInvoiceRelevancyNumber}"/>
+				</div>
+			</div>
+			<div class="layui-item layui-col-sm12">
 				<label class="layui-form-label">开票内容要求:</label>
 				<div class="layui-input-block">
 					<input htmlEscape="false" readonly="true"   class="form-control layui-input" value="${workInvoice.content}"/>

+ 124 - 2
src/main/webapp/webpage/modules/workinvoice/workInvoiceNotProjectModify.jsp

@@ -38,6 +38,20 @@
 					}
 				}
 
+
+				var money = $("#money").val();
+				var redInvoice=$('input:radio[name="redInvoiceFlag"]:checked').val();
+				if(money < 0 && redInvoice == 0){
+					parent.layer.msg("发票金额为负数,请将是否红字发票请选择是,并选择关联的发票信息",{icon:0});
+					return false;
+
+				}
+				if(money >= 0 && redInvoice == 1){
+					parent.layer.msg("发票金额为正数,不可为红字发票,请将是否红字发票请选择否",{icon:0});
+					return false;
+
+				}
+
 				if(obj == 2){
                     $("#flag").val("no");
 
@@ -98,6 +112,28 @@
 					}
 				});
 
+				form.on('radio(newDrawerRadio)',function (event) {
+					var radioVal = $(this).val();
+					if(radioVal == 1 || radioVal == 1){
+						$(".count2").hide();
+						$(".count1").show();
+					}else if(radioVal == 2 || radioVal == 2){
+						$(".count1").hide();
+						$(".count2").show();
+					}
+					form.render();
+				})
+
+				form.on('radio(redInvoiceFlagRadio)',function (event) {
+					var radioVal = $(this).val();
+					if(radioVal == 1 || radioVal == 1){
+						$(".redInvoice").show();
+					}else if(radioVal == 0 || radioVal == 0){
+						$(".redInvoice").hide();
+					}
+					form.render();
+				})
+
 				window.bankShow = function (data){
 					$('#bank').html('<option value="">请选择开户行信息</option>')
 					//对选中开票单位的银行做级联操作
@@ -144,6 +180,28 @@
 					}
 				});
 			});
+
+			var redInvoiceFlag = '${workInvoice.redInvoiceFlag}';//后端获取值
+			if(undefined == redInvoiceFlag || null == redInvoiceFlag || '' == redInvoiceFlag || redInvoiceFlag == "0"){
+				document.getElementsByName("redInvoiceFlag")[1].checked = true;
+				$(".redInvoice").hide();
+			}else{
+				document.getElementsByName("redInvoiceFlag")[0].checked = true;
+				$(".redInvoice").show();
+
+			}
+
+			var newDrawerRadio = '${workInvoice.newDrawer}';//后端获取值
+			if(undefined == newDrawerRadio || null == newDrawerRadio || '' == newDrawerRadio || newDrawerRadio == "1"){
+				document.getElementsByName("newDrawer")[0].checked = true;
+				$(".count2").hide();
+				$(".count1").show();
+			}else{
+				document.getElementsByName("newDrawer")[1].checked = true;
+				$(".count1").hide();
+				$(".count2").show();
+			}
+
             /*$('#money').keyup(function(){
                 var c=$(this);
                 if(/[^\d]/.test(c.val())){//替换非数字字符
@@ -292,6 +350,34 @@
 				}
             })
         }
+
+
+		function setInvoiceValue (obj){
+
+		}
+
+		function moneyChange(obj){
+			console.log("moneyChangeValue", obj.value)
+			//如果发票金额为负数,则表示为红冲金额,需要选择关联的发票信息
+			// 检查发票金额是否为数字
+			if (isNaN(obj.value)) {
+				//发票金额不是有效的数字格式,请输入正确的金额。进行抛出
+				return;
+			}
+			if (obj.value < 0) {
+				// 如果金额为负,则将红冲选择发票框进行展示,并自动将是否红字发票更新为是
+				$('input[name="redInvoiceFlag"][value="1"]').prop("checked", true);
+				$(".redInvoice").show();
+
+			}else{
+				$('input[name="redInvoiceFlag"][value="0"]').prop("checked", true);
+				$(".redInvoice").hide();
+			}
+			// 重新渲染表单,使得 layui 重新应用样式和事件
+			layui.form.render("radio");
+
+		}
+
 		function newBankShow (data){
 			$('#bank').html('<option value="">请选择开户行信息</option>')
 			//对选中开票单位的银行做级联操作
@@ -925,6 +1011,27 @@
 <%--						<label for="invoiceType">普票</label>--%>
 					</div>
 				</div>
+
+				<div class="layui-item layui-col-sm6">
+					<label class="layui-form-label">发票申请编号:</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>
+						</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">
+						<input type="radio" name="newDrawer" lay-filter="newDrawerRadio" title="企业开票" value="1">
+						<input type="radio" name="newDrawer" lay-filter="newDrawerRadio" title="个人开票" value="2">
+					</div>
+				</div>
+
 				<div class="layui-item layui-col-sm6 count1">
 					<label class="layui-form-label"><span class="require-item">*</span>实际开票单位:</label>
 					<div class="layui-input-block readOnlyFFF with-icon">
@@ -990,10 +1097,25 @@
 						</form:select>
 					</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" placeholder="请输入开票金额"  value="<fmt:formatNumber value="${workInvoice.money}" pattern="#.00#"/>" class="form-control judgment number layui-input"/>
+						<input id="money" name="money" htmlEscape="false" placeholder="请输入发票金额" maxlength="12" onkeyup="num(this)" onchange="moneyChange(this)" value="<fmt:formatNumber value="${workInvoice.money}" pattern="#.00#"/>" class="form-control judgment number layui-input"/>
+					</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" name="redInvoiceFlag" lay-filter="redInvoiceFlagRadio" title="是" value="1">
+						<input type="radio" name="redInvoiceFlag" lay-filter="redInvoiceFlagRadio" title="否" value="0">
+					</div>
+				</div>
+
+				<div class="layui-item layui-col-sm6 redInvoice">
+					<label class="layui-form-label"><span class="require-item">*</span>关联红字发票:</label>
+					<div class="layui-input-block with-icon">
+						<sys:selectinvoice url="${ctx}/workinvoiceTwo/workinvoiceTwo/selectInvoice" id="redInvoiceRelevancyId" name="redInvoiceRelevancyId"  value="${workInvoice.redInvoiceRelevancyId}"  title="选择关联红字发票" labelName="redInvoiceRelevancyNumber" cssStyle="background-color: #fff"
+										   labelValue="${workInvoice.redInvoiceRelevancyNumber}" cssClass="form-control judgment layui-input" fieldLabels="单位" fieldKeys="number" searchLabel="红字发票" searchKey="number" ></sys:selectinvoice>
 					</div>
 				</div>
 				<div class="layui-item layui-col-sm12 with-textarea">

+ 79 - 2
src/main/webapp/webpage/modules/workinvoice/workInvoiceTwoForm.jsp

@@ -79,6 +79,19 @@
 						return false;
 					}
 
+					var money = $("#money").val();
+					var redInvoice=$('input:radio[name="redInvoiceFlag"]:checked').val();
+					if(money < 0 && redInvoice == 0){
+						parent.layer.msg("发票金额为负数,请将是否红字发票请选择是,并选择关联的发票信息",{icon:0});
+						return false;
+
+					}
+					if(money >= 0 && redInvoice == 1){
+						parent.layer.msg("发票金额为正数,不可为红字发票,请将是否红字发票请选择否",{icon:0});
+						return false;
+
+					}
+
 					if($('#actualDrawerEmailAddress').val()==null||$('#actualDrawerEmailAddress').val()=="") {
 						parent.layer.msg("请填写电子邮箱!", {icon: 5});
 						return false;
@@ -128,6 +141,16 @@
 				$(".count1").hide();
 				$(".count2").show();
 			}
+
+			var redInvoiceFlag = '${workInvoice.redInvoiceFlag}';//后端获取值
+			if(undefined == redInvoiceFlag || null == redInvoiceFlag || '' == redInvoiceFlag || redInvoiceFlag == "0"){
+				document.getElementsByName("redInvoiceFlag")[1].checked = true;
+				$(".redInvoice").hide();
+			}else{
+				document.getElementsByName("redInvoiceFlag")[0].checked = true;
+				$(".redInvoice").show();
+
+			}
 			console.log("获取开票信息")
 			setValuee('${workInvoice.client.id}')
 
@@ -154,6 +177,16 @@
 					}
 				});
 
+				form.on('radio(redInvoiceFlagRadio)',function (event) {
+					var radioVal = $(this).val();
+					if(radioVal == 1 || radioVal == 1){
+						$(".redInvoice").show();
+					}else if(radioVal == 0 || radioVal == 0){
+						$(".redInvoice").hide();
+					}
+					form.render();
+				})
+
 				form.on('radio(newDrawerRadio)',function (event) {
 					var radioVal = $(this).val();
 					if(radioVal == 1 || radioVal == 1){
@@ -413,6 +446,33 @@
                 }
             })
         }
+
+		function setInvoiceValue (obj){
+
+		}
+
+		function moneyChange(obj){
+            	console.log("moneyChangeValue", obj.value)
+			//如果发票金额为负数,则表示为红冲金额,需要选择关联的发票信息
+			// 检查发票金额是否为数字
+			if (isNaN(obj.value)) {
+				//发票金额不是有效的数字格式,请输入正确的金额。进行抛出
+				return;
+			}
+			if (obj.value < 0) {
+				// 如果金额为负,则将红冲选择发票框进行展示,并自动将是否红字发票更新为是
+				$('input[name="redInvoiceFlag"][value="1"]').prop("checked", true);
+				$(".redInvoice").show();
+
+			}else{
+				$('input[name="redInvoiceFlag"][value="0"]').prop("checked", true);
+				$(".redInvoice").hide();
+			}
+			// 重新渲染表单,使得 layui 重新应用样式和事件
+			layui.form.render("radio");
+
+		}
+
 		function newBankShow (data){
 			$('#bank').html('<option value="">请选择开户行信息</option>')
 			//对选中开票单位的银行做级联操作
@@ -1173,13 +1233,30 @@
 					</div>
 				</div>
 
-				<div class="layui-item layui-col-sm12">
+				<div class="layui-item layui-col-sm6">
 					<label class="layui-form-label double-line"><span class="require-item">*</span>发票金额(元):</label>
 					<div class="layui-input-block">
 							<%--<form:input id=""  path="money" htmlEscape="false" class="form-control number judgment layui-input"/>--%>
-						<input name="money" htmlEscape="false" placeholder="请输入发票金额" maxlength="12" onkeyup="num(this)" value="${workInvoice.money}" class="form-control judgment number layui-input"/>
+						<input id="money" name="money" htmlEscape="false" placeholder="请输入发票金额" maxlength="12" onkeyup="num(this)" onchange="moneyChange(this)" value="${workInvoice.money}" class="form-control judgment number layui-input"/>
 					</div>
 				</div>
+
+				<div class="layui-item layui-col-sm6">
+					<label class="layui-form-label double-line"><span class="require-item">*</span>是否红字发票:</label>
+						<div class="layui-input-block">
+							<input type="radio" name="redInvoiceFlag" lay-filter="redInvoiceFlagRadio" title="是" value="1">
+							<input type="radio" name="redInvoiceFlag" lay-filter="redInvoiceFlagRadio" title="否" value="0">
+						</div>
+				</div>
+
+				<div class="layui-item layui-col-sm6 redInvoice">
+					<label class="layui-form-label double-line"><span class="require-item">*</span>关联红字发票:</label>
+					<div class="layui-input-block with-icon">
+						<sys:selectinvoice url="${ctx}/workinvoiceTwo/workinvoiceTwo/selectInvoice" id="redInvoiceRelevancyId" name="redInvoiceRelevancyId"  value="${workInvoice.redInvoiceRelevancyId}"  title="选择关联红字发票" labelName="redInvoiceRelevancyNumber" cssStyle="background-color: #fff"
+										labelValue="${workInvoice.redInvoiceRelevancyNumber}" cssClass="form-control judgment layui-input" fieldLabels="单位" fieldKeys="number" searchLabel="红字发票" searchKey="number" ></sys:selectinvoice>
+					</div>
+				</div>
+
 				<div class="layui-item layui-col-sm12 with-textarea">
 					<label class="layui-form-label double-line"><span class="require-item contractType">*</span>开票内容要求:</label>
 					<div class="layui-input-block">

+ 114 - 3
src/main/webapp/webpage/modules/workinvoice/workInvoiceTwoModify.jsp

@@ -37,6 +37,20 @@
 						}
 					}
 				}
+
+				var money = $("#money").val();
+				var redInvoice=$('input:radio[name="redInvoiceFlag"]:checked').val();
+				if(money < 0 && redInvoice == 0){
+					parent.layer.msg("发票金额为负数,请将是否红字发票请选择是,并选择关联的发票信息",{icon:0});
+					return false;
+
+				}
+				if(money >= 0 && redInvoice == 1){
+					parent.layer.msg("发票金额为正数,不可为红字发票,请将是否红字发票请选择否",{icon:0});
+					return false;
+
+				}
+
 				var invoiceType=$('input:radio[name="invoiceType"]:checked').val();
 				if(invoiceType == 1){
 					var bank = $("#bank").val();
@@ -121,6 +135,17 @@
 					}
 					form.render();
 				})
+
+				form.on('radio(redInvoiceFlagRadio)',function (event) {
+					var radioVal = $(this).val();
+					if(radioVal == 1 || radioVal == 1){
+						$(".redInvoice").show();
+					}else if(radioVal == 0 || radioVal == 0){
+						$(".redInvoice").hide();
+					}
+					form.render();
+				})
+
 				window.bankShow = function (data){
 					$('#bank').html('<option value="">请选择开户行信息</option>')
 					//对选中开票单位的银行做级联操作
@@ -167,6 +192,16 @@
 				});
 			});
 
+			var redInvoiceFlag = '${workInvoice.redInvoiceFlag}';//后端获取值
+			if(undefined == redInvoiceFlag || null == redInvoiceFlag || '' == redInvoiceFlag || redInvoiceFlag == "0"){
+				document.getElementsByName("redInvoiceFlag")[1].checked = true;
+				$(".redInvoice").hide();
+			}else{
+				document.getElementsByName("redInvoiceFlag")[0].checked = true;
+				$(".redInvoice").show();
+
+			}
+
 			var newDrawerRadio = '${workInvoice.newDrawer}';//后端获取值
 			if(undefined == newDrawerRadio || null == newDrawerRadio || '' == newDrawerRadio || newDrawerRadio == "1"){
 				document.getElementsByName("newDrawer")[0].checked = true;
@@ -327,6 +362,34 @@
                 }
             })
         }
+
+
+		function setInvoiceValue (obj){
+
+		}
+
+		function moneyChange(obj){
+			console.log("moneyChangeValue", obj.value)
+			//如果发票金额为负数,则表示为红冲金额,需要选择关联的发票信息
+			// 检查发票金额是否为数字
+			if (isNaN(obj.value)) {
+				//发票金额不是有效的数字格式,请输入正确的金额。进行抛出
+				return;
+			}
+			if (obj.value < 0) {
+				// 如果金额为负,则将红冲选择发票框进行展示,并自动将是否红字发票更新为是
+				$('input[name="redInvoiceFlag"][value="1"]').prop("checked", true);
+				$(".redInvoice").show();
+
+			}else{
+				$('input[name="redInvoiceFlag"][value="0"]').prop("checked", true);
+				$(".redInvoice").hide();
+			}
+			// 重新渲染表单,使得 layui 重新应用样式和事件
+			layui.form.render("radio");
+
+		}
+
 		function newBankShow (data){
 			$('#bank').html('<option value="">请选择开户行信息</option>')
 			//对选中开票单位的银行做级联操作
@@ -825,6 +888,27 @@
 				multipartUploadWithStsCollection(storeAs, file, attachmentId, attachmentFlag, uploadPath, divId, size);
 			}
 		}
+
+		/**
+		 * 数字处理
+		 * arg1 inputObject
+		 **/
+		function num(obj){//用户只能输入正负数与小数
+			if(isNaN(obj.value) && !/^-$/.test(obj.value)){
+				obj.value="";
+			}
+			if(!/^[+-]?\d*\.{0,1}\d{0,1}$/.test(obj.value)){
+				obj.value=obj.value.replace(/\.\d{2,}$/,obj.value.substr(obj.value.indexOf('.'),3));
+			}
+
+			var regStrs = [
+				['^0(\\d+)$', '$1'], //禁止录入整数部分两位以上,但首位为0
+			];
+			for(var i=0; i<regStrs.length; i++){
+				var reg = new RegExp(regStrs[i][0]);
+				obj.value = obj.value.replace(reg, regStrs[i][1]);
+			}
+		}
 	</script>
 </head>
 <body>
@@ -941,7 +1025,17 @@
 <%--						<label for="invoiceType">普票</label>--%>
 					</div>
 				</div>
-
+				<div class="layui-item layui-col-sm6">
+					<label class="layui-form-label double-line">发票申请编号:</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>
+						</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">
@@ -1014,12 +1108,29 @@
 						</form:select>
 					</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" placeholder="请输入开票金额"  value="<fmt:formatNumber value="${workInvoice.money}" pattern="#.00#"/>" class="form-control judgment number layui-input"/>
+						<input id="money" name="money" htmlEscape="false" placeholder="请输入发票金额" maxlength="12" onkeyup="num(this)" onchange="moneyChange(this)" value="<fmt:formatNumber value="${workInvoice.money}" pattern="#.00#"/>" class="form-control judgment number layui-input"/>
+
 					</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" name="redInvoiceFlag" lay-filter="redInvoiceFlagRadio" title="是" value="1">
+						<input type="radio" name="redInvoiceFlag" lay-filter="redInvoiceFlagRadio" title="否" value="0">
+					</div>
+				</div>
+
+				<div class="layui-item layui-col-sm6 redInvoice">
+					<label class="layui-form-label double-line"><span class="require-item">*</span>关联红字发票:</label>
+					<div class="layui-input-block with-icon">
+						<sys:selectinvoice url="${ctx}/workinvoiceTwo/workinvoiceTwo/selectInvoice" id="redInvoiceRelevancyId" name="redInvoiceRelevancyId"  value="${workInvoice.redInvoiceRelevancyId}"  title="选择关联红字发票" labelName="redInvoiceRelevancyNumber" cssStyle="background-color: #fff"
+										   labelValue="${workInvoice.redInvoiceRelevancyNumber}" cssClass="form-control judgment layui-input" fieldLabels="单位" fieldKeys="number" searchLabel="红字发票" searchKey="number" ></sys:selectinvoice>
+					</div>
+				</div>
+
 				<div class="layui-item layui-col-sm12 with-textarea">
 					<label class="layui-form-label">开票内容要求:</label>
 					<div class="layui-input-block">

+ 43 - 2
src/main/webapp/webpage/modules/workinvoice/workInvoiceView.jsp

@@ -4,6 +4,8 @@
 <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"/>
 	<style>
 		#workInvoiceProjectRelationList td{
 			padding-left: 0px;
@@ -22,6 +24,10 @@
 		}
 		$(document).ready(function() {
 
+			layui.use('form', function () {
+				var form = layui.form;
+				form.render();
+			});
 			var radioVal = '${workInvoice.newDrawer}';
 			//专票必填
 			if(radioVal == 1){
@@ -32,6 +38,16 @@
 				$(".count2").show();
 			}
 
+			var redInvoiceFlag = '${workInvoice.redInvoiceFlag}';//后端获取值
+			if(undefined == redInvoiceFlag || null == redInvoiceFlag || '' == redInvoiceFlag || redInvoiceFlag == "0"){
+				document.getElementsByName("redInvoiceFlag")[1].checked = true;
+				$(".redInvoice").hide();
+			}else{
+				document.getElementsByName("redInvoiceFlag")[0].checked = true;
+				$(".redInvoice").show();
+
+			}
+
 			$("#name").focus();
 			validateForm = $("#inputForm").validate({
 				submitHandler: function(form){
@@ -54,7 +70,7 @@
 <body >
 <div class="single-form view-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/saveAudit" method="post" class="form-horizontal layui-form">
 		<form:hidden path="id"/>
 		<form:hidden path="act.taskId"/>
 		<form:hidden path="act.taskName"/>
@@ -118,7 +134,17 @@
 						<input htmlEscape="false" readonly="true" style="background-color: #f1f1f1"  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 double-line">发票申请编号:</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>
+						</div>
+					</div>
+				</div>
 				<div class="layui-item layui-col-sm6">
 					<label class="layui-form-label">开票类型:</label>
 					<div class="layui-input-block">
@@ -188,6 +214,21 @@
 					</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" name="redInvoiceFlag" disabled lay-filter="redInvoiceFlagRadio" title="是" value="1">
+						<input type="radio" name="redInvoiceFlag" disabled lay-filter="redInvoiceFlagRadio" title="否" value="0">
+					</div>
+				</div>
+
+				<div class="layui-item layui-col-sm6 redInvoice">
+					<label class="layui-form-label"><span class="require-item">*</span>关联红字发票:</label>
+					<div class="layui-input-block">
+						<input type="hidden" id="redInvoiceRelevancyId" name="redInvoiceRelevancyId" htmlEscape="false" readonly="true"   class="form-control layui-input" value="${workInvoice.redInvoiceRelevancyId}"/>
+						<input id="redInvoiceRelevancyNumber"  style="background-color: #f1f1f1" name="redInvoiceRelevancyNumber" htmlEscape="false" readonly="true"   class="form-control layui-input" value="${workInvoice.redInvoiceRelevancyNumber}"/>
+					</div>
+				</div>
+				<div class="layui-item layui-col-sm6">
 					<label class="layui-form-label">开票内容要求:</label>
 					<div class="layui-input-block">
 						<input htmlEscape="false" readonly="true" style="background-color: #f1f1f1"  class="form-control layui-input" value="${workInvoice.content}"/>