Prechádzať zdrojové kódy

发票查询功能修改

user5 2 rokov pred
rodič
commit
8cdc9cc95f

+ 66 - 110
src/main/resources/mappings/modules/workinvoice/WorkInvoiceDao.xml

@@ -715,11 +715,11 @@
 			<if test="billingContent != null and billingContent != ''">
 				AND a.billing_content = #{billingContent}
 			</if>
-			<if test="project != null and project.projectName != null and project.projectName != ''">
-				AND p.project_name LIKE
-				<if test="dbName == 'oracle'">'%'||#{project.projectName}||'%'</if>
-				<if test="dbName == 'mssql'">'%'+#{project.projectName}+'%'</if>
-				<if test="dbName == 'mysql'">concat('%',#{project.projectName},'%')</if>
+			<if test="projectName != null and projectName != ''">
+				AND rpr.project_name LIKE
+				<if test="dbName == 'oracle'">'%'||#{projectName}||'%'</if>
+				<if test="dbName == 'mssql'">'%'+#{projectName}+'%'</if>
+				<if test="dbName == 'mysql'">concat('%',#{projectName},'%')</if>
 			</if>
 			<if test="reportNumber != null and reportNumber != ''">
 				and prds.number like
@@ -815,11 +815,11 @@
 			<if test="billingContent != null and billingContent != ''">
 				AND a.billing_content = #{billingContent}
 			</if>
-			<if test="project != null and project.projectName != null and project.projectName != ''">
-				AND p.project_name LIKE
-				<if test="dbName == 'oracle'">'%'||#{project.projectName}||'%'</if>
-				<if test="dbName == 'mssql'">'%'+#{project.projectName}+'%'</if>
-				<if test="dbName == 'mysql'">concat('%',#{project.projectName},'%')</if>
+			<if test="projectName != null and projectName != ''">
+				AND rpr.project_name LIKE
+				<if test="dbName == 'oracle'">'%'||#{projectName}||'%'</if>
+				<if test="dbName == 'mssql'">'%'+#{projectName}+'%'</if>
+				<if test="dbName == 'mysql'">concat('%',#{projectName},'%')</if>
 			</if>
 			<if test="reportNumber != null and reportNumber != ''">
 				and prds.number like
@@ -834,7 +834,7 @@
 
 	<select id="findListExport" resultType="WorkInvoice" >
 		SELECT
-		a.id AS "id",
+		DISTINCT(a.id) AS "id",
 		a.number AS "number",
 		a.process_instance_id AS "processInstanceId",
 		a.client_id AS "client.id",
@@ -847,6 +847,7 @@
 		a.content AS "content",
 		a.drawer_id AS "drawer.id",
 		a.office_id AS "office.id",
+		so.top_company AS "office.name",
 		a.invoice_number AS "invoiceNumber",
 		a.invoice_date AS "invoiceDate",
 		a.drawer_name AS "drawerName",
@@ -867,15 +868,11 @@
 		a.bank AS "bank",
 		a.bank_number AS "bankNumber",
 		a.cancle_reason AS "cancaleReason",
-		u.name AS "drawer.name",
 		su.name AS "createBy.name",
-		so.top_company AS "office.name",
 		w.name AS "client.name",
-		p.project_name AS "project.projectName",
 		p.id AS "project.id",
 		a.invoice_state AS "invoiceState",
 		p.project_id AS "project.projectId",
-		ci.name AS "project.workContractInfo.name",
 		w.usc_code AS "client.uscCode",
 		w.fax AS "client.fax",
 		w.or_unicode AS "client.orUnicode",
@@ -887,17 +884,18 @@
 		a.province AS "province",
 		a.ext AS "ext",
 		a.billing_content as "billingContent",
-		prd.number as "project.reportData.number",
 		p.area_name as "project.county",
 		a.receipt_money_date as "receiptMoneyDate",
 		(case when a.receipt_money = '0' then '否' when a.receipt_money = '1' then '是' else '否' end) as receiptMoney,
 		a.cancellation_remark as "cancellationRemark",
 		a.account_checking_user_id as "accountCheckingUserId",
 		a.area_id as "area.id",
-		acu.name as "accountCheckingUserName"
+		a.new_drawer_id as "newDrawerId",
+		a.new_drawer as "newDrawer",
+		a.actual_drawer_id as "actualDrawerId"
 		,wid.number as "widNumber"
-		,wid.total_money as "widTotalMoney"
-		,(select
+		,wid.total_money as "widTotalMoney",
+		(select
 		CASE
 		WHEN RIGHT( GROUP_CONCAT(is_project),1) =2 THEN GROUP_CONCAT(concat('其他:',wipr1.details))
 		WHEN RIGHT( GROUP_CONCAT(is_project),1) =1 THEN GROUP_CONCAT(rpr1.project_name)
@@ -913,11 +911,35 @@
 		LEFT JOIN project_report_data prd1 ON prd1.project_id = wipr1.project_id
 		WHERE wipr1.invoice_id = a.id) as reportNumber
 		FROM work_invoice a
-		<include refid="workInvoiceJoins"/>
-		left join work_invoice_detail wid on a.id = wid.invoice_id
+		LEFT JOIN sys_user su ON su.id = a.create_by
+		LEFT JOIN work_client_info w ON  w.id = a.client_id
+		LEFT JOIN rural_project_records p ON  p.id = a.project_id
+		left join work_invoice_project_relation wipr on a.id = wipr.invoice_id
+		left join rural_project_records rpr on rpr.id = wipr.project_id
+		left join project_report_data prds on rpr.id = prds.project_id
 		LEFT JOIN sys_user sua ON sua.id = a.account_checking_user_id
+		left join work_invoice_detail wid on a.id = wid.invoice_id
+		LEFT join sys_office so on so.id = a.office_id
 		<where>
 			a.del_flag = #{DEL_FLAG_NORMAL}
+			<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 = #{money}
+			</if>
+			<if test="(accountCheckingUserId != null and accountCheckingUserId != '') or (accountCheckingUserName != null and accountCheckingUserName != '')">
+				AND (a.account_checking_user_id = #{accountCheckingUserId} or sua.name like concat('%',#{accountCheckingUserName},'%'))
+			</if>
+			<if test="area != null and area.id != null and area.id != ''">
+				AND a.area_parent_id LIKE
+				<if test="dbName == 'oracle'">'%'||#{area.id}||'%'</if>
+				<if test="dbName == 'mssql'">'%'+#{area.id}+'%'</if>
+				<if test="dbName == 'mysql'">concat('%',#{area.id},'%')</if>
+			</if>
 			<if test="number != null and number != ''">
 				AND a.number LIKE
 				<if test="dbName == 'oracle'">'%'||#{number}||'%'</if>
@@ -930,37 +952,17 @@
 			<if test="beginContractDate != null and endContractDate != null and beginContractDate != '' and endContractDate != ''">
 				AND a.invoice_date BETWEEN #{beginContractDate} AND #{endContractDate}
 			</if>
-
-			<if test="receiptBeginDate != null and receiptBeginDate != ''">
-				AND date_format(a.receipt_money_date,'%Y-%m-%d') &gt;= date_format(#{receiptBeginDate},'%Y-%m-%d')
-			</if>
-			<if test="receiptEndDate != null and receiptEndDate != ''">
-				AND date_format(a.receipt_money_date,'%Y-%m-%d') &lt;= date_format(#{receiptEndDate},'%Y-%m-%d')
-			</if>
-
-			<if test="client != null and client.id != null and client.id != ''">
-				AND a.client_id = #{client.id}
-			</if>
-			<if test="project != null and project.id != null and project.id != ''">
-				AND a.project_id = #{project.id}
-			</if>
-			<if test="project != null and project.projectId != null and project.projectId != ''">
-				AND p.project_id LIKE
-				<if test="dbName == 'oracle'">'%'||#{project.projectId}||'%'</if>
-				<if test="dbName == 'mssql'">'%'+#{project.projectId}+'%'</if>
-				<if test="dbName == 'mysql'">concat('%',#{project.projectId},'%')</if>
+			<if test="officeIdList!=null and officeIdList.size!=0">
+				and a.office_id in
+				<foreach collection="officeIdList" item="officeId" separator="," open="(" close=")">
+					#{officeId}
+				</foreach>
 			</if>
-			<if test="project != null and project.projectName != null and project.projectName != ''">
-				AND p.project_name LIKE
-				<if test="dbName == 'oracle'">'%'||#{project.projectName}||'%'</if>
-				<if test="dbName == 'mssql'">'%'+#{project.projectName}+'%'</if>
-				<if test="dbName == 'mysql'">concat('%',#{project.projectName},'%')</if>
+			<if test="(submitterId != null and submitterId != '') or (submitterName != null and submitterName != '')">
+				AND (a.create_by = #{submitterId} or su.name like concat('%',#{submitterName},'%'))
 			</if>
-			<if test="project != null and project.reportData != null and project.reportData.number != null and project.reportData.number != ''">
-				AND prd.number LIKE
-				<if test="dbName == 'oracle'">'%'||#{project.reportData.number}||'%'</if>
-				<if test="dbName == 'mssql'">'%'+#{project.reportData.number}+'%'</if>
-				<if test="dbName == 'mysql'">concat('%',#{project.reportData.number},'%')</if>
+			<if test="receiptBeginDate != null and receiptBeginDate != ''">
+				AND date_format(a.receipt_money_date,'%Y-%m-%d') &gt;= date_format(#{receiptBeginDate},'%Y-%m-%d')
 			</if>
 			<if test="client != null and client.name != null and client.name != ''">
 				AND w.name LIKE
@@ -968,18 +970,6 @@
 				<if test="dbName == 'mssql'">'%'+#{client.name}+'%'</if>
 				<if test="dbName == 'mysql'">concat('%',#{client.name},'%')</if>
 			</if>
-			<!--<if test="officeId != null and officeId != ''">
-				AND so.id  = #{officeId}
-			</if>-->
-			<if test="money != null and money != ''">
-				AND a.money = #{money}
-			</if>
-			<!--<if test="submitterId != null and submitterId != ''">
-				AND a.create_by = #{submitterId}
-			</if>-->
-			<if test="(submitterId != null and submitterId != '') or (submitterName != null and submitterName != '')">
-				AND (a.create_by = #{submitterId} or su.name like concat('%',#{submitterName},'%'))
-			</if>
 			<if test="receiptMoney != null and receiptMoney != ''">
 				AND a.receipt_money = #{receiptMoney}
 			</if>
@@ -989,57 +979,23 @@
 			<if test="chargeType != null and chargeType != ''">
 				AND a.charge_type = #{chargeType}
 			</if>
-			<if test="content != null and content != ''">
-				AND a.content = #{content}
-			</if>
-			<if test="drawer != null and drawer.id != null and drawer.id != ''">
-				AND a.drawer_id = #{drawer.id}
-			</if>
-			<if test="companyId != null and companyId != ''">
-				AND a.company_id = #{companyId}
-			</if>
-			<!--<if test="office != null and office.id != null and office.id != ''">
-				AND a.office_id = #{office.id}
-			</if>-->
-			<if test="officeIdList!=null and officeIdList.size!=0">
-				and a.office_id in
-				<foreach collection="officeIdList" item="officeId" separator="," open="(" close=")">
-					#{officeId}
-				</foreach>
-			</if>
-			<if test="invoiceNumber != null and invoiceNumber != ''">
-				AND a.invoice_number LIKE
-				<if test="dbName == 'oracle'">'%'||#{invoiceNumber}||'%'</if>
-				<if test="dbName == 'mssql'">'%'+#{invoiceNumber}+'%'</if>
-				<if test="dbName == 'mysql'">concat('%',#{invoiceNumber},'%')</if>
-			</if>
-			<if test="invoiceDate != null and invoiceDate != ''">
-				AND a.invoice_date = #{invoiceDate}
-			</if>
-			<if test="isInvoice != null and isInvoice != ''">
-				AND a.is_invoice = #{isInvoice}
-			</if>
-			<if test="isCharge != null and isCharge != ''">
-				AND a.is_charge = #{isCharge}
-			</if>
-			<if test="isInvalid != null and isInvalid != ''">
-				AND a.is_invalid = #{isInvalid}
-			</if>
-			<if test="area != null and area.id != null and area.id != ''">
-				AND a.area_parent_id LIKE
-				<if test="dbName == 'oracle'">'%'||#{area.id}||'%'</if>
-				<if test="dbName == 'mssql'">'%'+#{area.id}+'%'</if>
-				<if test="dbName == 'mysql'">concat('%',#{area.id},'%')</if>
+			<if test="billingContent != null and billingContent != ''">
+				AND a.billing_content = #{billingContent}
 			</if>
-			<if test="(accountCheckingUserId != null and accountCheckingUserId != '') or (accountCheckingUserName != null and accountCheckingUserName != '')">
-				AND (a.account_checking_user_id = #{accountCheckingUserId} or sua.name like concat('%',#{accountCheckingUserName},'%'))
+			<if test="projectName != null and projectName != ''">
+				AND rpr.project_name LIKE
+				<if test="dbName == 'oracle'">'%'||#{projectName}||'%'</if>
+				<if test="dbName == 'mssql'">'%'+#{projectName}+'%'</if>
+				<if test="dbName == 'mysql'">concat('%',#{projectName},'%')</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 test="reportNumber != null and reportNumber != ''">
+				and prds.number like
+				<if test="dbName == 'oracle'">'%'||#{reportNumber}||'%'</if>
+				<if test="dbName == 'mssql'">'%'+#{reportNumber}+'%'</if>
+				<if test="dbName == 'mysql'">concat('%',#{reportNumber},'%')</if>
 			</if>
+
+
 			${sqlMap.dsf}
 		</where>
 		<choose>

+ 13 - 0
src/main/webapp/webpage/modules/workinvoice/workInvoiceAllList.jsp

@@ -580,6 +580,19 @@
 							</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 class="layui-item query athird">
+							<label class="layui-form-label">报告号:</label>
+							<div class="layui-input-block with-icon">
+								<form:input path="reportNumber" htmlEscape="false"  class=" form-control layui-input"/>
+							</div>
+						</div>
+
 
 					</div>
 				</form:form>