md
This commit is contained in:
parent
8cb2a6012b
commit
68e6ebc416
@ -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 <![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[ > ]]> 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,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user