Merge branch 'develop' into working
This commit is contained in:
commit
5f49f0fc98
2 changed files with 66 additions and 2 deletions
|
|
@ -3,6 +3,7 @@ using BMA.EHR.Application.Responses;
|
||||||
using BMA.EHR.Domain.Extensions;
|
using BMA.EHR.Domain.Extensions;
|
||||||
using BMA.EHR.Domain.Models.HR;
|
using BMA.EHR.Domain.Models.HR;
|
||||||
using BMA.EHR.Domain.Models.Insignias;
|
using BMA.EHR.Domain.Models.Insignias;
|
||||||
|
using BMA.EHR.Domain.Models.MetaData;
|
||||||
using BMA.EHR.Domain.Models.Organizations;
|
using BMA.EHR.Domain.Models.Organizations;
|
||||||
using BMA.EHR.Domain.Models.Retirement;
|
using BMA.EHR.Domain.Models.Retirement;
|
||||||
using BMA.EHR.Domain.Shared;
|
using BMA.EHR.Domain.Shared;
|
||||||
|
|
@ -78,6 +79,27 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<dynamic> GetProfileInsignia(Guid id)
|
||||||
|
{
|
||||||
|
var profile = (from r in await _dbContext.Set<Profile>()
|
||||||
|
.Include(x => x.Prefix)
|
||||||
|
.Include(x => x.Position)
|
||||||
|
.ToListAsync()
|
||||||
|
where r.Id == id
|
||||||
|
select new
|
||||||
|
{
|
||||||
|
FullName = $"{r.Prefix?.Name}{r.FirstName} {r.LastName}",
|
||||||
|
Position = r.Position == null ? "-" : r.Position.Name,
|
||||||
|
OCName = r.OcId == null ? "-" : _organizationCommonRepository.GetOrganizationNameFullPath(r.OcId.Value, false, false),
|
||||||
|
BirthDate = r.BirthDate.ToThaiFullDate().ToString().ToThaiNumber(),
|
||||||
|
})
|
||||||
|
.FirstOrDefault();
|
||||||
|
if (profile == null)
|
||||||
|
throw new Exception(GlobalMessages.DataNotFound);
|
||||||
|
|
||||||
|
return profile;
|
||||||
|
}
|
||||||
|
|
||||||
//39-แบบ ขร1 บัญชีแสดงจำนวนชั้นตราเครื่องราชฯ ข้าราชการ ชั้นสายสะพาย
|
//39-แบบ ขร1 บัญชีแสดงจำนวนชั้นตราเครื่องราชฯ ข้าราชการ ชั้นสายสะพาย
|
||||||
public async Task<dynamic> GetKhr1Report(Guid id)
|
public async Task<dynamic> GetKhr1Report(Guid id)
|
||||||
{
|
{
|
||||||
|
|
@ -268,9 +290,9 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
ProfileId = r.Profile.Id,
|
ProfileId = r.Profile.Id,
|
||||||
FullName = $"{r.Profile.Prefix?.Name}{r.Profile.FirstName} {r.Profile.LastName}",
|
FullName = $"{r.Profile.Prefix?.Name}{r.Profile.FirstName} {r.Profile.LastName}",
|
||||||
ShowProfileId = r.Profile.Id,
|
ShowProfileId = r.Profile.Id,
|
||||||
Type = r.Profile.PositionType?.Name,
|
Type = r.Profile.PositionType == null ? "-" : r.Profile.PositionType.Name,
|
||||||
AcademicStanding = "",
|
AcademicStanding = "",
|
||||||
Level = r.Profile.PositionLevel?.Name,
|
Level = r.Profile.PositionLevel == null ? "-" : r.Profile.PositionLevel.Name,
|
||||||
DateStart = r.Profile.DateStart == null ? null : r.Profile.DateStart.Value.ToThaiShortDate(),
|
DateStart = r.Profile.DateStart == null ? null : r.Profile.DateStart.Value.ToThaiShortDate(),
|
||||||
SalaryAmount = r.Profile.Salaries.Count() == 0 ? 0 :
|
SalaryAmount = r.Profile.Salaries.Count() == 0 ? 0 :
|
||||||
r.Profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
|
r.Profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
|
||||||
|
|
@ -430,6 +452,44 @@ namespace BMA.EHR.Application.Repositories.Reports
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//46-ประวัติสำหรับการเสนอขอพระราชทานเหรียญจักรพรรดิมาลา
|
||||||
|
public async Task<dynamic> GetHistorySalaryReport(Guid id)
|
||||||
|
{
|
||||||
|
var profile = await _dbContext.Set<Profile>()
|
||||||
|
.FirstOrDefaultAsync(x => x.Id == id);
|
||||||
|
if (profile == null)
|
||||||
|
throw new Exception(GlobalMessages.DataNotFound);
|
||||||
|
var positions = await _dbContext.Set<PositionPath>()
|
||||||
|
.ToListAsync();
|
||||||
|
var organizations = await _dbContext.Set<OrganizationEntity>()
|
||||||
|
.Include(x => x.Parent)
|
||||||
|
.ThenInclude(x => x.OrganizationOrganization)
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
var data = (from r in await _dbContext.Set<ProfileSalary>()
|
||||||
|
.Include(x => x.Profile)
|
||||||
|
.ToListAsync()
|
||||||
|
join p in positions on r.PositionId equals p.Id into pGroup
|
||||||
|
from p in pGroup.DefaultIfEmpty()
|
||||||
|
join o in organizations on r.OcId equals o.Id into oGroup
|
||||||
|
from o in oGroup.DefaultIfEmpty()
|
||||||
|
where r.Profile == profile
|
||||||
|
select new
|
||||||
|
{
|
||||||
|
DateTh = r.Date == null ? "-" : r.Date.Value.ToThaiShortDate().ToString().ToThaiNumber(),
|
||||||
|
Position = p.Name,
|
||||||
|
OCName = o.Parent == null ? "-" : (o.Parent.OrganizationOrganization == null ? "-" : o.Parent.OrganizationOrganization.Name),
|
||||||
|
Age = r.Date == null ? "-" : r.Date.Value.CalculateBetweenDateV2(DateTime.Now).ToThaiNumber(),
|
||||||
|
Amount = r.Amount == null ? null : r.Amount.Value.ToNumericText().ToThaiNumber(),
|
||||||
|
Date = r.Date,
|
||||||
|
})
|
||||||
|
.Distinct()
|
||||||
|
.OrderBy(x => x.Date)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,10 @@ namespace BMA.EHR.Domain.Extensions
|
||||||
{
|
{
|
||||||
return number.ToString("#,##0.00");
|
return number.ToString("#,##0.00");
|
||||||
}
|
}
|
||||||
|
public static string ToNumericNoDecimalText(this double number)
|
||||||
|
{
|
||||||
|
return number.ToString("#,##");
|
||||||
|
}
|
||||||
|
|
||||||
public static string ToReadText(this double value)
|
public static string ToReadText(this double value)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue