月份天数判断

parent e143c928
...@@ -102,7 +102,7 @@ public void Copy_DrugTypeDisburses(per_allot allot, int prevAllotId, bool delHis ...@@ -102,7 +102,7 @@ public void Copy_DrugTypeDisburses(per_allot allot, int prevAllotId, bool delHis
public void Copy_DrugTypeFactors(per_allot allot, int prevAllotId, bool delHistotyData = false) public void Copy_DrugTypeFactors(per_allot allot, int prevAllotId, bool delHistotyData = false)
{ {
Copy_DrugTypes(allot,prevAllotId,delHistotyData); Copy_DrugTypes(allot, prevAllotId, delHistotyData);
var flag = delHistotyData; var flag = delHistotyData;
_logger.LogInformation($"copy drugTypeFactors"); _logger.LogInformation($"copy drugTypeFactors");
...@@ -162,7 +162,7 @@ public void Copy_Agains(per_allot allot, int prevAllotId, bool delHistotyData = ...@@ -162,7 +162,7 @@ public void Copy_Agains(per_allot allot, int prevAllotId, bool delHistotyData =
agains = _againRepository.GetEntities(t => t.AllotID == prevAllotId) ?? _againRepository.GetEntities(t => t.AllotID == -1); agains = _againRepository.GetEntities(t => t.AllotID == prevAllotId) ?? _againRepository.GetEntities(t => t.AllotID == -1);
if (agains != null && agains.Any()) if (agains != null && agains.Any())
{ {
var days = DateTime.DaysInMonth(allot.Year, allot.Month); var days = allot.Month >= 1 && allot.Month <= 12 ? DateTime.DaysInMonth(allot.Year, allot.Month) : 30m;
var newAgains = agains.Select(t => new cof_again var newAgains = agains.Select(t => new cof_again
{ {
AllotID = allot.ID, AllotID = allot.ID,
......
...@@ -105,7 +105,7 @@ public void CreateAllotPersons(int hospitalId, int allotId, int prevAllotId = -1 ...@@ -105,7 +105,7 @@ public void CreateAllotPersons(int hospitalId, int allotId, int prevAllotId = -1
if (persons == null || !persons.Any()) return; if (persons == null || !persons.Any()) return;
int day = DateTime.DaysInMonth(allot.Year, allot.Month); int day = allot.Month >= 1 && allot.Month <= 12 ? DateTime.DaysInMonth(allot.Year, allot.Month) : 30;
var data = persons.Select(t => var data = persons.Select(t =>
{ {
...@@ -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 = allot.Month <= 12 ? DateTime.DaysInMonth(allot.Year, allot.Month) : 30; int day = allot.Month >= 1 && 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;
...@@ -373,7 +373,7 @@ public ApiResponse UpdatePerson(PerEmployeeResponse request) ...@@ -373,7 +373,7 @@ 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 = allot.Month <= 12 ? (decimal)DateTime.DaysInMonth(allot.Year, allot.Month) : 30; var day = allot.Month >= 1 && allot.Month <= 12 ? DateTime.DaysInMonth(allot.Year, allot.Month) : 30m;
employee.Attendance = Math.Round((request.AttendanceDay ?? 0) / day, 4); employee.Attendance = Math.Round((request.AttendanceDay ?? 0) / day, 4);
...@@ -1277,7 +1277,7 @@ public bool ReloadPersonnel(int hospitalId, int allotId) ...@@ -1277,7 +1277,7 @@ public bool ReloadPersonnel(int hospitalId, int allotId)
if (i <= 0) if (i <= 0)
throw new PerformanceException("加载失败,人员信息重置失败!"); throw new PerformanceException("加载失败,人员信息重置失败!");
int day = DateTime.DaysInMonth(allot.Year, allot.Month); int day = allot.Month >= 1 && allot.Month <= 12 ? DateTime.DaysInMonth(allot.Year, allot.Month) : 30;
var data = persons.Select(t => var data = persons.Select(t =>
{ {
var entity = new per_employee var entity = new per_employee
......
...@@ -125,7 +125,7 @@ public SecondDetailDto Load(int secondId, ComputeMode computeMode, EmployeeSourc ...@@ -125,7 +125,7 @@ public SecondDetailDto Load(int secondId, ComputeMode computeMode, EmployeeSourc
foreach (var item in loadEmployees) foreach (var item in loadEmployees)
{ {
item.StaffCoefficient = item.StaffCoefficient ?? 1; // 人员系数 item.StaffCoefficient = item.StaffCoefficient ?? 1; // 人员系数
var actualAttendance = (allot.Month > 0 && allot.Month < 13) ? DateTime.DaysInMonth(allot.Year, allot.Month) : 30; var actualAttendance = allot.Month >= 1 && allot.Month <= 12 ? DateTime.DaysInMonth(allot.Year, allot.Month) : 30;
item.ActualAttendance = item.ActualAttendance ?? actualAttendance; // 出勤 item.ActualAttendance = item.ActualAttendance ?? actualAttendance; // 出勤
item.TitleCoefficient = item.TitleCoefficient ?? 1; // 职称系数 item.TitleCoefficient = item.TitleCoefficient ?? 1; // 职称系数
// 填报模板带出 行政工勤 绩效 // 填报模板带出 行政工勤 绩效
...@@ -487,7 +487,7 @@ public void RowsExpand(per_allot allot, List<SecondColumnDictionary> dic, List<D ...@@ -487,7 +487,7 @@ public void RowsExpand(per_allot allot, List<SecondColumnDictionary> dic, List<D
head.AddOrUpdate(nameof(ag_headsource.SeniorityTitlesAccountedPerformance), history?.SeniorityTitlesAccountedPerformance ?? titleRatio); head.AddOrUpdate(nameof(ag_headsource.SeniorityTitlesAccountedPerformance), history?.SeniorityTitlesAccountedPerformance ?? titleRatio);
head.AddOrUpdate(nameof(ag_headsource.Workload_Ratio_Default), history?.Workload_Ratio_Default ?? workloadRatio); head.AddOrUpdate(nameof(ag_headsource.Workload_Ratio_Default), history?.Workload_Ratio_Default ?? workloadRatio);
var daysFullAttendance = (allot.Month > 0 && allot.Month < 13) ? DateTime.DaysInMonth(allot.Year, allot.Month) : 30; var daysFullAttendance = allot.Month >= 1 && allot.Month <= 12 ? DateTime.DaysInMonth(allot.Year, allot.Month) : 30;
head.AddOrUpdate(nameof(ag_headsource.DaysFullAttendance), daysFullAttendance); head.AddOrUpdate(nameof(ag_headsource.DaysFullAttendance), daysFullAttendance);
// 多工作量加载 // 多工作量加载
...@@ -1681,7 +1681,7 @@ public object RedistributionEmployee(SecondEmployeeDto request) ...@@ -1681,7 +1681,7 @@ public object RedistributionEmployee(SecondEmployeeDto request)
{ {
Func<per_employee, decimal?> getDistPerformance = (emp) => 0; Func<per_employee, decimal?> getDistPerformance = (emp) => 0;
var secondWorkload = GetSecondWorkloadByValue(second.AllotId.Value, second.UnitType, second.Department); var secondWorkload = GetSecondWorkloadByValue(second.AllotId.Value, second.UnitType, second.Department);
var monthDays = (allot.Month > 0 && allot.Month < 13) ? DateTime.DaysInMonth(allot.Year, allot.Month) : 30; var monthDays = allot.Month >= 1 && allot.Month <= 12 ? DateTime.DaysInMonth(allot.Year, allot.Month) : 30;
foreach (var employee in employees) foreach (var employee in employees)
{ {
Dictionary<string, object> item = new Dictionary<string, object>(); Dictionary<string, object> item = new Dictionary<string, object>();
......
...@@ -484,7 +484,8 @@ private void SupplementFixedData(ag_secondallot secondAllot, List<BodyItem> body ...@@ -484,7 +484,8 @@ private void SupplementFixedData(ag_secondallot secondAllot, List<BodyItem> body
var days = bodyItems.FirstOrDefault(w => w.RowNumber == -1 && w.FiledName == "满勤天数"); var days = bodyItems.FirstOrDefault(w => w.RowNumber == -1 && w.FiledName == "满勤天数");
if (days != null && string.IsNullOrEmpty(days.Value)) if (days != null && string.IsNullOrEmpty(days.Value))
days.Value = DateTime.DaysInMonth(secondAllot.Year.Value, secondAllot.Month.Value).ToString(); days.Value = secondAllot.Year.Value >= 1 && secondAllot.Month.Value <= 12 ? DateTime.DaysInMonth(secondAllot.Year.Value, secondAllot.Month.Value).ToString() : "30";
;
} }
/// <summary> /// <summary>
......
...@@ -54,7 +54,7 @@ public SecondAllotResponse GetSecondSavedData(int userId, int secondId, int empl ...@@ -54,7 +54,7 @@ public SecondAllotResponse GetSecondSavedData(int userId, int secondId, int empl
PaymentOfTheMonth = $"{allot.Year}{allot.Month.ToString().PadLeft(2, '0')}月", PaymentOfTheMonth = $"{allot.Year}{allot.Month.ToString().PadLeft(2, '0')}月",
SeniorityTitlesAccountedPerformance = 0.2m, SeniorityTitlesAccountedPerformance = 0.2m,
Workload_Ratio_Default = 0.8m, Workload_Ratio_Default = 0.8m,
DaysFullAttendance = DateTime.DaysInMonth(allot.Year, allot.Month) DaysFullAttendance = allot.Month >= 1 && allot.Month <= 12 ? DateTime.DaysInMonth(allot.Year, allot.Month) : 30
}; };
head.TotalDistPerformance = second.RealGiveFee; head.TotalDistPerformance = second.RealGiveFee;
head.PaymentOfTheMonth = $"{allot.Year}{allot.Month.ToString().PadLeft(2, '0')}月"; head.PaymentOfTheMonth = $"{allot.Year}{allot.Month.ToString().PadLeft(2, '0')}月";
......
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