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