totalDays

This commit is contained in:
jiangyong 2024-06-02 01:21:45 +08:00
parent 186ed9ae10
commit 96e68e9675
1 changed files with 7 additions and 2 deletions

View File

@ -110,7 +110,7 @@ func (s *Staff) SyncStaffSalary(month string) {
month = time.Now().AddDate(0, -1, 0).Format("2006-01")
}
month = strings.ReplaceAll(month, "-", "")
totalDays := s.getTotalWorkDay(month)
//totalDays := s.getTotalWorkDay(month)
monthTime, _ := time.ParseInLocation("200601", month, time.Local)
startDate := cast.ToInt(monthTime.Format("20060102"))
endDate := cast.ToInt(monthTime.AddDate(0, 1, -1).Format("20060102"))
@ -177,6 +177,7 @@ func (s *Staff) SyncStaffSalary(month string) {
}
// 打卡正常天数+补卡天数 为正常出勤天数
totalDays := s.getTotalWorkDay(staff.Username, month)
realWorkDays := s.getRealWorkDay(staff.Username, month)
approvalCheckinDay := s.getApprovalCheckinDay(staff.Username, month)
extra := make(map[string]interface{})
@ -284,7 +285,11 @@ func (s *Staff) getRealWorkDay(username, month string) float64 {
return realWorkdays
}
func (s *Staff) getTotalWorkDay(month string) int64 {
func (s *Staff) getTotalWorkDay(username, month string) int64 {
checkins, _ := dao.NewCheckinDao().Query(username, month, false)
return int64(len(checkins))
}
func (s *Staff) getTotalWorkDay_bak(month string) int64 {
// 最多人数的应出勤天数 为真正的出勤天数
userCounts, err := dao.NewCheckinDao().CountUsername(month)
if err != nil {