salary
This commit is contained in:
parent
7d1ce1d31c
commit
0055cab5c6
service
|
@ -9,7 +9,6 @@ import (
|
|||
"github.com/smbrave/goutil"
|
||||
"github.com/spf13/cast"
|
||||
"math"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
|
@ -162,24 +161,24 @@ func (s *StaffSalary) getRealWorkDay(month string) float64 {
|
|||
realWorkdays += 1
|
||||
}
|
||||
|
||||
corp, _ := dao.NewCorpDao().Get(s.user.CorpId)
|
||||
for _, checkin := range userCheckins {
|
||||
|
||||
//入职离职当天已经算过了
|
||||
if entryTime.Format("2006-01-02") == checkin.Day || leaveTime.Format("2006-01-02") == checkin.Day {
|
||||
continue
|
||||
}
|
||||
|
||||
if checkin.Exception == "" {
|
||||
realWorkdays += 1
|
||||
continue
|
||||
}
|
||||
|
||||
//有请假申请的不算出勤
|
||||
approvalVacation, _ := dao.NewApprovalVacationDao().GetByUsernameDay(s.user.CorpId, s.user.Username, checkin.Day)
|
||||
if approvalVacation != nil {
|
||||
continue
|
||||
}
|
||||
|
||||
if checkin.Exception == "" {
|
||||
realWorkdays += 1
|
||||
continue
|
||||
}
|
||||
|
||||
//有补卡申请就直接算出勤
|
||||
approvalCheckin, _ := dao.NewApprovalCheckinDao().GetByUsernameDay(s.user.CorpId, s.user.Username, checkin.Day)
|
||||
if approvalCheckin != nil {
|
||||
|
@ -188,16 +187,9 @@ func (s *StaffSalary) getRealWorkDay(month string) float64 {
|
|||
continue
|
||||
}
|
||||
|
||||
// 迟到的按时间折算
|
||||
if strings.Contains(checkin.Exception, "上班打卡:时间异常") {
|
||||
stTime := time.Unix(checkin.StartTime, 0)
|
||||
later := float64(stTime.Hour() - 8) //迟到小时数,从9点算
|
||||
if later > 8 {
|
||||
later = 8
|
||||
}
|
||||
realWorkdays += (8 - later) / 8
|
||||
continue
|
||||
}
|
||||
//其他按工作时长结算
|
||||
duration := float64(checkin.EndTime-checkin.StartTime) / cast.ToFloat64(corp.GetConfig().WorkerHouer)
|
||||
realWorkdays += goutil.If(duration > 1, 1, duration)
|
||||
}
|
||||
return realWorkdays
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue