บันทึกเงินเดือนของผู้บรรจุ

This commit is contained in:
Suphonchai Phoonsawat 2023-09-02 13:53:56 +07:00
parent 69bd9c0a68
commit bb9a0bc73e
6 changed files with 16338 additions and 6 deletions

View file

@ -1722,6 +1722,8 @@ namespace BMA.EHR.Application.Repositories.Commands
try
{
var receiver = await _dbContext.Set<CommandReceiver>()
.Include(x => x.Command)
.ThenInclude(x => x.CommandType)
.FirstOrDefaultAsync(x => x.Id == personalId);
if (receiver == null)
@ -2116,6 +2118,30 @@ namespace BMA.EHR.Application.Repositories.Commands
#region " Placement "
public async Task<PlacementSalaryResponse> GetCommandReceiverSalary(Guid recordId)
{
try
{
var cmdReceiver = await _dbContext.Set<CommandReceiver>()
.FirstOrDefaultAsync(x => x.Id == recordId);
if (cmdReceiver == null)
throw new Exception($"Invalid command receiver: {recordId}");
return new PlacementSalaryResponse
{
SalaryAmount = cmdReceiver.Amount ?? 0,
PositionSalaryAmount = cmdReceiver.PositionSalaryAmount ?? 0,
MonthSalaryAmount = cmdReceiver.MouthSalaryAmount ?? 0
};
}
catch
{
throw;
}
}
public async Task<PlacementSalaryResponse> GetPlacementSalaryAsync(Guid placementProfileId)
{
try
@ -2140,6 +2166,28 @@ namespace BMA.EHR.Application.Repositories.Commands
}
}
public async Task UpdateCommandReceiverSalaryAsync(Guid personalId, UpdatePlacementSalaryRequest req)
{
try
{
var current = await _dbContext.Set<CommandReceiver>()
.FirstOrDefaultAsync(x => x.Id == personalId);
if (current == null)
throw new Exception(GlobalMessages.DataNotFound);
current.Amount = req.SalaryAmount;
current.PositionSalaryAmount = req.PositionSalaryAmount;
current.MouthSalaryAmount = req.MonthSalaryAmount;
await _dbContext.SaveChangesAsync();
}
catch
{
throw;
}
}
public async Task UpdatePlacementSalaryAsync(Guid personalId, UpdatePlacementSalaryRequest req)
{
try