This commit is contained in:
jiangyong27 2023-09-04 22:21:04 +08:00
parent b801dda031
commit c4570ee30b
3 changed files with 52 additions and 12 deletions

View File

@ -12,11 +12,10 @@ func main() {
config.LoadServerConfig()
global.InitGlobal()
/*
if err := worker.Init(); err != nil {
panic(err)
}
*/
if err := server.Start(); err != nil {
panic(err)
}

View File

@ -34,6 +34,9 @@
<body>
<div class="table-container">
<div class="title">{{.title}}</div>
{{range $i, $v := .link}}
<a href={{ $v.url }}>{{ $v.name }}</a>
{{end}}
<div id="table-body">
<table>
<thead>

View File

@ -31,7 +31,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)
@ -63,10 +63,24 @@ func (s *StaffSalary) Agent(month string, ctx *gin.Context) {
s.toExcel(filename, header, datas, ctx)
os.Remove(filename)
} else {
ctx.HTML(http.StatusOK, "table.html", gin.H{
"title": month,
links := make([]map[string]string, 0)
links = append(links, map[string]string{
"url": "/api/staff/salary?type=agent&xls=1",
"name": "下载",
})
links = append(links, map[string]string{
"url": "/api/staff/salary?type=bank",
"name": "银行",
})
links = append(links, map[string]string{
"url": "/api/staff/salary?type=summary",
"name": "汇总",
})
ctx.HTML(http.StatusOK, "salary.html", gin.H{
"title": month + "工资汇总",
"header": header,
"data": datas,
"link": links,
})
}
}
@ -107,10 +121,24 @@ func (s *StaffSalary) Bank(month string, ctx *gin.Context) {
s.toExcel(filename, header, datas, ctx)
os.Remove(filename)
} else {
ctx.HTML(http.StatusOK, "table.html", gin.H{
"title": month,
links := make([]map[string]string, 0)
links = append(links, map[string]string{
"url": "/api/staff/salary?type=bank&xls=1",
"name": "下载",
})
links = append(links, map[string]string{
"url": "/api/staff/salary?type=summary",
"name": "汇总",
})
links = append(links, map[string]string{
"url": "/api/staff/salary?type=agent",
"name": "代理",
})
ctx.HTML(http.StatusOK, "salary.html", gin.H{
"title": month + "工资汇总",
"header": header,
"data": datas,
"link": links,
})
}
}
@ -164,10 +192,20 @@ func (s *StaffSalary) Summary(month string, ctx *gin.Context) {
s.toExcel(filename, header, datas, ctx)
os.Remove(filename)
} else {
ctx.HTML(http.StatusOK, "table.html", gin.H{
"title": month,
links := make([]map[string]string, 0)
links = append(links, map[string]string{
"url": "/api/staff/salary?type=bank",
"name": "银行",
})
links = append(links, map[string]string{
"url": "/api/staff/salary?type=agent",
"name": "代理",
})
ctx.HTML(http.StatusOK, "salary.html", gin.H{
"title": month + "工资汇总",
"header": header,
"data": datas,
"link": links,
})
}
}