Browse Source

发票管理调整

[user3] 3 năm trước cách đây
mục cha
commit
0edf0eb7a4

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

@@ -363,7 +363,7 @@ public class WorkInvoiceService extends CrudService<WorkInvoiceDao, WorkInvoice>
 					if(projectNameList.contains("非项目发票")){
 						continue;
 					}
-					projectNameList.add("非项目发票");
+					projectNameList.add("非项目发票"+projectRelation.getDetails());
 
 				}
 

+ 24 - 2
src/main/java/com/jeeplus/modules/workinvoice/web/WorkInvoiceAllController.java

@@ -798,11 +798,29 @@ public class WorkInvoiceAllController extends BaseController {
 	 * 选择开票项目
 	 */
 	@RequestMapping(value = "selectproject")
-	public String selectproject(ProjectRecords project, String url, String fieldLabels, String fieldKeys, String searchLabel, String searchKey, String ids, HttpServletRequest request, HttpServletResponse response, Model model) {
+	public String selectproject(ProjectRecords project, String url, String fieldLabels, String fieldKeys, String searchLabel, String searchKey, String ids,Integer isProject,Integer isProjectFalg,String details, HttpServletRequest request, HttpServletResponse response, Model model) {
 		project.setCompany(UserUtils.getSelectCompany());
 		project.setProjectStatus(ProjectStatusEnum.SIGNED.getValue());//已签状态
-		project.setLeaderNameStr(UserUtils.getUser().getName());
+		//project.setLeaderNameStr(UserUtils.getUser().getName());
 		Page<ProjectRecords> page = projectRecordsService.ruralFindPage(new Page<ProjectRecords>(request, response), project);
+		List<ProjectRecords> list = page.getList();
+		for (ProjectRecords info: list) {
+			if("1".equals(info.getInvoiceFlag())){
+				switch (info.getInvoiceStatus()){
+					case "5":
+						info.setInvoiceFlag("已开票");
+						break;
+					case "1":
+					case "2":
+					case "3":
+					case "4":
+						info.setInvoiceFlag("开票中");
+						break;
+					default:
+						info.setInvoiceFlag("");
+				}
+			}
+		}
 		try {
 			fieldLabels = URLDecoder.decode(fieldLabels, "UTF-8");
 			fieldKeys = URLDecoder.decode(fieldKeys, "UTF-8");
@@ -819,10 +837,14 @@ public class WorkInvoiceAllController extends BaseController {
 		model.addAttribute("url", url);
 		model.addAttribute("searchLabel", searchLabel);
 		model.addAttribute("searchKey", searchKey);
+		project.setDetails(details);
 		model.addAttribute("obj", project);
+		model.addAttribute("isProject", isProject);
+		model.addAttribute("isProjectFalg", isProjectFalg);
 		model.addAttribute("page",page);
 		return "modules/sys/gridinvoiceproject";
 	}
+
 	/**
 	 * 选择开票项目
 	 */

+ 30 - 2
src/main/java/com/jeeplus/modules/workinvoice/web/WorkInvoiceAllTwoController.java

@@ -158,6 +158,13 @@ public class WorkInvoiceAllTwoController extends BaseController {
 			List<String> projectNameList = invoiceService.getProjectNameList(invoice);
 			String projectNameStr = String.join(",", projectNameList);
 			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);
 		}
 		model.addAttribute("page", page);
 		model.addAttribute("sumMoney", getSumMoney);
@@ -806,11 +813,29 @@ public class WorkInvoiceAllTwoController extends BaseController {
 	 * 选择开票项目
 	 */
 	@RequestMapping(value = "selectproject")
-	public String selectproject(ProjectRecords project, String url, String fieldLabels, String fieldKeys, String searchLabel, String searchKey, String ids, HttpServletRequest request, HttpServletResponse response, Model model) {
+	public String selectproject(ProjectRecords project, String url, String fieldLabels, String fieldKeys, String searchLabel, String searchKey, String ids,Integer isProject,Integer isProjectFalg,String details, HttpServletRequest request, HttpServletResponse response, Model model) {
 		project.setCompany(UserUtils.getSelectCompany());
 		project.setProjectStatus(ProjectStatusEnum.SIGNED.getValue());//已签状态
-		project.setLeaderNameStr(UserUtils.getUser().getName());
+		//project.setLeaderNameStr(UserUtils.getUser().getName());
 		Page<ProjectRecords> page = projectRecordsService.ruralFindPage(new Page<ProjectRecords>(request, response), project);
+		List<ProjectRecords> list = page.getList();
+		for (ProjectRecords info: list) {
+			if("1".equals(info.getInvoiceFlag())){
+				switch (info.getInvoiceStatus()){
+					case "5":
+						info.setInvoiceFlag("已开票");
+						break;
+					case "1":
+					case "2":
+					case "3":
+					case "4":
+						info.setInvoiceFlag("开票中");
+						break;
+					default:
+						info.setInvoiceFlag("");
+				}
+			}
+		}
 		try {
 			fieldLabels = URLDecoder.decode(fieldLabels, "UTF-8");
 			fieldKeys = URLDecoder.decode(fieldKeys, "UTF-8");
@@ -827,7 +852,10 @@ public class WorkInvoiceAllTwoController extends BaseController {
 		model.addAttribute("url", url);
 		model.addAttribute("searchLabel", searchLabel);
 		model.addAttribute("searchKey", searchKey);
+		project.setDetails(details);
 		model.addAttribute("obj", project);
+		model.addAttribute("isProject", isProject);
+		model.addAttribute("isProjectFalg", isProjectFalg);
 		model.addAttribute("page",page);
 		return "modules/sys/gridinvoiceproject";
 	}

+ 3 - 1
src/main/java/com/jeeplus/modules/workinvoice/web/WorkInvoiceController.java

@@ -783,7 +783,7 @@ public class WorkInvoiceController extends BaseController {
 	 * 选择开票项目
 	 */
 	@RequestMapping(value = "selectproject")
-	public String selectproject(ProjectRecords project, String url, String fieldLabels, String fieldKeys, String searchLabel, String searchKey, String ids,Integer isProject,String details, HttpServletRequest request, HttpServletResponse response, Model model) {
+	public String selectproject(ProjectRecords project, String url, String fieldLabels, String fieldKeys, String searchLabel, String searchKey, String ids,Integer isProject,Integer isProjectFalg,String details, HttpServletRequest request, HttpServletResponse response, Model model) {
 		project.setCompany(UserUtils.getSelectCompany());
 		project.setProjectStatus(ProjectStatusEnum.SIGNED.getValue());//已签状态
 		//project.setLeaderNameStr(UserUtils.getUser().getName());
@@ -825,9 +825,11 @@ public class WorkInvoiceController extends BaseController {
 		project.setDetails(details);
 		model.addAttribute("obj", project);
 		model.addAttribute("isProject", isProject);
+		model.addAttribute("isProjectFalg", isProjectFalg);
 		model.addAttribute("page",page);
 		return "modules/sys/gridinvoiceproject";
 	}
+
 	/**
 	 * 选择开票项目
 	 */

+ 9 - 1
src/main/java/com/jeeplus/modules/workinvoice/web/WorkInvoiceTwoController.java

@@ -180,6 +180,13 @@ public class WorkInvoiceTwoController extends BaseController {
 			List<String> projectNameList = workInvoiceService.getProjectNameList(invoice);
 			String projectNameStr = String.join(",", projectNameList);
 			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);
 		}
 		model.addAttribute("page", page);
 		model.addAttribute("sumMoney", getSumMoney);
@@ -812,7 +819,7 @@ public class WorkInvoiceTwoController extends BaseController {
 	 * 选择开票项目
 	 */
 	@RequestMapping(value = "selectproject")
-	public String selectproject(ProjectRecords project, String url, String fieldLabels, String fieldKeys, String searchLabel, String searchKey, String ids,Integer isProject,String details, HttpServletRequest request, HttpServletResponse response, Model model) {
+	public String selectproject(ProjectRecords project, String url, String fieldLabels, String fieldKeys, String searchLabel, String searchKey, String ids,Integer isProject,Integer isProjectFalg,String details, HttpServletRequest request, HttpServletResponse response, Model model) {
 		project.setCompany(UserUtils.getSelectCompany());
 		project.setProjectStatus(ProjectStatusEnum.SIGNED.getValue());//已签状态
 		//project.setLeaderNameStr(UserUtils.getUser().getName());
@@ -854,6 +861,7 @@ public class WorkInvoiceTwoController extends BaseController {
 		project.setDetails(details);
 		model.addAttribute("obj", project);
 		model.addAttribute("isProject", isProject);
+		model.addAttribute("isProjectFalg", isProjectFalg);
 		model.addAttribute("page",page);
 		return "modules/sys/gridinvoiceproject";
 	}

+ 20 - 0
src/main/resources/mappings/modules/workinvoice/WorkInvoiceDao.xml

@@ -244,6 +244,16 @@
 				<if test="dbName == 'mssql'">'%'+#{number}+'%'</if>
 				<if test="dbName == 'mysql'">concat('%',#{number},'%')</if>
 			</if>
+			<if test="projectName != null and projectName != ''">
+				and a.number in
+				(select DISTINCT(aa.number) FROM
+				work_invoice aa
+				LEFT JOIN work_invoice_project_relation ar on ar.invoice_id =aa.id
+				LEFT JOIN rural_project_records pr ON pr.id = ar.project_id
+				where
+				IF (ar.is_project="2",ar.details like CONCAT("%",#{projectName},"%"), pr.project_name like CONCAT("%",#{projectName},"%"))
+				)
+			</if>
 			<if test="invoiceState != null and invoiceState != ''">
 				AND a.invoice_state = #{invoiceState}
 			</if>
@@ -774,6 +784,16 @@
 			<if test="number != null and number != ''">
 				AND a.number = #{number}
 			</if>
+			<if test="projectName != null and projectName != ''">
+				and a.number in
+				(select DISTINCT(aa.number) FROM
+				work_invoice aa
+				LEFT JOIN work_invoice_project_relation ar on ar.invoice_id =aa.id
+				LEFT JOIN rural_project_records pr ON pr.id = ar.project_id
+				where
+				IF (ar.is_project="2",ar.details like CONCAT("%",#{projectName},"%"), pr.project_name like CONCAT("%",#{projectName},"%"))
+				)
+			</if>
 			<if test="invoiceState != null and invoiceState != ''">
 				AND a.invoice_state = #{invoiceState}
 			</if>

+ 10 - 3
src/main/webapp/webpage/modules/sys/gridinvoiceproject.jsp

@@ -29,6 +29,13 @@
 				$(".project").hide();
 				$("#noProject").show();
 			}
+			var isProjectFalg='${isProjectFalg}';
+			if (isProjectFalg=="1"){
+				parent.layer.msg("第一条为项目后面新增只能选择项目",{icon:6});
+				$("#isProjectFalg").hide();
+				$(".project").show();
+				$("#noProject").hide();
+			}
             <%--var val = "<%=request.getAttribute("state")%>";--%>
             <%--if(val!=null){--%>
                 <%--alert("++++++++++");--%>
@@ -98,9 +105,9 @@
 					<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
 					<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
 					<table:sortColumn id="orderBy" name="orderBy" value="${page.orderBy}" callback="sortOrRefresh();"/><!-- 支持排序 -->
-					<div class="layui-input-block">
-						<input type="radio" name="isProject" class="isProject" lay-filter="isproject" title="项目" <c:if test="${isProject ==null || isProject==1  }">checked</c:if>  id="isproject" value="1">
-						<input type="radio" name="isProject" class="isProject" lay-filter="isproject" title="非项目" <c:if test="${isProject==2}">checked</c:if> id="isNoproject" value="2">
+					<div class="layui-input-block" id="isProjectFalg">
+						<input type="radio" name="isProject" class="isProject" lay-filter="isproject" title="项目" <c:if test="${isProject ==null || isProject==1 || isProject==3  }">checked</c:if>  id="isproject" value="1">
+						<input type="radio" name="isProject" class="isProject" lay-filter="isproject" title="其它" <c:if test="${isProject==2}">checked</c:if> id="isNoproject" value="2">
 					</div>
 					<div class="project">
 						<div class="commonQuery">

+ 80 - 7
src/main/webapp/webpage/modules/workinvoice/workInvoiceAllForm.jsp

@@ -30,11 +30,29 @@
 		function doSubmit(obj){//回调函数,在编辑和保存动作时,供openDialog调用提交表单。
 			//debugger
 			if(validateForm.form()){
+				var leng=$("#workInvoiceProjectRelationList tr").length;
+				if (leng>1){
+					var count=0;
+					var count1=leng;
+					for (var i=0;i<leng;i++) {
+						var delFlag = $("#workInvoiceProjectRelationList").find("tr").eq(i).find("input").eq(1).val();
+						if (delFlag == "1") {
+							count = i+1;
+							count1 = count1-1;
+						}
+					}
+					if (count1!=1){
+						var id=$("#workInvoiceProjectRelationList").find("tr").eq(count).find("input").eq(3).val();
+						if (id==undefined || id == ''){
+							parent.layer.msg("非项目,只能有一条非项目数据,请删除其余项目数据",{icon:6});
+							return false;
+						}
+					}
+				}
 				if(obj == 2){
 					$("#inputForm").attr("action","${ctx}/workinvoiceAll/workInvoiceAll/store");
 				}else{
 					var flag=judgment();
-					var leng=$("#workInvoiceProjectRelationList tr").length;
 					if (leng==0){
 						flag=2;
 					}
@@ -180,7 +198,7 @@
 			if (isProject==1){
 				$.ajax({
 					type:'post',
-					url:'${ctx}/workinvoice/workInvoice/getPNumber',
+					url:'${ctx}/workinvoiceTwo/workinvoiceTwo/getPNumber',
 					data:{
 						"obj":obj
 					},
@@ -206,6 +224,22 @@
 				var detailsName="#"+idx+"_details";
 				$(workContractName).val(details);
 				$(detailsName).val(details);
+
+				var projectNum="#"+idx+"_projectNum";
+				var clientName="#"+idx+"_clientName";
+				var reportDataNum="#"+idx+"_reportDataNum";
+				$(projectNum).val("");
+				$(clientName).val("");
+				$(reportDataNum).val("");
+				var length=$("#workInvoiceProjectRelationList tr").length;
+				if(length>1){
+					var id=$("#workInvoiceProjectRelationList").find("tr").eq(0).find("input").eq(3).val();
+					if (id==undefined || id == ''){
+						parent.layer.msg("非项目,只能有一条非项目数据,请删除其余项目数据",{icon:6});
+						return false;
+					}
+				}
+
 			}
 
 		}
@@ -236,6 +270,34 @@
 
 		function addRow1(list, idx, tpl, row){
 			var idx1 = $("#workInvoiceProjectRelationList tr").length;
+			if ('${workInvoice.chargeType}' == ''){
+				$("#chargeType").val("2")
+				layui.form.render();
+			}
+			if(idx1>0){
+				var count=0;
+				for (var i=1;i<=idx1;i++) {
+					var delFlag = $("#workInvoiceProjectRelationList").find("tr").eq(i-1).find("input").eq(1).val();
+					if (delFlag == "1") {
+						count = i;
+					}
+				}
+				if (idx1>count){
+					var id=$("#workInvoiceProjectRelationList").find("tr").eq(count).find("input").eq(3).val();
+					if (id!=undefined && id != ''){
+						if (row== undefined){
+							row={"isProject": "1","isProjectFalg": "1"};
+							$("#chargeType").val("1")
+							layui.form.render();
+						}
+					}else{
+						parent.layer.msg("非项目,只能有一条非项目数据",{icon:6});
+						$("#chargeType").val("2")
+						layui.form.render();
+						return false;
+					}
+				}
+			}
 			if(list == '#workInvoiceProjectRelationList'){
 				bornTemplete1(list, idx, tpl, row, idx1);
 			}
@@ -273,10 +335,21 @@
 				$(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);
-			// }
+			var length=$("#workInvoiceProjectRelationList tr").length;
+			var count=length;
+			for (var i=1;i<=length;i++) {
+				var delFlag = $("#workInvoiceProjectRelationList").find("tr").eq(i-1).find("input").eq(1).val();
+				if (delFlag == "1") {
+					count =count-1;
+				}
+			}
+			if(count==1){
+				$("#chargeType").val("2")
+				layui.form.render();
+			}else if (count>1){
+				$("#chargeType").val("1")
+				layui.form.render();
+			}
 		}
 		function provinceForShort(province){
 			if(province == "北京市")
@@ -492,7 +565,7 @@
                         </td>
                         <td>
                             <sys:gridselectcallprojecttss url="${ctx}/workinvoice/workInvoice/selectproject" id="workInvoiceProjectRelationList{{idx}}_projectId" name="workInvoiceProjectRelationList[{{idx}}].projectId"  value="{{row.projectId}}"  title="选择所属项目" labelName="workInvoiceProjectRelationList[{{idx}}].projectName" cssStyle="background-color: #fff"
-													labelValue="{{row.projectName}}" cssClass="form-control judgment layui-input" fieldLabels="项目" fieldKeys="projectName" searchLabel="项目名称" searchKey="projectName"  isProject="{{row.isProject}}" details="{{row.details}}"></sys:gridselectcallprojecttss>
+													labelValue="{{row.projectName}}" cssClass="form-control judgment layui-input" fieldLabels="项目" fieldKeys="projectName" searchLabel="项目名称" searchKey="projectName"  isProject="{{row.isProject}}" isProjectFalg="{{row.isProjectFalg}}" details="{{row.details}}"></sys:gridselectcallprojecttss>
                         </td>
                         <td>
 							<input id="workInvoiceProjectRelationList{{idx}}_workContractName"   type="text" value="{{row.workContractName}}" readonly="readonly"  class="form-control"/>

+ 83 - 8
src/main/webapp/webpage/modules/workinvoice/workInvoiceAllTwoForm.jsp

@@ -30,11 +30,29 @@
 		function doSubmit(obj){//回调函数,在编辑和保存动作时,供openDialog调用提交表单。
 			//debugger
 			if(validateForm.form()){
+				var leng=$("#workInvoiceProjectRelationList tr").length;
+				if (leng>1){
+					var count=0;
+					var count1=leng;
+					for (var i=0;i<leng;i++) {
+						var delFlag = $("#workInvoiceProjectRelationList").find("tr").eq(i).find("input").eq(1).val();
+						if (delFlag == "1") {
+							count = i+1;
+							count1 = count1-1;
+						}
+					}
+					if (count1!=1){
+						var id=$("#workInvoiceProjectRelationList").find("tr").eq(count).find("input").eq(3).val();
+						if (id==undefined || id == ''){
+							parent.layer.msg("非项目,只能有一条非项目数据,请删除其余项目数据",{icon:6});
+							return false;
+						}
+					}
+				}
 				if(obj == 2){
 					$("#inputForm").attr("action","${ctx}/workinvoiceAllTwo/workinvoiceAllTwo/store");
 				}else{
 					var flag=judgment();
-					var leng=$("#workInvoiceProjectRelationList tr").length;
 					if (leng==0){
 						flag=2;
 					}
@@ -48,6 +66,7 @@
 						return flag;
 					}
 				}
+				$("#chargeType").removeAttr("disabled")
 				$("#inputForm").submit();
 				return true;
 			}else {
@@ -180,7 +199,7 @@
 			if (isProject==1){
 				$.ajax({
 					type:'post',
-					url:'${ctx}/workinvoice/workInvoice/getPNumber',
+					url:'${ctx}/workinvoiceTwo/workinvoiceTwo/getPNumber',
 					data:{
 						"obj":obj
 					},
@@ -206,6 +225,22 @@
 				var detailsName="#"+idx+"_details";
 				$(workContractName).val(details);
 				$(detailsName).val(details);
+
+				var projectNum="#"+idx+"_projectNum";
+				var clientName="#"+idx+"_clientName";
+				var reportDataNum="#"+idx+"_reportDataNum";
+				$(projectNum).val("");
+				$(clientName).val("");
+				$(reportDataNum).val("");
+				var length=$("#workInvoiceProjectRelationList tr").length;
+				if(length>1){
+					var id=$("#workInvoiceProjectRelationList").find("tr").eq(0).find("input").eq(3).val();
+					if (id==undefined || id == ''){
+						parent.layer.msg("非项目,只能有一条非项目数据,请删除其余项目数据",{icon:6});
+						return false;
+					}
+				}
+
 			}
 
 		}
@@ -236,6 +271,34 @@
 
 		function addRow1(list, idx, tpl, row){
 			var idx1 = $("#workInvoiceProjectRelationList tr").length;
+			if ('${workInvoice.chargeType}' == ''){
+				$("#chargeType").val("2")
+				layui.form.render();
+			}
+			if(idx1>0){
+				var count=0;
+				for (var i=1;i<=idx1;i++) {
+					var delFlag = $("#workInvoiceProjectRelationList").find("tr").eq(i-1).find("input").eq(1).val();
+					if (delFlag == "1") {
+						count = i;
+					}
+				}
+				if (idx1>count){
+					var id=$("#workInvoiceProjectRelationList").find("tr").eq(count).find("input").eq(3).val();
+					if (id!=undefined && id != ''){
+						if (row== undefined){
+							row={"isProject": "1","isProjectFalg": "1"};
+							$("#chargeType").val("1")
+							layui.form.render();
+						}
+					}else{
+						parent.layer.msg("非项目,只能有一条非项目数据",{icon:6});
+						$("#chargeType").val("2")
+						layui.form.render();
+						return false;
+					}
+				}
+			}
 			if(list == '#workInvoiceProjectRelationList'){
 				bornTemplete1(list, idx, tpl, row, idx1);
 			}
@@ -273,10 +336,21 @@
 				$(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);
-			// }
+			var length=$("#workInvoiceProjectRelationList tr").length;
+			var count=length;
+			for (var i=1;i<=length;i++) {
+				var delFlag = $("#workInvoiceProjectRelationList").find("tr").eq(i-1).find("input").eq(1).val();
+				if (delFlag == "1") {
+					count =count-1;
+				}
+			}
+			if(count==1){
+				$("#chargeType").val("2")
+				layui.form.render();
+			}else if (count>1){
+				$("#chargeType").val("1")
+				layui.form.render();
+			}
 		}
 		function provinceForShort(province){
 			if(province == "北京市")
@@ -492,7 +566,8 @@
                         </td>
                         <td>
                             <sys:gridselectcallprojecttss url="${ctx}/workinvoice/workInvoice/selectproject" id="workInvoiceProjectRelationList{{idx}}_projectId" name="workInvoiceProjectRelationList[{{idx}}].projectId"  value="{{row.projectId}}"  title="选择所属项目" labelName="workInvoiceProjectRelationList[{{idx}}].projectName" cssStyle="background-color: #fff"
-													labelValue="{{row.projectName}}" cssClass="form-control judgment layui-input" fieldLabels="项目" fieldKeys="projectName" searchLabel="项目名称" searchKey="projectName"  isProject="{{row.isProject}}" details="{{row.details}}"></sys:gridselectcallprojecttss>
+															labelValue="{{row.projectName}}" cssClass="form-control judgment layui-input" fieldLabels="项目" fieldKeys="projectName" searchLabel="项目名称" searchKey="projectName"  isProject="{{row.isProject}}" isProjectFalg="{{row.isProjectFalg}}" details="{{row.details}}"></sys:gridselectcallprojecttss>
+
                         </td>
                         <td>
 							<input id="workInvoiceProjectRelationList{{idx}}_workContractName"   type="text" value="{{row.workContractName}}" readonly="readonly"  class="form-control"/>
@@ -613,7 +688,7 @@
 				<div class="layui-item layui-col-sm6">
 					<label class="layui-form-label"><span class="require-item">*</span>收款类型:</label>
 					<div class="layui-input-block">
-						<form:select  path="chargeType" class="form-control simple-select judgment">
+						<form:select  path="chargeType" class="form-control simple-select judgment" disabled="true">
 							<form:options items="${fns:getMainDictList('receipt_type')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
 						</form:select>
 					</div>

+ 38 - 10
src/main/webapp/webpage/modules/workinvoice/workInvoiceAllTwoList.jsp

@@ -448,6 +448,22 @@
 				}
 			}
 		}
+		function readProjectInfo(obj,numbers) {
+        	if(numbers!=undefined && numbers!=""){
+				var vals=numbers.split(",");
+				var value="";
+				for (var i=0;i<vals.length;i++){
+					value+=vals[i]+";</br>"
+				}
+				if (vals.length>0){
+					layer.tips(value, obj, {
+						tips: [3, '#000'],
+						area: ['250px', 'auto'],
+						time: 3000
+					});
+				}
+			}
+		}
 
 	</script>
 	<style>
@@ -623,6 +639,12 @@
 								</form:select>
 							</div>
 						</div>
+						<div class="layui-item query athird">
+							<label class="layui-form-label">项目名称:</label>
+							<div class="layui-input-block with-icon">
+								<form:input path="projectName" htmlEscape="false"  class=" form-control layui-input"/>
+							</div>
+						</div>
 					</div>
 				</form:form>
 			</div>
@@ -667,17 +689,23 @@
             ,cols: [[
 				//{checkbox: true, fixed: true},
                 {field:'index',align:'center', title: '序号',width:40}
+				,{field:'invoiceNum',align:'center', sort:true,title: '发票申请编号', minWidth:130,templet:function(d){
+						return "<a class=\"attention-info\" title=\""+ d.invoiceNum +"\"href=\"javascript:void(0);\" onclick=\"openDialogListView('查看发票管理', '${ctx}/workinvoiceAllTwo/workinvoiceAllTwo/form?id=" + d.id + "&tabId=1','"+ d.id +"','95%', '95%')\">" + d.invoiceNum + "</a>";
+					}}
 				,{field:'projName',align:'center', title: '项目名称', minWidth:160,templet:function(d){
 						if(1 == d.showView && d.showView != undefined){
-							return "<a class=\"attention-info\" title=\"" + d.projName + "\" href=\"javascript:void(0);\" onclick=\"openDialogView('查看项目', '${ctx}/workinvoiceAllTwo/workinvoiceAllTwo/projectview?id=" + d.id +"','95%', '95%')\">" + d.projName + "</a>";
+							return "<a class=\"attention-info\" onmouseover=\"readProjectInfo(this,'"+d.projName+"')\" href=\"javascript:void(0);\" onclick=\"openDialogView('查看项目', '${ctx}/workinvoiceAll/workInvoiceAll/projectview?id=" + d.id +"','95%', '95%')\">" + d.projName + "</a>";
 						}else{
 							return "<span title='"+ d.projName +"'>" +d.projName+ "</span>";
 						}
-					<%--return "<a class=\"attention-info\" title=\"" + d.projName + "\" href=\"javascript:void(0);\" onclick=\"openDialogView('查看项目', '${ctx}/ruralProject/ruralProjectRecords/view?id=" + d.projectId +"','95%', '95%')\">" + d.projName + "</a>";--%>
 					}}
-                ,{field:'invoiceNum',align:'center', sort:true,title: '发票申请编号', minWidth:130,templet:function(d){
-                        return "<a class=\"attention-info\" title=\""+ d.invoiceNum +"\"href=\"javascript:void(0);\" onclick=\"openDialogListView('查看发票管理', '${ctx}/workinvoiceAllTwo/workinvoiceAllTwo/form?id=" + d.id + "&tabId=1','"+ d.id +"','95%', '95%')\">" + d.invoiceNum + "</a>";
-                    }}
+				,{field:'reportNumber',align:'center', sort:true,title: '报告号', minWidth:130,templet:function(d){
+						if (d.reportNumber!=''){
+							return "<span class=\"attention-info\" title=\""+ d.reportNumber +"\">" + d.reportNumber + "</span>";
+						}else{
+							return "<span class=\"attention-info\" title=\"\">无</span>";
+						}
+					}}
 				// ,{field:'widNumber',align:'center', title: '发票号',  width:90,templet:function(d){
 				// 		return "<span title='"+ d.widNumber +"'>" + d.widNumber + "</span>";
 				// 	}}
@@ -687,9 +715,12 @@
 				,{field:'responsibleName', align:'center',title: '经办人', minWidth:80,templet:function(d){
 						return "<span title='"+ d.responsibleName +"'>" + d.responsibleName + "</span>";
 					}}
-				,{field:'officeName', align:'center',title: '经办单位',width:80,templet:function(d){
+				,{field:'officeName', align:'center',title: '部门',width:80,templet:function(d){
 						return "<span title='"+ d.officeName +"'>" + d.officeName + "</span>";
 					}}
+				,{field:'chargeType',align:'center', title: '收款类型',  width:90,templet:function(d){
+						return "<span title='"+ d.chargeType +"'>" + d.chargeType + "</span>";
+					}}
 				,{field:'money',align:'center', title: '开票金额(元)',  width:110,templet:function(d){
 						var numbers = new Array();;
 						if (d.workAccountListStr.length>0){
@@ -706,9 +737,6 @@
 				,{field:'billingContent',align:'center', title: '开票内容',  width:90,templet:function(d){
 						return "<span title='"+ d.billingContent +"'>" + d.billingContent + "</span>";
 					}}
-				,{field:'chargeType',align:'center', title: '收款类型',  width:90,templet:function(d){
-						return "<span title='"+ d.chargeType +"'>" + d.chargeType + "</span>";
-					}}
 				,{field:'invoiceType',align:'center', title: '发票类型',  width:90,templet:function(d){
 						return "<span title='"+ d.invoiceType +"'>" + d.invoiceType + "</span>";
 					}}
@@ -810,7 +838,7 @@
                     ,"projNum":"${workInvoice.project.projectId}"
                     ,"projectId":"${workInvoice.project.id}"
                     ,"areaName":"${workInvoice.project.county}"
-                    ,"reportNumber":"${workInvoice.project.reportData.number}"
+                    ,"reportNumber":"${workInvoice.reportNumber}"
                     ,"projName":"${workInvoice.projectName}"
                     ,"clientName":"${workInvoice.client.name}"
                     ,"officeName":"${workInvoice.office.name}"

+ 87 - 11
src/main/webapp/webpage/modules/workinvoice/workInvoiceForm.jsp

@@ -30,6 +30,25 @@
         function doSubmit(obj){//回调函数,在编辑和保存动作时,供openDialog调用提交表单。
             //debugger
             if(validateForm.form()){
+				var leng=$("#workInvoiceProjectRelationList tr").length;
+				if (leng>1){
+					var count=0;
+					var count1=leng;
+					for (var i=0;i<leng;i++) {
+						var delFlag = $("#workInvoiceProjectRelationList").find("tr").eq(i).find("input").eq(1).val();
+						if (delFlag == "1") {
+							count = i+1;
+							count1 = count1-1;
+						}
+					}
+					if (count1!=1){
+						var id=$("#workInvoiceProjectRelationList").find("tr").eq(count).find("input").eq(3).val();
+						if (id==undefined || id == ''){
+							parent.layer.msg("非项目,只能有一条非项目数据,请删除其余项目数据",{icon:6});
+							return false;
+						}
+					}
+				}
                 if(obj == 2){
                     $("#inputForm").attr("action","${ctx}/workinvoice/workInvoice/store");
                 }else{
@@ -48,7 +67,8 @@
 						return flag;
 					}
                 }
-                $("#inputForm").submit();
+				$("#chargeType").removeAttr("disabled")
+				$("#inputForm").submit();
                 return true;
             }else {
 				parent.layer.msg("信息未填写完整!", {icon: 5});
@@ -174,12 +194,12 @@
                 }
             })
         }
-        function setPNumber(obj,ids,isProject,details){
+		function setPNumber(obj,ids,isProject,details){
 			var idx=ids.split("_")[0]
 			if (isProject==1){
 				$.ajax({
 					type:'post',
-					url:'${ctx}/workinvoice/workInvoice/getPNumber',
+					url:'${ctx}/workinvoiceTwo/workinvoiceTwo/getPNumber',
 					data:{
 						"obj":obj
 					},
@@ -205,11 +225,28 @@
 				var detailsName="#"+idx+"_details";
 				$(workContractName).val(details);
 				$(detailsName).val(details);
+
+				var projectNum="#"+idx+"_projectNum";
+				var clientName="#"+idx+"_clientName";
+				var reportDataNum="#"+idx+"_reportDataNum";
+				$(projectNum).val("");
+				$(clientName).val("");
+				$(reportDataNum).val("");
+				var length=$("#workInvoiceProjectRelationList tr").length;
+				if(length>1){
+					var id=$("#workInvoiceProjectRelationList").find("tr").eq(0).find("input").eq(3).val();
+					if (id==undefined || id == ''){
+						parent.layer.msg("非项目,只能有一条非项目数据,请删除其余项目数据",{icon:6});
+						return false;
+					}
+				}
+
 			}
 
-        }
+		}
+
 
-        function addRow(list, idx, tpl, row){
+		function addRow(list, idx, tpl, row){
             var idx1 = $("#workAccountList tr").length;
             if(list == '#workAccountList' && idx1 < 100){
                 bornTemplete(list, idx, tpl, row, idx1);
@@ -235,6 +272,34 @@
 
 		function addRow1(list, idx, tpl, row){
 			var idx1 = $("#workInvoiceProjectRelationList tr").length;
+			if ('${workInvoice.chargeType}' == ''){
+				$("#chargeType").val("2")
+				layui.form.render();
+			}
+			if(idx1>0){
+				var count=0;
+				for (var i=1;i<=idx1;i++) {
+					var delFlag = $("#workInvoiceProjectRelationList").find("tr").eq(i-1).find("input").eq(1).val();
+					if (delFlag == "1") {
+						count = i;
+					}
+				}
+				if (idx1>count){
+					var id=$("#workInvoiceProjectRelationList").find("tr").eq(count).find("input").eq(3).val();
+					if (id!=undefined && id != ''){
+						if (row== undefined){
+							row={"isProject": "1","isProjectFalg": "1"};
+							$("#chargeType").val("1")
+							layui.form.render();
+						}
+					}else{
+						parent.layer.msg("非项目,只能有一条非项目数据",{icon:6});
+						$("#chargeType").val("2")
+						layui.form.render();
+						return false;
+					}
+				}
+			}
 			if(list == '#workInvoiceProjectRelationList'){
 				bornTemplete1(list, idx, tpl, row, idx1);
 			}
@@ -272,10 +337,21 @@
                 $(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);
-            // }
+		   var length=$("#workInvoiceProjectRelationList tr").length;
+		   var count=length;
+		   for (var i=1;i<=length;i++) {
+			   var delFlag = $("#workInvoiceProjectRelationList").find("tr").eq(i-1).find("input").eq(1).val();
+			   if (delFlag == "1") {
+				   count =count-1;
+			   }
+		   }
+		   if(count==1){
+			   $("#chargeType").val("2")
+			   layui.form.render();
+		   }else if (count>1){
+			   $("#chargeType").val("1")
+			   layui.form.render();
+		   }
         }
         function provinceForShort(province){
             if(province == "北京市")
@@ -491,7 +567,7 @@
                         </td>
                         <td>
                             <sys:gridselectcallprojecttss url="${ctx}/workinvoice/workInvoice/selectproject" id="workInvoiceProjectRelationList{{idx}}_projectId" name="workInvoiceProjectRelationList[{{idx}}].projectId"  value="{{row.projectId}}"  title="选择所属项目" labelName="workInvoiceProjectRelationList[{{idx}}].projectName" cssStyle="background-color: #fff"
-													labelValue="{{row.projectName}}" cssClass="form-control judgment layui-input" fieldLabels="项目" fieldKeys="projectName" searchLabel="项目名称" searchKey="projectName"  isProject="{{row.isProject}}" details="{{row.details}}"></sys:gridselectcallprojecttss>
+														labelValue="{{row.projectName}}" cssClass="form-control judgment layui-input" fieldLabels="项目" fieldKeys="projectName" searchLabel="项目名称" searchKey="projectName"  isProject="{{row.isProject}}" isProjectFalg="{{row.isProjectFalg}}" details="{{row.details}}"></sys:gridselectcallprojecttss>
                         </td>
                         <td>
 							<input id="workInvoiceProjectRelationList{{idx}}_workContractName"   type="text" value="{{row.workContractName}}" readonly="readonly"  class="form-control"/>
@@ -612,7 +688,7 @@
 				<div class="layui-item layui-col-sm6">
 					<label class="layui-form-label"><span class="require-item">*</span>收款类型:</label>
 					<div class="layui-input-block">
-						<form:select  path="chargeType" class="form-control simple-select judgment">
+						<form:select  path="chargeType" class="form-control simple-select judgment" disabled="true">
 							<form:options items="${fns:getMainDictList('receipt_type')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
 						</form:select>
 					</div>

+ 82 - 20
src/main/webapp/webpage/modules/workinvoice/workInvoiceModify.jsp

@@ -18,11 +18,30 @@
         function doSubmit(obj){//回调函数,在编辑和保存动作时,供openDialog调用提交表单。
             //debugger
             if(validateForm.form()){
-                if(obj == 2){
+				var leng=$("#workInvoiceProjectRelationList tr").length;
+				if (leng>1){
+					var count=0;
+					var count1=leng;
+					for (var i=0;i<leng;i++) {
+						var delFlag = $("#workInvoiceProjectRelationList").find("tr").eq(i).find("input").eq(1).val();
+						if (delFlag == "1") {
+							count = i+1;
+							count1 = count1-1;
+						}
+					}
+					if (count1!=1){
+						var id=$("#workInvoiceProjectRelationList").find("tr").eq(count).find("input").eq(3).val();
+						if (id==undefined || id == ''){
+							parent.layer.msg("非项目,只能有一条非项目数据,请删除其余项目数据",{icon:6});
+							return false;
+						}
+					}
+				}
+
+				if(obj == 2){
                     $("#flag").val("no");
                 }else{
 					var flags=judgment();
-					var leng=$("#workInvoiceProjectRelationList tr").length;
 					if (leng==0){
 						flags=2;
 					}
@@ -36,7 +55,8 @@
 						return flags;
 					}
                 }
-                $("#inputForm").submit();
+				$("#chargeType").removeAttr("disabled")
+				$("#inputForm").submit();
                 return true;
             }else {
 				parent.layer.msg("信息未填写完整!", {icon: 5});
@@ -206,6 +226,21 @@
 				var detailsName="#"+idx+"_details";
 				$(workContractName).val(details);
 				$(detailsName).val(details);
+
+				var projectNum="#"+idx+"_projectNum";
+				var clientName="#"+idx+"_clientName";
+				var reportDataNum="#"+idx+"_reportDataNum";
+				$(projectNum).val("");
+				$(clientName).val("");
+				$(reportDataNum).val("");
+				var length=$("#workInvoiceProjectRelationList tr").length;
+				if(length>1){
+					var id=$("#workInvoiceProjectRelationList").find("tr").eq(0).find("input").eq(3).val();
+					if (id==undefined || id == ''){
+						parent.layer.msg("非项目,只能有一条非项目数据,请删除其余项目数据",{icon:6});
+						return false;
+					}
+				}
 			}
 		}
 
@@ -234,19 +269,35 @@
         }
 		function addRow1(list, idx, tpl, row){
 			var idx1 = $("#workInvoiceProjectRelationList tr").length;
+			if ('${workInvoice.chargeType}' == ''){
+				$("#chargeType").val("2")
+				layui.form.render();
+			}
+			if(idx1>0){
+				var count=0;
+				for (var i=1;i<=idx1;i++) {
+					var delFlag = $("#workInvoiceProjectRelationList").find("tr").eq(i-1).find("input").eq(1).val();
+					if (delFlag == "1") {
+						count = i;
+					}
+				}
+				if (idx1>count){
+					var id=$("#workInvoiceProjectRelationList").find("tr").eq(count).find("input").eq(3).val();
+					if (id!=undefined && id != ''){
+						if (row== undefined){
+							row={"isProject": "1","isProjectFalg": "1"};
+							$("#chargeType").val("1")
+							layui.form.render();
+						}
+					}else{
+						parent.layer.msg("非项目,只能有一条非项目数据",{icon:6});
+						$("#chargeType").val("2")
+						layui.form.render();
+						return false;
+					}
+				}
+			}
 			if(list == '#workInvoiceProjectRelationList'){
-				// tpl = tpl.replace("workAccountList[0].financialSubjects","workAccountList["+idx1+"].financialSubjects");
-				// tpl = tpl.replace("workAccountList[0].financialSubjectss","workAccountList["+idx1+"].financialSubjectss");
-				/*var ext = $("input[name='ext']:checked").val();
-                if(ext == 0){
-                    tpl = tpl.replace("not_project_reimbursement_div","not_project_reimbursement_div\" style=\"display:none;\"");
-                    tpl = tpl.replace("project_reimbursement_div\" style=\"display:none;\"","project_reimbursement_div");
-                }else {
-                    tpl = tpl.replace("project_reimbursement_div","project_reimbursement_div\" style=\"display:none;\"");
-                    tpl = tpl.replace("not_project_reimbursement_div\" style=\"display:none;\"","not_project_reimbursement_div\"");
-                }*/
-				// tpl = tpl.replace("not_project_reimbursement_div","not_project_reimbursement_div\" style=\"display:none;\"");
-				// tpl = tpl.replace("project_reimbursement_div\" style=\"display:none;\"","project_reimbursement_div");
 				bornTemplete1(list, idx, tpl, row, idx1);
 			}
 		}
@@ -284,10 +335,21 @@
 				$(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);
-			// }
+			var length=$("#workInvoiceProjectRelationList tr").length;
+			var count=length;
+			for (var i=1;i<=length;i++) {
+				var delFlag = $("#workInvoiceProjectRelationList").find("tr").eq(i-1).find("input").eq(1).val();
+				if (delFlag == "1") {
+					count =count-1;
+				}
+			}
+			if(count==1){
+				$("#chargeType").val("2")
+				layui.form.render();
+			}else if (count>1){
+				$("#chargeType").val("1")
+				layui.form.render();
+			}
 		}
         /*function delRow(obj, prefix) {
             var id = $(prefix + "_id");
@@ -637,7 +699,7 @@
 				<div class="layui-item layui-col-sm6">
 					<label class="layui-form-label"><span class="require-item">*</span>收款类型:</label>
 					<div class="layui-input-block">
-						<form:select  path="chargeType" class="form-control simple-select judgment">
+						<form:select  path="chargeType" class="form-control simple-select judgment" disabled="true">
 							<form:options items="${fns:getMainDictList('receipt_type')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
 						</form:select>
 					</div>

+ 85 - 9
src/main/webapp/webpage/modules/workinvoice/workInvoiceTwoForm.jsp

@@ -30,11 +30,29 @@
         function doSubmit(obj){//回调函数,在编辑和保存动作时,供openDialog调用提交表单。
             //debugger
             if(validateForm.form()){
-                if(obj == 2){
+				var leng=$("#workInvoiceProjectRelationList tr").length;
+				if (leng>1){
+					var count=0;
+					var count1=leng;
+					for (var i=0;i<leng;i++) {
+						var delFlag = $("#workInvoiceProjectRelationList").find("tr").eq(i).find("input").eq(1).val();
+						if (delFlag == "1") {
+							count = i+1;
+							count1 = count1-1;
+						}
+					}
+					if (count1!=1){
+						var id=$("#workInvoiceProjectRelationList").find("tr").eq(count).find("input").eq(3).val();
+						if (id==undefined || id == ''){
+							parent.layer.msg("非项目,只能有一条非项目数据,请删除其余项目数据",{icon:6});
+							return false;
+						}
+					}
+				}
+				if(obj == 2){
                     $("#inputForm").attr("action","${ctx}/workinvoiceTwo/workinvoiceTwo/store");
                 }else{
 					var flag=judgment();
-					var leng=$("#workInvoiceProjectRelationList tr").length;
 					if (leng==0){
 						flag=2;
 					}
@@ -42,13 +60,15 @@
 						parent.layer.msg("先添加项目信息!", {icon: 5});
 						return false;
 					}
+
 					if (flag){
 						$("#inputForm").attr("action","${ctx}/workinvoiceTwo/workinvoiceTwo/save");
 					}else if (!flags){
 						return flag;
 					}
                 }
-                $("#inputForm").submit();
+				$("#chargeType").removeAttr("disabled")
+				$("#inputForm").submit();
                 return true;
             }else {
 				parent.layer.msg("信息未填写完整!", {icon: 5});
@@ -205,6 +225,22 @@
 				var detailsName="#"+idx+"_details";
 				$(workContractName).val(details);
 				$(detailsName).val(details);
+
+				var projectNum="#"+idx+"_projectNum";
+				var clientName="#"+idx+"_clientName";
+				var reportDataNum="#"+idx+"_reportDataNum";
+				$(projectNum).val("");
+				$(clientName).val("");
+				$(reportDataNum).val("");
+				var length=$("#workInvoiceProjectRelationList tr").length;
+				if(length>1){
+					var id=$("#workInvoiceProjectRelationList").find("tr").eq(0).find("input").eq(3).val();
+					if (id==undefined || id == ''){
+						parent.layer.msg("非项目,只能有一条非项目数据,请删除其余项目数据",{icon:6});
+						return false;
+					}
+				}
+
 			}
 
         }
@@ -235,6 +271,34 @@
 
 		function addRow1(list, idx, tpl, row){
 			var idx1 = $("#workInvoiceProjectRelationList tr").length;
+			if ('${workInvoice.chargeType}' == ''){
+				$("#chargeType").val("2")
+				layui.form.render();
+			}
+			if(idx1>0){
+				var count=0;
+				for (var i=1;i<=idx1;i++) {
+					var delFlag = $("#workInvoiceProjectRelationList").find("tr").eq(i-1).find("input").eq(1).val();
+					if (delFlag == "1") {
+						count = i;
+					}
+				}
+				if (idx1>count){
+					var id=$("#workInvoiceProjectRelationList").find("tr").eq(count).find("input").eq(3).val();
+					if (id!=undefined && id != ''){
+						if (row== undefined){
+							row={"isProject": "1","isProjectFalg": "1"};
+							$("#chargeType").val("1")
+							layui.form.render();
+						}
+					}else{
+						parent.layer.msg("非项目,只能有一条非项目数据",{icon:6});
+						$("#chargeType").val("2")
+						layui.form.render();
+						return false;
+					}
+				}
+			}
 			if(list == '#workInvoiceProjectRelationList'){
 				bornTemplete1(list, idx, tpl, row, idx1);
 			}
@@ -272,10 +336,21 @@
                 $(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);
-            // }
+		   var length=$("#workInvoiceProjectRelationList tr").length;
+		   var count=length;
+		   for (var i=1;i<=length;i++) {
+			   var delFlag = $("#workInvoiceProjectRelationList").find("tr").eq(i-1).find("input").eq(1).val();
+			   if (delFlag == "1") {
+				   count =count-1;
+			   }
+		   }
+		   if(count==1){
+			   $("#chargeType").val("2")
+			   layui.form.render();
+		   }else if (count>1){
+			   $("#chargeType").val("1")
+			   layui.form.render();
+		   }
         }
         function provinceForShort(province){
             if(province == "北京市")
@@ -491,7 +566,7 @@
                         </td>
                         <td>
                             <sys:gridselectcallprojecttss url="${ctx}/workinvoiceTwo/workinvoiceTwo/selectproject" id="workInvoiceProjectRelationList{{idx}}_projectId" name="workInvoiceProjectRelationList[{{idx}}].projectId"  value="{{row.projectId}}"  title="选择所属项目" labelName="workInvoiceProjectRelationList[{{idx}}].projectName" cssStyle="background-color: #fff"
-													labelValue="{{row.projectName}}" cssClass="form-control judgment layui-input" fieldLabels="项目" fieldKeys="projectName" searchLabel="项目名称" searchKey="projectName"  isProject="{{row.isProject}}" details="{{row.details}}"></sys:gridselectcallprojecttss>
+													labelValue="{{row.projectName}}" cssClass="form-control judgment layui-input" fieldLabels="项目" fieldKeys="projectName" searchLabel="项目名称" searchKey="projectName"  isProject="{{row.isProject}}" isProjectFalg="{{row.isProjectFalg}}" details="{{row.details}}"></sys:gridselectcallprojecttss>
                         </td>
                         <td>
 							<input id="workInvoiceProjectRelationList{{idx}}_workContractName"   type="text" value="{{row.workContractName}}" readonly="readonly"  class="form-control"/>
@@ -517,6 +592,7 @@
 						}*/
 						$(document).ready(function() {
 							var data = ${fns:toJson(workInvoice.workInvoiceProjectRelationList)};
+							console.log(data)
 							for (var i=0; i<data.length; i++){
 								addRow1('#workInvoiceProjectRelationList', workInvoiceProjectRelationListRowIdx, workInvoiceProjectRelationListTpl, data[i])
 								workInvoiceProjectRelationListRowIdx = workInvoiceProjectRelationListRowIdx + 1;
@@ -612,7 +688,7 @@
 				<div class="layui-item layui-col-sm6">
 					<label class="layui-form-label"><span class="require-item">*</span>收款类型:</label>
 					<div class="layui-input-block">
-						<form:select  path="chargeType" class="form-control simple-select judgment">
+						<form:select  path="chargeType" class="form-control simple-select judgment" disabled="true">
 							<form:options items="${fns:getMainDictList('receipt_type')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
 						</form:select>
 					</div>

+ 38 - 9
src/main/webapp/webpage/modules/workinvoice/workInvoiceTwoList.jsp

@@ -451,6 +451,22 @@
 				}
 			}
 		}
+		function readProjectInfo(obj,numbers) {
+			if(numbers!=undefined && numbers!=""){
+				var vals=numbers.split(",");
+				var value="";
+				for (var i=0;i<vals.length;i++){
+					value+=vals[i]+";</br>"
+				}
+				if (vals.length>0){
+					layer.tips(value, obj, {
+						tips: [3, '#000'],
+						area: ['250px', 'auto'],
+						time: 3000
+					});
+				}
+			}
+		}
 
 	</script>
 	<style>
@@ -620,6 +636,12 @@
 								</form:select>
 							</div>
 						</div>
+						<div class="layui-item query athird">
+							<label class="layui-form-label">项目名称:</label>
+							<div class="layui-input-block with-icon">
+								<form:input path="projectName" htmlEscape="false"  class=" form-control layui-input"/>
+							</div>
+						</div>
 					</div>
 				</form:form>
 			</div>
@@ -663,16 +685,23 @@
             ,cols: [[
 				//{checkbox: true, fixed: true},
                 {field:'index',align:'center', title: '序号',width:40}
+				,{field:'invoiceNum',align:'center', sort:true,title: '发票申请编号', minWidth:130,templet:function(d){
+						return "<a class=\"attention-info\" title=\""+ d.invoiceNum +"\"href=\"javascript:void(0);\" onclick=\"openDialogListView('查看发票管理', '${ctx}/workinvoiceTwo/workinvoiceTwo/form?id=" + d.id + "&tabId=1','"+ d.id +"','95%', '95%')\">" + d.invoiceNum + "</a>";
+					}}
 				,{field:'projName',align:'center', title: '项目名称', minWidth:160,templet:function(d){
 						if(1 == d.showView && d.showView != undefined){
-							return "<a class=\"attention-info\" title=\"" + d.projName + "\" href=\"javascript:void(0);\" onclick=\"openDialogView('查看项目', '${ctx}/workinvoiceAll/workInvoiceAll/projectview?id=" + d.id +"','95%', '95%')\">" + d.projName + "</a>";
+							return "<a class=\"attention-info\" onmouseover=\"readProjectInfo(this,'"+d.projName+"')\" href=\"javascript:void(0);\" onclick=\"openDialogView('查看项目', '${ctx}/workinvoiceAll/workInvoiceAll/projectview?id=" + d.id +"','95%', '95%')\">" + d.projName + "</a>";
 						}else{
 							return "<span title='"+ d.projName +"'>" +d.projName+ "</span>";
 						}
 					}}
-                ,{field:'invoiceNum',align:'center', sort:true,title: '发票申请编号', minWidth:130,templet:function(d){
-                        return "<a class=\"attention-info\" title=\""+ d.invoiceNum +"\"href=\"javascript:void(0);\" onclick=\"openDialogListView('查看发票管理', '${ctx}/workinvoiceTwo/workinvoiceTwo/form?id=" + d.id + "&tabId=1','"+ d.id +"','95%', '95%')\">" + d.invoiceNum + "</a>";
-                    }}
+				,{field:'reportNumber',align:'center', sort:true,title: '报告号', minWidth:130,templet:function(d){
+						if (d.reportNumber!=''){
+							return "<span class=\"attention-info\" title=\""+ d.reportNumber +"\">" + d.reportNumber + "</span>";
+						}else{
+							return "<span class=\"attention-info\" title=\"\">无</span>";
+						}
+					}}
 				// ,{field:'widNumber',align:'center', title: '发票号',  width:90,templet:function(d){
 				// 		return "<span title='"+ d.widNumber +"'>" + d.widNumber + "</span>";
 				// 	}}
@@ -682,9 +711,12 @@
 				,{field:'responsibleName', align:'center',title: '经办人', minWidth:80,templet:function(d){
 						return "<span title='"+ d.responsibleName +"'>" + d.responsibleName + "</span>";
 					}}
-				,{field:'officeName', align:'center',title: '经办单位',width:80,templet:function(d){
+				,{field:'officeName', align:'center',title: '部门',width:80,templet:function(d){
 						return "<span title='"+ d.officeName +"'>" + d.officeName + "</span>";
 					}}
+				,{field:'chargeType',align:'center', title: '收款类型',  width:90,templet:function(d){
+						return "<span title='"+ d.chargeType +"'>" + d.chargeType + "</span>";
+					}}
 				,{field:'money',align:'center', title: '开票金额(元)',  width:110,templet:function(d){
 						var numbers = new Array();;
 						if (d.workAccountListStr.length>0){
@@ -701,9 +733,6 @@
 				,{field:'billingContent',align:'center', title: '开票内容',  width:90,templet:function(d){
 						return "<span title='"+ d.billingContent +"'>" + d.billingContent + "</span>";
 					}}
-				,{field:'chargeType',align:'center', title: '收款类型',  width:90,templet:function(d){
-						return "<span title='"+ d.chargeType +"'>" + d.chargeType + "</span>";
-					}}
 				,{field:'invoiceType',align:'center', title: '发票类型',  width:90,templet:function(d){
 						return "<span title='"+ d.invoiceType +"'>" + d.invoiceType + "</span>";
 					}}
@@ -812,7 +841,7 @@
                     ,"projNum":"${workInvoice.project.projectId}"
                     ,"projectId":"${workInvoice.project.id}"
                     ,"areaName":"${workInvoice.project.county}"
-                    ,"reportNumber":"${workInvoice.project.reportData.number}"
+                    ,"reportNumber":"${workInvoice.reportNumber}"
                     ,"projName":"${workInvoice.projectName}"
                     ,"clientName":"${workInvoice.client.name}"
                     ,"officeName":"${workInvoice.office.name}"

+ 82 - 20
src/main/webapp/webpage/modules/workinvoice/workInvoiceTwoModify.jsp

@@ -18,11 +18,29 @@
         function doSubmit(obj){//回调函数,在编辑和保存动作时,供openDialog调用提交表单。
             //debugger
             if(validateForm.form()){
-                if(obj == 2){
+				var leng=$("#workInvoiceProjectRelationList tr").length;
+				if (leng>1){
+					var count=0;
+					var count1=leng;
+					for (var i=0;i<leng;i++) {
+						var delFlag = $("#workInvoiceProjectRelationList").find("tr").eq(i).find("input").eq(1).val();
+						if (delFlag == "1") {
+							count = i+1;
+							count1 = count1-1;
+						}
+					}
+					if (count1!=1){
+						var id=$("#workInvoiceProjectRelationList").find("tr").eq(count).find("input").eq(3).val();
+						if (id==undefined || id == ''){
+							parent.layer.msg("非项目,只能有一条非项目数据,请删除其余项目数据",{icon:6});
+							return false;
+						}
+					}
+				}
+				if(obj == 2){
                     $("#flag").val("no");
                 }else{
 					var flags=judgment();
-					var leng=$("#workInvoiceProjectRelationList tr").length;
 					if (leng==0){
 						flags=2;
 					}
@@ -36,6 +54,7 @@
 						return flags;
 					}
                 }
+				$("#chargeType").removeAttr("disabled")
                 $("#inputForm").submit();
                 return true;
             }else {
@@ -206,6 +225,21 @@
 				var detailsName="#"+idx+"_details";
 				$(workContractName).val(details);
 				$(detailsName).val(details);
+
+				var projectNum="#"+idx+"_projectNum";
+				var clientName="#"+idx+"_clientName";
+				var reportDataNum="#"+idx+"_reportDataNum";
+				$(projectNum).val("");
+				$(clientName).val("");
+				$(reportDataNum).val("");
+				var length=$("#workInvoiceProjectRelationList tr").length;
+				if(length>1){
+					var id=$("#workInvoiceProjectRelationList").find("tr").eq(0).find("input").eq(3).val();
+					if (id==undefined || id == ''){
+						parent.layer.msg("非项目,只能有一条非项目数据,请删除其余项目数据",{icon:6});
+						return false;
+					}
+				}
 			}
 		}
 
@@ -234,19 +268,36 @@
         }
 		function addRow1(list, idx, tpl, row){
 			var idx1 = $("#workInvoiceProjectRelationList tr").length;
+			if ('${workInvoice.chargeType}' == ''){
+				$("#chargeType").val("2")
+				layui.form.render();
+			}
+			if(idx1>0){
+				var count=0;
+				for (var i=1;i<=idx1;i++) {
+					var delFlag = $("#workInvoiceProjectRelationList").find("tr").eq(i-1).find("input").eq(1).val();
+					if (delFlag == "1") {
+						count = i;
+					}
+				}
+				if (idx1>count){
+					var id=$("#workInvoiceProjectRelationList").find("tr").eq(count).find("input").eq(3).val();
+					if (id!=undefined && id != ''){
+						if (row== undefined){
+							row={"isProject": "1","isProjectFalg": "1"};
+							$("#chargeType").val("1")
+							layui.form.render();
+						}
+					}else{
+						parent.layer.msg("非项目,只能有一条非项目数据",{icon:6});
+						$("#chargeType").val("2")
+						layui.form.render();
+						return false;
+					}
+				}
+			}
+
 			if(list == '#workInvoiceProjectRelationList'){
-				// tpl = tpl.replace("workAccountList[0].financialSubjects","workAccountList["+idx1+"].financialSubjects");
-				// tpl = tpl.replace("workAccountList[0].financialSubjectss","workAccountList["+idx1+"].financialSubjectss");
-				/*var ext = $("input[name='ext']:checked").val();
-                if(ext == 0){
-                    tpl = tpl.replace("not_project_reimbursement_div","not_project_reimbursement_div\" style=\"display:none;\"");
-                    tpl = tpl.replace("project_reimbursement_div\" style=\"display:none;\"","project_reimbursement_div");
-                }else {
-                    tpl = tpl.replace("project_reimbursement_div","project_reimbursement_div\" style=\"display:none;\"");
-                    tpl = tpl.replace("not_project_reimbursement_div\" style=\"display:none;\"","not_project_reimbursement_div\"");
-                }*/
-				// tpl = tpl.replace("not_project_reimbursement_div","not_project_reimbursement_div\" style=\"display:none;\"");
-				// tpl = tpl.replace("project_reimbursement_div\" style=\"display:none;\"","project_reimbursement_div");
 				bornTemplete1(list, idx, tpl, row, idx1);
 			}
 		}
@@ -284,10 +335,21 @@
 				$(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);
-			// }
+			var length=$("#workInvoiceProjectRelationList tr").length;
+			var count=length;
+			for (var i=1;i<=length;i++) {
+				var delFlag = $("#workInvoiceProjectRelationList").find("tr").eq(i-1).find("input").eq(1).val();
+				if (delFlag == "1") {
+					count =count-1;
+				}
+			}
+			if(count==1){
+				$("#chargeType").val("2")
+				layui.form.render();
+			}else if (count>1){
+				$("#chargeType").val("1")
+				layui.form.render();
+			}
 		}
         /*function delRow(obj, prefix) {
             var id = $(prefix + "_id");
@@ -531,7 +593,7 @@
                         </td>
                         <td>
                             <sys:gridselectcallprojecttss url="${ctx}/workinvoiceTwo/workinvoiceTwo/selectproject" id="workInvoiceProjectRelationList{{idx}}_projectId" name="workInvoiceProjectRelationList[{{idx}}].projectId"  value="{{row.projectId}}"  title="选择所属项目" labelName="workInvoiceProjectRelationList[{{idx}}].projectName" cssStyle="background-color: #fff"
-													labelValue="{{row.projectName}}" cssClass="form-control judgment layui-input" fieldLabels="项目" fieldKeys="projectName" searchLabel="项目名称" searchKey="projectName" isProject="{{row.isProject}}" details="{{row.details}}"></sys:gridselectcallprojecttss>
+													labelValue="{{row.projectName}}" cssClass="form-control judgment layui-input" fieldLabels="项目" fieldKeys="projectName" searchLabel="项目名称" searchKey="projectName" isProject="{{row.isProject}}" isProjectFalg="{{row.isProjectFalg}}" details="{{row.details}}"></sys:gridselectcallprojecttss>
                         </td>
                         <td>
 							<input id="workInvoiceProjectRelationList{{idx}}_workContractName"   type="text" value="{{row.workContractName}}" readonly="readonly"  class="form-control"/>
@@ -637,7 +699,7 @@
 				<div class="layui-item layui-col-sm6">
 					<label class="layui-form-label"><span class="require-item">*</span>收款类型:</label>
 					<div class="layui-input-block">
-						<form:select  path="chargeType" class="form-control simple-select judgment">
+						<form:select  path="chargeType" class="form-control simple-select judgment" disabled="true" >
 							<form:options items="${fns:getMainDictList('receipt_type')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
 						</form:select>
 					</div>