ตำนวนและบันทึกเงินเดือน คำสั่ง
This commit is contained in:
parent
684a0200b3
commit
ae488fcfdb
2 changed files with 19 additions and 18 deletions
|
|
@ -6189,15 +6189,14 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
case "C-PM-01":
|
||||
case "C-PM-02":
|
||||
case "C-PM-03":
|
||||
case "c-PM-04":
|
||||
case "C-PM-04":
|
||||
salary = await GetPlacementSalaryAsync(item.RefPlacementProfileId.Value);
|
||||
break;
|
||||
default:
|
||||
salary = await GetCommandReceiverSalary(item.RefPlacementProfileId.Value);
|
||||
salary = await GetCommandReceiverSalary(item.RefPlacementProfileId.Value, item.Amount, item.MouthSalaryAmount, item.PositionSalaryAmount);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
var receiver = new CommandReceiver
|
||||
{
|
||||
Sequence = seq,
|
||||
|
|
@ -6769,27 +6768,29 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
|
||||
#region " Placement "
|
||||
|
||||
public async Task<PlacementSalaryResponse> GetCommandReceiverSalary(Guid recordId)
|
||||
public async Task<PlacementSalaryResponse> GetCommandReceiverSalary(Guid recordId, Double? _Amount, Double? _MouthSalaryAmount, Double? _PositionSalaryAmount)
|
||||
{
|
||||
try
|
||||
{
|
||||
var cmdReceiver = await _dbContext.Set<CommandReceiver>()
|
||||
.FirstOrDefaultAsync(x => x.Id == recordId);
|
||||
|
||||
double SalaryAmount = 0;
|
||||
double PositionSalaryAmount = 0;
|
||||
double MonthSalaryAmount = 0;
|
||||
|
||||
if (cmdReceiver == null)
|
||||
{
|
||||
return new PlacementSalaryResponse
|
||||
{
|
||||
SalaryAmount = 0,
|
||||
PositionSalaryAmount = 0,
|
||||
MonthSalaryAmount = 0
|
||||
SalaryAmount = _Amount == null ? 0 : _Amount.Value,
|
||||
PositionSalaryAmount = _MouthSalaryAmount == null ? 0 : _MouthSalaryAmount.Value,
|
||||
MonthSalaryAmount = _PositionSalaryAmount == null ? 0 : _PositionSalaryAmount.Value,
|
||||
};
|
||||
}
|
||||
var profile = await _dbContext.Set<Profile>()
|
||||
.Include(x => x.Salaries)
|
||||
.FirstOrDefaultAsync(p => p.CitizenId == cmdReceiver.CitizenId);
|
||||
double? SalaryAmount = 0;
|
||||
double? PositionSalaryAmount = 0;
|
||||
double? MonthSalaryAmount = 0;
|
||||
|
||||
if (profile != null && profile.Salaries != null && profile.Salaries.Count() > 0)
|
||||
{
|
||||
SalaryAmount = profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount != null ? profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value : 0;
|
||||
|
|
@ -6799,9 +6800,9 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
|
||||
return new PlacementSalaryResponse
|
||||
{
|
||||
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,
|
||||
SalaryAmount = cmdReceiver.Amount != null && cmdReceiver.Amount != 0 ? cmdReceiver.Amount.Value : SalaryAmount,
|
||||
PositionSalaryAmount = cmdReceiver.PositionSalaryAmount != null && cmdReceiver.PositionSalaryAmount != 0 ? cmdReceiver.PositionSalaryAmount.Value : PositionSalaryAmount,
|
||||
MonthSalaryAmount = cmdReceiver.MouthSalaryAmount != null && cmdReceiver.MouthSalaryAmount != 0 ? cmdReceiver.MouthSalaryAmount.Value : MonthSalaryAmount,
|
||||
};
|
||||
}
|
||||
catch
|
||||
|
|
|
|||
|
|
@ -2929,7 +2929,7 @@ namespace BMA.EHR.Command.Service.Controllers
|
|||
{
|
||||
foreach (var r in receivers)
|
||||
{
|
||||
var salary = await _repository.GetCommandReceiverSalary(r.PersonalId);
|
||||
var salary = await _repository.GetCommandReceiverSalary(r.PersonalId, r.SalaryAmount, r.MonthSalaryAmount, r.PositionSalaryAmount);
|
||||
r.SalaryAmount = salary.SalaryAmount;
|
||||
r.PositionSalaryAmount = salary.PositionSalaryAmount;
|
||||
r.MonthSalaryAmount = salary.MonthSalaryAmount;
|
||||
|
|
@ -3001,7 +3001,7 @@ namespace BMA.EHR.Command.Service.Controllers
|
|||
{
|
||||
foreach (var r in receivers)
|
||||
{
|
||||
var salary = await _repository.GetCommandReceiverSalary(r.PersonalId);
|
||||
var salary = await _repository.GetCommandReceiverSalary(r.PersonalId, r.SalaryAmount, r.MonthSalaryAmount, r.PositionSalaryAmount);
|
||||
r.SalaryAmount = salary.SalaryAmount;
|
||||
r.PositionSalaryAmount = salary.PositionSalaryAmount;
|
||||
r.MonthSalaryAmount = salary.MonthSalaryAmount;
|
||||
|
|
@ -3345,7 +3345,7 @@ namespace BMA.EHR.Command.Service.Controllers
|
|||
|
||||
var payload_str = JsonConvert.SerializeObject(payload);
|
||||
|
||||
return Success(payload_str);
|
||||
return Success(payload_str);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
|
@ -3579,7 +3579,7 @@ namespace BMA.EHR.Command.Service.Controllers
|
|||
data = await _repository.GetPlacementSalaryAsync(record!.RefPlacementProfileId!.Value);
|
||||
break;
|
||||
default:
|
||||
data = await _repository.GetCommandReceiverSalary(personalId);
|
||||
data = await _repository.GetCommandReceiverSalary(personalId, record.Amount, record.MouthSalaryAmount, record.PositionSalaryAmount);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue