salary4
This commit is contained in:
parent
b801dda031
commit
c4570ee30b
|
@ -12,11 +12,10 @@ func main() {
|
|||
config.LoadServerConfig()
|
||||
global.InitGlobal()
|
||||
|
||||
/*
|
||||
if err := worker.Init(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
*/
|
||||
if err := worker.Init(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
if err := server.Start(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
|
|
@ -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>
|
|
@ -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,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue