entrytime
This commit is contained in:
parent
b8ad3d364a
commit
5550f302bd
|
@ -31,22 +31,27 @@ func (s *StaffSalary) CalcSalary(salary *model.StaffSalary, month string) (*mode
|
|||
userSalary := s.user.GetSalary()
|
||||
userConfig := s.user.GetConfig()
|
||||
corpConfig := corp.GetConfig()
|
||||
if userSalary.Base == "" && userSalary.Target == "" {
|
||||
if cast.ToInt(userSalary.Base) == 0 && cast.ToInt(userSalary.Target) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
if salary == nil {
|
||||
salary = new(model.StaffSalary)
|
||||
salary.Month = month
|
||||
salary.CorpId = s.user.CorpId
|
||||
salary.UserId = s.user.Id
|
||||
salary.Username = s.user.Username
|
||||
}
|
||||
|
||||
entryTime, _ := time.ParseInLocation("2006-01-02", s.user.EntryDate, time.Local)
|
||||
leaveTime, _ := time.ParseInLocation("2006-01-02", s.user.LeaveDate, time.Local)
|
||||
isEntryMonth := goutil.If(cast.ToInt(entryTime.Format("200601")) == cast.ToInt(month), true, false)
|
||||
isLeaveMonth := goutil.If(cast.ToInt(leaveTime.Format("200601")) == cast.ToInt(month), true, false)
|
||||
|
||||
//入职之前的工资不计算
|
||||
if cast.ToInt(month) < cast.ToInt(entryTime.Format("200601")) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
if salary == nil {
|
||||
salary = new(model.StaffSalary)
|
||||
salary.Month = month
|
||||
salary.CorpId = s.user.CorpId
|
||||
salary.UserId = s.user.Id
|
||||
salary.Username = s.user.Username
|
||||
}
|
||||
//社保和公积金
|
||||
salary.SocialDeduct = 0
|
||||
salary.HouseDeduct = 0
|
||||
|
|
Loading…
Reference in New Issue