Merge branch 'master' into Main
This commit is contained in:
@@ -319,7 +319,10 @@ namespace CompanyManagment.Application
|
||||
|
||||
if (workshopId == 170)
|
||||
{
|
||||
var exceptionEmployeeIds = _customizeWorkshopGroupSettingsRepository.GetEmployeeSettingsByGroupSettingsId(117).Select(x => x.EmployeeId).ToList();
|
||||
var exceptionEmployeeIds = _customizeWorkshopGroupSettingsRepository
|
||||
.GetEmployeeSettingsByGroupSettingsId(117)
|
||||
.Select(x => x.EmployeeId)
|
||||
.Where(x=> workshopLeftWorksInMonth.Select(l=>l.EmployeeId).Contains(x)).ToList();
|
||||
foreach (var employeesId in exceptionEmployeeIds)
|
||||
{
|
||||
|
||||
|
||||
@@ -249,7 +249,10 @@ namespace CompanyManagment.Application
|
||||
|
||||
if (workshopId == 170)
|
||||
{
|
||||
var exceptionEmployeeIds = _customizeWorkshopGroupSettingsRepository.GetEmployeeSettingsByGroupSettingsId(117).Select(x => x.EmployeeId).ToList();
|
||||
var exceptionEmployeeIds = _customizeWorkshopGroupSettingsRepository
|
||||
.GetEmployeeSettingsByGroupSettingsId(117)
|
||||
.Select(x => x.EmployeeId)
|
||||
.Where(x=> workshopLeftWorksInMonth.Select(l=>l.EmployeeId).Contains(x)).ToList();
|
||||
foreach (var employeesId in exceptionEmployeeIds)
|
||||
{
|
||||
|
||||
|
||||
@@ -1345,8 +1345,12 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
|
||||
public List<EmployeeDetailsForInsuranceListViewModel> GetEmployeeInsuranceDataForEdit(long insuranceListId, DateTime startDate, DateTime endDate)
|
||||
{
|
||||
|
||||
var res = _context.EmployeeInsurancListDataSet
|
||||
var employeeDataQuery = _context.EmployeeInsurancListDataSet
|
||||
.Where(x => x.InsuranceListId == insuranceListId)
|
||||
.Join(_context.InsuranceListSet,
|
||||
employeeInsurancListData => employeeInsurancListData.InsuranceListId,
|
||||
insuranceList => insuranceList.id,
|
||||
(employeeInsurancListData, insuranceList) => new{employeeInsurancListData,insuranceList})
|
||||
.Join(_context.LeftWorkInsuranceList
|
||||
.Where(x =>
|
||||
((x.LeftWorkDate != null && x.LeftWorkDate != DateTime.MinValue) &&
|
||||
@@ -1357,14 +1361,18 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
|
||||
(x.LeftWorkDate == null || x.LeftWorkDate == DateTime.MinValue))
|
||||
.Where(x => x.StartWorkDate <= endDate)
|
||||
.Include(x => x.Employee),
|
||||
employeeData => employeeData.EmployeeId,
|
||||
leftwork => leftwork.EmployeeId,
|
||||
(employeeData, leftwork) => new { employeeData, leftwork })
|
||||
.Join(_context.Jobs,
|
||||
employeeData =>new { employeeData.employeeInsurancListData.EmployeeId,employeeData.insuranceList.WorkshopId},
|
||||
leftwork => new {leftwork.EmployeeId,leftwork.WorkshopId},
|
||||
(employeeData, leftwork)
|
||||
=> new { employeeData = employeeData.employeeInsurancListData, leftwork });
|
||||
|
||||
var employeeJobs =employeeDataQuery.Join(_context.Jobs,
|
||||
result => result.leftwork.JobId,
|
||||
job => job.id,
|
||||
(result, job) => new { result, job })
|
||||
.GroupJoin(_context.InsuranceEmployeeInformationSet.AsSplitQuery(),
|
||||
(result, job) => new { result, job });
|
||||
|
||||
|
||||
var res =employeeJobs.GroupJoin(_context.InsuranceEmployeeInformationSet.AsSplitQuery(),
|
||||
allResult => allResult.result.employeeData.EmployeeId,
|
||||
employeeInfo => employeeInfo.EmployeeId,
|
||||
(allResult, employeeInfo) => new
|
||||
|
||||
@@ -35,9 +35,18 @@ public class LoanRepository : RepositoryBase<long, Loan>, ILoanRepository
|
||||
|
||||
var startDate = loan.LoanInstallments.MinBy(x => x.InstallmentDate).InstallmentDate;
|
||||
var endDate = loan.LoanInstallments.MaxBy(x => x.InstallmentDate).InstallmentDate;
|
||||
|
||||
var customizeCheckouts =await _companyContext.CustomizeCheckouts.Where(x => x.WorkshopId == loan.WorkshopId && x.EmployeeId == loan.EmployeeId &&
|
||||
x.ContractStart <= endDate && x.ContractEnd >= startDate).Select(x=> new {x.MonthInt, x.YearInt}).ToListAsync();
|
||||
var pc = new PersianCalendar();
|
||||
var customizeCheckouts = (await _companyContext.CheckoutSet
|
||||
.Where(x => x.WorkshopId == loan.WorkshopId && x.EmployeeId == loan.EmployeeId &&
|
||||
startDate<=x.ContractEnd && endDate>=x.ContractEnd)
|
||||
.Select(x => x.ContractStart).ToListAsync())
|
||||
.Select(x =>
|
||||
{
|
||||
|
||||
var year = pc.GetYear(x);
|
||||
var month = pc.GetMonth(x);
|
||||
return new { Month = month, Year = year };
|
||||
});
|
||||
|
||||
var result = new LoanDetailsViewModel()
|
||||
{
|
||||
@@ -51,7 +60,7 @@ public class LoanRepository : RepositoryBase<long, Loan>, ILoanRepository
|
||||
Id = x.Id,
|
||||
InstallmentAmount = x.AmountForMonth.ToMoney(),
|
||||
InstallmentDate = x.InstallmentDate.ToFarsi(),
|
||||
IsPaid = customizeCheckouts.Any(c => c.MonthInt.ToString() == x.Month && c.YearInt.ToString() == x.Year)
|
||||
IsPaid = customizeCheckouts.Any(c => c.Month.ToString("00") == x.Month && c.Year.ToString() == x.Year),
|
||||
}).ToList()
|
||||
|
||||
};
|
||||
|
||||
@@ -52,6 +52,7 @@ public class FinancialController : ClientBaseController
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("CreatePay")]
|
||||
[AllowAnonymous]
|
||||
public async Task<ActionResult<OperationResult<string>>> CreatePay([FromForm] CreateFinancialPayRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
var op = new OperationResult<string>();
|
||||
|
||||
Reference in New Issue
Block a user