Neuer Bericht ServiceRecordChangesAfterInvoiceDateReport, der alle Änderungen nach Erstellung von Rechnungen auflistet.

Bugfix für Zeiterfassung Edit View.
Anpassungen für diverse Kunden (HPH Bersenbrück, Diakonie KK Kleve, PariSozial, Bewegt)
This commit is contained in:
Christian
2024-05-13 17:56:09 +02:00
parent 486e11c7ab
commit 8a6b7bfbf1
50 changed files with 6611 additions and 2567 deletions

View File

@@ -15,42 +15,70 @@ using DevExpress.XtraReports.UI;
namespace HphBersenbrueck
{
public class CustomReportCreator : DefaultReportCreator
public class CustomReportCreator : DefaultReportCreator
{
public override XtraReport CreateQueryReport(long queryOid, string 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 (queryOid == 4000)
{
var ro = base.CreateQueryRO(queryOid, queryReportId);
DateTime start = DateTime.MaxValue;
DateTime end = DateTime.MinValue;
if (lROs.Count > 0)
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))
{
var rootReport = CreateServicesOverviewReportForRo(lROs[0]);
rootReport.CreateDocument();
for (int i = 1; i < lROs.Count; i++)
if (dt2.Year < 9000)
{
var lNext = CreateServicesOverviewReportForRo(lROs[i]);
lNext.CreateDocument();
rootReport.Pages.AddRange(lNext.Pages);
end = dt2.AddDays(-1);
}
return rootReport;
}
return new XtraReport();
}
return CreateServiceRecordChangesReport(start, end);
}
return base.CreateQueryReport(queryOid, queryReportId);
}
public override XtraReport CreateServiceOverviewSingleCustomerReport(long customerOid, int month, int year, long orgaOid, long empOid, long? serviceCategoryOid, int startDay, int endDay)
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 ro = ServicesOverviewRO.Create(customerOid, month, year, false, orgaOid, empOid, startDay, endDay, serviceCategoryOid);
var rootReport = CreateServicesOverviewReportForRo(lROs[0]);
rootReport.CreateDocument();
return CreateServicesOverviewReportForRo(ro);
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 neu = false;
bool neuQA = false;
bool neuKA = false;
@@ -58,9 +86,13 @@ namespace HphBersenbrueck
{
foreach (ServicesOverviewRO.ServiceDetail s in ro.Services)
{
if (s.ServiceCategory.Contains("Neu Qualifizierte Assistenz"))
if (s.ServiceCategory.ToLower().StartsWith("neu qualifiziert"))
{
neu = true;
neuQA = true;
}
if (s.ServiceCategory.ToLower().StartsWith("neu kompensatorisch"))
{
neuKA = true;
}
//}
}
@@ -68,9 +100,13 @@ namespace HphBersenbrueck
}
IBeWoReport<ServicesOverviewRO> qb;
if (neu)
if (neuQA)
{
qb = new BeWo.HPHBersenbrueck.QuittierungsbelegHannover();
qb = new BeWo.HPHBersenbrueck.LeistungsnachweisQualifizierteAssistenz();
}
else if (neuKA)
{
qb = new BeWo.HPHBersenbrueck.LeistungsnachweisKompensatorischeAssistenz();
}
else
{
@@ -82,7 +118,7 @@ namespace HphBersenbrueck
return qb as XtraReport;
}
}
}

View File

@@ -94,6 +94,12 @@
<Compile Include="Abrechnungsbogen.designer.cs">
<DependentUpon>Abrechnungsbogen.cs</DependentUpon>
</Compile>
<Compile Include="LeistungsnachweisKompensatorischeAssistenz.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="LeistungsnachweisKompensatorischeAssistenz.Designer.cs">
<DependentUpon>LeistungsnachweisKompensatorischeAssistenz.cs</DependentUpon>
</Compile>
<Compile Include="Mitarbeiterauslastung.cs">
<SubType>Component</SubType>
</Compile>
@@ -101,11 +107,11 @@
<DependentUpon>Mitarbeiterauslastung.cs</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="QuittierungsbelegHannover.cs">
<Compile Include="LeistungsnachweisQualifizierteAssistenz.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="QuittierungsbelegHannover.Designer.cs">
<DependentUpon>QuittierungsbelegHannover.cs</DependentUpon>
<Compile Include="LeistungsnachweisQualifizierteAssistenz.Designer.cs">
<DependentUpon>LeistungsnachweisQualifizierteAssistenz.cs</DependentUpon>
</Compile>
<Compile Include="RechnungSelbstzahler.cs">
<SubType>Component</SubType>
@@ -152,12 +158,16 @@
<EmbeddedResource Include="Abrechnungsbogen.resx">
<DependentUpon>Abrechnungsbogen.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="LeistungsnachweisKompensatorischeAssistenz.resx">
<DependentUpon>LeistungsnachweisKompensatorischeAssistenz.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Mitarbeiterauslastung.resx">
<DependentUpon>Mitarbeiterauslastung.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\licenses.licx" />
<EmbeddedResource Include="QuittierungsbelegHannover.resx">
<DependentUpon>QuittierungsbelegHannover.cs</DependentUpon>
<EmbeddedResource Include="LeistungsnachweisQualifizierteAssistenz.resx">
<DependentUpon>LeistungsnachweisQualifizierteAssistenz.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="RechnungSelbstzahler.resx">

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,271 @@
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 BeWo.HPHBersenbrueck
{
public partial class LeistungsnachweisKompensatorischeAssistenz : XtraReport, IBeWoReport<ServicesOverviewRO>
{
public LeistungsnachweisKompensatorischeAssistenz()
{
InitializeComponent();
}
public void SetReportDataSource(ServicesOverviewRO pRO)
{
// Get calling method name
//StackTrace stackTrace = new StackTrace();
//Debug.WriteLine(stackTrace.GetFrame(1).GetMethod().Name);
bool hatGruppen = false;
double minuten = 0;
CostRatePeriod currentFLSUnit = null;
if (pRO.CostBearer2SupportConceptList != null && pRO.CostBearer2SupportConceptList.Count > 0)
{
var cr = pRO.CostBearer2SupportConceptList[0].CostBearer.CostRatePeriods.Where(p => p.CostRateType == CostRatePeriodType.MinutesPerServiceUnit).OrderBy(c => c.EndDate).ToList();
currentFLSUnit = cr.FirstOrDefault(c => c.EndDate >= pRO.EndDate);
if (currentFLSUnit == null)
currentFLSUnit = cr[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");
if (sd.IsBillable && !sd.ServiceCategory.Contains("Fahrt"))
{
sd.FLSQualified = sd.Minutes / 50;
minuten += sd.Minutes;
ServicesOverviewRO.CreateSignatureString(sd);
if (sd.IsGroup)
{
//sd.Notice5 = String.Format("{0} Teilnehmer", sd.CustomerCount);
hatGruppen = true;
sd.Notice3 = "1";
}
else
sd.Notice3 = "";
// 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("ausfallstunde"))
{
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);
//if (pRO.CostBearer2SupportConceptList != null && pRO.CostBearer2SupportConceptList.Count > 0)
//{
// var c2s = pRO.CostBearer2SupportConceptList[0];
// var dc = MapperFactory.SupportConceptCostBearerRelDC_CostBearer2SupportConcept.MapToNewDC(c2s);
// foreach (var scap in dc.ApprovalPeriodList)
// {
// if (scap.ApprovedBEPerInterval.HasValue && scap.ApprovedBEInterval.HasValue && scap.ServiceCategory != null && scap.ServiceCategory.Name == pRO.Services[0].ServiceCategory)
// {
// lblBewilligtFls.Text = String.Format("{0:0.00}", scap.ApprovedBEPerInterval.Value);
// if (scap.ApprovedBEInterval.HasValue && scap.ApprovedBEInterval.Value == SupportConceptApprovalInterval.Weekly)
// pRO.ApprovedFLSTotal = Convert.ToDecimal(((scap.EndDate.Value - scap.StartDate.Value).TotalDays + 1) / 7) * scap.ApprovedBEPerInterval.Value;
// else if (scap.ApprovedBEInterval.HasValue && scap.ApprovedBEInterval.Value == SupportConceptApprovalInterval.Monthly)
// pRO.ApprovedFLSTotal = Convert.ToDecimal(((scap.EndDate.Value - scap.StartDate.Value).TotalDays + 1) / 30.44) * scap.ApprovedBEPerInterval.Value;
// }
// }
//}
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

@@ -1,7 +1,7 @@
using BeWo.Report.ReportObjects;
namespace BeWo.HPHBersenbrueck
{
partial class QuittierungsbelegHannover
partial class LeistungsnachweisQualifizierteAssistenz
{
/// <summary>
/// Required designer variable.

View File

@@ -18,9 +18,9 @@ using DevExpress.XtraReports.UI;
namespace BeWo.HPHBersenbrueck
{
public partial class QuittierungsbelegHannover : XtraReport, IBeWoReport<ServicesOverviewRO>
public partial class LeistungsnachweisQualifizierteAssistenz : XtraReport, IBeWoReport<ServicesOverviewRO>
{
public QuittierungsbelegHannover()
public LeistungsnachweisQualifizierteAssistenz()
{
InitializeComponent();
}

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>