This commit is contained in:
linfso 2025-05-30 07:09:38 +08:00
parent 4e477336da
commit 034ad477ce
2 changed files with 13 additions and 14 deletions

View File

@ -328,7 +328,6 @@ public class EmisSettleBillServiceImpl extends EmisBaseService implements IEmisS
EmisSettleBill updBill = new EmisSettleBill();
updBill.setId(oldEmisSettleBill.getId());
// 默认30天,从1号开始
BigDecimal creditPeriod = BigDecimal.valueOf(30D);
Integer settleDay = 1;
@ -341,11 +340,11 @@ public class EmisSettleBillServiceImpl extends EmisBaseService implements IEmisS
settleDay = monthUser.getSettleDay();
}
// 现金账期从寄件开始10天
updBill.setCreditPeriodType("1");
updBill.setCreditPeriod(creditPeriod);
updBill.setSettleDay(settleDay);
// 现金账期从寄件开始10天
Date billMonthDate = DateUtils.parseDate(oldEmisSettleBill.getBillMonth() + "-" + settleDay);
Date paymentDueDate = DateUtils.addMonths(billMonthDate, 1);
paymentDueDate = DateUtils.addDays(paymentDueDate, creditPeriod.intValue());

View File

@ -150,10 +150,10 @@
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,
if( tbb.totalPayMoney > 0,tbb.totalPayMoney-(tbb.satisfyMoney + tbb.allowanceMoney + tbb.deductionMoney + tbb.otherMoney), 0 ) AS totalPayMoney,
if( tbb.recdMoneyIn > 0,tbb.recdMoneyIn-(tbb.satisfyMoney + tbb.allowanceMoney + tbb.deductionMoney + tbb.otherMoney),0) AS recdMoneyIn,
if( tbb.recdPayMoney60D > 0,tbb.recdPayMoney60D-(tbb.satisfyMoney + tbb.allowanceMoney + tbb.deductionMoney + tbb.otherMoney),0) recdPayMoney60D,
if( tbb.recdPayMoneyGreat60D >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
(
@ -237,14 +237,14 @@
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( 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,
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 ) ) 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
sum( ifnull(b.satisfy_money,0) ) AS satisfyMoney,
sum( ifnull(b.allowance_money,0) ) AS allowanceMoney,
sum( ifnull(b.deduction_money,0) ) AS deductionMoney,
sum( ifnull(b.other_money,0) ) AS otherMoney,
sum( ifnull(d.pay_money,0) ) AS totalPayMoney,
sum( if(b.trade_date <![CDATA[ <= ]]> a.payment_due_date,ifnull(d.pay_money,0) ,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 ),ifnull(d.pay_money,0) ,0) ) AS recdPayMoney60D,
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 ) ) 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 ),ifnull(d.pay_money,0) ,0) ) AS recdPayMoneyGreat60D
FROM
emis_settle_bill a,
emis_settle_pay_record b,