บันทึกข้อมูล คำสั่งจ้างและแต่งตั้งลูกจ้างประจำ
This commit is contained in:
parent
7546ac39e8
commit
c285b4dd72
1 changed files with 72 additions and 1 deletions
|
|
@ -1899,7 +1899,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
}
|
||||
|
||||
// add profile document
|
||||
foreach(var doc in placementProfile.PlacementProfileDocs)
|
||||
foreach (var doc in placementProfile.PlacementProfileDocs)
|
||||
{
|
||||
profile.Papers.Add(new ProfilePaper
|
||||
{
|
||||
|
|
@ -6094,6 +6094,77 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
foreach (var recv in command.Receivers)
|
||||
{
|
||||
// TODO: รอมอสเข้ามา Query แล้วแก้ไขข้อมูลทะเบียนประวัติ
|
||||
var data = await _dbContext.Set<PlacementAppointment>()
|
||||
.Include(x => x.PositionEmployeeLine)
|
||||
.Include(x => x.PositionEmployeePosition)
|
||||
.Include(x => x.Profile)
|
||||
.ThenInclude(x => x.Salaries)
|
||||
.ThenInclude(x => x.PositionLevel)
|
||||
.Include(x => x.Profile)
|
||||
.ThenInclude(x => x.PositionEmployeeLine)
|
||||
.Include(x => x.Profile)
|
||||
.ThenInclude(x => x.PositionEmployeePosition)
|
||||
.Include(x => x.OrgEmployee)
|
||||
.ThenInclude(x => x.OrganizationShortName)
|
||||
.Include(x => x.OrgEmployee)
|
||||
.ThenInclude(x => x.OrganizationOrganization)
|
||||
.FirstOrDefaultAsync(x => x.Id == recv.RefPlacementProfileId);
|
||||
|
||||
if (data == null)
|
||||
throw new Exception(GlobalMessages.DataNotFound);
|
||||
data.Profile.EmployeeClass = "perm"; // ลจ ประจำ
|
||||
data.Profile.PositionEmployeeLine = data.PositionEmployeeLine;
|
||||
data.Profile.PositionEmployeePosition = data.PositionEmployeePosition;
|
||||
data.Profile.OrganizationShortNameId = data.OrgEmployee == null || data.OrgEmployee!.OrganizationShortName == null ? null : data.OrgEmployee!.OrganizationShortName!.Id;
|
||||
data.Profile.OrganizationShortName = data.OrgEmployee == null || data.OrgEmployee!.OrganizationShortName == null ? null : data.OrgEmployee!.OrganizationShortName!.Name;
|
||||
data.Profile.OrganizationOrganizationId = data.OrgEmployee == null || data.OrgEmployee!.OrganizationOrganization == null ? null : data.OrgEmployee!.OrganizationOrganization!.Id;
|
||||
data.Profile.OrganizationOrganization = data.OrgEmployee == null || data.OrgEmployee!.OrganizationOrganization == null ? null : data.OrgEmployee!.OrganizationOrganization!.Name;
|
||||
data.Profile.PosNoEmployee = data.OrgEmployee == null ? null : data.OrgEmployee!.PosNo;
|
||||
data.Profile.OcId = data.OrgEmployee == null || data.OrgEmployee!.Organization == null ? null : data.OrgEmployee!.Organization!.Id;
|
||||
data.Profile.Oc = data.OrgEmployee == null || data.OrgEmployee!.Organization == null ? null : _organizationCommonRepository.GetOrganizationNameFullPath(data.OrgEmployee!.Organization!.Id, false, false, "/");
|
||||
|
||||
var lastSarary = data.Profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault();
|
||||
var order = 1;
|
||||
if (lastSarary != null && lastSarary.Order != null)
|
||||
order = lastSarary.Order.Value + 1;
|
||||
|
||||
var salary = new ProfileSalary
|
||||
{
|
||||
Order = order,
|
||||
Date = command.CommandAffectDate,
|
||||
Amount = recv.Amount,
|
||||
PositionSalaryAmount = recv.PositionSalaryAmount,
|
||||
MouthSalaryAmount = recv.MouthSalaryAmount,
|
||||
SalaryClass = "",
|
||||
SalaryRef = "คำสั่งจ้างและแต่งตั้งลูกจ้างประจำ คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}",
|
||||
//OcId = lastSarary.OcId,
|
||||
//PositionLevel = lastSarary.PositionLevel,
|
||||
//PositionLineId = lastSarary.PositionLineId,
|
||||
//PositionTypeId = lastSarary.PositionTypeId,
|
||||
//OrganizationShortNameId = lastSarary.OrganizationShortNameId,
|
||||
//PosNoId = lastSarary.PosNoId,
|
||||
CommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}",
|
||||
CommandTypeName = command.CommandType.Name,
|
||||
//PositionEmployeeGroupId = null,
|
||||
//PositionEmployeeLevelId = null,
|
||||
//PositionEmployeePositionId = null,
|
||||
//PositionEmployeePositionSideId = null,
|
||||
//PosNoEmployee = "",
|
||||
////PositionPathSideId = lastSarary.PositionPathSideId == null,
|
||||
//PositionExecutiveId = lastSarary.PositionExecutiveId,
|
||||
////PositionExecutiveSideId = lastSarary.PositionExecutiveSideId,
|
||||
IsActive = true,
|
||||
CreatedAt = DateTime.Now,
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
CreatedUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
};
|
||||
data.Profile.Salaries.Add(salary);
|
||||
// update placementstatus
|
||||
data.Status = "DONE";
|
||||
await _dbContext.SaveChangesAsync();
|
||||
|
||||
// TODO: ต้องเปลี่ยนเป็น Email จริงนะ ตอนนี้ Hardcode อยู่
|
||||
// Send noti inbox and email
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue