Insurance confirm merged
This commit is contained in:
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Domain;
|
||||
using CompanyManagment.App.Contracts.InsuranceList;
|
||||
using CompanyManagment.App.Contracts.LeftWork;
|
||||
using CompanyManagment.App.Contracts.LeftWorkInsurance;
|
||||
using CompanyManagment.App.Contracts.PersonnleCode;
|
||||
|
||||
@@ -40,5 +41,16 @@ public interface ILeftWorkInsuranceRepository : IRepository<long, LeftWorkInsura
|
||||
/// <returns></returns>
|
||||
List<EmployeeDetailsForInsuranceListViewModel> GetEmployeeInsuranceLeftWorksAndInformation(long workshopId, DateTime startDate, DateTime endDate);
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Mahan
|
||||
|
||||
/// <summary>
|
||||
/// پرسنل هایی که در قرارداد ترک کار دارند ولی در بیمه ترک کاری برایشان نخورده
|
||||
/// </summary>
|
||||
/// <param name="workshopId"></param>
|
||||
/// <returns></returns>
|
||||
List<LeftWorkViewModel> GetEmployeesWithContractExitOnly(long workshopId);
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using CompanyManagment.App.Contracts.LeftWork;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.InsuranceList;
|
||||
|
||||
@@ -14,4 +15,8 @@ public class EditInsuranceList:CreateInsuranceList
|
||||
public string Population { get; set; }
|
||||
public long? InsuranceJobId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// پرسنل هایی که قرارداد ترک کار کرده اند ولی ترک کار بیمه ندارند
|
||||
/// </summary>
|
||||
public List<LeftWorkViewModel> LeftWorkEmployees { get; set; }
|
||||
}
|
||||
@@ -292,12 +292,12 @@ public class InsuranceListApplication: IInsuranceListApplication
|
||||
var consumableItems = new YearlysalaryItemViewModel();
|
||||
if (yearSalaryObj != null)
|
||||
{
|
||||
yearlysalaryItem = _yearlySalaryItemApplication.GetItemsByYearlySalaryId(yearSalaryObj.Id)
|
||||
.Where(x => x.ItemName == "مزد روزانه").FirstOrDefault();
|
||||
housingAllowance = _yearlySalaryItemApplication.GetItemsByYearlySalaryId(yearSalaryObj.Id)
|
||||
.Where(x => x.ItemName == "کمک هزینه مسکن").FirstOrDefault();
|
||||
consumableItems = _yearlySalaryItemApplication.GetItemsByYearlySalaryId(yearSalaryObj.Id)
|
||||
.Where(x => x.ItemName == "کمک هزینه اقلام").FirstOrDefault();
|
||||
yearlysalaryItem = _yearlySalaryItemApplication
|
||||
.GetItemsByYearlySalaryId(yearSalaryObj.Id).FirstOrDefault(x => x.ItemName == "مزد روزانه");
|
||||
housingAllowance = _yearlySalaryItemApplication
|
||||
.GetItemsByYearlySalaryId(yearSalaryObj.Id).FirstOrDefault(x => x.ItemName == "کمک هزینه مسکن");
|
||||
consumableItems = _yearlySalaryItemApplication
|
||||
.GetItemsByYearlySalaryId(yearSalaryObj.Id).FirstOrDefault(x => x.ItemName == "کمک هزینه اقلام");
|
||||
}
|
||||
|
||||
foreach (var item in insuranceListDetails.EmployeeDetailsForInsuranceList)
|
||||
@@ -341,6 +341,10 @@ public class InsuranceListApplication: IInsuranceListApplication
|
||||
insuranceListDetails.AllInsuredShare = insuranceListDetails.InsuredShare +
|
||||
insuranceListDetails.EmployerShare +
|
||||
insuranceListDetails.UnEmploymentInsurance;
|
||||
|
||||
insuranceListDetails.LeftWorkEmployees =
|
||||
_leftWorkInsuranceRepository.GetEmployeesWithContractExitOnly(insuranceListDetails.WorkshopId);
|
||||
|
||||
return insuranceListDetails;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ using Company.Domain.InsuranceListAgg;
|
||||
using Company.Domain.LeftWorkInsuranceAgg;
|
||||
using Company.Domain.PersonnelCodeAgg;
|
||||
using CompanyManagment.App.Contracts.InsuranceList;
|
||||
using CompanyManagment.App.Contracts.LeftWork;
|
||||
using CompanyManagment.App.Contracts.LeftWorkInsurance;
|
||||
using CompanyManagment.App.Contracts.PersonnleCode;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
@@ -25,15 +26,15 @@ public class LeftWorkInsuranceRepository : RepositoryBase<long, LeftWorkInsuranc
|
||||
public EditLeftWorkInsurance GetDetails(long id)
|
||||
{
|
||||
return _context.LeftWorkInsuranceList.Select(x => new EditLeftWorkInsurance()
|
||||
{
|
||||
Id = x.id,
|
||||
LeftWorkDate = x.LeftWorkDate != null ? x.LeftWorkDate.ToFarsi() : "",
|
||||
StartWorkDate = x.StartWorkDate.ToFarsi(),
|
||||
EmployeeFullName = x.EmployeeFullName,
|
||||
WorkshopName = x.WorkshopName,
|
||||
WorkshopId = x.WorkshopId,
|
||||
EmployeeId = x.EmployeeId
|
||||
})
|
||||
{
|
||||
Id = x.id,
|
||||
LeftWorkDate = x.LeftWorkDate != null ? x.LeftWorkDate.ToFarsi() : "",
|
||||
StartWorkDate = x.StartWorkDate.ToFarsi(),
|
||||
EmployeeFullName = x.EmployeeFullName,
|
||||
WorkshopName = x.WorkshopName,
|
||||
WorkshopId = x.WorkshopId,
|
||||
EmployeeId = x.EmployeeId
|
||||
})
|
||||
.FirstOrDefault(x => x.Id == id);
|
||||
}
|
||||
|
||||
@@ -89,7 +90,7 @@ public class LeftWorkInsuranceRepository : RepositoryBase<long, LeftWorkInsuranc
|
||||
EmployeeId = x.EmployeeId,
|
||||
JobId = x.JobId,
|
||||
|
||||
}).Where(x=>x.WorkshopId == workshopId);
|
||||
}).Where(x => x.WorkshopId == workshopId);
|
||||
return query.ToList();
|
||||
}
|
||||
|
||||
@@ -108,10 +109,10 @@ public class LeftWorkInsuranceRepository : RepositoryBase<long, LeftWorkInsuranc
|
||||
foreach (var item in query)
|
||||
{
|
||||
var jobObj = _context.Jobs.Where(x => x.id == item.JobId).FirstOrDefault();
|
||||
var insuranceListIds = _context.EmployeeInsurancListDataSet.Where(x => x.EmployeeId == searchModel.EmployeeId && (x.StartWorkDate == item.StartWorkDate ||x.LeftWorkDate==item.LeftWorkDate))
|
||||
.Select(x=>x.InsuranceListId).ToList();
|
||||
var hasInsuranceList = _context.InsuranceListSet.Any(x => insuranceListIds.Contains(x.id) && x.WorkshopId==item.WorkshopId);
|
||||
|
||||
var insuranceListIds = _context.EmployeeInsurancListDataSet.Where(x => x.EmployeeId == searchModel.EmployeeId && (x.StartWorkDate == item.StartWorkDate || x.LeftWorkDate == item.LeftWorkDate))
|
||||
.Select(x => x.InsuranceListId).ToList();
|
||||
var hasInsuranceList = _context.InsuranceListSet.Any(x => insuranceListIds.Contains(x.id) && x.WorkshopId == item.WorkshopId);
|
||||
|
||||
list.Add(new LeftWorkInsuranceViewModel()
|
||||
{
|
||||
Id = item.id,
|
||||
@@ -125,7 +126,7 @@ public class LeftWorkInsuranceRepository : RepositoryBase<long, LeftWorkInsuranc
|
||||
EmployeeId = item.EmployeeId,
|
||||
JobId = item.JobId,
|
||||
IncludeStatus = item.IncludeStatus,
|
||||
JobName = jobObj!=null?jobObj.JobName:string.Empty,
|
||||
JobName = jobObj != null ? jobObj.JobName : string.Empty,
|
||||
JobCode = jobObj != null ? jobObj.JobCode : string.Empty,
|
||||
HasInsuranceList = hasInsuranceList,
|
||||
});
|
||||
@@ -142,14 +143,14 @@ public class LeftWorkInsuranceRepository : RepositoryBase<long, LeftWorkInsuranc
|
||||
{
|
||||
var op = new OperationResult();
|
||||
|
||||
var item = _context.LeftWorkInsuranceList.FirstOrDefault(x=>x.id==id);
|
||||
if(item !=null)
|
||||
var item = _context.LeftWorkInsuranceList.FirstOrDefault(x => x.id == id);
|
||||
if (item != null)
|
||||
_context.LeftWorkInsuranceList.Remove(item);
|
||||
|
||||
|
||||
_context.SaveChanges();
|
||||
return op.Succcedded();
|
||||
}
|
||||
public OperationResult RemoveAllLeftWorkInsurance(long workshopId, long employeeId)
|
||||
public OperationResult RemoveAllLeftWorkInsurance(long workshopId, long employeeId)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
|
||||
@@ -161,8 +162,8 @@ public class LeftWorkInsuranceRepository : RepositoryBase<long, LeftWorkInsuranc
|
||||
var insuranceList = _context.InsuranceListSet.Where(x => x.WorkshopId == workshopId).ToList();
|
||||
foreach (var item in insuranceList)
|
||||
{
|
||||
hasInsurance =_context.EmployeeInsurancListDataSet.Any(x => x.EmployeeId == employeeId && x.InsuranceListId==item.id);
|
||||
if(hasInsurance)
|
||||
hasInsurance = _context.EmployeeInsurancListDataSet.Any(x => x.EmployeeId == employeeId && x.InsuranceListId == item.id);
|
||||
if (hasInsurance)
|
||||
break;
|
||||
}
|
||||
//tempChange
|
||||
@@ -174,7 +175,7 @@ public class LeftWorkInsuranceRepository : RepositoryBase<long, LeftWorkInsuranc
|
||||
if (list != null && list.Count > 0)
|
||||
_context.LeftWorkInsuranceList.RemoveRange(list);
|
||||
|
||||
bool hasLeftWork = _context.LeftWorkList.Any(x => x.EmployeeId == employeeId && x.WorkshopId==workshopId);
|
||||
bool hasLeftWork = _context.LeftWorkList.Any(x => x.EmployeeId == employeeId && x.WorkshopId == workshopId);
|
||||
if (!hasLeftWork)
|
||||
{
|
||||
var personelCodeList = _context.PersonnelCodeSet.Where(x => x.EmployeeId == employeeId && x.WorkshopId == workshopId).ToList();
|
||||
@@ -186,8 +187,8 @@ public class LeftWorkInsuranceRepository : RepositoryBase<long, LeftWorkInsuranc
|
||||
string Message = "";
|
||||
|
||||
if (hasLeftWork)
|
||||
{
|
||||
op.Message="حذف با موفقیت انجام شد." + "<br/>" + "<span class='text-warning'>" +"کد پرسنلی این شخص در این کارگاه به دلیل استفاده در ترک کار قرارداد قابل حذف نمی باشد. " + "</span>";
|
||||
{
|
||||
op.Message = "حذف با موفقیت انجام شد." + "<br/>" + "<span class='text-warning'>" + "کد پرسنلی این شخص در این کارگاه به دلیل استفاده در ترک کار قرارداد قابل حذف نمی باشد. " + "</span>";
|
||||
op.IsSuccedded = true;
|
||||
}
|
||||
else
|
||||
@@ -231,7 +232,7 @@ public class LeftWorkInsuranceRepository : RepositoryBase<long, LeftWorkInsuranc
|
||||
|
||||
public List<LeftWorkInsuranceViewModel> SearchForCreateInsuranceList(EmployeeForCreateInsuranceListSearchModel searchModel)
|
||||
{
|
||||
List <LeftWorkInsuranceViewModel> listLeftWorkInsurance = new List<LeftWorkInsuranceViewModel>();
|
||||
List<LeftWorkInsuranceViewModel> listLeftWorkInsurance = new List<LeftWorkInsuranceViewModel>();
|
||||
// IQueryable<LeftWorkInsuranceViewModel> query;
|
||||
|
||||
//if (searchModel.WorkshopIds != null && searchModel.WorkshopIds.Count > 0)
|
||||
@@ -286,7 +287,7 @@ public class LeftWorkInsuranceRepository : RepositoryBase<long, LeftWorkInsuranc
|
||||
leftWorkInsurance.EmployeeId = item.EmployeeId;
|
||||
leftWorkInsurance.IncludeStatus = item.IncludeStatus;
|
||||
leftWorkInsurance.JobId = item.JobId;
|
||||
leftWorkInsurance.JobName = job!=null?job.JobName:string.Empty;
|
||||
leftWorkInsurance.JobName = job != null ? job.JobName : string.Empty;
|
||||
leftWorkInsurance.JobCode = job != null ? job.JobCode : string.Empty;
|
||||
listLeftWorkInsurance.Add(leftWorkInsurance);
|
||||
}
|
||||
@@ -319,7 +320,7 @@ public class LeftWorkInsuranceRepository : RepositoryBase<long, LeftWorkInsuranc
|
||||
public LeftWorkInsuranceViewModel GetLeftPersonelByWorkshopIdAndEmployeeId(long workshopId, long employeeId)
|
||||
{
|
||||
var leftWorkInsurance = new LeftWorkInsuranceViewModel();
|
||||
var leftWorkInsuranceObj = _context.LeftWorkInsuranceList.Where(x=>x.EmployeeId==employeeId && x.WorkshopId==workshopId).OrderByDescending(x=>x.id).FirstOrDefault();
|
||||
var leftWorkInsuranceObj = _context.LeftWorkInsuranceList.Where(x => x.EmployeeId == employeeId && x.WorkshopId == workshopId).OrderByDescending(x => x.id).FirstOrDefault();
|
||||
|
||||
if (leftWorkInsuranceObj != null)
|
||||
{
|
||||
@@ -327,7 +328,7 @@ public class LeftWorkInsuranceRepository : RepositoryBase<long, LeftWorkInsuranc
|
||||
leftWorkInsurance.LeftWorkDateGr = leftWorkInsuranceObj.LeftWorkDate;
|
||||
leftWorkInsurance.StartWorkDateGr = leftWorkInsuranceObj.StartWorkDate;
|
||||
|
||||
if(leftWorkInsuranceObj.LeftWorkDate!=null)
|
||||
if (leftWorkInsuranceObj.LeftWorkDate != null)
|
||||
leftWorkInsurance.LeftWorkDate = leftWorkInsuranceObj.LeftWorkDate.ToFarsi();
|
||||
|
||||
leftWorkInsurance.StartWorkDate = leftWorkInsuranceObj.StartWorkDate.ToFarsi();
|
||||
@@ -361,7 +362,7 @@ public class LeftWorkInsuranceRepository : RepositoryBase<long, LeftWorkInsuranc
|
||||
var personelcode = command.PersonnelCodeList.Where(x => x.EmployeeId == command.EmployeeId && x.WorkshopId == command.WorkshopId).FirstOrDefault();
|
||||
if (personelcode != null)
|
||||
{
|
||||
if(_context.PersonnelCodeSet.Any(x=> x.WorkshopId == command.WorkshopId && x.PersonnelCode == personelcode.PersonnelCode))
|
||||
if (_context.PersonnelCodeSet.Any(x => x.WorkshopId == command.WorkshopId && x.PersonnelCode == personelcode.PersonnelCode))
|
||||
{
|
||||
op.Failed(" کد پرسنلی در کارگاه " + command.WorkshopName + " تکراری می باشد. ");
|
||||
}
|
||||
@@ -370,7 +371,7 @@ public class LeftWorkInsuranceRepository : RepositoryBase<long, LeftWorkInsuranc
|
||||
{
|
||||
return op.Failed(" کد پرسنلی در کارگاه " + command.WorkshopName + "نامعتبر است.");
|
||||
}
|
||||
_context.PersonnelCodeSet.Add(new PersonnelCodeDomain(command.WorkshopId, command.EmployeeId, personelcode.PersonnelCode));
|
||||
_context.PersonnelCodeSet.Add(new PersonnelCodeDomain(command.WorkshopId, command.EmployeeId, personelcode.PersonnelCode));
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
@@ -453,11 +454,11 @@ public class LeftWorkInsuranceRepository : RepositoryBase<long, LeftWorkInsuranc
|
||||
|
||||
foreach (var removeItem in leftworkInsuranceList)
|
||||
{
|
||||
if(!item.LeftworkInsuranceViewModels.Any(x=>x.Id==removeItem.id))
|
||||
if (!item.LeftworkInsuranceViewModels.Any(x => x.Id == removeItem.id))
|
||||
removeList.Add(removeItem);
|
||||
}
|
||||
foreach (var item2 in item.LeftworkInsuranceViewModels)
|
||||
{
|
||||
{
|
||||
DateTime? left = null;
|
||||
if (!string.IsNullOrWhiteSpace(item2.LeftWorkDate))
|
||||
left = item2.LeftWorkDate.ToGeorgianDateTime();
|
||||
@@ -469,7 +470,7 @@ public class LeftWorkInsuranceRepository : RepositoryBase<long, LeftWorkInsuranc
|
||||
var check = _context.LeftWorkInsuranceList.Any(x =>
|
||||
x.EmployeeId == item2.EmployeeId && x.WorkshopId == item2.WorkshopId &&
|
||||
x.StartWorkDate == start);
|
||||
|
||||
|
||||
if (!check)
|
||||
{
|
||||
|
||||
@@ -477,11 +478,11 @@ public class LeftWorkInsuranceRepository : RepositoryBase<long, LeftWorkInsuranc
|
||||
employeeFullName, item2.WorkshopName, item2.JobId, item2.IncludeStatus);
|
||||
Create(leftworkInsuranceObj);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
var leftworkInsurance = _context.LeftWorkInsuranceList.Where(x => x.id==item2.Id)?.FirstOrDefault();
|
||||
var leftworkInsurance = _context.LeftWorkInsuranceList.Where(x => x.id == item2.Id)?.FirstOrDefault();
|
||||
leftworkInsurance.Edit(left, start, item2.WorkshopId, item2.EmployeeId, item2.JobId, item2.IncludeStatus);
|
||||
}
|
||||
}
|
||||
@@ -508,13 +509,13 @@ public class LeftWorkInsuranceRepository : RepositoryBase<long, LeftWorkInsuranc
|
||||
|
||||
public OperationResult CheckDeleteLeftWorkInsurance(long workshopId, long employeeId, DateTime date, int type)
|
||||
{
|
||||
|
||||
|
||||
var op = new OperationResult();
|
||||
bool hasInsurance = false;
|
||||
var insuranceList = _context.InsuranceListSet.Where(x => x.WorkshopId == workshopId).ToList();
|
||||
foreach (var item in insuranceList)
|
||||
{
|
||||
if(type == 1)
|
||||
if (type == 1)
|
||||
hasInsurance = _context.EmployeeInsurancListDataSet.Any(x => x.EmployeeId == employeeId && x.InsuranceListId == item.id && x.StartWorkDate.Date >= date.Date && item.ConfirmSentlist);
|
||||
else
|
||||
hasInsurance = _context.EmployeeInsurancListDataSet.Any(x => x.EmployeeId == employeeId && x.InsuranceListId == item.id && (x.LeftWorkDate != null && ((DateTime)x.LeftWorkDate).Date == date.Date));
|
||||
@@ -555,7 +556,7 @@ public class LeftWorkInsuranceRepository : RepositoryBase<long, LeftWorkInsuranc
|
||||
|
||||
insuranceList = _context.InsuranceListSet.Where(x => x.Year == year && x.Month == month && x.WorkshopId == workshopId).ToList();
|
||||
if (insuranceList != null && insuranceList.Count > 0)
|
||||
{
|
||||
{
|
||||
foreach (var item in insuranceList)
|
||||
{
|
||||
if (type == 1)
|
||||
@@ -587,7 +588,7 @@ public class LeftWorkInsuranceRepository : RepositoryBase<long, LeftWorkInsuranc
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -658,7 +659,7 @@ public class LeftWorkInsuranceRepository : RepositoryBase<long, LeftWorkInsuranc
|
||||
{
|
||||
string resulDate = month.ToFarsiMonthByNumber() + " " + year;
|
||||
//tempChange
|
||||
// return op.Failed("در صورت تمایل به ثبت تاریخ ترک کار به کار این پرسنل می بایست لیست تنظیمی بیمه "+ resulDate + " را حذف نمایید.");
|
||||
// return op.Failed("در صورت تمایل به ثبت تاریخ ترک کار به کار این پرسنل می بایست لیست تنظیمی بیمه "+ resulDate + " را حذف نمایید.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -670,7 +671,7 @@ public class LeftWorkInsuranceRepository : RepositoryBase<long, LeftWorkInsuranc
|
||||
{
|
||||
var lefts = _context.LeftWorkInsuranceList
|
||||
.Where(x => x.EmployeeId == employeeId && x.WorkshopId == workshopId && x.StartWorkDate < startDate)
|
||||
.OrderBy(x=>x.StartWorkDate)
|
||||
.OrderBy(x => x.StartWorkDate)
|
||||
.ToList();
|
||||
if (lefts.Count > 0)
|
||||
{
|
||||
@@ -689,74 +690,110 @@ public class LeftWorkInsuranceRepository : RepositoryBase<long, LeftWorkInsuranc
|
||||
}
|
||||
}
|
||||
|
||||
var sum = totalDays.Sum(x=>x);
|
||||
var sum = totalDays.Sum(x => x);
|
||||
return (sum / 365);
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
#region Insurance
|
||||
|
||||
public List<EmployeeDetailsForInsuranceListViewModel> GetEmployeeInsuranceLeftWorksAndInformation(long workshopId, DateTime startDate, DateTime endDate)
|
||||
{
|
||||
if (workshopId == 0)
|
||||
return [];
|
||||
var query = _context.LeftWorkInsuranceList.Include(x => x.Employee)
|
||||
.Where(x => x.WorkshopId == workshopId)
|
||||
.Where(x =>
|
||||
((x.LeftWorkDate != null && x.LeftWorkDate != DateTime.MinValue) &&
|
||||
((DateTime)x.LeftWorkDate >= startDate &&
|
||||
(DateTime)x.LeftWorkDate <= endDate)) ||
|
||||
((x.LeftWorkDate != null && x.LeftWorkDate != DateTime.MinValue) &&
|
||||
(DateTime)x.LeftWorkDate >= endDate) ||
|
||||
(x.LeftWorkDate == null || x.LeftWorkDate == DateTime.MinValue))
|
||||
.Where(x => x.StartWorkDate <= endDate)
|
||||
.Join(_context.Jobs,
|
||||
left => left.JobId,
|
||||
job => job.id,
|
||||
(left, job) => new { left, job })
|
||||
.GroupJoin(_context.InsuranceEmployeeInformationSet.AsSplitQuery(),
|
||||
result => result.left.EmployeeId,
|
||||
employeeInfo => employeeInfo.EmployeeId,
|
||||
(result, employeeInfo) => new
|
||||
{
|
||||
result.left,
|
||||
result.job,
|
||||
employeeInfo
|
||||
})
|
||||
.SelectMany(x => x.employeeInfo.DefaultIfEmpty(), (x, employeeInfo) => new { x, employeeInfo })
|
||||
.Select(result => new EmployeeDetailsForInsuranceListViewModel
|
||||
{
|
||||
StartWorkDateGr = result.x.left.StartWorkDate,
|
||||
LeftWorkDateGr = result.x.left.LeftWorkDate,
|
||||
IncludeStatus = result.x.left.IncludeStatus,
|
||||
JobId = result.x.left.JobId,
|
||||
JobName = result.x.job != null ? result.x.job.JobName : string.Empty,
|
||||
JobCode = result.x.job != null ? result.x.job.JobCode : string.Empty,
|
||||
InsuranceEmployeeInformationId = result.employeeInfo != null ? result.employeeInfo.id : 0,
|
||||
EmployeeId = result.x.left.EmployeeId,
|
||||
|
||||
//اطلاعات هویتی
|
||||
FName = result.employeeInfo != null ? result.employeeInfo.FName : result.x.left.Employee.FName,
|
||||
LName = result.employeeInfo != null ? result.employeeInfo.LName : result.x.left.Employee.LName,
|
||||
FatherName = result.employeeInfo != null ? result.employeeInfo.FatherName : result.x.left.Employee.FatherName,
|
||||
DateOfBirthGr = result.employeeInfo != null ? result.employeeInfo.DateOfBirth : result.x.left.Employee.DateOfBirth,
|
||||
DateOfIssueGr = result.employeeInfo != null ? result.employeeInfo.DateOfIssue : result.x.left.Employee.DateOfIssue,
|
||||
PlaceOfIssue = result.employeeInfo != null ? result.employeeInfo.PlaceOfIssue : result.x.left.Employee.PlaceOfIssue,
|
||||
IdNumber = result.employeeInfo != null ? result.employeeInfo.IdNumber : result.x.left.Employee.IdNumber,
|
||||
Gender = result.employeeInfo != null ? result.employeeInfo.Gender : result.x.left.Employee.Gender,
|
||||
NationalCode = result.x.left.Employee.NationalCode,
|
||||
Nationality = result.x.left.Employee.Nationality,
|
||||
InsuranceCode = result.x.left.Employee.InsuranceCode,
|
||||
MaritalStatus = result.x.left.Employee.MaritalStatus,
|
||||
IsMaritalStatusSet = !string.IsNullOrWhiteSpace(result.x.left.Employee.MaritalStatus)
|
||||
}).ToList();
|
||||
if (workshopId == 0)
|
||||
return [];
|
||||
var query = _context.LeftWorkInsuranceList.Include(x => x.Employee)
|
||||
.Where(x => x.WorkshopId == workshopId)
|
||||
.Where(x =>
|
||||
((x.LeftWorkDate != null && x.LeftWorkDate != DateTime.MinValue) &&
|
||||
((DateTime)x.LeftWorkDate >= startDate &&
|
||||
(DateTime)x.LeftWorkDate <= endDate)) ||
|
||||
((x.LeftWorkDate != null && x.LeftWorkDate != DateTime.MinValue) &&
|
||||
(DateTime)x.LeftWorkDate >= endDate) ||
|
||||
(x.LeftWorkDate == null || x.LeftWorkDate == DateTime.MinValue))
|
||||
.Where(x => x.StartWorkDate <= endDate)
|
||||
.Join(_context.Jobs,
|
||||
left => left.JobId,
|
||||
job => job.id,
|
||||
(left, job) => new { left, job })
|
||||
.GroupJoin(_context.InsuranceEmployeeInformationSet.AsSplitQuery(),
|
||||
result => result.left.EmployeeId,
|
||||
employeeInfo => employeeInfo.EmployeeId,
|
||||
(result, employeeInfo) => new
|
||||
{
|
||||
result.left,
|
||||
result.job,
|
||||
employeeInfo
|
||||
})
|
||||
.SelectMany(x => x.employeeInfo.DefaultIfEmpty(), (x, employeeInfo) => new { x, employeeInfo })
|
||||
.Select(result => new EmployeeDetailsForInsuranceListViewModel
|
||||
{
|
||||
StartWorkDateGr = result.x.left.StartWorkDate,
|
||||
LeftWorkDateGr = result.x.left.LeftWorkDate,
|
||||
IncludeStatus = result.x.left.IncludeStatus,
|
||||
JobId = result.x.left.JobId,
|
||||
JobName = result.x.job != null ? result.x.job.JobName : string.Empty,
|
||||
JobCode = result.x.job != null ? result.x.job.JobCode : string.Empty,
|
||||
InsuranceEmployeeInformationId = result.employeeInfo != null ? result.employeeInfo.id : 0,
|
||||
EmployeeId = result.x.left.EmployeeId,
|
||||
|
||||
return query;
|
||||
//اطلاعات هویتی
|
||||
FName = result.employeeInfo != null ? result.employeeInfo.FName : result.x.left.Employee.FName,
|
||||
LName = result.employeeInfo != null ? result.employeeInfo.LName : result.x.left.Employee.LName,
|
||||
FatherName = result.employeeInfo != null ? result.employeeInfo.FatherName : result.x.left.Employee.FatherName,
|
||||
DateOfBirthGr = result.employeeInfo != null ? result.employeeInfo.DateOfBirth : result.x.left.Employee.DateOfBirth,
|
||||
DateOfIssueGr = result.employeeInfo != null ? result.employeeInfo.DateOfIssue : result.x.left.Employee.DateOfIssue,
|
||||
PlaceOfIssue = result.employeeInfo != null ? result.employeeInfo.PlaceOfIssue : result.x.left.Employee.PlaceOfIssue,
|
||||
IdNumber = result.employeeInfo != null ? result.employeeInfo.IdNumber : result.x.left.Employee.IdNumber,
|
||||
Gender = result.employeeInfo != null ? result.employeeInfo.Gender : result.x.left.Employee.Gender,
|
||||
NationalCode = result.x.left.Employee.NationalCode,
|
||||
Nationality = result.x.left.Employee.Nationality,
|
||||
InsuranceCode = result.x.left.Employee.InsuranceCode,
|
||||
MaritalStatus = result.x.left.Employee.MaritalStatus,
|
||||
IsMaritalStatusSet = !string.IsNullOrWhiteSpace(result.x.left.Employee.MaritalStatus)
|
||||
}).ToList();
|
||||
|
||||
return query;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Mahan
|
||||
|
||||
public List<LeftWorkViewModel> GetEmployeesWithContractExitOnly(long workshopId)
|
||||
{
|
||||
var leftWorkedEmployees = _context.LeftWorkList
|
||||
.Where(x => x.WorkshopId == workshopId)
|
||||
.GroupBy(x => x.EmployeeId)
|
||||
.Select(x => new
|
||||
{
|
||||
EmployeeId = x.Key,
|
||||
x.OrderByDescending(s => s.StartWorkDate).FirstOrDefault().LeftWorkDate
|
||||
}).Where(x => x.LeftWorkDate != new DateTime(2121, 3, 21))
|
||||
.ToList();
|
||||
|
||||
var leftWorkEmployeeIds = leftWorkedEmployees.Select(x => x.EmployeeId);
|
||||
|
||||
var insuranceLeftWorkWithContractExitOnly = _context.LeftWorkInsuranceList.Where(x =>
|
||||
x.WorkshopId == workshopId && leftWorkEmployeeIds.Contains(x.EmployeeId) && x.LeftWorkDate == null).ToList()
|
||||
.Select(x =>
|
||||
{
|
||||
var employee = leftWorkedEmployees.First(l => l.EmployeeId == x.EmployeeId);
|
||||
return new LeftWorkViewModel()
|
||||
{
|
||||
WorkshopId = x.WorkshopId,
|
||||
EmployeeId = x.EmployeeId,
|
||||
EmployeeFullName = x.EmployeeFullName,
|
||||
LeftWorkDate = employee.LeftWorkDate.ToFarsi(),
|
||||
LeftWorkDateGr = employee.LeftWorkDate
|
||||
};
|
||||
});
|
||||
|
||||
return insuranceLeftWorkWithContractExitOnly.ToList();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
@using _0_Framework.Application
|
||||
@using CompanyManagment.App.Contracts.LeftWork
|
||||
@model CompanyManagment.App.Contracts.InsuranceList.EditInsuranceList
|
||||
|
||||
|
||||
@@ -75,8 +76,17 @@
|
||||
size: A4 landscape;
|
||||
}
|
||||
|
||||
.table-container-employee {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
|
||||
.trTable:nth-child(2n) {
|
||||
background-color: #f1f1f1 !important;
|
||||
-webkit-print-color-adjust: exact !important;
|
||||
print-color-adjust: exact !important;
|
||||
}
|
||||
|
||||
#printThis .table-bordered .has-left-work p, #printThis .table-bordered .has-start-work p {
|
||||
margin: 0;
|
||||
@@ -279,8 +289,8 @@
|
||||
.asignment-field {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
margin-bottom: 50px !important;
|
||||
margin-top: 25px !important;
|
||||
margin-bottom: 60px !important;
|
||||
margin-top: 15px !important;
|
||||
}
|
||||
|
||||
|
||||
@@ -374,6 +384,15 @@
|
||||
#printThis .colgp-16 {
|
||||
width: 60px;
|
||||
}
|
||||
|
||||
.col-md-9, .col-sm-9, .col-lg-9 {
|
||||
width: 75%;
|
||||
float: right;
|
||||
}
|
||||
|
||||
.asignment {
|
||||
width: 25%;
|
||||
}
|
||||
}
|
||||
|
||||
@@media screen {
|
||||
@@ -492,6 +511,13 @@
|
||||
#printThis .table-bordered .has-start-work td {
|
||||
background: grey !important;
|
||||
}
|
||||
|
||||
#printThis .trTable.new-leftwork td {
|
||||
background-color: #333333 !important;
|
||||
color: #ffffff !important;
|
||||
-webkit-print-color-adjust: exact !important;
|
||||
print-color-adjust: exact !important;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -525,12 +551,24 @@
|
||||
<div class="col-md-12">
|
||||
<fieldset class="top-title">
|
||||
<div class="titleSection">
|
||||
<img src="/AdminTheme/LogoAndProfile/logo.png" class="img-circle" style="width:50px;">
|
||||
<div class="titles" style="background: #d3d3d3 !important;">
|
||||
<h3 style="margin-left: auto;font-size: large;"> تایید کارفرما جهت تنظیم لیست بیمه پرسنل </h3>
|
||||
@* <img src="/AdminTheme/LogoAndProfile/logo.png" class="img-circle" style="width:50px;"> *@
|
||||
<div style="font-size: 1rem; width: 33.3333%;">
|
||||
<p>
|
||||
* سطر به رنگ <span class="row-color"><i class="fa fa-square" aria-hidden="true"></i></span>
|
||||
به معنای ترک کار پرسنل می باشد.
|
||||
</p>
|
||||
<p>
|
||||
* سطر به رنگ <span class="row-color2"><i class="fa fa-square" aria-hidden="true"></i></span>به معنای شروع بکار پرسنل می باشد.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<img src="/AdminTheme/LogoAndProfile/logo.png" class="img-circle" style="width:50px;">
|
||||
<div class="titles" style="background: #d3d3d3 !important; width: 33.3333%;">
|
||||
<h3 style="margin-left: auto;font-size: 15px;"> تایید کارفرما جهت تنظیم لیست بیمه پرسنل </h3>
|
||||
</div>
|
||||
|
||||
<div style="text-align: left; width: 33.3333%;">
|
||||
<img src="/AdminTheme/LogoAndProfile/logo.png" class="img-circle" style="width:50px;">
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
@@ -788,8 +826,101 @@
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="row asignment-field">
|
||||
<div class="col-md-4 col-sm-4 col-lg-4" style="display:inline-grid;">
|
||||
<div style="font-size: 1rem;">
|
||||
<div class="col-md-9 col-sm-9 col-lg-9" style="display: inline-grid;">
|
||||
|
||||
<div>
|
||||
@{
|
||||
var pageStartIndex = i * 12;
|
||||
var pageEndIndex = (i == q - 1) ? ((i * 12) + r) : ((i + 1) * 12);
|
||||
|
||||
var pageEmployees = Model.EmployeeDetailsForInsuranceList
|
||||
.Skip(pageStartIndex)
|
||||
.Take(pageEndIndex - pageStartIndex)
|
||||
.ToList();
|
||||
var pageEmployeeIds = pageEmployees.Select(x => x.EmployeeId).ToHashSet();
|
||||
|
||||
var leftWorkList = Model.LeftWorkEmployees
|
||||
.Where(x => pageEmployeeIds.Contains(x.EmployeeId))
|
||||
.Select(x => new LeftWorkViewModel {
|
||||
EmployeeFullName = x.EmployeeFullName ?? "-",
|
||||
LeftWorkDate = x.LeftWorkDate ?? "-"
|
||||
})
|
||||
.ToList();
|
||||
|
||||
while (leftWorkList.Count < 12)
|
||||
{
|
||||
leftWorkList.Add(new LeftWorkViewModel { EmployeeFullName = "-", LeftWorkDate = "-" });
|
||||
}
|
||||
|
||||
var tables = new List<List<LeftWorkViewModel>>();
|
||||
for (int t = 0; t < 3; t++)
|
||||
{
|
||||
tables.Add(leftWorkList.Skip(t * 4).Take(4).ToList());
|
||||
}
|
||||
}
|
||||
|
||||
<p style="font-size: 12px; margin: 0 0 3px 0;">هشدار پرسنل ذیل با توجه به تاریخ مندرج با مجموعه شما هیچگونه قرارداد کاری ندارند.</p>
|
||||
<fieldset style="border: 1px solid #cccccc !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; border-radius: 10px 10px 10px 10px; margin: 0px 0px; overflow: hidden; padding: 0; display: flex; width: 100%;">
|
||||
<div class="table-container-employee">
|
||||
|
||||
@for (int t = 0; t < tables.Count; t++)
|
||||
{
|
||||
var table = tables[t];
|
||||
<table style="width: 100%;">
|
||||
<colgroup>
|
||||
<col style="width: 40%;">
|
||||
<col style="width: 60%;">
|
||||
</colgroup>
|
||||
|
||||
<tr style="border-bottom: 1px solid; background-color: #e1e1e1 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; font-size: 9px; height: 15px;">
|
||||
<th style="padding: 1px 4px; text-align: center; min-width: 4rem; font-size: 10px; @(t == 2 ? "" : "border-left: 2px solid black;")">تاریخ</th>
|
||||
<th style="padding: 1px 4px; text-align: center; border-left: 1px solid black; min-width: 4rem; font-size: 10px;">نام پرسنل</th>
|
||||
</tr>
|
||||
|
||||
@foreach (var item in table)
|
||||
{
|
||||
<tr class="trTable @(@item.LeftWorkDate != "-" ? "new-leftwork" : "")" style="text-align: right; font-size: 9px; height: 15px;">
|
||||
<td style="font-size: 8px; text-align: center; @(t == 2 ? "" : "border-left: 2px solid black;") @(@item.LeftWorkDate != "-" ? "background-color: #333333;color: #ffffff; -webkit-print-color-adjust:exact !important; print-color-adjust:exact !important;" : "")">
|
||||
@item.LeftWorkDate
|
||||
</td>
|
||||
<td style="font-size: 8px; text-align: center; border-left: 1px solid black; @(@item.LeftWorkDate != "-" ? "background-color: #333333;color: #ffffff; -webkit-print-color-adjust:exact !important; print-color-adjust:exact !important;" : "")">
|
||||
@item.EmployeeFullName
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</table>
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@* <table style="width: 100%;">
|
||||
<colgroup>
|
||||
<col style="width: 40%;">
|
||||
<col style="width: 60%;">
|
||||
</colgroup>
|
||||
|
||||
<tr style="border-bottom: 1px solid; background-color: #e1e1e1 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; font-size: 9px; height: 15px;">
|
||||
<th style="padding: 1px 4px; text-align: center; min-width: 4rem; font-size: 10px;">تاریخ</th>
|
||||
<th style="padding: 1px 4px; text-align: center; border-left: 1px solid black; min-width: 4rem; font-size: 10px;">نام پرسنل</th>
|
||||
</tr>
|
||||
|
||||
<tr class="trTable" style="text-align: right; font-size: 9px; height: 15px;">
|
||||
<td style="font-size: 8px; text-align: center;">
|
||||
-
|
||||
</td>
|
||||
<td style="font-size: 8px; text-align: center; border-left: 1px solid black;">
|
||||
-
|
||||
</td>
|
||||
</tr>
|
||||
</table>*@
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
@* <div
|
||||
style="font-size: 1rem;">
|
||||
<p>
|
||||
* سطر به رنگ <span class="row-color"><i class="fa fa-square" aria-hidden="true"></i></span>
|
||||
به معنای ترک کار پرسنل می باشد.
|
||||
@@ -797,10 +928,10 @@
|
||||
<p>
|
||||
* سطر به رنگ <span class="row-color2"><i class="fa fa-square" aria-hidden="true"></i></span>به معنای شروع بکار پرسنل می باشد.
|
||||
</p>
|
||||
</div>
|
||||
<p style="margin: 0;align-self: end !important;">صفحه @(i + 1) از @((r>0 && r <= 8 )?q:q+1)</p>
|
||||
</div>
|
||||
<div class="col-md-5 col-sm-5 col-lg-5"></div>
|
||||
</div> *@
|
||||
<p style="margin: 0; align-self: end !important;">صفحه @(i + 1) از @((r > 0 && r <= 8) ? q : q + 1)</p>
|
||||
</div>
|
||||
@* <div class="col-md-5 col-sm-5 col-lg-5"></div> *@
|
||||
<div class="col-md-3 col-sm-3 col-lg-3 asignment">
|
||||
<h5 style="color: grey !important;"> امضا و تایید کارفرما </h5>
|
||||
</div>
|
||||
@@ -816,12 +947,12 @@
|
||||
<div class="col-md-12">
|
||||
<fieldset class="top-title">
|
||||
<div class="titleSection">
|
||||
<img src="/AdminTheme/LogoAndProfile/logo.png" class="img-circle" style="width:50px;">
|
||||
@* <img src="/AdminTheme/LogoAndProfile/logo.png" class="img-circle" style="width:50px;"> *@
|
||||
<div class="titles" style="background: #d3d3d3 !important;">
|
||||
<h3 style="margin-left: auto;font-size: large;"> تایید کارفرما جهت تنظیم لیست بیمه پرسنل </h3>
|
||||
|
||||
</div>
|
||||
<img src="/AdminTheme/LogoAndProfile/logo.png" class="img-circle" style="width:50px;">
|
||||
@* <img src="/AdminTheme/LogoAndProfile/logo.png" class="img-circle" style="width:50px;"> *@
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user