MH: VKM Hamm AbsenceReport Sortierung nach Personalnummer

This commit is contained in:
2025-10-31 07:37:38 +01:00
parent c1bb9fd5d6
commit c9e47f4a4e
5 changed files with 1469 additions and 0 deletions

1179
ReportImp/VkmHamm/AbsenceReport.Designer.cs generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,108 @@
using System;
using System.Drawing;
using System.Globalization;
using DevExpress.XtraReports.UI;
using BeWo.Report.ReportObjects;
using System.Collections.Generic;
using BeWo.Report;
namespace VkmHamm
{
public partial class AbsenceReport : XtraReport, IBeWoReport<AbsenceRO>
{
public int Month { get; set; }
public int Year { get; set; }
public List<int> Feiertage { get; set; }
public AbsenceReport()
{
InitializeComponent();
}
public void SetReportDataSource(AbsenceRO pRO)
{
int i = DateTime.DaysInMonth(pRO.ReportFilter.Year, pRO.ReportFilter.Month);
Month = pRO.ReportFilter.Month;
Year = pRO.ReportFilter.Year;
Feiertage = pRO.Feiertage;
cellHeader29.Visible = cellDetail29.Visible = i >= 29;
cellHeader30.Visible = cellDetail30.Visible = i >= 30;
cellHeader31.Visible = cellDetail31.Visible = i >= 31;
SetWeekDayNames(pRO.ReportFilter.Year, pRO.ReportFilter.Month, i);
string date = SetDate(pRO);
if (pRO.Teams != null)
{
if(pRO.Teams.Count > 0)
{
date += " (";
for (int z = 0; z < pRO.Teams.Count; z++)
{
var t = pRO.Teams[z];
date += t.Name;
if (t.TeamOid != pRO.Teams[pRO.Teams.Count - 1].TeamOid)
date += ", ";
}
date += ") ";
}
}
lblReportInformation.Text = date;
bindingSource1.DataSource = pRO;
}
private void SetWeekDayNames(int year, int month, int numberOfDays)
{
for (int i = 1; i <= numberOfDays; i++)
{
DateTime date = new DateTime(year, month, i);
CultureInfo c = new CultureInfo("de-DE");
string weekday = c.DateTimeFormat.GetAbbreviatedDayName(date.DayOfWeek);
cellHeader1.Row.Cells[i].Text += "\n" + weekday;
}
}
private string SetDate(AbsenceRO pRO)
{
string date = "";
DateTimeFormatInfo dti = CultureInfo.GetCultureInfo("de-DE").DateTimeFormat;
date += dti.GetMonthName(pRO.ReportFilter.Month).ToString() + " " + pRO.ReportFilter.Year;
return date;
}
private void Cell_EvaluateBinding(object sender, BindingEventArgs e)
{
var cell = sender as XRTableCell;
var sv = e.Value as CellValue;
if (sv != null && !string.IsNullOrEmpty(sv.Color))
{
int argb = Int32.Parse(sv.Color.Replace("#", ""), NumberStyles.HexNumber);
Color clr = Color.FromArgb(argb);
cell.BackColor = clr;
}
else
{
cell.BackColor = Color.Transparent;
if(cell.Index <= DateTime.DaysInMonth(Year, Month))
{
DateTime date = new DateTime(Year, Month, cell.Index);
if (date.DayOfWeek == DayOfWeek.Sunday || date.DayOfWeek == DayOfWeek.Saturday)
cell.BackColor = Color.LightGray;
if (Feiertage != null)
{
if (Feiertage.Contains(date.Day))
cell.BackColor = Color.LightPink;
}
}
}
}
}
}

View File

@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="bindingSource1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@@ -9,9 +9,11 @@ using BeWo.Data.Entities;
using BeWo.Report;
using BeWo.Report.ReportObjects;
using BeWo.Service.DCEntityMapper;
using BeWo.Service.ServiceImplementations;
using BS.Shared;
using BS.Shared.Core;
using BS.Shared.DataContracts;
using BS.Shared.DataContracts.Compact;
using DevExpress.XtraReports.UI;
namespace VkmHamm
@@ -60,6 +62,53 @@ namespace VkmHamm
return report as XtraReport;
}
public override XtraReport CreateAbsenceReport(DateTime dt, List<long> abs, List<long> empTypes, List<long> teams, List<int> feiertage)
{
var report = FindReportImp<AbsenceRO>();
var service = new OperationsServiceImp();
var filter = new AbsenceOverviewFilterDC() { AbsenceReasons = abs, EmploymentType = empTypes, Year = dt.Year, Month = dt.Month, Teams = teams };
List<CompactTeamDC> compactTeams = new List<CompactTeamDC>();
if (teams != null)
{
if (teams.Count > 0)
compactTeams = service.GetCertainTeamsById(teams);
}
// Anpassung - Ordnen nach Personalnummer statt Name
Dictionary<int, EmployeeDC> personalnummer2employee = new Dictionary<int, EmployeeDC>();
List<EmployeeDC> empsOhnePersonalnummer = new List<EmployeeDC>();
var employees = service.GetAbsenceOverview(filter).OrderBy(e => e.PersonnelNumber).ToList();
foreach (var e in employees)
{
int personalnummer = 0;
if (int.TryParse(e.PersonnelNumber, out personalnummer))
{
personalnummer = Convert.ToInt32(e.PersonnelNumber);
if (personalnummer2employee.ContainsKey(personalnummer))
empsOhnePersonalnummer.Add(e);
else
personalnummer2employee.Add(personalnummer, e);
}
else
empsOhnePersonalnummer.Add(e);
}
personalnummer2employee = personalnummer2employee.OrderBy(x => x.Key).ToDictionary(x => x.Key, x => x.Value);
empsOhnePersonalnummer = empsOhnePersonalnummer.OrderBy(e => e.LastName).ToList();
employees = new List<EmployeeDC>();
employees.AddRange(personalnummer2employee.Values.ToList());
employees.AddRange(empsOhnePersonalnummer);
report.SetReportDataSource(AbsenceRO.Create(employees, filter, compactTeams, feiertage));
// Anpassung Ende
return report as XtraReport;
}
}
}

View File

@@ -68,6 +68,12 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AbsenceReport.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="AbsenceReport.Designer.cs">
<DependentUpon>AbsenceReport.cs</DependentUpon>
</Compile>
<Compile Include="CustomerMitarbeiterstundenkontoBerechnung.cs" />
<Compile Include="Calculation\CustomGroupDurationCalculator.cs" />
<Compile Include="CustomMitarbeiterstundenkontoBerechnungMonate.cs" />
@@ -199,6 +205,10 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="AbsenceReport.resx">
<DependentUpon>AbsenceReport.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Finanzauswertung.resx">
<DependentUpon>Finanzauswertung.cs</DependentUpon>
<SubType>Designer</SubType>