feat: 增加工龄调整津贴计算逻辑

- 在add_history函数中新增工龄调整津贴的计算逻辑,基于参加工作时间每五年进行津贴调整
- 优化历史记录的字段更新,确保包含最新的变动后时间和变动原因
This commit is contained in:
Miu Li 2025-06-14 06:40:39 +08:00
parent 3f0f382d49
commit ec3782fbdd

View File

@ -304,6 +304,14 @@ def add_history(History_pd, row, promote):
for rule in Rule_Level: for rule in Rule_Level:
if row["入职时间"] < rule["start"]: if row["入职时间"] < rule["start"]:
History_pd.loc[len(History_pd),["变动后时间","变动原因"]] = [rule["start"], "工资调标"] History_pd.loc[len(History_pd),["变动后时间","变动原因"]] = [rule["start"], "工资调标"]
calctime = row["参加工作时间"]
while True:
calctime += relativedelta(years=1)
if calctime > NOWTIME:
break
elif int(calculate_seniority(row,calctime.year)) % 5 == 0:
History_pd.loc[len(History_pd),["变动后时间","变动原因"]] = \
[calctime,"调整津贴"]
History_pd["身份证号码"] = row["身份证号码"] History_pd["身份证号码"] = row["身份证号码"]
History_pd["姓名"] = row["姓名"] History_pd["姓名"] = row["姓名"]
History_pd["工龄"] = History_pd.apply(lambda x: calculate_seniority(row, x["变动后时间"].year), axis=1) History_pd["工龄"] = History_pd.apply(lambda x: calculate_seniority(row, x["变动后时间"].year), axis=1)