bug Amo Fixed Part 1502
This commit is contained in:
@@ -46,25 +46,16 @@ public class AdminMonthlyOverviewRepository : RepositoryBase<long, AdminMonthlyO
|
||||
|
||||
// دریافت طرف حساب های معتبر برای تاریخ مورد نظر
|
||||
var contractingPartyIds = _companyContext.InstitutionContractSet.AsNoTracking()
|
||||
.Where(c => c.ContractStartGr <= targetDate && c.ContractEndGr >= targetDate )
|
||||
.Where(c => c.ContractStartGr <= targetDate && c.ContractEndGr >= targetDate)
|
||||
.Select(c => c.ContractingPartyId);
|
||||
|
||||
// دریافت کارگاههای مرتبط با اکانت
|
||||
List<long> workshopAccounts;
|
||||
if (accountId is 2 or 3)
|
||||
{
|
||||
workshopAccounts = _companyContext.WorkshopAccounts
|
||||
|
||||
var workshopAccounts = _companyContext.WorkshopAccounts
|
||||
.AsNoTracking()
|
||||
.Where(w => w.AccountId == accountId)
|
||||
.Select(w => w.WorkshopId).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
workshopAccounts = _accountContext.AccountLeftWorks
|
||||
.AsNoTracking()
|
||||
.Where(w => w.AccountId == accountId && w.StartWorkGr <= targetDate && w.LeftWorkGr > targetDate)
|
||||
.Select(w => w.WorkshopId).ToList();
|
||||
}
|
||||
|
||||
|
||||
|
||||
var workshopsHasLeftWorkEmployees = _companyContext.LeftWorkList.Where(x =>
|
||||
@@ -155,6 +146,23 @@ public class AdminMonthlyOverviewRepository : RepositoryBase<long, AdminMonthlyO
|
||||
|
||||
var adminMonthlyOverviewsList = await adminMonthlyOverviewsQuery.ToListAsync();
|
||||
|
||||
var now = DateTime.Today;
|
||||
//پرسنل ادمین اجرایی
|
||||
var operatorAdminAccounts = _accountContext.AccountLeftWorks
|
||||
.Where(x => workshopIds.Contains(x.WorkshopId) && x.StartWorkGr <= now && x.LeftWorkGr >= now &&
|
||||
x.RoleId == 5).Select(x => new { x.WorkshopId, x.AccountId })
|
||||
.Join(_accountContext.Accounts,
|
||||
x =>x.AccountId,
|
||||
account=>account.id,(x, account) => new
|
||||
{
|
||||
x.WorkshopId,
|
||||
account.Fullname
|
||||
}).ToList();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var adminMonthlyOverviewList = adminMonthlyOverviewsList.Select(x =>
|
||||
{
|
||||
@@ -163,6 +171,8 @@ public class AdminMonthlyOverviewRepository : RepositoryBase<long, AdminMonthlyO
|
||||
var workshopWithContractingParty =
|
||||
workshopsWithContractingParty.FirstOrDefault(w => w.Workshop.id == x.WorkshopId);
|
||||
|
||||
var operatorAccount = operatorAdminAccounts.FirstOrDefault(o => o.WorkshopId == x.WorkshopId);
|
||||
|
||||
var workshop = workshopWithContractingParty?.Workshop;
|
||||
var contractingParty = workshopWithContractingParty?.ContractingParty;
|
||||
var employer = workshop?.WorkshopEmployers.FirstOrDefault()?.Employer;
|
||||
@@ -179,7 +189,7 @@ public class AdminMonthlyOverviewRepository : RepositoryBase<long, AdminMonthlyO
|
||||
Province = workshop?.State ?? "",
|
||||
EmployerName = employer?.FullName ?? "",
|
||||
EmployerPhoneNumber = employer?.Phone ?? "",
|
||||
AdminFullName = adminAccount.Fullname,
|
||||
AdminFullName = operatorAccount?.Fullname??"",
|
||||
CheckoutEmployeeCount = employeeCheckoutCount?.EmployeeCounts ?? 0,
|
||||
ContractEmployeeCount = employeeContractCount?.EmployeeCounts ?? 0,
|
||||
AgentPhoneNumber = "",
|
||||
|
||||
@@ -106,7 +106,7 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.MonthlyOverview
|
||||
public async Task<IActionResult> OnGetAccountSelectList()
|
||||
{
|
||||
var res = await _accountApplication.GetAdminSelectList();
|
||||
res = res.Where(x => x.RoleId == 5).ToList();
|
||||
//res = res.Where(x => x.RoleId == 5).ToList();
|
||||
return new JsonResult(new
|
||||
{
|
||||
data = res
|
||||
|
||||
Reference in New Issue
Block a user