@@ -656,19 +656,22 @@ class PropertyReconciliationLine(models.Model):
|
||||
if round(line.amount or 0, 2) == 0 and line.collection_type != 'penalty':
|
||||
line.remake = ""
|
||||
return
|
||||
if line.amount and line.collection_type != 'penalty':
|
||||
if line.amount and line.collection_type != 'penalty' and actual_date and line.due_date:
|
||||
due_date = line.due_date
|
||||
actual_year, actual_month = actual_date.year, actual_date.month
|
||||
due_year, due_month = due_date.year, due_date.month
|
||||
due_date_str = due_date.strftime('%Y-%m')
|
||||
actual_date_str = actual_date.strftime('%Y-%m-%d')
|
||||
rent = round(line.rent or 0, 2)
|
||||
rent = round(line.rent or 0, 2)
|
||||
# 计算欠款金额并判断是否小于0
|
||||
debt_amount = round(rent - line.amount, 2)
|
||||
debt_str = f',欠{debt_amount}' if debt_amount >= 0 else ""
|
||||
if (due_month > actual_month and due_year == actual_year) or (due_year > actual_year):
|
||||
if rent >= line.amount:
|
||||
line.remake = f'{actual_date_str}预{due_date_str},欠{round(rent - line.amount, 2)}'
|
||||
line.remake = f'{actual_date_str}预{due_date_str}{debt_str}'
|
||||
elif due_month == actual_month and due_year == actual_year:
|
||||
if rent >= line.amount:
|
||||
line.remake = f'交{due_date_str},欠{round(rent - line.amount, 2)}'
|
||||
line.remake = f'交{due_date_str}{debt_str}'
|
||||
elif (due_month < actual_month and due_year == actual_year) or (due_year < actual_year):
|
||||
if rent >= line.amount:
|
||||
line.remake = f'{actual_date_str}补{due_date_str},欠{round(rent - line.amount, 2)}'
|
||||
line.remake = f'{actual_date_str}补{due_date_str}{debt_str}'
|
||||
Reference in New Issue
Block a user