attendSalary

This commit is contained in:
jiangyong27 2024-04-02 12:14:23 +08:00
parent c89880e13f
commit 5719239899
3 changed files with 16 additions and 14 deletions

View File

@ -10,6 +10,7 @@ type StaffSalary struct {
Username string
Month string
BaseSalary float64
AttendSalary float64
RealSalary float64
AwardSalary float64
SocialInsurence float64

View File

@ -52,11 +52,11 @@ func (s *StaffSalary) Agent(month string, ctx *gin.Context) {
item = append(item, cast.ToString(baseInfo.Idno))
item = append(item, cast.ToString(baseInfo.Phone))
item = append(item, cast.ToString(staff.BaseSalary))
item = append(item, cast.ToString(staff.RealSalary))
item = append(item, cast.ToString(staff.AttendSalary))
item = append(item, cast.ToString(staff.AwardSalary))
item = append(item, cast.ToString(staff.SocialInsurence))
item = append(item, cast.ToString(staff.PersonalTax))
item = append(item, cast.ToString(butil.FloatCut(staff.RealSalary+staff.AwardSalary-staff.SocialInsurence-staff.PersonalTax)))
item = append(item, cast.ToString(butil.FloatCut(staff.RealSalary)))
datas = append(datas, item)
}
@ -112,7 +112,7 @@ func (s *StaffSalary) Bank(month string, ctx *gin.Context) {
item := make([]string, 0)
item = append(item, baseInfo.BankCard)
item = append(item, baseInfo.Realname)
item = append(item, cast.ToString(butil.FloatCut(staff.RealSalary+staff.AwardSalary-staff.SocialInsurence-staff.PersonalTax)))
item = append(item, cast.ToString(butil.FloatCut(staff.RealSalary)))
item = append(item, cast.ToString(baseInfo.BankName))
item = append(item, "重庆市")
item = append(item, fmt.Sprintf("%s工资", month))
@ -173,7 +173,7 @@ func (s *StaffSalary) Summary(month string, ctx *gin.Context) {
item = append(item, cast.ToString(baseInfo.EntryDate))
item = append(item, cast.ToString(baseInfo.OfficialDate))
item = append(item, cast.ToString(staff.BaseSalary))
item = append(item, cast.ToString(staff.RealSalary))
item = append(item, cast.ToString(staff.AttendSalary))
item = append(item, cast.ToString(staff.AwardSalary))
item = append(item, cast.ToString(staff.SocialInsurence))
item = append(item, cast.ToString(staff.PersonalTax))
@ -181,7 +181,7 @@ func (s *StaffSalary) Summary(month string, ctx *gin.Context) {
item = append(item, cast.ToString(staff.RealDay))
item = append(item, cast.ToString(extra["approvalCheckinDay"]))
item = append(item, cast.ToString(staff.Holiday))
item = append(item, cast.ToString(butil.FloatCut(staff.RealSalary+staff.AwardSalary-staff.SocialInsurence-staff.PersonalTax)))
item = append(item, cast.ToString(butil.FloatCut(staff.RealSalary)))
if staff.TotalDay != cast.ToFloat64(staff.RealDay)+cast.ToFloat64(staff.Holiday) {
item = append(item, "【异常】")
} else {
@ -190,7 +190,7 @@ func (s *StaffSalary) Summary(month string, ctx *gin.Context) {
datas = append(datas, item)
summary.BaseSalary += staff.BaseSalary
summary.RealSalary += staff.RealSalary
summary.AttendSalary += staff.AttendSalary
summary.AwardSalary += staff.AwardSalary
summary.SocialInsurence += staff.SocialInsurence
summary.PersonalTax += staff.PersonalTax
@ -198,14 +198,14 @@ func (s *StaffSalary) Summary(month string, ctx *gin.Context) {
}
summary.Holiday = butil.FloatCut(summary.Holiday)
summary.BaseSalary = butil.FloatCut(summary.BaseSalary)
summary.RealSalary = butil.FloatCut(summary.RealSalary)
summary.AttendSalary = butil.FloatCut(summary.AttendSalary)
summary.AwardSalary = butil.FloatCut(summary.AwardSalary)
summary.SocialInsurence = butil.FloatCut(summary.SocialInsurence)
summary.PersonalTax = butil.FloatCut(summary.PersonalTax)
datas = append(datas, []string{"合计", "-", "-", "-",
cast.ToString(summary.BaseSalary), cast.ToString(summary.RealSalary), cast.ToString(summary.AwardSalary), cast.ToString(summary.SocialInsurence),
cast.ToString(summary.BaseSalary), cast.ToString(summary.AttendSalary), cast.ToString(summary.AwardSalary), cast.ToString(summary.SocialInsurence),
cast.ToString(summary.PersonalTax), "-", "-", "-", cast.ToString(summary.Holiday),
cast.ToString(butil.FloatCut(summary.RealSalary + summary.AwardSalary - summary.SocialInsurence - summary.PersonalTax)), "-"})
cast.ToString(butil.FloatCut(summary.RealSalary)), "-"})
if xls != "" {
filename := fmt.Sprintf("summary_%s.xlsx", time.Now().Format("20060102_150405"))

View File

@ -31,13 +31,13 @@ func (s *Staff) SendStaffSalaryBill(month string) {
message := make([]string, 0)
message = append(message, fmt.Sprintf("【工资单】[%s][%s]", staffSalary.Username, month))
message = append(message, fmt.Sprintf("基本工资:%.2f", staffSalary.BaseSalary))
message = append(message, fmt.Sprintf("出勤工资:%.2f", staffSalary.RealSalary))
message = append(message, fmt.Sprintf("出勤工资:%.2f", staffSalary.AttendSalary))
if staffSalary.AwardSalary >= 0.1 {
message = append(message, fmt.Sprintf("额外工资:%.2f", staffSalary.AwardSalary))
}
message = append(message, fmt.Sprintf("社保扣除:%.2f", staffSalary.SocialInsurence))
message = append(message, fmt.Sprintf("个税扣除:%.2f", staffSalary.PersonalTax))
message = append(message, fmt.Sprintf("实发工资:%.2f", butil.FloatCut(staffSalary.RealSalary+staffSalary.AwardSalary-staffSalary.SocialInsurence-staffSalary.PersonalTax)))
message = append(message, fmt.Sprintf("实发工资:%.2f", staffSalary.RealSalary))
if err := global.SendMessage([]string{"jiangyong"}, strings.Join(message, "\n")); err != nil {
log.Errorf("send message error :%s", err.Error())
@ -177,10 +177,10 @@ func (s *Staff) SyncStaffSalary(month string) {
}
realWorkDays = realWorkDays + surplusHoliday
realSalary := salary.BaseSalary * (realWorkDays / float64(totalDays)) * discount
attendSalary := salary.BaseSalary * (realWorkDays / float64(totalDays)) * discount
staffSalaryPerDay := cast.ToFloat64(config.Get(model.StaffSalaryPerDay))
if staffSalaryPerDay > 0 {
realSalary = staffSalaryPerDay * realWorkDays
attendSalary = staffSalaryPerDay * realWorkDays
}
extra["discount"] = discount
@ -198,7 +198,8 @@ func (s *Staff) SyncStaffSalary(month string) {
extra["isOfficialMonth"] = isOfficialMonth
extra["surplusHoliday"] = surplusHoliday
salary.RealSalary = butil.FloatCut(realSalary)
salary.AttendSalary = butil.FloatCut(attendSalary)
salary.RealSalary = butil.FloatCut(attendSalary + salary.AwardSalary - salary.SocialInsurence - salary.PersonalTax)
salary.SocialInsurence = socialInsurence
salary.Holiday = holiday
salary.TotalDay = float64(totalDays)