|
@@ -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 <= #{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>
|
|
|
|