This commit is contained in:
jiangyong27 2023-10-07 14:30:31 +08:00
parent d4bd2853b2
commit bb512232e8
2 changed files with 10 additions and 5 deletions

View File

@ -11,6 +11,7 @@ type StaffSalary struct {
Month string
BaseSalary float64
RealSalary float64
AwardSalary float64
SocialInsurence float64
PersonalTax float64
Holiday float64

View File

@ -32,7 +32,7 @@ func (s *StaffSalary) Agent(month string, ctx *gin.Context) {
panic(config.ErrDb.New().Append(err))
}
header := []string{"姓名", "身份证号", "电话", "基本工资", "出勤工资", "社保扣除", "个税扣除", "应发工资"}
header := []string{"姓名", "身份证号", "电话", "基本工资", "出勤工资", "奖金", "社保扣除", "个税扣除", "应发工资"}
datas := make([][]string, 0)
for _, staff := range staffSalarys {
baseInfo, err := dao.NewStaffInfoDao().GetByUsername(staff.Username)
@ -52,9 +52,10 @@ func (s *StaffSalary) Agent(month string, ctx *gin.Context) {
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.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.SocialInsurence-staff.PersonalTax)))
item = append(item, cast.ToString(butil.FloatCut(staff.RealSalary+staff.AwardSalary-staff.SocialInsurence-staff.PersonalTax)))
datas = append(datas, item)
}
@ -110,7 +111,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.SocialInsurence-staff.PersonalTax)))
item = append(item, cast.ToString(butil.FloatCut(staff.RealSalary+staff.AwardSalary-staff.SocialInsurence-staff.PersonalTax)))
item = append(item, cast.ToString(baseInfo.BankName))
item = append(item, "重庆市")
item = append(item, fmt.Sprintf("%s工资", month))
@ -151,7 +152,7 @@ func (s *StaffSalary) Summary(month string, ctx *gin.Context) {
panic(config.ErrDb.New().Append(err))
}
header := []string{"姓名", "身份证号", "入职日期", "转正日期", "基本工资", "出勤工资", "社保扣除", "个税扣除", "请假天数", "实发工资"}
header := []string{"姓名", "身份证号", "入职日期", "转正日期", "基本工资", "出勤工资", "奖金", "社保扣除", "个税扣除", "请假天数", "实发工资"}
datas := make([][]string, 0)
summary := new(model.StaffSalary)
for _, staff := range staffSalarys {
@ -171,6 +172,7 @@ func (s *StaffSalary) Summary(month string, ctx *gin.Context) {
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.AwardSalary))
item = append(item, cast.ToString(staff.SocialInsurence))
item = append(item, cast.ToString(staff.PersonalTax))
item = append(item, cast.ToString(staff.Holiday))
@ -179,6 +181,7 @@ func (s *StaffSalary) Summary(month string, ctx *gin.Context) {
datas = append(datas, item)
summary.BaseSalary += staff.BaseSalary
summary.RealSalary += staff.RealSalary
summary.AwardSalary += staff.AwardSalary
summary.SocialInsurence += staff.SocialInsurence
summary.PersonalTax += staff.PersonalTax
summary.Holiday += staff.Holiday
@ -186,10 +189,11 @@ 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.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.SocialInsurence),
cast.ToString(summary.BaseSalary), cast.ToString(summary.RealSalary), cast.ToString(summary.AwardSalary), cast.ToString(summary.SocialInsurence),
cast.ToString(summary.PersonalTax), cast.ToString(summary.Holiday),
cast.ToString(butil.FloatCut(summary.RealSalary - summary.SocialInsurence - summary.PersonalTax))})