stalary
This commit is contained in:
parent
ff6a951231
commit
72309d20f2
|
@ -68,14 +68,15 @@ func (d *StaffSalaryDao) GetBy(corpId, userId int64, month string) (*model.Staff
|
|||
return &u, nil
|
||||
}
|
||||
|
||||
func (d *StaffSalaryDao) QueryAll(corpId int64, month string) ([]*model.StaffSalary, error) {
|
||||
func (d *StaffSalaryDao) QueryAll(corpId int64, month string, status int) ([]*model.StaffSalary, error) {
|
||||
var u []*model.StaffSalary
|
||||
tx := GetDB().Table(d.TableName())
|
||||
|
||||
tx.Where("corp_id = ?", corpId)
|
||||
|
||||
tx = tx.Where("month = ?", month)
|
||||
|
||||
tx.Where("month = ?", month)
|
||||
if status != 0 {
|
||||
tx.Where("status = ?", status)
|
||||
}
|
||||
tx.Order("month DESC")
|
||||
|
||||
res := tx.Find(&u)
|
||||
|
|
|
@ -166,7 +166,7 @@ func (s *StaffSalary) Pay(sess *session.AdminSession, req *api.PaySalaryReq) {
|
|||
|
||||
func (s *StaffSalary) Agent(cid int64, month string, ctx *gin.Context) {
|
||||
xls := ctx.Query("xls")
|
||||
staffSalarys, err := dao.NewStaffSalaryDao().QueryAll(cid, month)
|
||||
staffSalarys, err := dao.NewStaffSalaryDao().QueryAll(cid, month, model.StaffSalaryStatusWait)
|
||||
if err != nil {
|
||||
panic(config.ErrDb.New().Append(err))
|
||||
}
|
||||
|
@ -229,7 +229,7 @@ func (s *StaffSalary) Agent(cid int64, month string, ctx *gin.Context) {
|
|||
|
||||
func (s *StaffSalary) Bank(cid int64, month string, ctx *gin.Context) {
|
||||
xls := ctx.Query("xls")
|
||||
staffSalarys, err := dao.NewStaffSalaryDao().QueryAll(cid, month)
|
||||
staffSalarys, err := dao.NewStaffSalaryDao().QueryAll(cid, month, model.StaffSalaryStatusWait)
|
||||
if err != nil {
|
||||
panic(config.ErrDb.New().Append(err))
|
||||
}
|
||||
|
@ -290,7 +290,7 @@ func (s *StaffSalary) Bank(cid int64, month string, ctx *gin.Context) {
|
|||
|
||||
func (s *StaffSalary) Summary(cid int64, month string, ctx *gin.Context) {
|
||||
xls := ctx.Query("xls")
|
||||
staffSalarys, err := dao.NewStaffSalaryDao().QueryAll(cid, month)
|
||||
staffSalarys, err := dao.NewStaffSalaryDao().QueryAll(cid, month, 0)
|
||||
if err != nil {
|
||||
panic(config.ErrDb.New().Append(err))
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ func (s *Staff) MontorWorkAge(corpId int64) {
|
|||
}
|
||||
|
||||
func (s *Staff) SendStaffSalaryBill(corpId int64, month string) {
|
||||
staffSalarys, err := dao.NewStaffSalaryDao().QueryAll(corpId, month)
|
||||
staffSalarys, err := dao.NewStaffSalaryDao().QueryAll(corpId, month, model.StaffSalaryStatusPayed)
|
||||
if err != nil {
|
||||
log.Errorf("db error :%s", err.Error())
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue