!10064 Merge branch 'dev' of <a href="https://gitee.com/jinan-pengyusen-data/gzth">https://gitee.com/jinan-pengyusen-data/gzth</a> into dev_wang
Merge pull request !10064 from 李鹏宇/dev_wang
This commit is contained in:
@@ -133,7 +133,7 @@ class ReceivableFlowReport(models.Model):
|
||||
|
||||
if billing_period:
|
||||
try:
|
||||
# 兼容中文"到"和英文"~"两种分隔符
|
||||
# 兼容中文“到”和英文“~”两种分隔符
|
||||
if ' 到 ' in billing_period:
|
||||
date_parts = billing_period.split(' 到 ')
|
||||
elif ' ~ ' in billing_period:
|
||||
@@ -148,55 +148,11 @@ class ReceivableFlowReport(models.Model):
|
||||
days_diff = (end_date - start_date).days + 1
|
||||
billing_period = f"{days_diff} {start_date_str} ~ {end_date_str}"
|
||||
except Exception:
|
||||
if rec.due_date:
|
||||
start_date = rec.due_date.replace(day=1)
|
||||
if rec.payout_date:
|
||||
end_date = rec.payout_date
|
||||
else:
|
||||
if date_end:
|
||||
end_date_obj = datetime.datetime.fromisoformat(date_end).date()
|
||||
if end_date_obj.month == 12:
|
||||
last_day = datetime.date(end_date_obj.year, 12, 31)
|
||||
else:
|
||||
last_day = datetime.date(end_date_obj.year, end_date_obj.month + 1, 1) - datetime.timedelta(days=1)
|
||||
end_date = last_day
|
||||
else:
|
||||
today = datetime.date.today()
|
||||
if today.month == 12:
|
||||
last_day = datetime.date(today.year, 12, 31)
|
||||
else:
|
||||
last_day = datetime.date(today.year, today.month + 1, 1) - datetime.timedelta(days=1)
|
||||
end_date = last_day
|
||||
|
||||
days_diff = (end_date - start_date).days + 1
|
||||
billing_period = f"{days_diff} {start_date.strftime('%Y-%m-%d')} ~ {end_date.strftime('%Y-%m-%d')}"
|
||||
else:
|
||||
if rec.due_date:
|
||||
start_date = rec.due_date.replace(day=1)
|
||||
if rec.payout_date:
|
||||
end_date = rec.payout_date
|
||||
else:
|
||||
if date_end:
|
||||
end_date_obj = datetime.datetime.fromisoformat(date_end).date()
|
||||
if end_date_obj.month == 12:
|
||||
last_day = datetime.date(end_date_obj.year, 12, 31)
|
||||
else:
|
||||
last_day = datetime.date(end_date_obj.year, end_date_obj.month + 1, 1) - datetime.timedelta(days=1)
|
||||
end_date = last_day
|
||||
else:
|
||||
today = datetime.date.today()
|
||||
if today.month == 12:
|
||||
last_day = datetime.date(today.year, 12, 31)
|
||||
else:
|
||||
last_day = datetime.date(today.year, today.month + 1, 1) - datetime.timedelta(days=1)
|
||||
end_date = last_day
|
||||
|
||||
days_diff = (end_date - start_date).days + 1
|
||||
billing_period = f"{days_diff} {start_date.strftime('%Y-%m-%d')} ~ {end_date.strftime('%Y-%m-%d')}"
|
||||
billing_period = rec.charging_range or ""
|
||||
days_diff = 0
|
||||
|
||||
# 计算违约金金额
|
||||
penalty_amount = days_diff * per_day
|
||||
penalty_amount = penalty_amount or rec.penalty or rec.original_amount or 0.0
|
||||
penalty_amount = round(days_diff * per_day, 2)
|
||||
|
||||
# 获取违约金收款信息(从预加载字典取)
|
||||
wz_list = wizard_map.get(rec.id, [])
|
||||
|
||||
Reference in New Issue
Block a user