แก้ไขหมาย้หตุคำสั่ง

This commit is contained in:
Kittapath 2023-10-02 19:51:38 +07:00
parent a76ba4270f
commit ccf19c5683
21 changed files with 16530 additions and 70 deletions

View file

@ -315,8 +315,9 @@ namespace BMA.EHR.Application.Repositories.Commands
orderby r.Sequence
select new CommandType03Response
{
Education = pf.Educations == null || pf.Educations.Count == 0 ? "" :
pf.Educations.OrderByDescending(x => x.StartDate).FirstOrDefault().Degree,
// Education = pf.Educations == null || pf.Educations.Count == 0 ? "" :
// pf.Educations.OrderByDescending(x => x.StartDate).FirstOrDefault().Degree,
Education = p.EducationOld == null ? "-" : p.EducationOld,
Seq = r.Sequence.ToString().ToThaiNumber(),
CitizenId = r.CitizenId,
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
@ -325,14 +326,16 @@ namespace BMA.EHR.Application.Repositories.Commands
OldPositionLevel = pf.PositionLevel == null ? "" : pf.PositionLevel.Name,
OldPositionType = pf.PositionType == null ? "" : pf.PositionType.Name,
OldPositionNumber = pf.PosNo == null ? "" : pf.PosNo.Name.ToThaiNumber(),
OldSalary = pf.Salaries == null || pf.Salaries.Count == 0 ? "" : pf.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
// OldSalary = pf.Salaries == null || pf.Salaries.Count == 0 ? "" : pf.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
NewOc = _organizationCommonRepository.GetOrganizationNameFullPath(p.OrganizationPosition!.Organization!.Id, false, false, "/"),
NewPositionName = p.PositionPath == null ? "" : p.PositionPath!.Name,
NewPositionLevel = p.PositionLevel == null ? "" : p.PositionLevel.Name,
NewPositionType = p.PositionType == null ? "" : p.PositionType.Name,
NewPositionNumber = p.PositionNumber == null ? "" : p.PositionNumber.Name.ToThaiNumber(),
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
AppointDate = p.RecruitDate == null ? "" : p.RecruitDate.Value.ToThaiShortDate2().ToThaiNumber()
AppointDate = p.RecruitDate == null ? "" : p.RecruitDate.Value.ToThaiShortDate2().ToThaiNumber(),
Reason = p.Reason == null ? "-" : p.Reason,
})
.ToList();
@ -377,8 +380,9 @@ namespace BMA.EHR.Application.Repositories.Commands
orderby r.Sequence
select new CommandType03Response
{
Education = pf.Educations == null || pf.Educations.Count == 0 ? "" :
pf.Educations.OrderByDescending(x => x.StartDate).FirstOrDefault().Degree,
// Education = pf.Educations == null || pf.Educations.Count == 0 ? "" :
// pf.Educations.OrderByDescending(x => x.StartDate).FirstOrDefault().Degree,
Education = p.EducationOld == null ? "-" : p.EducationOld,
Seq = r.Sequence.ToString().ToThaiNumber(),
CitizenId = r.CitizenId,
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
@ -387,14 +391,16 @@ namespace BMA.EHR.Application.Repositories.Commands
OldPositionLevel = pf.PositionLevel == null ? "" : pf.PositionLevel.Name,
OldPositionType = pf.PositionType == null ? "" : pf.PositionType.Name,
OldPositionNumber = pf.PosNo == null ? "" : pf.PosNo.Name.ToThaiNumber(),
OldSalary = pf.Salaries == null || pf.Salaries.Count == 0 ? "" : pf.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
// OldSalary = pf.Salaries == null || pf.Salaries.Count == 0 ? "" : pf.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
NewOc = _organizationCommonRepository.GetOrganizationNameFullPath(p.OrganizationPosition!.Organization!.Id, false, false, "/"),
NewPositionName = p.PositionPath == null ? "" : p.PositionPath!.Name,
NewPositionLevel = p.PositionLevel == null ? "" : p.PositionLevel.Name,
NewPositionType = p.PositionType == null ? "" : p.PositionType.Name,
NewPositionNumber = p.PositionNumber == null ? "" : p.PositionNumber.Name.ToThaiNumber(),
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
AppointDate = p.RecruitDate == null ? "" : p.RecruitDate.Value.ToThaiShortDate2().ToThaiNumber()
AppointDate = p.RecruitDate == null ? "" : p.RecruitDate.Value.ToThaiShortDate2().ToThaiNumber(),
Reason = p.Reason == null ? "-" : p.Reason,
})
.ToList();
@ -431,9 +437,8 @@ namespace BMA.EHR.Application.Repositories.Commands
.ThenInclude(x => x.PositionType)
.Include(x => x.Profile)
.ThenInclude(x => x.PosNo)
.Include(x => x.Profile)
.Include(x => x.Profile)
.ThenInclude(x => x.Educations)
.Include(x => x.OrganizationPosition)
.ThenInclude(x => x.Organization)
.Include(x => x.PositionPath)
@ -444,8 +449,9 @@ namespace BMA.EHR.Application.Repositories.Commands
orderby r.Sequence
select new CommandType03Response
{
Education = p.Profile.Educations == null || p.Profile.Educations.Count == 0 ? "" :
p.Profile.Educations.OrderByDescending(x => x.StartDate).FirstOrDefault().Degree,
// Education = p.Profile.Educations == null || p.Profile.Educations.Count == 0 ? "" :
// p.Profile.Educations.OrderByDescending(x => x.StartDate).FirstOrDefault().Degree,
Education = p.EducationOld == null ? "-" : p.EducationOld,
Seq = r.Sequence.ToString().ToThaiNumber(),
CitizenId = r.CitizenId,
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
@ -454,14 +460,17 @@ namespace BMA.EHR.Application.Repositories.Commands
OldPositionLevel = p.Profile.PositionLevel == null ? "" : p.Profile.PositionLevel.Name,
OldPositionType = p.Profile.PositionType == null ? "" : p.Profile.PositionType.Name,
OldPositionNumber = p.Profile.PosNo == null ? "" : p.Profile.PosNo.Name.ToThaiNumber(),
OldSalary = p.Profile.Salaries == null || p.Profile.Salaries.Count == 0 ? "" : p.Profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
// OldSalary = p.Profile.Salaries == null || p.Profile.Salaries.Count == 0 ? "" : p.Profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
NewOc = p.OrganizationPosition == null ? "" : _organizationCommonRepository.GetOrganizationNameFullPath(p.OrganizationPosition!.Organization!.Id, false, false, "/"),
NewPositionName = p.PositionPath == null ? "" : p.PositionPath!.Name,
NewPositionLevel = p.PositionLevel == null ? "" : p.PositionLevel.Name,
NewPositionType = p.PositionType == null ? "" : p.PositionType.Name,
NewPositionNumber = p.PositionNumber == null ? "" : p.PositionNumber.Name.ToThaiNumber(),
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
AppointDate = p.RecruitDate == null ? "" : p.RecruitDate.Value.ToThaiShortDate2().ToThaiNumber()
AppointDate = p.PositionDate == null ? "" : p.PositionDate.Value.ToThaiShortDate2().ToThaiNumber(),
LeaveDate = p.Profile.LeaveDate == null ? "" : p.Profile.LeaveDate.Value.ToThaiShortDate2().ToThaiNumber(),
Reason = p.Reason == null ? "-" : p.Reason,
})
.ToList();
@ -500,7 +509,6 @@ namespace BMA.EHR.Application.Repositories.Commands
.ThenInclude(x => x.PosNo)
.Include(x => x.Profile)
.ThenInclude(x => x.Educations)
.Include(x => x.OrganizationPosition)
.ThenInclude(x => x.Organization)
.Include(x => x.PositionPath)
@ -511,8 +519,9 @@ namespace BMA.EHR.Application.Repositories.Commands
orderby r.Sequence
select new CommandType03Response
{
Education = p.Profile.Educations == null || p.Profile.Educations.Count == 0 ? "" :
p.Profile.Educations.OrderByDescending(x => x.StartDate).FirstOrDefault().Degree,
// Education = p.Profile.Educations == null || p.Profile.Educations.Count == 0 ? "" :
// p.Profile.Educations.OrderByDescending(x => x.StartDate).FirstOrDefault().Degree,
Education = p.EducationOld == null ? "-" : p.EducationOld,
Seq = r.Sequence.ToString().ToThaiNumber(),
CitizenId = r.CitizenId,
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
@ -521,14 +530,18 @@ namespace BMA.EHR.Application.Repositories.Commands
OldPositionLevel = p.Profile.PositionLevel == null ? "" : p.Profile.PositionLevel.Name,
OldPositionType = p.Profile.PositionType == null ? "" : p.Profile.PositionType.Name,
OldPositionNumber = p.Profile.PosNo == null ? "" : p.Profile.PosNo.Name.ToThaiNumber(),
OldSalary = p.Profile.Salaries == null || p.Profile.Salaries.Count == 0 ? "" : p.Profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
// OldSalary = p.Profile.Salaries == null || p.Profile.Salaries.Count == 0 ? "" : p.Profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
NewOc = p.OrganizationPosition == null ? "" : _organizationCommonRepository.GetOrganizationNameFullPath(p.OrganizationPosition!.Organization!.Id, false, false, "/"),
NewPositionName = p.PositionPath == null ? "" : p.PositionPath!.Name,
NewPositionLevel = p.PositionLevel == null ? "" : p.PositionLevel.Name,
NewPositionType = p.PositionType == null ? "" : p.PositionType.Name,
NewPositionNumber = p.PositionNumber == null ? "" : p.PositionNumber.Name.ToThaiNumber(),
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
AppointDate = p.RecruitDate == null ? "" : p.RecruitDate.Value.ToThaiShortDate2().ToThaiNumber()
AppointDate = p.PositionDate == null ? "" : p.PositionDate.Value.ToThaiShortDate2().ToThaiNumber(),
LeaveDate = p.Profile.LeaveDate == null ? "" : p.Profile.LeaveDate.Value.ToThaiShortDate2().ToThaiNumber(),
MilitaryDate = p.MilitaryDate == null ? "" : p.MilitaryDate.Value.ToThaiShortDate2().ToThaiNumber(),
Reason = p.Reason == null ? "-" : p.Reason,
})
.ToList();
@ -683,6 +696,7 @@ namespace BMA.EHR.Application.Repositories.Commands
orderby r.Sequence
select new CommandType03Response
{
Education = p.EducationOld == null ? "-" : p.EducationOld,
Seq = r.Sequence.ToString().ToThaiNumber(),
CitizenId = r.CitizenId,
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
@ -698,7 +712,8 @@ namespace BMA.EHR.Application.Repositories.Commands
NewPositionType = p.PositionType == null ? "" : p.PositionType.Name,
NewPositionNumber = p.PositionNumber == null ? "" : p.PositionNumber.Name.ToThaiNumber(),
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
AppointDate = p.RecruitDate == null ? "" : p.RecruitDate.Value.ToThaiShortDate2().ToThaiNumber()
AppointDate = p.RecruitDate == null ? "" : p.RecruitDate.Value.ToThaiShortDate2().ToThaiNumber(),
Reason = p.Reason == null ? "-" : p.Reason,
})
.ToList();

View file

@ -202,7 +202,7 @@ namespace BMA.EHR.Application.Repositories.Commands
Prefix = item.Prefix!.Name,
FirstName = item.Firstname!,
LastName = item.Lastname!,
RefPlacementProfileId = item.Id
RefPlacementProfileId = item.Id,
};
seq++;
result.Add(receiver);
@ -267,7 +267,7 @@ namespace BMA.EHR.Application.Repositories.Commands
Prefix = item.Prefix!.Name,
FirstName = item.Firstname!,
LastName = item.Lastname!,
RefPlacementProfileId = item.Id
RefPlacementProfileId = item.Id,
};
seq++;
@ -333,7 +333,7 @@ namespace BMA.EHR.Application.Repositories.Commands
Prefix = item.Prefix!.Name,
FirstName = item.Firstname!,
LastName = item.Lastname!,
RefPlacementProfileId = item.Id
RefPlacementProfileId = item.Id,
};
seq++;
@ -398,7 +398,7 @@ namespace BMA.EHR.Application.Repositories.Commands
Prefix = item.Prefix!.Name,
FirstName = item.Firstname!,
LastName = item.Lastname!,
RefPlacementProfileId = item.Id
RefPlacementProfileId = item.Id,
};
seq++;
@ -459,7 +459,8 @@ namespace BMA.EHR.Application.Repositories.Commands
Prefix = item.Prefix!.Name,
FirstName = item.Firstname!,
LastName = item.Lastname!,
RefPlacementProfileId = item.Id
RefPlacementProfileId = item.Id,
Amount = item.AmountOld,
};
seq++;
@ -519,7 +520,8 @@ namespace BMA.EHR.Application.Repositories.Commands
Prefix = item.Prefix!.Name,
FirstName = item.Firstname!,
LastName = item.Lastname!,
RefPlacementProfileId = item.Id
RefPlacementProfileId = item.Id,
Amount = item.AmountOld,
};
seq++;
@ -579,7 +581,8 @@ namespace BMA.EHR.Application.Repositories.Commands
Prefix = item.Prefix!.Name,
FirstName = item.Firstname!,
LastName = item.Lastname!,
RefPlacementProfileId = item.Id
RefPlacementProfileId = item.Id,
Amount = item.AmountOld,
};
seq++;
@ -639,7 +642,8 @@ namespace BMA.EHR.Application.Repositories.Commands
Prefix = item.Prefix!.Name,
FirstName = item.Firstname!,
LastName = item.Lastname!,
RefPlacementProfileId = item.Id
RefPlacementProfileId = item.Id,
Amount = item.AmountOld,
};
seq++;
@ -699,7 +703,8 @@ namespace BMA.EHR.Application.Repositories.Commands
Prefix = item.Prefix!.Name,
FirstName = item.Firstname!,
LastName = item.Lastname!,
RefPlacementProfileId = item.Id
RefPlacementProfileId = item.Id,
Amount = item.AmountOld,
};
seq++;
@ -751,7 +756,7 @@ namespace BMA.EHR.Application.Repositories.Commands
Prefix = p1.prefix!,
FirstName = p1.firstName!,
LastName = p1.lastName!,
RefPlacementProfileId = p1.profileId
RefPlacementProfileId = p1.profileId,
};
seq++;
result.Add(receiver);
@ -780,7 +785,7 @@ namespace BMA.EHR.Application.Repositories.Commands
Prefix = p2.prefix!,
FirstName = p2.firstName!,
LastName = p2.lastName!,
RefPlacementProfileId = p2.profileId
RefPlacementProfileId = p2.profileId,
};
seq++;
result.Add(receiver);
@ -809,7 +814,7 @@ namespace BMA.EHR.Application.Repositories.Commands
Prefix = p3.prefix!,
FirstName = p3.firstName!,
LastName = p3.lastName!,
RefPlacementProfileId = p3.profileId
RefPlacementProfileId = p3.profileId,
};
seq++;
result.Add(receiver);
@ -862,7 +867,7 @@ namespace BMA.EHR.Application.Repositories.Commands
Prefix = pf.Prefix!.Name,
FirstName = pf.FirstName!,
LastName = pf.LastName!,
RefPlacementProfileId = pf.Id
RefPlacementProfileId = pf.Id,
};
seq++;
@ -920,7 +925,7 @@ namespace BMA.EHR.Application.Repositories.Commands
Prefix = pf.Prefix!.Name,
FirstName = pf.FirstName!,
LastName = pf.LastName!,
RefPlacementProfileId = pf.Id
RefPlacementProfileId = pf.Id,
};
seq++;
@ -979,7 +984,8 @@ namespace BMA.EHR.Application.Repositories.Commands
Prefix = item.Profile!.Prefix!.Name,
FirstName = item.Profile!.FirstName!,
LastName = item.Profile!.LastName!,
RefPlacementProfileId = item.Id
RefPlacementProfileId = item.Id,
Amount = item.AmountOld,
};
seq++;
@ -1037,7 +1043,8 @@ namespace BMA.EHR.Application.Repositories.Commands
Prefix = item.Prefix!.Name,
FirstName = item.Firstname!,
LastName = item.Lastname!,
RefPlacementProfileId = item.Id
RefPlacementProfileId = item.Id,
Amount = item.AmountOld,
};
seq++;
@ -1094,7 +1101,8 @@ namespace BMA.EHR.Application.Repositories.Commands
Prefix = item.Profile!.Prefix!.Name,
FirstName = item.Profile!.FirstName!,
LastName = item.Profile!.LastName!,
RefPlacementProfileId = item.Id
RefPlacementProfileId = item.Id,
Amount = item.AmountOld,
};
seq++;
@ -1151,7 +1159,8 @@ namespace BMA.EHR.Application.Repositories.Commands
Prefix = item.Profile!.Prefix!.Name,
FirstName = item.Profile!.FirstName!,
LastName = item.Profile!.LastName!,
RefPlacementProfileId = item.Id
RefPlacementProfileId = item.Id,
Amount = item.AmountOld,
};
seq++;
@ -1208,7 +1217,8 @@ namespace BMA.EHR.Application.Repositories.Commands
Prefix = item.Profile!.Prefix!.Name,
FirstName = item.Profile!.FirstName!,
LastName = item.Profile!.LastName!,
RefPlacementProfileId = item.Id
RefPlacementProfileId = item.Id,
Amount = item.AmountOld,
};
seq++;
@ -1265,7 +1275,8 @@ namespace BMA.EHR.Application.Repositories.Commands
Prefix = item.Profile!.Prefix!.Name,
FirstName = item.Profile!.FirstName!,
LastName = item.Profile!.LastName!,
RefPlacementProfileId = item.Id
RefPlacementProfileId = item.Id,
Amount = item.AmountOld,
};
seq++;
@ -1322,7 +1333,8 @@ namespace BMA.EHR.Application.Repositories.Commands
Prefix = item.Profile!.Prefix!.Name,
FirstName = item.Profile!.FirstName!,
LastName = item.Profile!.LastName!,
RefPlacementProfileId = item.Id
RefPlacementProfileId = item.Id,
Amount = item.AmountOld,
};
seq++;
@ -1379,7 +1391,8 @@ namespace BMA.EHR.Application.Repositories.Commands
Prefix = item.Profile!.Prefix!.Name,
FirstName = item.Profile!.FirstName!,
LastName = item.Profile!.LastName!,
RefPlacementProfileId = item.Id
RefPlacementProfileId = item.Id,
Amount = item.AmountOld,
};
seq++;
@ -1436,7 +1449,7 @@ namespace BMA.EHR.Application.Repositories.Commands
Prefix = item.Profile!.Prefix!.Name,
FirstName = item.Profile!.FirstName!,
LastName = item.Profile!.LastName!,
RefPlacementProfileId = item.Id
RefPlacementProfileId = item.Id,
};
seq++;
@ -6644,21 +6657,18 @@ namespace BMA.EHR.Application.Repositories.Commands
double? PositionSalaryAmount = 0;
double? MonthSalaryAmount = 0;
if (profile != null && profile.Salaries.Count() > 0)
if (profile != null && profile.Salaries != null && profile.Salaries.Count() > 0)
{
SalaryAmount = cmdReceiver.Amount == null ? profile.Salaries == null ? 0 :
profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount != null ? profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value : 0 : 0;
PositionSalaryAmount = cmdReceiver.PositionSalaryAmount == null ? profile.Salaries == null ? 0 :
profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().PositionSalaryAmount != null ? profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().PositionSalaryAmount.Value : 0 : 0;
MonthSalaryAmount = cmdReceiver.MouthSalaryAmount == null ? profile.Salaries == null ? 0 :
profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().MouthSalaryAmount != null ? profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().MouthSalaryAmount.Value : 0 : 0;
SalaryAmount = profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount != null ? profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value : 0;
PositionSalaryAmount = profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().PositionSalaryAmount != null ? profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().PositionSalaryAmount.Value : 0;
MonthSalaryAmount = profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().MouthSalaryAmount != null ? profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().MouthSalaryAmount.Value : 0;
}
return new PlacementSalaryResponse
{
SalaryAmount = cmdReceiver.Amount != null ? cmdReceiver.Amount.Value : SalaryAmount ?? 0,
PositionSalaryAmount = cmdReceiver.PositionSalaryAmount != null ? cmdReceiver.PositionSalaryAmount.Value : PositionSalaryAmount ?? 0,
MonthSalaryAmount = cmdReceiver.MouthSalaryAmount != null ? cmdReceiver.MouthSalaryAmount.Value : MonthSalaryAmount ?? 0,
SalaryAmount = cmdReceiver.Amount != null && cmdReceiver.Amount != 0 ? cmdReceiver.Amount.Value : SalaryAmount ?? 0,
PositionSalaryAmount = cmdReceiver.PositionSalaryAmount != null && cmdReceiver.PositionSalaryAmount != 0 ? cmdReceiver.PositionSalaryAmount.Value : PositionSalaryAmount ?? 0,
MonthSalaryAmount = cmdReceiver.MouthSalaryAmount != null && cmdReceiver.MouthSalaryAmount != 0 ? cmdReceiver.MouthSalaryAmount.Value : MonthSalaryAmount ?? 0,
};
}
catch
@ -6685,16 +6695,16 @@ namespace BMA.EHR.Application.Repositories.Commands
Double MonthSalaryAmount = 0;
if (profile != null && profile.Salaries.Count() > 0)
{
SalaryAmount = placementProfile.Amount == null ? profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value : 0;
PositionSalaryAmount = placementProfile.PositionSalaryAmount == null ? profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().PositionSalaryAmount.Value : 0;
MonthSalaryAmount = placementProfile.MouthSalaryAmount == null ? profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().MouthSalaryAmount.Value : 0;
SalaryAmount = placementProfile.Amount == null || placementProfile.Amount == 0 ? profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value : 0;
PositionSalaryAmount = placementProfile.PositionSalaryAmount == null || placementProfile.PositionSalaryAmount == 0 ? profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().PositionSalaryAmount.Value : 0;
MonthSalaryAmount = placementProfile.MouthSalaryAmount == null || placementProfile.MouthSalaryAmount == 0 ? profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().MouthSalaryAmount.Value : 0;
}
return new PlacementSalaryResponse
{
SalaryAmount = placementProfile.Amount != null ? placementProfile.Amount.Value : SalaryAmount,
PositionSalaryAmount = placementProfile.PositionSalaryAmount != null ? placementProfile.PositionSalaryAmount.Value : PositionSalaryAmount,
MonthSalaryAmount = placementProfile.MouthSalaryAmount != null ? placementProfile.MouthSalaryAmount.Value : MonthSalaryAmount,
SalaryAmount = placementProfile.Amount != null && placementProfile.Amount != 0 ? placementProfile.Amount.Value : SalaryAmount,
PositionSalaryAmount = placementProfile.PositionSalaryAmount != null && placementProfile.PositionSalaryAmount != 0 ? placementProfile.PositionSalaryAmount.Value : PositionSalaryAmount,
MonthSalaryAmount = placementProfile.MouthSalaryAmount != null && placementProfile.MouthSalaryAmount != 0 ? placementProfile.MouthSalaryAmount.Value : MonthSalaryAmount,
};
}

View file

@ -36,6 +36,9 @@ namespace BMA.EHR.Application.Responses.Reports
public string AppointDate { get; set; } = string.Empty;
public string Education { get; set;} = string.Empty;
public string Education { get; set; } = string.Empty;
public string? Reason { get; set; } = string.Empty;
public string? LeaveDate { get; set; } = string.Empty;
public string? MilitaryDate { get; set; } = string.Empty;
}
}

View file

@ -82,6 +82,8 @@ namespace BMA.EHR.Domain.Models.Retirement
public CommandType? CommandType { get; set; }
[Comment("ดำรงตำแหน่งในระดับปัจจุบันเมื่อ")]
public DateTime? PositionDate { get; set; }
[Comment("วันที่พ้นจากราชการทหาร")]
public DateTime? MilitaryDate { get; set; }
public virtual List<RetirementOtherDoc> RetirementOtherDocs { get; set; } = new List<RetirementOtherDoc>();
}
}

View file

@ -0,0 +1,30 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class updatetableRetirementOtheraddMilitaryDate : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<DateTime>(
name: "MilitaryDate",
table: "RetirementOthers",
type: "datetime(6)",
nullable: true,
comment: "วันที่พ้นจากราชการทหาร");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "MilitaryDate",
table: "RetirementOthers");
}
}
}

View file

@ -13230,6 +13230,10 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("longtext")
.HasComment("นามสกุล");
b.Property<DateTime?>("MilitaryDate")
.HasColumnType("datetime(6)")
.HasComment("วันที่พ้นจากราชการทหาร");
b.Property<string>("Nationality")
.HasMaxLength(100)
.HasColumnType("varchar(100)")

View file

@ -262,7 +262,7 @@ namespace BMA.EHR.Placement.Service.Controllers
Relationship = await _context.Relationships.FindAsync(profile.RelationshipId),
TelephoneNumber = profile.TelephoneNumber,
EducationOld = profile.Educations.Count() == 0 ? null : $"{profile.Educations.OrderByDescending(x => x.FinishDate).FirstOrDefault().Degree}-{profile.Educations.OrderByDescending(x => x.FinishDate).FirstOrDefault().Field}",
AmountOld = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().PositionSalaryAmount,
AmountOld = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
PositionLevelOld = profile.PositionLevel == null ? null : profile.PositionLevel.Name,
PositionTypeOld = profile.PositionType == null ? null : profile.PositionType.Name,
PositionNumberOld = profile.PosNo == null ? null : profile.PosNo.Name,

View file

@ -192,7 +192,7 @@ namespace BMA.EHR.Placement.Service.Controllers
Organization = Request.Form.ContainsKey("Organization") ? Request.Form["Organization"] : "",
Reason = Request.Form.ContainsKey("Reason") ? Request.Form["Reason"] : "",
// Date = req.Date,
AmountOld = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().PositionSalaryAmount,
AmountOld = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
PositionLevelOld = profile.PositionLevel == null ? null : profile.PositionLevel.Name,
PositionTypeOld = profile.PositionType == null ? null : profile.PositionType.Name,
PositionNumberOld = profile.PosNo == null ? null : profile.PosNo.Name,

View file

@ -265,7 +265,7 @@ namespace BMA.EHR.Placement.Service.Controllers
if (profile != null)
{
placementReceive.EducationOld = profile.Educations.Count() == 0 ? null : $"{profile.Educations.OrderByDescending(x => x.FinishDate).FirstOrDefault().Degree}-{profile.Educations.OrderByDescending(x => x.FinishDate).FirstOrDefault().Field}";
placementReceive.AmountOld = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().PositionSalaryAmount;
placementReceive.AmountOld = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount;
placementReceive.PositionLevelOld = profile.PositionLevel == null ? null : profile.PositionLevel.Name;
placementReceive.PositionTypeOld = profile.PositionType == null ? null : profile.PositionType.Name;
placementReceive.PositionNumberOld = profile.PosNo == null ? null : profile.PosNo.Name;

View file

@ -256,7 +256,7 @@ namespace BMA.EHR.Placement.Service.Controllers
Relationship = await _context.Relationships.FindAsync(profile.RelationshipId),
TelephoneNumber = profile.TelephoneNumber,
EducationOld = profile.Educations.Count() == 0 ? null : $"{profile.Educations.OrderByDescending(x => x.FinishDate).FirstOrDefault().Degree}-{profile.Educations.OrderByDescending(x => x.FinishDate).FirstOrDefault().Field}",
AmountOld = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().PositionSalaryAmount,
AmountOld = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
PositionLevelOld = profile.PositionLevel == null ? null : profile.PositionLevel.Name,
PositionTypeOld = profile.PositionType == null ? null : profile.PositionType.Name,
PositionNumberOld = profile.PosNo == null ? null : profile.PosNo.Name,

View file

@ -192,7 +192,7 @@ namespace BMA.EHR.Placement.Service.Controllers
Organization = Request.Form.ContainsKey("Organization") ? Request.Form["Organization"] : "",
Reason = Request.Form.ContainsKey("Reason") ? Request.Form["Reason"] : "",
// Date = req.Date,
AmountOld = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().PositionSalaryAmount,
AmountOld = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
PositionLevelOld = profile.PositionLevel == null ? null : profile.PositionLevel.Name,
PositionTypeOld = profile.PositionType == null ? null : profile.PositionType.Name,
PositionNumberOld = profile.PosNo == null ? null : profile.PosNo.Name,

View file

@ -189,7 +189,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
Organization = Request.Form.ContainsKey("Organization") ? Request.Form["Organization"] : "",
Reason = Request.Form.ContainsKey("Reason") ? Request.Form["Reason"] : "",
// Date = req.Date,
AmountOld = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().PositionSalaryAmount,
AmountOld = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
PositionLevelOld = profile.PositionLevel == null ? null : profile.PositionLevel.Name,
PositionTypeOld = profile.PositionType == null ? null : profile.PositionType.Name,
PositionNumberOld = profile.PosNo == null ? null : profile.PosNo.Name,

View file

@ -189,7 +189,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
Organization = Request.Form.ContainsKey("Organization") ? Request.Form["Organization"] : "",
Reason = Request.Form.ContainsKey("Reason") ? Request.Form["Reason"] : "",
// Date = req.Date,
AmountOld = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().PositionSalaryAmount,
AmountOld = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
PositionLevelOld = profile.PositionLevel == null ? null : profile.PositionLevel.Name,
PositionTypeOld = profile.PositionType == null ? null : profile.PositionType.Name,
PositionNumberOld = profile.PosNo == null ? null : profile.PosNo.Name,

View file

@ -94,6 +94,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
p.IsActive,
p.PositionDate,
p.Reason,
p.MilitaryDate,
p.EducationOld,
p.AmountOld,
p.PositionTypeOld,
@ -153,6 +154,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
OrganizationPositionId = p.OrganizationPosition == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.OrganizationPosition.Id,
p.CreatedAt,
p.Reason,
p.MilitaryDate,
p.EducationOld,
p.AmountOld,
p.PositionTypeOld,
@ -207,6 +209,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
data.OrganizationPositionId,
data.CreatedAt,
data.Reason,
data.MilitaryDate,
data.EducationOld,
data.AmountOld,
data.PositionTypeOld,
@ -262,7 +265,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
Relationship = await _context.Relationships.FindAsync(profile.RelationshipId),
TelephoneNumber = profile.TelephoneNumber,
EducationOld = profile.Educations.Count() == 0 ? null : $"{profile.Educations.OrderByDescending(x => x.FinishDate).FirstOrDefault().Degree}-{profile.Educations.OrderByDescending(x => x.FinishDate).FirstOrDefault().Field}",
AmountOld = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().PositionSalaryAmount,
AmountOld = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
PositionLevelOld = profile.PositionLevel == null ? null : profile.PositionLevel.Name,
PositionTypeOld = profile.PositionType == null ? null : profile.PositionType.Name,
PositionNumberOld = profile.PosNo == null ? null : profile.PosNo.Name,
@ -460,6 +463,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
uppdated.TelephoneNumber = req.TelephoneNumber;
uppdated.EducationOld = req.EducationOld;
uppdated.Reason = req.Reason;
uppdated.MilitaryDate = req.MilitaryDate;
uppdated.OrganizationPositionOld = req.OrganizationPositionOld;
uppdated.PositionTypeOld = req.PositionTypeOld;
uppdated.PositionLevelOld = req.PositionLevelOld;

View file

@ -189,7 +189,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
Organization = Request.Form.ContainsKey("Organization") ? Request.Form["Organization"] : "",
Reason = Request.Form.ContainsKey("Reason") ? Request.Form["Reason"] : "",
// Date = req.Date,
AmountOld = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().PositionSalaryAmount,
AmountOld = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
PositionLevelOld = profile.PositionLevel == null ? null : profile.PositionLevel.Name,
PositionTypeOld = profile.PositionType == null ? null : profile.PositionType.Name,
PositionNumberOld = profile.PosNo == null ? null : profile.PosNo.Name,

View file

@ -310,7 +310,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
SendDate = req.SendDate,
ActiveDate = req.ActiveDate,
Reason = req.Reason,
AmountOld = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().PositionSalaryAmount,
AmountOld = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
PositionLevelOld = profile.PositionLevel == null ? null : profile.PositionLevel.Name,
PositionTypeOld = profile.PositionType == null ? null : profile.PositionType.Name,
PositionNumberOld = profile.PosNo == null ? null : profile.PosNo.Name,

View file

@ -26,5 +26,6 @@ namespace BMA.EHR.Retirement.Service.Requests
public double? Amount { get; set; }
public double? AmountOld { get; set; }
public DateTime? PositionDate { get; set; }
public DateTime? MilitaryDate { get; set; }
}
}