add salary list
This commit is contained in:
@@ -30,5 +30,16 @@ public interface IClassificationGroupSalariesRepository : IRepository<long, Clas
|
||||
/// <param name="schemeId"></param>
|
||||
/// <returns></returns>
|
||||
Task<SalaryAndRialCoefficientTab> GetSalariesTabData(long schemeId);
|
||||
|
||||
|
||||
#region ForApi
|
||||
/// <summary>
|
||||
/// لیست دستمزدها بر اساس تاریخ و سال برای تب دستمزدها
|
||||
/// </summary>
|
||||
/// <param name="schemeId"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<SalaryAndRialCoefficientTabDataList>> GetSalaryList(long schemeId);
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -232,6 +232,13 @@ public interface IClassificationSchemeApplication
|
||||
/// <param name="command"></param>
|
||||
/// <returns></returns>
|
||||
Task<OperationResult> SaveJobsToGroup(AddOrEditJobInGroupDto command);
|
||||
|
||||
/// <summary>
|
||||
/// لیست دستمزدها بر اساس تاریخ و سال برای تب دستمزدها
|
||||
/// </summary>
|
||||
/// <param name="schemeId"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<SalaryAndRialCoefficientTabDataList>> GetSalaryList(long schemeId);
|
||||
#endregion
|
||||
|
||||
}
|
||||
@@ -603,6 +603,7 @@ public class ClassificationSchemeApplication : IClassificationSchemeApplication
|
||||
|
||||
|
||||
}
|
||||
#region ForApi
|
||||
|
||||
public async Task<OperationResult> DeleteScheme(long id)
|
||||
{
|
||||
@@ -637,10 +638,17 @@ public class ClassificationSchemeApplication : IClassificationSchemeApplication
|
||||
public async Task<OperationResult> SaveJobsToGroup(AddOrEditJobInGroupDto command)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
var res= await _classificationGroupRepository.SaveJobsToGroup(command);
|
||||
var res = await _classificationGroupRepository.SaveJobsToGroup(command);
|
||||
if (!res)
|
||||
return op.Failed("خطا در انجام عملیات");
|
||||
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
public async Task<List<SalaryAndRialCoefficientTabDataList>> GetSalaryList(long schemeId)
|
||||
{
|
||||
return await _classificationGroupSalariesRepository.GetSalaryList(schemeId);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -139,5 +139,49 @@ public class ClassificationGroupSalariesRepository : RepositoryBase<long, Classi
|
||||
|
||||
}
|
||||
|
||||
#region ForApi
|
||||
|
||||
public async Task<List<SalaryAndRialCoefficientTabDataList>> GetSalaryList(long schemeId)
|
||||
{
|
||||
var scheme = await _context.ClassificationSchemes.AsSplitQuery().Include(xc => xc.ClassificationRialCoefficients)
|
||||
.Include(xg => xg.ClassificationGroups)
|
||||
.ThenInclude(xs => xs.ClassificationGroupSalaries)
|
||||
.FirstOrDefaultAsync(x => x.id == schemeId);
|
||||
|
||||
if (scheme == null)
|
||||
return null;
|
||||
|
||||
// جمعآوری همهی حقوقها از تمام گروهها
|
||||
var allSalaries = scheme.ClassificationGroups
|
||||
.SelectMany(g => g.ClassificationGroupSalaries)
|
||||
.ToList();
|
||||
|
||||
// اگر هیچ حقوقی وجود ندارد
|
||||
if (!allSalaries.Any())
|
||||
{
|
||||
return new List<SalaryAndRialCoefficientTabDataList>();
|
||||
}
|
||||
|
||||
// گروهبندی بر اساس StartDate و EndDate برای حذف موارد تکراری
|
||||
var distinctPeriods = allSalaries
|
||||
.GroupBy(s => new { s.StartDate, s.EndDate })
|
||||
.Select(g => g.First()) // فقط یکی از هر بازه تاریخ
|
||||
.OrderByDescending(x => x.StartDate)
|
||||
.ToList();
|
||||
|
||||
//تبدیل به مدل خروجی
|
||||
var dataList = distinctPeriods
|
||||
.Select(s => new SalaryAndRialCoefficientTabDataList
|
||||
{
|
||||
RialCoefficientStr = $"{scheme.ClassificationRialCoefficients.FirstOrDefault(x => x.StartDate.Date == s.StartDate.Date && x.EndDate.Date == s.EndDate.Date)?.RialCoefficient}",
|
||||
StartDateFa = s.StartDate.ToFarsi(),
|
||||
EndDateFa = s.EndDate.ToFarsi(),
|
||||
Year = s.Year
|
||||
})
|
||||
.ToList();
|
||||
|
||||
return dataList;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -23,6 +23,7 @@ public class ClassificationSchemeController : AdminBaseController
|
||||
_jobApplication = jobApplication;
|
||||
}
|
||||
|
||||
// تب لیست طرح
|
||||
#region SchemeTab
|
||||
|
||||
/// <summary>
|
||||
@@ -100,6 +101,7 @@ public class ClassificationSchemeController : AdminBaseController
|
||||
|
||||
#endregion
|
||||
|
||||
// تب تعیین مشاغل گروه
|
||||
#region GroupsTab
|
||||
/// <summary>
|
||||
/// دریافت لیست گروه ها
|
||||
@@ -161,4 +163,21 @@ public class ClassificationSchemeController : AdminBaseController
|
||||
return result;
|
||||
}
|
||||
#endregion
|
||||
|
||||
//تب تعیین دستمزد
|
||||
#region SalariesTab
|
||||
|
||||
/// <summary>
|
||||
/// دریافت لیست دستمزدها
|
||||
/// </summary>
|
||||
/// <param name="schemeId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("GetSalariesList")]
|
||||
public async Task<List<SalaryAndRialCoefficientTabDataList>> GetSalariesList(long schemeId)
|
||||
{
|
||||
var result =await _classificationSchemeApplication.GetSalaryList(schemeId);
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
Reference in New Issue
Block a user