From 68e6ebc4165266ddf96454e4955b19c257b12caf Mon Sep 17 00:00:00 2001 From: linfso Date: Thu, 29 May 2025 19:03:46 +0800 Subject: [PATCH] md --- .../resources/mapper/EmisSettleBillMapper.xml | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/emis-biz/src/main/resources/mapper/EmisSettleBillMapper.xml b/emis-biz/src/main/resources/mapper/EmisSettleBillMapper.xml index 8249365c0..834b58731 100644 --- a/emis-biz/src/main/resources/mapper/EmisSettleBillMapper.xml +++ b/emis-biz/src/main/resources/mapper/EmisSettleBillMapper.xml @@ -146,15 +146,15 @@ tba.salesmen as salesmen, tba.payee as payee, tba.create_time as createTime, - tba.satisfy_money as satisfyMoney, - tba.allowance_money as allowanceMoney, - tba.deduction_money as deductionMoney, - tba.other_money as otherMoney, - IFNULL( tbb.totalPayMoney, 0 ) AS totalPayMoney, - IFNULL( tbb.recdMoneyIn, 0 ) AS recdMoneyIn, - IFNULL( tbb.recdPayMoney60D, 0 ) recdPayMoney60D, - IFNULL( tbb.recdPayMoneyGreat60D, 0 ) recdPayMoneyGreat60D, - (tba.rec_money - tba.reced_money ) AS noRecMoney + tbb.satisfyMoney as satisfyMoney, + tbb.allowanceMoney as allowanceMoney, + tbb.deductionMoney as deductionMoney, + tbb.otherMoney as otherMoney, + if( IFNULL(tbb.totalPayMoney,0) > 0,tbb.totalPayMoney-(tbb.satisfyMoney + tbb.allowanceMoney + tbb.deductionMoney + tbb.otherMoney), 0 ) AS totalPayMoney, + if( IFNULL(tbb.recdMoneyIn, 0) > 0,tbb.recdMoneyIn-(tbb.satisfyMoney + tbb.allowanceMoney + tbb.deductionMoney + tbb.otherMoney),0) AS recdMoneyIn, + if( IFNULL(tbb.recdPayMoney60D, 0 )> 0,tbb.recdPayMoney60D-(tbb.satisfyMoney + tbb.allowanceMoney + tbb.deductionMoney + tbb.otherMoney),0) recdPayMoney60D, + if( IFNULL(tbb.recdPayMoneyGreat60D, 0 )>0,tbb.recdPayMoneyGreat60D-(tbb.satisfyMoney + tbb.allowanceMoney + tbb.deductionMoney + tbb.otherMoney),0) recdPayMoneyGreat60D, + ( tba.rec_money - tba.reced_money - (tbb.satisfyMoney + tbb.allowanceMoney + tbb.deductionMoney + tbb.otherMoney) ) AS noRecMoney FROM ( SELECT @@ -237,6 +237,11 @@ LEFT JOIN ( SELECT a.settle_bill_no, + sum( b.satisfy_money) AS satisfyMoney, + sum( b.allowance_money) AS allowanceMoney, + sum( b.deduction_money) AS deductionMoney, + sum( b.other_money) AS otherMoney, + sum( d.pay_money) AS totalPayMoney, sum( d.pay_money) AS totalPayMoney, sum( if(b.trade_date a.payment_due_date,d.pay_money,0) ) AS recdMoneyIn, sum( if(a.settle_type='2' and a.credit_period = ]]> 30 and b.trade_date ]]> a.payment_due_date and b.trade_date ]]> a.payment_due_date and b.trade_date DATE_SUB( a.payment_due_date, INTERVAL (a.credit_period-60) DAY ),d.pay_money,0) ) AS recdPayMoney60D,