fix: 业务员sheet奖金池期数按当前核算月过滤
之前vehicle_payments是Q1全量,导致1月文件显示了3个月的累计期数。 改为只统计截至settle_month的发放记录。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -285,10 +285,11 @@ def write_salesperson_sheet(wb, person, dept, settle_month, D, G, month_data, ve
|
|||||||
if settle_month>=2: row_data += ['','','']
|
if settle_month>=2: row_data += ['','','']
|
||||||
WR(ws,rn,row_data); rn+=1
|
WR(ws,rn,row_data); rn+=1
|
||||||
|
|
||||||
# 奖金池
|
# 奖金池(只统计截至当前核算月的发放)
|
||||||
pays = vehicle_payments.get(plate, [])
|
pays = vehicle_payments.get(plate, [])
|
||||||
total_periods = len(pays)
|
pays_to_date = [p for p in pays if p['结算月'] <= settle_month]
|
||||||
plate_this = sum(p['金额'] for p in pays if p['结算月']==settle_month and p['业务员']==person)
|
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)
|
ws.cell(row=rn,column=1,value=f'小计: {R(plate_this)}元 | 奖金池: 已发{total_periods}期/共12期, 剩余{12-total_periods}期').font=Font(italic=True)
|
||||||
rn += 2
|
rn += 2
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user