Ужс
This commit is contained in:
parent
37f7893c03
commit
e3edb20bb8
@ -1,4 +1,5 @@
|
|||||||
|
|
||||||
|
using Accounting_Time_It_Company.Entities;
|
||||||
using Accounting_Time_It_Company.Repositories;
|
using Accounting_Time_It_Company.Repositories;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
@ -29,10 +30,9 @@ internal class TableReport
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
new ExcelBuilder(filePath)
|
new ExcelBuilder(filePath)
|
||||||
.AddHeader("Сводка по движению корма", 0, 4)
|
.AddHeader("Сводка по работе сотрудников", 0, 4)
|
||||||
.AddParagraph("за период", 0)
|
.AddParagraph("за период", 0)
|
||||||
.AddTable([10, 10, 15, 15], GetData(feedId, startDate,
|
.AddTable([10, 10, 15, 15], GetData(feedId, startDate, endDate)).Build();
|
||||||
endDate)).Build();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -42,42 +42,42 @@ internal class TableReport
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<string[]> GetData(int feedId, DateTime startDate, DateTime endDate)
|
private List<string[]> GetData(int employeeId, DateTime startDate, DateTime endDate)
|
||||||
{
|
{
|
||||||
var data = _feedReplenishmentRepository
|
var data = _typeJobRepositories
|
||||||
.ReadFeedReplenishment()
|
.ReadTypeJobs()
|
||||||
.Where(x => x.DateReceipt >= startDate && x.DateReceipt <=
|
.Where(x => x.Date >= startDate && x.Date <= endDate
|
||||||
endDate && x.FeedFeedReplenishments.Any(y => y.FeedId == feedId))
|
&& (x.WorkTimesDevelop.Any(y => y.EmployeeId == employeeId)
|
||||||
|
|| x.WorkTimesManager.Any(y => y.EmployeeId == employeeId)))
|
||||||
.Select(x => new {
|
.Select(x => new {
|
||||||
x.EmployeeId,
|
x.ProductId,
|
||||||
Date = x.DateReceipt,
|
x.Date,
|
||||||
CountIn
|
CountInManager = x.WorkTimesManager.FirstOrDefault(y => y.EmployeeId == employeeId)?.Hours,
|
||||||
= x.FeedFeedReplenishments.FirstOrDefault(y => y.FeedId == feedId)?.Count,
|
CountOutManager = (int?)null,
|
||||||
CountOut = (int?)null
|
CountInDevelop = x.WorkTimesDevelop.FirstOrDefault(y => y.EmployeeId == employeeId)?.Hours,
|
||||||
|
CountOutDevelop = (int?)null
|
||||||
})
|
})
|
||||||
.Union(
|
.Union(_vacationRepositories
|
||||||
_feedingAnimalRepository
|
.ReadVacations()
|
||||||
.ReadFeedingAnimals()
|
.Where(x => x.StartDate >= startDate
|
||||||
.Where(x => x.FeedingDate >= startDate &&
|
&& x.StartDate <= endDate
|
||||||
x.FeedingDate <= endDate && x.FeedId == feedId)
|
&& x.EmployeeId == employeeId)
|
||||||
.Select(x => new {
|
.Select(x => new {
|
||||||
x.EmployeeId,
|
x.EmployeeId,
|
||||||
Date =
|
Date = x.StartDate,
|
||||||
x.FeedingDate,
|
|
||||||
CountIn = (int?)null,
|
CountIn = (int?)null,
|
||||||
CountOut = (int?)x.Ration
|
CountOut = (int?)x.Ration
|
||||||
}))
|
}))
|
||||||
.OrderBy(x => x.Date);
|
.OrderBy(x => x.Date);
|
||||||
|
|
||||||
return
|
return
|
||||||
new List<string[]>() { item }
|
new List<string[]>() { item }
|
||||||
.Union(
|
.Union(data.Select(x => new string[] {
|
||||||
data
|
x.EmployeeId.ToString(), x.Date.ToString(), x.CountIn?.ToString() ??
|
||||||
.Select(x => new string[] {
|
string.Empty, x.CountOut?.ToString() ?? string.Empty}))
|
||||||
x.EmployeeId.ToString(), x.Date.ToString(), x.CountIn?.ToString() ??
|
|
||||||
string.Empty, x.CountOut?.ToString() ?? string.Empty}))
|
|
||||||
.Union(
|
.Union(
|
||||||
[["Всего", "", data.Sum(x => x.CountIn ?? 0).ToString(),
|
[["Всего", "", data.Sum(x => x.CountIn ?? 0).ToString(),
|
||||||
data.Sum(x => x.CountOut ?? 0).ToString()]])
|
data.Sum(x => x.CountOut ?? 0).ToString()]])
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user