entrydate

This commit is contained in:
jiangyong27 2024-09-02 11:56:19 +08:00
parent d8e971ec74
commit 29c02b6064
1 changed files with 8 additions and 2 deletions

View File

@ -187,7 +187,7 @@ func (s *Staff) SyncStaffSalary(month string) {
// 打卡正常天数+补卡天数 为正常出勤天数 // 打卡正常天数+补卡天数 为正常出勤天数
totalDays := s.getTotalWorkDay(staff.Username, month) totalDays := s.getTotalWorkDay(staff.Username, month)
realWorkDays := s.getRealWorkDay(staff.Username, month) realWorkDays := s.getRealWorkDay(staff.EntryDate, staff.Username, month)
approvalCheckinDay := s.getApprovalCheckinDay(staff.Username, month) approvalCheckinDay := s.getApprovalCheckinDay(staff.Username, month)
extra := make(map[string]interface{}) extra := make(map[string]interface{})
salary.BaseSalary = cast.ToFloat64(staff.Salary) salary.BaseSalary = cast.ToFloat64(staff.Salary)
@ -265,7 +265,7 @@ func (s *Staff) getApprovalCheckinDay(username, month string) int {
return approvalDay return approvalDay
} }
func (s *Staff) getRealWorkDay(username, month string) float64 { func (s *Staff) getRealWorkDay(entryDate, username, month string) float64 {
realWorkdays := float64(0) realWorkdays := float64(0)
userCheckins, err := dao.NewCheckinDao().Query(username, month, false) userCheckins, err := dao.NewCheckinDao().Query(username, month, false)
if err != nil { if err != nil {
@ -285,6 +285,12 @@ func (s *Staff) getRealWorkDay(username, month string) float64 {
continue continue
} }
//入职当天考勤异常忽略
if checkin.Day == entryDate {
realWorkdays += 1
continue
}
// 迟到的按时间折算 // 迟到的按时间折算
if strings.Contains(checkin.Exception, "上班打卡:时间异常") { if strings.Contains(checkin.Exception, "上班打卡:时间异常") {
stTime := time.Unix(checkin.StartTime, 0) stTime := time.Unix(checkin.StartTime, 0)