MH: TeamPfeil Neuer QB
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using BeWo.Report;
|
||||
using BeWo.Report.ReportObjects;
|
||||
using BS.Shared.DataContracts;
|
||||
using DevExpress.XtraReports.UI;
|
||||
|
||||
namespace TeamPfeil
|
||||
@@ -65,12 +66,15 @@ namespace TeamPfeil
|
||||
|
||||
private XtraReport CreateServicesOverviewReportForRo(ServicesOverviewRO ro, long? serviceCategoryOid)
|
||||
{
|
||||
|
||||
|
||||
IBeWoReport<ServicesOverviewRO> report = null;
|
||||
if (!String.IsNullOrEmpty(ro.Costbearer) && ro.Costbearer.Contains("Modellprojekt"))
|
||||
{
|
||||
report = new TeamPfeil.QuittierungsbelegQuali();
|
||||
}
|
||||
|
||||
|
||||
if (report == null)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(ro.Costbearer) && ro.Costbearer.Contains("Schwaben") && ro.StartDate >= new DateTime(2023, 6, 1))
|
||||
@@ -82,6 +86,41 @@ namespace TeamPfeil
|
||||
report = new TeamPfeil.Quittierungsbeleg();
|
||||
}
|
||||
}
|
||||
|
||||
// Wenn in den aktuellen Bewilligungen AUSSCHLIESSLICH welche sind, die als Kategorie "Qualifizierte Assistenz" oder "Unterstützende Assistenz" haben,
|
||||
// wird der Bericht "QuittierungsbelegNeuesModell" aufgerufen
|
||||
List<SupportConceptApprovalPeriodDC> aktuelleBewilligungen = new List<SupportConceptApprovalPeriodDC>();
|
||||
if (ro.CustomerLastName.Contains("Haubner"))
|
||||
{
|
||||
|
||||
}
|
||||
if (ro.SupportConceptCostBearer != null)
|
||||
{
|
||||
foreach (var ap in ro.SupportConceptCostBearer.ApprovalPeriodList)
|
||||
{
|
||||
// Wenn die Bewilligung über den QB-Zeitraum hinausgeht oder währenddessen beginnt / endet, zu aktuelleBewilligungen hinzufügen
|
||||
if (ap.StartDate.HasValue && ap.EndDate.HasValue &&
|
||||
(ap.StartDate.Value <= ro.StartDate && ap.EndDate.Value >= ro.EndDate ||
|
||||
ap.StartDate.Value >= ro.StartDate && ap.StartDate.Value <= ro.EndDate ||
|
||||
ap.EndDate.Value >= ro.StartDate && ap.EndDate.Value <= ro.EndDate))
|
||||
{
|
||||
aktuelleBewilligungen.Add(ap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool neuesModell = true;
|
||||
if (aktuelleBewilligungen.Count > 0)
|
||||
{
|
||||
foreach (var ap in aktuelleBewilligungen)
|
||||
{
|
||||
if (ap.ServiceCategory.Name != "Qualifizierte Assistenz" && ap.ServiceCategory.Name != "Unterstützende Assistenz")
|
||||
neuesModell = false;break;
|
||||
}
|
||||
}
|
||||
if (neuesModell)
|
||||
report = new TeamPfeil.QuittierungsbelegNeuesModell();
|
||||
|
||||
report.SetReportDataSource(ro);
|
||||
|
||||
return report as XtraReport;
|
||||
|
||||
1207
ReportImp/TeamPfeil/QuittierungsbelegNeuesModell.Designer.cs
generated
Normal file
1207
ReportImp/TeamPfeil/QuittierungsbelegNeuesModell.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
263
ReportImp/TeamPfeil/QuittierungsbelegNeuesModell.cs
Normal file
263
ReportImp/TeamPfeil/QuittierungsbelegNeuesModell.cs
Normal file
@@ -0,0 +1,263 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using BeWo.Data.Access;
|
||||
using BeWo.Data.Entities;
|
||||
using BeWo.Report;
|
||||
using BeWo.Report.ReportObjects;
|
||||
using BeWo.Service.Plugins;
|
||||
using BS.Shared;
|
||||
using BS.Shared.Core;
|
||||
using BS.Shared.Services;
|
||||
using DevExpress.XtraReports.UI;
|
||||
|
||||
namespace TeamPfeil
|
||||
{
|
||||
// Im Grunde entspricht dieser Beleg "QuittierungsbelegQualifikation". Allerdings werden hier neue Begrifflichkeiten verwendet und es wird sich auf eine andere
|
||||
// Leistungskategorie bezogen. Dieser hier wird aufgerufen, wenn es zum Zeitpunkt des ReportStartDates keine Bewilligung mehr gibt, die die alten Leistungskategorien
|
||||
// verwenden.
|
||||
public partial class QuittierungsbelegNeuesModell : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<ServicesOverviewRO>
|
||||
{
|
||||
public QuittierungsbelegNeuesModell()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public void SetReportDataSource(ServicesOverviewRO pRO)
|
||||
{
|
||||
bool hatGruppen = false;
|
||||
double qa1Min = 0;
|
||||
double qa2Min = 0;
|
||||
double ua3Min = 0;
|
||||
double ua4Min = 0;
|
||||
double qa1MinKat = 0;
|
||||
double qa2MinKat = 0;
|
||||
double ua3MinKat = 0;
|
||||
double ua4MinKat = 0;
|
||||
|
||||
if (pRO.Services != null)
|
||||
{
|
||||
Dictionary<long, string> empQuali = new Dictionary<long, string>();
|
||||
List<ServicesOverviewRO.ServiceDetail> servicesBillable = new List<ServicesOverviewRO.ServiceDetail>();
|
||||
|
||||
foreach (var sd in pRO.Services)
|
||||
{
|
||||
sd.FLSQualifiedString = "";
|
||||
sd.FLSUnqualifiedString = "";
|
||||
if (sd.IsBillable)
|
||||
{
|
||||
ServicesOverviewRO.CreateGoalList(sd);
|
||||
ServicesOverviewRO.CreateSignatureString(sd);
|
||||
if (sd.IsGroup)
|
||||
{
|
||||
//sd.Notice5 = String.Format("{0} Teilnehmer", sd.CustomerCount);
|
||||
hatGruppen = true;
|
||||
}
|
||||
|
||||
// Summen der geleisteten Stunden nach Qualifikationen der Mitarbeitenden
|
||||
if (!empQuali.ContainsKey(sd.EmployeeOid))
|
||||
{
|
||||
var e = DAOFactory.GenericDAO.LoadByID<Employee>(sd.EmployeeOid);
|
||||
foreach (var valueEntry in e.ValueList)
|
||||
{
|
||||
if (valueEntry.Entry.Type == ValueListEntryType.StaffQualificationsType)
|
||||
{
|
||||
if (valueEntry.Entry.Value.StartsWith("QA 1"))
|
||||
{
|
||||
empQuali[sd.EmployeeOid] = "1";
|
||||
}
|
||||
else if (valueEntry.Entry.Value.StartsWith("QA 2"))
|
||||
{
|
||||
empQuali[sd.EmployeeOid] = "2";
|
||||
}
|
||||
else if (valueEntry.Entry.Value.StartsWith("UA 3"))
|
||||
{
|
||||
empQuali[sd.EmployeeOid] = "3";
|
||||
}
|
||||
else if (valueEntry.Entry.Value.StartsWith("UA 4"))
|
||||
{
|
||||
empQuali[sd.EmployeeOid] = "4";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (empQuali != null && empQuali.ContainsKey(sd.EmployeeOid))
|
||||
{
|
||||
string quali = empQuali[sd.EmployeeOid];
|
||||
|
||||
if (quali == "1")
|
||||
{
|
||||
qa1Min += sd.Minutes;
|
||||
}
|
||||
if (quali == "2")
|
||||
{
|
||||
qa2Min += sd.Minutes;
|
||||
}
|
||||
if (quali == "3")
|
||||
{
|
||||
ua3Min += sd.Minutes;
|
||||
}
|
||||
if (quali == "4")
|
||||
{
|
||||
ua4Min += sd.Minutes;
|
||||
}
|
||||
}
|
||||
|
||||
// Summen der geleisteten Stunden nach Qualifikationen der Leistungen
|
||||
if (sd.ServiceDescription == "QA 1")
|
||||
{
|
||||
qa1MinKat += sd.Minutes;
|
||||
}
|
||||
if (sd.ServiceDescription == "QA 2")
|
||||
{
|
||||
qa2MinKat += sd.Minutes;
|
||||
}
|
||||
if (sd.ServiceDescription == "UA 3")
|
||||
{
|
||||
ua3MinKat += sd.Minutes;
|
||||
}
|
||||
if (sd.ServiceDescription == "UA 4")
|
||||
{
|
||||
ua4MinKat += sd.Minutes;
|
||||
}
|
||||
|
||||
}
|
||||
servicesBillable.Add(sd);
|
||||
}
|
||||
|
||||
pRO.Services = servicesBillable;
|
||||
}
|
||||
|
||||
lblStd1.Text = String.Format("{0:0.00}", qa1Min / 60);
|
||||
lblStd2.Text = String.Format("{0:0.00}", qa2Min / 60);
|
||||
lblStd3.Text = String.Format("{0:0.00}", ua3Min / 60);
|
||||
lblStd4.Text = String.Format("{0:0.00}", ua4Min / 60);
|
||||
lblStd1Kat.Text = String.Format("{0:0.00}", qa1MinKat / 60);
|
||||
lblStd2Kat.Text = String.Format("{0:0.00}", qa2MinKat / 60);
|
||||
lblStd3Kat.Text = String.Format("{0:0.00}", ua3MinKat / 60);
|
||||
lblStd4Kat.Text = String.Format("{0:0.00}", ua4MinKat / 60);
|
||||
lblFlsTotal.Text = string.Format("{0:0.00}", pRO.ApprovedFLSPerWeekTotal);
|
||||
|
||||
var std = BerechneBewilligungenProWoche(pRO);
|
||||
|
||||
lblWeeklyQA.Text = string.Format("{0:0.00}", std.QA);
|
||||
lblWeeklyUA.Text = string.Format("{0:0.00}", std.UA);
|
||||
|
||||
|
||||
pRO.MainAttendant = SetMainAttendantsQuali(pRO.CustomerOid, pRO);
|
||||
|
||||
bindingSource1.DataSource = pRO;
|
||||
}
|
||||
|
||||
private string SetMainAttendantsQuali(long customerOid, ServicesOverviewRO pRO)
|
||||
{
|
||||
var c = DAOFactory.GenericDAO.GetByID<Customer>(customerOid);
|
||||
string MainAttendant = "";
|
||||
foreach (var item in c.Employee2CustomerList)
|
||||
{
|
||||
if (!item.StartDate.HasValue && !item.EndDate.HasValue
|
||||
|| item.StartDate.HasValue && item.StartDate.Value < pRO.EndDate && (!item.EndDate.HasValue || item.EndDate.Value > pRO.StartDate)
|
||||
|| !item.StartDate.HasValue && item.EndDate.HasValue && item.EndDate > pRO.EndDate)
|
||||
{
|
||||
foreach (var valueEntry in item.ValueList)
|
||||
{
|
||||
if (MainAttendant.Length > 0)
|
||||
{
|
||||
MainAttendant += ", ";
|
||||
}
|
||||
MainAttendant += item.Employee.Person.FirstName + " " + item.Employee.Person.LastName;
|
||||
var e = DAOFactory.GenericDAO.LoadByID<Employee>(item.EmployeeOid ?? 0);
|
||||
foreach (var ve in e.ValueList)
|
||||
{
|
||||
if (ve.Entry.Type == ValueListEntryType.StaffQualificationsType)
|
||||
{
|
||||
if (ve.Entry.Value.StartsWith("QA 1"))
|
||||
{
|
||||
MainAttendant += " (QA 1)";
|
||||
}
|
||||
else if (ve.Entry.Value.StartsWith("QA 2"))
|
||||
{
|
||||
MainAttendant += " (QA 2)";
|
||||
}
|
||||
else if (ve.Entry.Value.StartsWith("UA 3"))
|
||||
{
|
||||
MainAttendant += " (UA 3)";
|
||||
}
|
||||
else if (ve.Entry.Value.StartsWith("UA 4"))
|
||||
{
|
||||
MainAttendant += " (UA 4)";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return MainAttendant;
|
||||
}
|
||||
|
||||
private Stunden BerechneBewilligungenProWoche(ServicesOverviewRO pRO)
|
||||
{
|
||||
Stunden std = new Stunden();
|
||||
CostBearer2SupportConcept c2s = DAOFactory.GenericDAO.LoadByID<CostBearer2SupportConcept>(pRO.SupportConceptCostBearer.CostBearer2SupportConceptOid.Value);
|
||||
var calc = PluginLoader.FindClass<Calculations>(c2s.CostBearer.ID) ?? Calculations.GetInstance(c2s.CostBearer.ID);
|
||||
|
||||
foreach (var scap in pRO.SupportConceptCostBearer.ApprovalPeriodList)
|
||||
{
|
||||
if (scap.StartDate <= pRO.EndDate && scap.EndDate >= pRO.StartDate)
|
||||
{
|
||||
var bewilligt = calc.GetApprovedHoursPerWeek(scap, pRO.SupportConceptCostBearer.CostBearer.CostRatePeriods) ?? 0;
|
||||
if (scap.ServiceCategory.Name == "Qualifizierte Assistenz")
|
||||
{
|
||||
std.QA += bewilligt;
|
||||
}
|
||||
else if (scap.ServiceCategory.Name == "Unterstützende Assistenz")
|
||||
{
|
||||
std.UA += bewilligt;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return std;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
public System.Drawing.Image ByteArrayToImage(byte[] byteArrayIn)
|
||||
{
|
||||
System.Drawing.Image returnImage = null;
|
||||
MemoryStream ms = new System.IO.MemoryStream(byteArrayIn);
|
||||
returnImage = System.Drawing.Image.FromStream(ms);
|
||||
|
||||
return returnImage;
|
||||
}
|
||||
|
||||
public class Stunden
|
||||
{
|
||||
|
||||
public decimal QA { get; set; }
|
||||
public decimal UA { get; set; }
|
||||
public override string ToString()
|
||||
{
|
||||
return String.Format("QA: {0:0.00}, UA: {1:0.00}", QA, UA);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
123
ReportImp/TeamPfeil/QuittierungsbelegNeuesModell.resx
Normal file
123
ReportImp/TeamPfeil/QuittierungsbelegNeuesModell.resx
Normal file
File diff suppressed because one or more lines are too long
@@ -82,6 +82,12 @@
|
||||
<Compile Include="Quittierungsbeleg.Designer.cs">
|
||||
<DependentUpon>Quittierungsbeleg.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="QuittierungsbelegNeuesModell.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="QuittierungsbelegNeuesModell.Designer.cs">
|
||||
<DependentUpon>QuittierungsbelegNeuesModell.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="QuittierungsbelegQualifikation.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
@@ -141,6 +147,10 @@
|
||||
<DependentUpon>Quittierungsbeleg.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="QuittierungsbelegNeuesModell.resx">
|
||||
<DependentUpon>QuittierungsbelegNeuesModell.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="QuittierungsbelegQualifikation.resx">
|
||||
<DependentUpon>QuittierungsbelegQualifikation.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
|
||||
Reference in New Issue
Block a user