real salaray

This commit is contained in:
jiangyong27 2024-04-02 13:54:39 +08:00
parent 82cd3ee2f4
commit c54dea5cb8
3 changed files with 12 additions and 7 deletions

View File

@ -1,5 +1,7 @@
package model
import butil "enterprise/base/util"
var (
StaffSalaryStatusNormal = 1
StaffSalaryStatusDisable = 2
@ -22,3 +24,7 @@ type StaffSalary struct {
UpdateTime int64
Extra string
}
func (s *StaffSalary) GetRealSalary() float64 {
return butil.FloatCut(s.AttendSalary + s.AwardSalary - s.SocialInsurence - s.PersonalTax)
}

View File

@ -56,7 +56,7 @@ func (s *StaffSalary) Agent(month string, ctx *gin.Context) {
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)))
item = append(item, cast.ToString(staff.GetRealSalary()))
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)))
item = append(item, cast.ToString(staff.GetRealSalary()))
item = append(item, cast.ToString(baseInfo.BankName))
item = append(item, "重庆市")
item = append(item, fmt.Sprintf("%s工资", month))
@ -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)))
item = append(item, cast.ToString(staff.GetRealSalary()))
if staff.TotalDay != cast.ToFloat64(staff.RealDay)+cast.ToFloat64(staff.Holiday) {
item = append(item, "【异常】")
} else {
@ -195,7 +195,6 @@ func (s *StaffSalary) Summary(month string, ctx *gin.Context) {
summary.SocialInsurence += staff.SocialInsurence
summary.PersonalTax += staff.PersonalTax
summary.Holiday += staff.Holiday
summary.RealSalary += staff.RealSalary
}
summary.Holiday = butil.FloatCut(summary.Holiday)
summary.BaseSalary = butil.FloatCut(summary.BaseSalary)
@ -206,7 +205,7 @@ func (s *StaffSalary) Summary(month string, ctx *gin.Context) {
datas = append(datas, []string{"合计", "-", "-", "-",
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)), "-"})
cast.ToString(butil.FloatCut(summary.GetRealSalary())), "-"})
if xls != "" {
filename := fmt.Sprintf("summary_%s.xlsx", time.Now().Format("20060102_150405"))

View File

@ -37,7 +37,7 @@ func (s *Staff) SendStaffSalaryBill(month string) {
}
message = append(message, fmt.Sprintf("社保扣除:%.2f", staffSalary.SocialInsurence))
message = append(message, fmt.Sprintf("个税扣除:%.2f", staffSalary.PersonalTax))
message = append(message, fmt.Sprintf("实发工资:%.2f", staffSalary.RealSalary))
message = append(message, fmt.Sprintf("实发工资:%.2f", staffSalary.GetRealSalary()))
if err := global.SendMessage([]string{"jiangyong"}, strings.Join(message, "\n")); err != nil {
log.Errorf("send message error :%s", err.Error())
@ -199,7 +199,7 @@ func (s *Staff) SyncStaffSalary(month string) {
extra["surplusHoliday"] = surplusHoliday
salary.AttendSalary = butil.FloatCut(attendSalary)
salary.RealSalary = butil.FloatCut(attendSalary + salary.AwardSalary - salary.SocialInsurence - salary.PersonalTax)
salary.RealSalary = salary.GetRealSalary()
salary.SocialInsurence = socialInsurence
salary.Holiday = holiday
salary.TotalDay = float64(totalDays)