2023-02-08 19:02:19 +01:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Data;
|
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using BeWo.Data;
|
|
|
|
|
|
using BeWo.Data.Access;
|
|
|
|
|
|
using BeWo.Data.Entities;
|
|
|
|
|
|
using BeWo.Report;
|
|
|
|
|
|
using BeWo.Report.ReportObjects;
|
|
|
|
|
|
using BeWo.Service.DCEntityMapper;
|
|
|
|
|
|
using BS.Shared.Core;
|
|
|
|
|
|
using BS.Shared.DataContracts;
|
|
|
|
|
|
using DevExpress.XtraReports.UI;
|
|
|
|
|
|
|
|
|
|
|
|
namespace BeWoDarmstadt
|
|
|
|
|
|
{
|
2026-05-15 13:55:38 +02:00
|
|
|
|
public class CustomReportCreator : DefaultReportCreator
|
|
|
|
|
|
{
|
|
|
|
|
|
public override XtraReport CreateQueryReport(long queryOid, string queryReportId)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (queryOid == 100 || queryOid == 101)
|
|
|
|
|
|
{
|
|
|
|
|
|
return CreateZeitzuschlagsbeleg(queryOid, queryReportId);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (queryOid == 110)
|
|
|
|
|
|
{
|
|
|
|
|
|
return CreateTeamuebersichtByCategory(queryOid, queryReportId, "qualifiziert");
|
|
|
|
|
|
}
|
|
|
|
|
|
if (queryOid == 111)
|
|
|
|
|
|
{
|
|
|
|
|
|
return CreateTeamuebersichtByCategory(queryOid, queryReportId, "kompensatorisch");
|
|
|
|
|
|
}
|
|
|
|
|
|
return base.CreateQueryReport(queryOid, queryReportId);
|
2023-02-08 19:02:19 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-15 13:55:38 +02:00
|
|
|
|
private XtraReport CreateZeitzuschlagsbeleg(long queryOid, string queryReportId)
|
|
|
|
|
|
{
|
|
|
|
|
|
var query = DAOFactory.GenericDAO.LoadByID<Query>(queryOid);
|
2023-02-08 19:02:19 +01:00
|
|
|
|
|
2026-05-15 13:55:38 +02:00
|
|
|
|
if (query == null)
|
|
|
|
|
|
return new XtraReport();
|
2023-02-08 19:02:19 +01:00
|
|
|
|
|
2026-05-15 13:55:38 +02:00
|
|
|
|
var path = Path.Combine(TempPath, queryReportId + ".xml");
|
|
|
|
|
|
var table = Utils.XMLDeserialize<DataTable>(path);
|
|
|
|
|
|
var qro = QueryRO.Create(query, table);
|
2023-02-08 19:02:19 +01:00
|
|
|
|
|
2026-05-15 13:55:38 +02:00
|
|
|
|
if (qro.Rows.Count > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
long? employeeOid = BeWo.Data.Security.UserRightHelper.GetLoggedInUser().Employee.Oid;
|
|
|
|
|
|
if (qro.Rows[0].Field2 != null && qro.Rows[0].Field2.ToString() != "0")
|
|
|
|
|
|
employeeOid = Int64.Parse(qro.Rows[0].Field2.ToString());
|
2023-02-08 19:02:19 +01:00
|
|
|
|
|
2026-05-15 13:55:38 +02:00
|
|
|
|
DateTime monat = DateTime.Parse(qro.Rows[0].Field1.ToString());
|
|
|
|
|
|
DateTimeSpan span = new DateTimeSpan();
|
|
|
|
|
|
span.StartDateTime = monat;
|
|
|
|
|
|
span.EndDateTime = monat.AddMonths(1).AddTicks(-1);
|
2023-02-08 19:02:19 +01:00
|
|
|
|
|
2026-05-15 13:55:38 +02:00
|
|
|
|
MitarbeiterstundenkontoRO ro = MitarbeiterstundenkontoRO.Create(employeeOid, null, monat, monat.AddMonths(1), null);
|
2023-02-15 17:33:28 +01:00
|
|
|
|
var msb = new CustomMitarbeiterstundenkontoBerechnung();
|
2026-05-15 13:55:38 +02:00
|
|
|
|
msb.CreateReport(ro);
|
2023-02-08 19:02:19 +01:00
|
|
|
|
|
2026-05-15 13:55:38 +02:00
|
|
|
|
XtraReport allReports = null;
|
2023-02-08 19:02:19 +01:00
|
|
|
|
|
2026-05-15 13:55:38 +02:00
|
|
|
|
foreach (var ed in ro.EmployeeDetailList)
|
|
|
|
|
|
{
|
|
|
|
|
|
ed.StundenGesamtIst += ed.Custom10;
|
2023-02-08 19:02:19 +01:00
|
|
|
|
|
2026-05-15 13:55:38 +02:00
|
|
|
|
Zeitzuschlagsbeleg beleg = new Zeitzuschlagsbeleg();
|
2023-02-08 19:02:19 +01:00
|
|
|
|
|
2026-05-15 13:55:38 +02:00
|
|
|
|
beleg.SetReportDataSource(ro.ReportStartDate, ed);
|
2023-02-08 19:02:19 +01:00
|
|
|
|
|
2026-05-15 13:55:38 +02:00
|
|
|
|
beleg.CreateDocument();
|
|
|
|
|
|
if (allReports == null)
|
|
|
|
|
|
allReports = beleg;
|
|
|
|
|
|
else
|
|
|
|
|
|
allReports.Pages.AddRange(beleg.Pages);
|
|
|
|
|
|
}
|
2023-02-08 19:02:19 +01:00
|
|
|
|
|
2026-05-15 13:55:38 +02:00
|
|
|
|
if (allReports != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
return allReports;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return new XtraReport();
|
2023-02-08 19:02:19 +01:00
|
|
|
|
}
|
2023-04-14 13:44:28 +02:00
|
|
|
|
|
2026-05-15 13:55:38 +02:00
|
|
|
|
private XtraReport CreateTeamuebersichtByCategory(long queryOid, string queryReportId, string leistungskategorie)
|
|
|
|
|
|
{
|
|
|
|
|
|
var query = DAOFactory.GenericDAO.LoadByID<Query>(queryOid);
|
|
|
|
|
|
|
|
|
|
|
|
if (query == null)
|
|
|
|
|
|
return new XtraReport();
|
|
|
|
|
|
|
|
|
|
|
|
var path = Path.Combine(TempPath, queryReportId + ".xml");
|
|
|
|
|
|
var table = Utils.XMLDeserialize<DataTable>(path);
|
|
|
|
|
|
var qro = QueryRO.Create(query, table);
|
|
|
|
|
|
|
|
|
|
|
|
if (qro.Rows.Count > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
DateTime param = DateTime.Parse(qro.Rows[0].Field1.ToString());
|
|
|
|
|
|
DateTime start = new DateTime(param.Year, 1, 1);
|
|
|
|
|
|
DateTime end = param.AddMonths(1).AddDays(-1);
|
|
|
|
|
|
|
|
|
|
|
|
var ro = FinanceRO.Create(start, end, true, false);
|
|
|
|
|
|
ro.SupportConceptFinanceList = ro.SupportConceptFinanceList.Where(sc => sc.Leistungskategorie == null ||
|
|
|
|
|
|
sc.Leistungskategorie.IndexOf(leistungskategorie, StringComparison.OrdinalIgnoreCase) >= 0).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
var druck = new Teamuebersicht();
|
|
|
|
|
|
druck.SetReportDataSource(ro);
|
|
|
|
|
|
return druck;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return new XtraReport();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override XtraReport CreateAuslastungReport(long? employeeOid, IList<long> teamOids, DateTime startDate, DateTime endDate)
|
|
|
|
|
|
{
|
|
|
|
|
|
IBeWoReport<MitarbeiterauslastungRO> report;
|
|
|
|
|
|
MitarbeiterauslastungRO x;
|
|
|
|
|
|
if (teamOids != null && teamOids.Count > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
IList<long> employeeOids = new List<long>();
|
|
|
|
|
|
report = FindReportImp<MitarbeiterauslastungRO>("TeamauslastungNachMitarbeiter");
|
|
|
|
|
|
x = MitarbeiterauslastungRO.Create(employeeOids, teamOids, startDate, endDate, false);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
report = FindReportImp<MitarbeiterauslastungRO>("Mitarbeiterauslastung");
|
|
|
|
|
|
x = MitarbeiterauslastungRO.Create(employeeOid, teamOids, startDate, endDate);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
report.SetReportDataSource(x);
|
|
|
|
|
|
|
|
|
|
|
|
return report as XtraReport;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-02-08 19:02:19 +01:00
|
|
|
|
}
|