feat: 新增变动后津贴工资字段的计算逻辑
- 修改allowance函数中的警告信息,明确指出津贴规则缺失 - 确保在津贴规则不存在时返回0,避免抛出异常 - 优化calc_history函数,新增变动后津贴工资字段的计算逻辑
This commit is contained in:
parent
c374dcf40c
commit
3f0f382d49
12
main.py
12
main.py
@ -234,9 +234,10 @@ def allowance(role:str, level:int, time):
|
|||||||
tmp = rule["rule"][rule["rule"]["level"] == f"{role}-{level}"].iloc[0]
|
tmp = rule["rule"][rule["rule"]["level"] == f"{role}-{level}"].iloc[0]
|
||||||
return tmp["salary"]
|
return tmp["salary"]
|
||||||
except:
|
except:
|
||||||
logging.warning(f"组合[{role}-{level}]在[{time}]时不存在工资规则")
|
logging.warning(f"组合[{role}-{level}]在[{time}]时不存在津贴规则")
|
||||||
|
return 0
|
||||||
logging.warning(f"时间[{time}]时不存在津贴规则")
|
logging.warning(f"时间[{time}]时不存在津贴规则")
|
||||||
raise 0
|
return 0
|
||||||
|
|
||||||
# 填充类辅助函数
|
# 填充类辅助函数
|
||||||
|
|
||||||
@ -367,9 +368,10 @@ def calc_history(History_pd, row):
|
|||||||
else:
|
else:
|
||||||
History_pd.at[index, "变动后级别档次"] = History_pd.at[index, "变动前级别档次"]
|
History_pd.at[index, "变动后级别档次"] = History_pd.at[index, "变动前级别档次"]
|
||||||
# 计算工资
|
# 计算工资
|
||||||
History_pd.at[index, "变动后职务工资"] = role_salary(History_pd.iloc[index]["变动后职务"], hrow["变动后时间"])
|
History_pd.at[index, "变动后职务工资"] = role_salary(History_pd.at[index,"变动后职务"], hrow["变动后时间"])
|
||||||
History_pd.at[index, "变动后级别工资"] = level_salary(History_pd.iloc[index]["变动后级别档次"], hrow["变动后时间"])
|
History_pd.at[index, "变动后级别工资"] = level_salary(History_pd.at[index,"变动后级别档次"], hrow["变动后时间"])
|
||||||
History_pd.at[index, "变动后工资合计"] = to_int(History_pd.iloc[index]["变动后职务工资"]) + to_int(History_pd.iloc[index]["变动后级别工资"])
|
History_pd.at[index, "变动后工资合计"] = to_int(History_pd.at[index,"变动后职务工资"]) + to_int(History_pd.at[index,"变动后级别工资"])
|
||||||
|
History_pd.at[index, "变动后津贴工资"] = allowance(History_pd.at[index,"变动后职务"], History_pd.at[index,"工龄"], History_pd.at[index,"变动后时间"])
|
||||||
|
|
||||||
def fill_history_info(ws, History_pd):# 填充历史记录
|
def fill_history_info(ws, History_pd):# 填充历史记录
|
||||||
for index, hrow in History_pd.iterrows(): # 打印
|
for index, hrow in History_pd.iterrows(): # 打印
|
||||||
|
Loading…
x
Reference in New Issue
Block a user