MH: Bugfix für Mittelpunkt, bevor es Serie wird
This commit is contained in:
@@ -1,17 +1,20 @@
|
||||
using System;
|
||||
using BeWo.Data.Access;
|
||||
using BeWo.Data.Entities;
|
||||
using BeWo.Report;
|
||||
using BeWo.Report.DefaultReports;
|
||||
using BeWo.Report.ReportObjects;
|
||||
using BeWo.Service.DCEntityMapper;
|
||||
using BeWo.Service.ServiceImplementations;
|
||||
using BS.Shared.Core;
|
||||
using BS.Shared.DataContracts;
|
||||
using BS.Shared.Extensions;
|
||||
using DevExpress.XtraReports.UI;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using BeWo.Data.Access;
|
||||
using BeWo.Data.Entities;
|
||||
using BeWo.Report;
|
||||
using BeWo.Report.DefaultReports;
|
||||
using BeWo.Report.ReportObjects;
|
||||
using BS.Shared.Core;
|
||||
using BS.Shared.Extensions;
|
||||
using DevExpress.XtraReports.UI;
|
||||
|
||||
namespace Mittelpunkt
|
||||
{
|
||||
@@ -475,5 +478,78 @@ namespace Mittelpunkt
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public override XtraReport CreateRosterReportIst(long wOid, DateTime dt)
|
||||
{
|
||||
var opertionsService = new OperationsServiceImp();
|
||||
var customerService = new CustomerServiceImp();
|
||||
var employeeService = new EmployeeServiceImp();
|
||||
|
||||
var report = FindReportImp<RosterIstRO>();
|
||||
|
||||
var dienstEintraege = opertionsService.GetAllDienstEintraegeAsList(wOid, dt.Year, dt.Month);
|
||||
var vertretungen = opertionsService.GetAllDienstvertretungenAsList(wOid, dt.Year, dt.Month);
|
||||
|
||||
List<long> employeeOids = new List<long>();
|
||||
foreach (var eintrag in dienstEintraege)
|
||||
{
|
||||
if (!employeeOids.Contains(eintrag.EmployeeOid))
|
||||
employeeOids.Add(eintrag.EmployeeOid);
|
||||
}
|
||||
foreach (var vertretung in vertretungen)
|
||||
{
|
||||
if (!employeeOids.Contains(vertretung.EmployeeOid))
|
||||
employeeOids.Add(vertretung.EmployeeOid);
|
||||
}
|
||||
|
||||
List<EmployeeDC> employee = new List<EmployeeDC>();
|
||||
foreach (var oid in employeeOids)
|
||||
employee.Add(MapperFactory.EmployeeDC_Employee.MapToNewDC(DAOFactory.GenericDAO.GetByID<Employee>(oid)));
|
||||
|
||||
List<AbsenceTimeDC> absences = employeeService.GetMultipleEmployeeAbsenceTimesForMonth(dt.Year, dt.Month, employeeOids);
|
||||
List<FeiertagDC> feiertageDCs = opertionsService.ErstelleDefaultFeiertage(dt.Year).Where(f => f.Datum.Month == dt.Month).ToList();
|
||||
|
||||
Dictionary<long?, decimal> stundenBeiAbwesenheit = new Dictionary<long?, decimal>();
|
||||
foreach (var emp in employee) // Irgendwo hier drin Fehler
|
||||
{
|
||||
ContractDC currentContract = null;
|
||||
foreach (var c in emp.Contracts)
|
||||
{
|
||||
if (!c.ContractEndDate.HasValue)
|
||||
{
|
||||
if (dt >= c.EntryDate)
|
||||
{
|
||||
currentContract = c;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dt >= c.EntryDate && dt <= c.ContractEndDate)
|
||||
{
|
||||
currentContract = c;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (currentContract != null)
|
||||
{
|
||||
if ((currentContract.WeeklyTotalHours == null && currentContract.MonthlyTotalHours == null) || currentContract.WeeklyDays == null)
|
||||
continue;
|
||||
else
|
||||
{
|
||||
if (currentContract.WeeklyTotalHours != null)
|
||||
stundenBeiAbwesenheit.Add(emp.EmployeeOid, currentContract.WeeklyTotalHours.Value / currentContract.WeeklyDays);
|
||||
else if (currentContract.MonthlyTotalHours != null)
|
||||
stundenBeiAbwesenheit.Add(emp.EmployeeOid, currentContract.MonthlyTotalHours.Value / DateTime.DaysInMonth(dt.Year, dt.Month));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
report.SetReportDataSource(RosterIstRO.Create(dienstEintraege, vertretungen, employee, opertionsService.GetAllDienste(wOid),
|
||||
customerService.GetAllActiveWohnheimeCompact().First(x => x.WohnheimOid == wOid), dt.Year, dt.Month, feiertageDCs, absences, stundenBeiAbwesenheit));
|
||||
|
||||
return report as XtraReport;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user