添加功能

This commit is contained in:
李鹏宇
2026-03-31 11:45:25 +08:00
parent 80a0e46a08
commit 4d03c93e79
@@ -567,17 +567,27 @@ class PropertyReconciliationLine(models.Model):
due_date_str = due_date.strftime('%Y-%m')
actual_date_str = actual_date.strftime('%Y-%m-%d')
rent = round(line.rent or 0, 2)
debt_amount = round(rent - line.amount, 2)
# 不显示备注条件:年月相同 + rent == rent_month
rent_month = round(line.rent_month or 0, 2)
amount = round(line.amount or 0, 2)
debt_amount = round(rent - amount, 2)
# ===================== 不显示备注条件 =====================
same_month = (due_month == actual_month) and (due_year == actual_year)
no_remark = same_month and (round(line.rent or 0, 2) == round(line.rent_month or 0, 2))
no_remark = same_month and (rent == rent_month)
if no_remark:
line.remake = ""
continue
debt_str = f',欠{debt_amount}' if debt_amount != 0 else ''
if same_month:
# 条件1:rent_month≠rent 且 rent_month≠amount 且 amount≠0 → 补交
if rent_month != rent and rent_month != amount and amount != 0:
line.remake = f'补交{due_date_str}'
# 条件2:rent == amount → 补齐
elif rent == amount and amount != 0:
line.remake = f'补齐{due_date_str}'
continue
if (due_month > actual_month and due_year == actual_year) or (due_year > actual_year):
line.remake = f'{actual_date_str}预{due_date_str}{debt_str}'
elif due_month == actual_month and due_year == actual_year:
line.remake = f'交{due_date_str}{debt_str}'
elif (due_month < actual_month and due_year == actual_year) or (due_year < actual_year):
line.remake = f'{actual_date_str}补{due_date_str}{debt_str}'
line.remake = f'{actual_date_str}补{due_date.strftime("%Y-%m-%d")}{debt_str}'