md
This commit is contained in:
parent
10fee5583f
commit
9a7b03b8ae
@ -228,19 +228,26 @@
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
a.settle_bill_no,
|
||||
sum( b.pay_money) AS totalPayMoney,
|
||||
sum( if(b.trade_date <![CDATA[ <= ]]> a.payment_due_date,b.pay_money,0) ) AS recdMoneyIn,
|
||||
sum( if(a.settle_type='2' and a.credit_period <![CDATA[ >= ]]> 30 and b.trade_date <![CDATA[ > ]]> a.payment_due_date and b.trade_date <![CDATA[ < ]]> DATE_SUB( a.payment_due_date, INTERVAL (a.credit_period-60) DAY ),b.pay_money,0) ) AS recdPayMoney60D,
|
||||
sum( if( (a.settle_type='2' and a.credit_period <![CDATA[ >= ]]> 30 and b.trade_date <![CDATA[ >= ]]> DATE_SUB( a.payment_due_date, INTERVAL (a.credit_period-60) DAY ) ) or ( ( (a.settle_type='2' and a.credit_period <![CDATA[ < ]]> 30) or a.settle_type='1' ) and b.trade_date <![CDATA[ > ]]> a.payment_due_date ),b.pay_money,0) ) AS recdPayMoneyGreat60D
|
||||
sum( d.pay_money) AS totalPayMoney,
|
||||
sum( if(b.trade_date <![CDATA[ <= ]]> a.payment_due_date,d.pay_money,0) ) AS recdMoneyIn,
|
||||
sum( if(a.settle_type='2' and a.credit_period <![CDATA[ >= ]]> 30 and b.trade_date <![CDATA[ > ]]> a.payment_due_date and b.trade_date <![CDATA[ < ]]> DATE_SUB( a.payment_due_date, INTERVAL (a.credit_period-60) DAY ),d.pay_money,0) ) AS recdPayMoney60D,
|
||||
sum( if( (a.settle_type='2' and a.credit_period <![CDATA[ >= ]]> 30 and b.trade_date <![CDATA[ >= ]]> DATE_SUB( a.payment_due_date, INTERVAL (a.credit_period-60) DAY ) ) or ( ( (a.settle_type='2' and a.credit_period <![CDATA[ < ]]> 30) or a.settle_type='1' ) and b.trade_date <![CDATA[ > ]]> a.payment_due_date ),d.pay_money,0) ) AS recdPayMoneyGreat60D
|
||||
FROM
|
||||
emis_settle_bill a,
|
||||
emis_settle_pay_record b,
|
||||
emis_settle_pay_bill_rel c
|
||||
emis_settle_pay_bill_rel c,
|
||||
emis_settle_pay_rel d,
|
||||
emis_settle_sub_bill e
|
||||
|
||||
<where>
|
||||
a.del_flag = '0'
|
||||
AND b.del_flag = '0'
|
||||
AND c.del_flag = '0'
|
||||
and d.del_flag ='0'
|
||||
AND a.settle_bill_no = c.settle_bill_no
|
||||
and d.pay_id=b.pay_id
|
||||
and d.bill_no=e.bill_code
|
||||
and e.settle_bill_no=a.settle_bill_no
|
||||
AND b.pay_id = c.pay_id
|
||||
<if test="settleBillNo != null and settleBillNo != ''"> and FIND_IN_SET(a.`settle_bill_no`,#{settleBillNo})</if>
|
||||
<if test="custNo != null and custNo != ''"> and a.cust_no = #{custNo}</if>
|
||||
@ -251,11 +258,7 @@
|
||||
<if test="openBillStatus != null and openBillStatus != ''"> and a.open_bill_status = #{openBillStatus}</if>
|
||||
<if test="paymentStatus != null and paymentStatus != ''"> and a.payment_status = #{paymentStatus}</if>
|
||||
<if test="params.billCode != null and params.billCode != ''">
|
||||
and exists (
|
||||
select 1 from emis_settle_sub_bill b
|
||||
where a.settle_bill_no=b.settle_bill_no
|
||||
and ( FIND_IN_SET(b.`bill_code`,#{params.billCode}) or b.bill_code like concat('%', #{params.billCode}, '%') )
|
||||
)
|
||||
and ( FIND_IN_SET(e.`bill_code`,#{params.billCode}) or e.bill_code like concat('%', #{params.billCode}, '%') )
|
||||
</if>
|
||||
<if test="params.payCreateBy != null and params.payCreateBy != ''">
|
||||
and b.create_by = #{params.payCreateBy}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user