From 1b7d25c821c9c8247bf0dd599d2ab44700f55877 Mon Sep 17 00:00:00 2001 From: kkfluous Date: Thu, 2 Apr 2026 14:41:34 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=B8=9A=E5=8A=A1=E5=91=98sheet?= =?UTF-8?q?=E5=A5=96=E9=87=91=E6=B1=A0=E6=9C=9F=E6=95=B0=E6=8C=89=E5=BD=93?= =?UTF-8?q?=E5=89=8D=E6=A0=B8=E7=AE=97=E6=9C=88=E8=BF=87=E6=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 之前vehicle_payments是Q1全量,导致1月文件显示了3个月的累计期数。 改为只统计截至settle_month的发放记录。 Co-Authored-By: Claude Opus 4.6 (1M context) --- excel_writer.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/excel_writer.py b/excel_writer.py index dbda88a..ae56d19 100644 --- a/excel_writer.py +++ b/excel_writer.py @@ -285,10 +285,11 @@ def write_salesperson_sheet(wb, person, dept, settle_month, D, G, month_data, ve if settle_month>=2: row_data += ['','',''] WR(ws,rn,row_data); rn+=1 - # 奖金池 + # 奖金池(只统计截至当前核算月的发放) pays = vehicle_payments.get(plate, []) - total_periods = len(pays) - plate_this = sum(p['金额'] for p in pays if p['结算月']==settle_month and p['业务员']==person) + pays_to_date = [p for p in pays if p['结算月'] <= settle_month] + total_periods = len(pays_to_date) + plate_this = sum(p['金额'] for p in pays_to_date if p['结算月']==settle_month and p['业务员']==person) ws.cell(row=rn,column=1,value=f'小计: {R(plate_this)}元 | 奖金池: 已发{total_periods}期/共12期, 剩余{12-total_periods}期').font=Font(italic=True) rn += 2