Commit 97ba3478 by 纪旭 韦

人员字典添加时获取月份超出

parent 78453b6e
...@@ -281,7 +281,7 @@ public ApiResponse CreatePerson(PerEmployeeResponse request) ...@@ -281,7 +281,7 @@ public ApiResponse CreatePerson(PerEmployeeResponse request)
var entity = _mapper.Map<per_employee>(request); var entity = _mapper.Map<per_employee>(request);
var allot = perallotRepository.GetEntity(t => t.ID == request.AllotId); var allot = perallotRepository.GetEntity(t => t.ID == request.AllotId);
int day = DateTime.DaysInMonth(allot.Year, allot.Month); int day = allot.Month <= 12 ? DateTime.DaysInMonth(allot.Year, allot.Month) : 30;
entity.Attendance = request.AttendanceDay / day; entity.Attendance = request.AttendanceDay / day;
entity.CreateTime = DateTime.Now; entity.CreateTime = DateTime.Now;
entity.IsVerify = 1; entity.IsVerify = 1;
...@@ -295,7 +295,7 @@ public ApiResponse CreatePerson(PerEmployeeResponse request) ...@@ -295,7 +295,7 @@ public ApiResponse CreatePerson(PerEmployeeResponse request)
perallotRepository.AccoungtingVerify(entity.AllotId ?? 0); perallotRepository.AccoungtingVerify(entity.AllotId ?? 0);
return new ApiResponse(ResponseType.OK, "添加成功", entity); return new ApiResponse(ResponseType.OK, "添加成功", entity);
} }
...@@ -373,7 +373,8 @@ public ApiResponse UpdatePerson(PerEmployeeResponse request) ...@@ -373,7 +373,8 @@ public ApiResponse UpdatePerson(PerEmployeeResponse request)
// 出勤率 // 出勤率
var allot = perallotRepository.GetEntity(t => t.ID == request.AllotId); var allot = perallotRepository.GetEntity(t => t.ID == request.AllotId);
var day = (decimal)DateTime.DaysInMonth(allot.Year, allot.Month); var day = allot.Month <= 12 ? (decimal)DateTime.DaysInMonth(allot.Year, allot.Month) : 30;
employee.Attendance = Math.Round((request.AttendanceDay ?? 0) / day, 4); employee.Attendance = Math.Round((request.AttendanceDay ?? 0) / day, 4);
//CheckAccountingDept(request.HospitalId.Value, request.AccountingUnit, request.Department); //CheckAccountingDept(request.HospitalId.Value, request.AccountingUnit, request.Department);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment