|
|
@@ -70,8 +70,7 @@
|
|
|
LEFT JOIN (
|
|
|
SELECT
|
|
|
FC.Corpid AS corpId,
|
|
|
- SUM( FC.Amount ) AS amount,
|
|
|
- SUM( FC.Settlement_Amount ) AS settlementAmount
|
|
|
+ SUM( FC.Amount ) AS amount
|
|
|
FROM finance_acc FC
|
|
|
<where>
|
|
|
FC.tenant_id = #{acc.tenantId}
|
|
|
@@ -124,28 +123,18 @@
|
|
|
HAVING SUM(IFNULL( IFNULL( BC.amount, 0 ) - IFNULL( FS.settlementAmount, 0 ), 0 )) >= 100
|
|
|
</select>
|
|
|
|
|
|
- <select id="SelAccItem" resultType="org.springblade.finance.vojo.Acc">
|
|
|
- SELECT DISTINCT
|
|
|
+ <select id="SelChargeItem" resultType="org.springblade.finance.vojo.Acc">
|
|
|
+ SELECT
|
|
|
FA.AccSysNo AS accSysNo,
|
|
|
FA.quantity AS quantity,
|
|
|
- FA.Amount AS amount,
|
|
|
- FA.Settlement_Amount AS settlementAmount,
|
|
|
- IFNULL( IFNULL( FA.Amount, 0 ) - IFNULL( FA.Settlement_Amount, 0 ), 0 ) AS balance,
|
|
|
- FS.subject_number as subjectNumber,
|
|
|
- FS.ACCOUNT_bank AS accountBank,
|
|
|
- FS.ACCOUNT_NAME AS accountName,
|
|
|
- FS.ACCOUNT_no AS accountNo,
|
|
|
- FS.over_payment AS overPayment,
|
|
|
- 0 as usedProfit,
|
|
|
- FS.case_over_payment AS caseOverPayment
|
|
|
+ FA.Amount AS amount
|
|
|
FROM finance_acc FA
|
|
|
- LEFT JOIN finance_settlement FS ON FS.Src_OrderNo = FA.AccSysNo
|
|
|
<where>
|
|
|
FA.tenant_id = #{acc.tenantId}
|
|
|
AND FA.is_deleted = 0
|
|
|
- and FC.bill_type = #{acc.billType}
|
|
|
+ and FA.bill_type = #{acc.billType}
|
|
|
<if test="acc.corpId != null and acc.corpId != ''">
|
|
|
- and FC.Corpid = #{acc.corpId}
|
|
|
+ and FA.Corpid = #{acc.corpId}
|
|
|
</if>
|
|
|
<if test="acc.accSysNo != null and acc.accSysNo != ''">
|
|
|
and FA.AccSysNo like concat('%', #{acc.accSysNo}, '%')
|
|
|
@@ -153,6 +142,54 @@
|
|
|
<if test="acc.amount != null and acc.amount != ''">
|
|
|
and FA.Amount like concat('%', #{acc.amount}, '%')
|
|
|
</if>
|
|
|
+ <if test='acc.createDateList != null and acc.createDateList[0] != null and acc.createDateList[0]!= ""'>
|
|
|
+ and FA.create_time >= #{acc.createDateList[0]}
|
|
|
+ </if>
|
|
|
+ <if test='acc.createDateList != null and acc.createDateList[1] != null and acc.createDateList[1]!= ""'>
|
|
|
+ and FA.create_time <= #{acc.createDateList[1]}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="SelPayItem" resultType="org.springblade.finance.vojo.Acc">
|
|
|
+ SELECT
|
|
|
+ FI.src_orderNo AS accSysNo,
|
|
|
+ FI.quantity AS quantity,
|
|
|
+ FI.this_amount AS amount,
|
|
|
+ FS.subject_number AS subjectNumber,
|
|
|
+ FS.ACCOUNT_bank AS accountBank,
|
|
|
+ FS.ACCOUNT_NAME AS accountName,
|
|
|
+ FS.ACCOUNT_no AS accountNo,
|
|
|
+ FS.over_payment AS overPayment,
|
|
|
+ FS.case_over_payment AS caseOverPayment
|
|
|
+ FROM finance_settlement FS
|
|
|
+ LEFT JOIN finance_items FI ON FI.pid = FS.id
|
|
|
+ <where>
|
|
|
+ FS.tenant_id = #{acc.tenantId}
|
|
|
+ AND FS.is_deleted = 0n
|
|
|
+ AND FI.is_deleted = 0
|
|
|
+ AND FS.finance_status = '结算完成'
|
|
|
+ <if test='acc.billType != null and acc.billType != "" and acc.billType == "申请"'>
|
|
|
+ AND FS.bill_type = '付费'
|
|
|
+ </if>
|
|
|
+ <if test='acc.billType != null and acc.billType != "" and acc.billType == "收费"'>
|
|
|
+ AND FS.bill_type = #{acc.billType}
|
|
|
+ </if>
|
|
|
+ <if test="acc.corpId != null and acc.corpId != ''">
|
|
|
+ and FS.Corp_id = #{acc.corpId}
|
|
|
+ </if>
|
|
|
+ <if test="acc.accSysNo != null and acc.accSysNo != ''">
|
|
|
+ and FI.src_orderNo like concat('%', #{acc.accSysNo}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="acc.amount != null and acc.amount != ''">
|
|
|
+ and FI.this_amount like concat('%', #{acc.amount}, '%')
|
|
|
+ </if>
|
|
|
+ <if test='acc.createDateList != null and acc.createDateList[0] != null and acc.createDateList[0]!= ""'>
|
|
|
+ and FS.completion_time >= #{acc.createDateList[0]}
|
|
|
+ </if>
|
|
|
+ <if test='acc.createDateList != null and acc.createDateList[1] != null and acc.createDateList[1]!= ""'>
|
|
|
+ and FS.completion_time <= #{acc.createDateList[1]}
|
|
|
+ </if>
|
|
|
</where>
|
|
|
</select>
|
|
|
|