salary4
This commit is contained in:
parent
b801dda031
commit
c4570ee30b
|
@ -12,11 +12,10 @@ func main() {
|
||||||
config.LoadServerConfig()
|
config.LoadServerConfig()
|
||||||
global.InitGlobal()
|
global.InitGlobal()
|
||||||
|
|
||||||
/*
|
if err := worker.Init(); err != nil {
|
||||||
if err := worker.Init(); err != nil {
|
panic(err)
|
||||||
panic(err)
|
}
|
||||||
}
|
|
||||||
*/
|
|
||||||
if err := server.Start(); err != nil {
|
if err := server.Start(); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,9 @@
|
||||||
<body>
|
<body>
|
||||||
<div class="table-container">
|
<div class="table-container">
|
||||||
<div class="title">{{.title}}</div>
|
<div class="title">{{.title}}</div>
|
||||||
|
{{range $i, $v := .link}}
|
||||||
|
<a href={{ $v.url }}>{{ $v.name }}</a>
|
||||||
|
{{end}}
|
||||||
<div id="table-body">
|
<div id="table-body">
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
|
@ -31,7 +31,7 @@ func (s *StaffSalary) Agent(month string, ctx *gin.Context) {
|
||||||
panic(config.ErrDb.New().Append(err))
|
panic(config.ErrDb.New().Append(err))
|
||||||
}
|
}
|
||||||
|
|
||||||
header := []string{"姓名", "身份证号", "电话", "基本工资", "应发工资", "社保扣除", "个税扣除", "实发工资"}
|
header := []string{"姓名", "身份证号", "电话", "基本工资", "出勤工资", "社保扣除", "个税扣除", "应发工资"}
|
||||||
datas := make([][]string, 0)
|
datas := make([][]string, 0)
|
||||||
for _, staff := range staffSalarys {
|
for _, staff := range staffSalarys {
|
||||||
baseInfo, err := dao.NewStaffInfoDao().GetByUsername(staff.Username)
|
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)
|
s.toExcel(filename, header, datas, ctx)
|
||||||
os.Remove(filename)
|
os.Remove(filename)
|
||||||
} else {
|
} else {
|
||||||
ctx.HTML(http.StatusOK, "table.html", gin.H{
|
links := make([]map[string]string, 0)
|
||||||
"title": month,
|
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,
|
"header": header,
|
||||||
"data": datas,
|
"data": datas,
|
||||||
|
"link": links,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,10 +121,24 @@ func (s *StaffSalary) Bank(month string, ctx *gin.Context) {
|
||||||
s.toExcel(filename, header, datas, ctx)
|
s.toExcel(filename, header, datas, ctx)
|
||||||
os.Remove(filename)
|
os.Remove(filename)
|
||||||
} else {
|
} else {
|
||||||
ctx.HTML(http.StatusOK, "table.html", gin.H{
|
links := make([]map[string]string, 0)
|
||||||
"title": month,
|
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,
|
"header": header,
|
||||||
"data": datas,
|
"data": datas,
|
||||||
|
"link": links,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -164,10 +192,20 @@ func (s *StaffSalary) Summary(month string, ctx *gin.Context) {
|
||||||
s.toExcel(filename, header, datas, ctx)
|
s.toExcel(filename, header, datas, ctx)
|
||||||
os.Remove(filename)
|
os.Remove(filename)
|
||||||
} else {
|
} else {
|
||||||
ctx.HTML(http.StatusOK, "table.html", gin.H{
|
links := make([]map[string]string, 0)
|
||||||
"title": month,
|
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,
|
"header": header,
|
||||||
"data": datas,
|
"data": datas,
|
||||||
|
"link": links,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue