butil.FloatCut(

This commit is contained in:
Jiang Yong 2023-10-06 10:10:38 +08:00
parent de0b441e26
commit 8ae071b375
1 changed files with 4 additions and 5 deletions

View File

@ -12,7 +12,6 @@ import (
"os" "os"
"time" "time"
"github.com/xuri/excelize/v2"
"net/http" "net/http"
) )
@ -54,7 +53,7 @@ func (s *StaffSalary) Agent(month string, ctx *gin.Context) {
item = append(item, cast.ToString(staff.RealSalary)) item = append(item, cast.ToString(staff.RealSalary))
item = append(item, cast.ToString(staff.SocialInsurence)) item = append(item, cast.ToString(staff.SocialInsurence))
item = append(item, cast.ToString(staff.PersonalTax)) item = append(item, cast.ToString(staff.PersonalTax))
item = append(item, cast.ToString(staff.RealSalary-staff.SocialInsurence-staff.PersonalTax)) item = append(item, cast.ToString(butil.FloatCut(staff.RealSalary-staff.SocialInsurence-staff.PersonalTax)))
datas = append(datas, item) datas = append(datas, item)
} }
@ -110,7 +109,7 @@ func (s *StaffSalary) Bank(month string, ctx *gin.Context) {
item := make([]string, 0) item := make([]string, 0)
item = append(item, baseInfo.BankCard) item = append(item, baseInfo.BankCard)
item = append(item, baseInfo.Realname) item = append(item, baseInfo.Realname)
item = append(item, cast.ToString(staff.RealSalary-staff.SocialInsurence-staff.PersonalTax)) item = append(item, cast.ToString(butil.FloatCut(staff.RealSalary-staff.SocialInsurence-staff.PersonalTax)))
item = append(item, cast.ToString(baseInfo.BankName)) item = append(item, cast.ToString(baseInfo.BankName))
item = append(item, "重庆市") item = append(item, "重庆市")
item = append(item, fmt.Sprintf("%s工资", month)) item = append(item, fmt.Sprintf("%s工资", month))
@ -174,7 +173,7 @@ func (s *StaffSalary) Summary(month string, ctx *gin.Context) {
item = append(item, cast.ToString(staff.SocialInsurence)) item = append(item, cast.ToString(staff.SocialInsurence))
item = append(item, cast.ToString(staff.PersonalTax)) item = append(item, cast.ToString(staff.PersonalTax))
item = append(item, cast.ToString(staff.Holiday)) item = append(item, cast.ToString(staff.Holiday))
item = append(item, cast.ToString(staff.RealSalary-staff.SocialInsurence-staff.PersonalTax)) item = append(item, cast.ToString(butil.FloatCut(staff.RealSalary-staff.SocialInsurence-staff.PersonalTax)))
datas = append(datas, item) datas = append(datas, item)
summary.BaseSalary += staff.BaseSalary summary.BaseSalary += staff.BaseSalary
@ -191,7 +190,7 @@ func (s *StaffSalary) Summary(month string, ctx *gin.Context) {
datas = append(datas, []string{"合计", "-", "-", "-", 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.SocialInsurence),
cast.ToString(summary.PersonalTax), cast.ToString(summary.Holiday), cast.ToString(summary.PersonalTax), cast.ToString(summary.Holiday),
cast.ToString(summary.RealSalary - summary.SocialInsurence - summary.PersonalTax)}) cast.ToString(butil.FloatCut(summary.RealSalary - summary.SocialInsurence - summary.PersonalTax))})
if xls != "" { if xls != "" {
filename := fmt.Sprintf("summary_%s.xlsx", time.Now().Format("20060102_150405")) filename := fmt.Sprintf("summary_%s.xlsx", time.Now().Format("20060102_150405"))