LebenshilfeWolfsburg: LeistungsnachweisQualifizierteAssistenz

under construction
This commit is contained in:
2024-07-02 15:12:03 +02:00
parent 87d9a6920f
commit 07ed483f78
6 changed files with 1983 additions and 109 deletions

View File

@@ -0,0 +1,112 @@
using System;
using System.Collections.Generic;
using BeWo.Report;
using BeWo.Report.ReportObjects;
using DevExpress.XtraReports.UI;
namespace LebenshilfeWolfsburg
{
public class CustomReportCreator : DefaultReportCreator
{
public override XtraReport CreateQueryReport(long queryOid, string queryReportId)
{
if (queryOid == 4000)
{
var ro = base.CreateQueryRO(queryOid, queryReportId);
DateTime start = DateTime.MaxValue;
DateTime end = DateTime.MinValue;
if (DateTime.TryParse(ro.Rows[0].Field1.ToString(), out var dt))
{
if (dt.Year > 1900)
{
start = dt;
}
}
if (DateTime.TryParse(ro.Rows[0].Field2.ToString(), out var dt2))
{
if (dt2.Year < 9000)
{
end = dt2.AddDays(-1);
}
}
return CreateServiceRecordChangesReport(start, end);
}
return base.CreateQueryReport(queryOid, queryReportId);
}
public override XtraReport CreateServiceOverviewAllCustomersReport(int month, int year, long orgaOid, long empOid, long? serviceCategoryOid, int startDay, int endDay)
{
List<ServicesOverviewRO> lROs = ServicesOverviewRO.Create(month, year, orgaOid, empOid, startDay, endDay);
if (lROs.Count > 0)
{
var rootReport = CreateServicesOverviewReportForRo(lROs[0]);
rootReport.CreateDocument();
for (int i = 1; i < lROs.Count; i++)
{
var lNext = CreateServicesOverviewReportForRo(lROs[i]);
lNext.CreateDocument();
rootReport.Pages.AddRange(lNext.Pages);
}
return rootReport;
}
return new XtraReport();
}
public override XtraReport CreateServiceOverviewSingleCustomerReport(long customerOid, int month, int year, long orgaOid, long empOid, long? serviceCategoryOid, int startDay, int endDay)
{
var ro = ServicesOverviewRO.Create(customerOid, month, year, false, orgaOid, empOid, startDay, endDay, serviceCategoryOid);
return CreateServicesOverviewReportForRo(ro);
}
private XtraReport CreateServicesOverviewReportForRo(ServicesOverviewRO ro)
{
bool neuQA = false;
bool neuKA = false;
ServicesOverviewRO qaRo = ServicesOverviewRO.CopyFromRO(ro);
ServicesOverviewRO kaRo = ServicesOverviewRO.CopyFromRO(ro);
ServicesOverviewRO sonstigesRo = ServicesOverviewRO.CopyFromRO(ro);
if (ro.Services != null)
{
foreach (ServicesOverviewRO.ServiceDetail s in ro.Services)
{
if (s.ServiceCategory.ToLower().StartsWith("neu qualifiziert"))
{
neuQA = true;
qaRo.Services.Add(s);
}
else if (s.ServiceCategory.ToLower().StartsWith("neu kompensatorisch"))
{
neuKA = true;
kaRo.Services.Add(s);
}
else
{
sonstigesRo.Services.Add(s);
}
}
}
XtraReport report = null;
report = AddSubServicesOverviewReportToReport(report, new LeistungsnachweisQualifizierteAssistenz(), qaRo);
//report = AddSubServicesOverviewReportToReport(report, new LeistungsnachweisKompensatorischeAssistenz(), kaRo);
//report = AddSubServicesOverviewReportToReport(report, new Stundenzettel(), sonstigesRo);
if (report == null)
report = new XtraReport();
return report;
}
}
}

View File

@@ -55,8 +55,15 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="CustomReportCreator.cs" />
<Compile Include="Export\CustomDataExporter.cs" />
<Compile Include="Export\LohnExporter.cs" />
<Compile Include="LeistungsnachweisQualifizierteAssistenz.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="LeistungsnachweisQualifizierteAssistenz.Designer.cs">
<DependentUpon>LeistungsnachweisQualifizierteAssistenz.cs</DependentUpon>
</Compile>
<Compile Include="Reporting\CustomMitarbeiterstundenkontoBerechnung.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Reporting\CustomReportCreator.cs" />
@@ -93,6 +100,10 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="LeistungsnachweisQualifizierteAssistenz.resx">
<DependentUpon>LeistungsnachweisQualifizierteAssistenz.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Properties\licenses.licx" />
<EmbeddedResource Include="Reporting\Schnittstellendruck.resx">
<DependentUpon>Schnittstellendruck.cs</DependentUpon>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,236 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using BeWo.Data.Entities;
using BeWo.Report;
using BeWo.Report.ReportObjects;
using BeWo.Service.DCEntityMapper;
using BeWo.Service.Plugins;
using BeWo.Service.ServiceImplementations;
using BS.Shared;
using BS.Shared.Core;
using BS.Shared.DataContracts;
using BS.Shared.Services;
using DevExpress.XtraReports.UI;
namespace LebenshilfeWolfsburg
{
public partial class LeistungsnachweisQualifizierteAssistenz : XtraReport, IBeWoReport<ServicesOverviewRO>
{
public LeistungsnachweisQualifizierteAssistenz()
{
InitializeComponent();
}
public void SetReportDataSource(ServicesOverviewRO pRO)
{
double minuten = 0;
if (pRO.Services != null)
{
List<ServicesOverviewRO.ServiceDetail> servicesBillable = new List<ServicesOverviewRO.ServiceDetail>();
int summeWegepauschalen = 0;
int summeAusfallstunden = 0;
foreach (var sd in pRO.Services)
{
sd.IsBillable = sd.ServiceDescription.Contains("50 direkt") || sd.ServiceDescription.Contains("Ausfall");
if (sd.IsBillable && !sd.ServiceCategory.Contains("Fahrt"))
{
sd.FLSQualified = sd.Minutes / 50;
minuten += sd.Minutes;
ServicesOverviewRO.CreateSignatureString(sd);
sd.Notice3 = "";
if (sd.IsGroup)
{
sd.Notice3 = "1";
}
// Felder für Wegepauschale setzen (Wenn FLS FaceToFace, dann ja)
sd.Notice4 = "";
if (!String.IsNullOrWhiteSpace(sd.GefahreneKilometer) && Decimal.TryParse(sd.GefahreneKilometer, out var k))
{
if (k > 0)
{
sd.Notice4 = "1";
summeWegepauschalen++;
}
}
// Felder für Ausfallstundnen setzen
if (sd.ServiceDescription.ToLower().Contains("ausfall"))
{
sd.Notice5 = "1";
summeAusfallstunden++;
}
else
sd.Notice5 = "";
servicesBillable.Add(sd);
}
}
pRO.Services = servicesBillable;
lblSummeWegepauschalen.Text = string.Format("{0:0}", summeWegepauschalen);
lblSummeAusfallstunden.Text = string.Format("{0:0}", summeAusfallstunden);
}
lblBewilligtFls.Text = String.Format("{0:0.00}", pRO.ApprovedFLSPerWeek);
CalculateFLSSollIst(pRO);
pRO.TotalFLMBillable = minuten;
lblRestbudget.Text = String.Format("{0:0.00}", pRO.ApprovedFLSTotal - pRO.MinutenGeleistetBisVormonat);
bindingSource1.DataSource = pRO;
}
public void CalculateFLSSollIst(ServicesOverviewRO pRO)
{
if (pRO.CostBearer2SupportConceptList != null && pRO.CostBearer2SupportConceptList.Count > 0)
{
var c2s = pRO.CostBearer2SupportConceptList[0];
var dc = MapperFactory.SupportConceptCostBearerRelDC_CostBearer2SupportConcept.MapToNewDC(c2s);
var calc = PluginLoader.FindClass<Calculations>(c2s.CostBearer.ID) ?? Calculations.GetInstance(c2s.CostBearer.ID);
var costRatePeriods = MapperFactory.CostRatePeriodDC_CostRatePeriod.MapToNewDCs(c2s.CostBearer.CostRatePeriods);
decimal sollGesamt = 0;
DateTime start = c2s.StartDate ?? pRO.StartDate;
DateTime ende = pRO.StartDate.AddTicks(-1); // Ein Tag vor aktuellem Monat, da ja das Soll der Vergangenheit berechnet werden soll
// Erstelle Soll
while (start < ende)
{
DateTime monatsEnde = new DateTime(start.Year, start.Month, 1).AddMonths(1).AddDays(-1);
foreach (var scap in c2s.ApprovalPeriodList)
{
if (scap.StartDate.HasValue && scap.StartDate <= monatsEnde && scap.EndDate.HasValue && scap.EndDate >= start)
{
var scapdc = MapperFactory.SupportConceptApprovalPeriodDC_SupportConceptApprovalPeriod.MapToNewDC(scap);
decimal soll = calc.GetApprovedHoursForPeriod(scapdc, costRatePeriods, start, monatsEnde) ?? 0;
sollGesamt += Math.Round(soll, 2, MidpointRounding.AwayFromZero);
}
}
start = monatsEnde.AddDays(1);
}
start = c2s.StartDate ?? pRO.StartDate;
//Berechne Ist bis Ende des Vormonats
decimal minutenIst = 0;
IList<ServiceRecord> allServiceRecords = c2s.ServiceRecords;
Dictionary<long, bool> groupBookingDict = new Dictionary<long, bool>();
foreach (var item in allServiceRecords)
{
if (!item.GroupOid.HasValue || !groupBookingDict.ContainsKey(item.GroupOid.Value))
{
if (item.Start != null)
{
if (item.Start >= start && item.Start.Value <= ende)
{
if (item.ServiceDescription.Name.Contains("50 direkt"))
{
minutenIst += item.RoundedDuration;
if (item.GroupOid.HasValue)
groupBookingDict.Add(item.GroupOid.Value, true);
}
}
}
}
}
pRO.MinutenGeleistetBisVormonat = minutenIst / 50;
pRO.MinutenSollBisVormonat = sollGesamt * 60;
}
}
private void picSignature_BeforePrint(object sender, System.ComponentModel.CancelEventArgs e)
{
XRPictureBox xrBox = sender as XRPictureBox;
//var test = this.GetCurrent
string base64String = xrBox.Tag as string;
if (!String.IsNullOrWhiteSpace(base64String))
{
var base64Data = Regex.Match(base64String, @"data:image/(?<type>.+?),(?<data>.+)").Groups["data"].Value;
var binData = Convert.FromBase64String(base64Data);
System.Drawing.Image img = ByteArrayToImage(binData);
xrBox.Image = Utils.CropImage(img);
}
else
{
xrBox.Image = null;
}
}
// TODO: Wie anzeigen? Alle?
private void EmployeeSignature_BeforePrint(object sender, System.ComponentModel.CancelEventArgs e)
{
return;
if (sender is XRPictureBox pictureBox)
{
var base64String = pictureBox.Tag as string;
if (!string.IsNullOrWhiteSpace(base64String))
{
var base64Data = Regex.Match(base64String, @"data:image/(?<type>.+?),(?<data>.+)").Groups["data"].Value;
var binaryData = Convert.FromBase64String(base64Data);
var image = ByteArrayToImage(binaryData);
pictureBox.Image = image;
}
else
{
pictureBox.Image = null;
}
}
}
// TODO: Wie anzeigen? Alle?
// TODO: Visibile der Datumstextboxen auf true setzen!
private void CustomerSignature_BeforePrint(object sender, System.ComponentModel.CancelEventArgs e)
{
return;
if (sender is XRPictureBox pictureBox)
{
var base64String = pictureBox.Tag as string;
if (!string.IsNullOrWhiteSpace(base64String))
{
var base64Data = Regex.Match(base64String, @"data:image/(?<type>.+?),(?<data>.+)").Groups["data"].Value;
var binaryData = Convert.FromBase64String(base64Data);
var image = ByteArrayToImage(binaryData);
pictureBox.Image = image;
}
else
{
pictureBox.Image = null;
}
}
}
public System.Drawing.Image ByteArrayToImage(byte[] byteArrayIn)
{
using (var memoryStream = new MemoryStream(byteArrayIn))
{
return System.Drawing.Image.FromStream(memoryStream);
}
}
}
}

View File

@@ -0,0 +1,120 @@
<?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>
</root>

View File

@@ -0,0 +1 @@
DevExpress.XtraReports.UI.XtraReport, DevExpress.XtraReports.v23.2, Version=23.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a