Dateien hinzugefügt
This commit is contained in:
@@ -4424,5 +4424,15 @@ namespace BeWo.Data.Access
|
||||
|
||||
return criteria.List<SchedulerAppointment>().ToList();
|
||||
}
|
||||
|
||||
public List<SchedulerAppointment> LoadFilteredAllActiveAppointments(long employeeOid, DateTime start, DateTime end)
|
||||
{
|
||||
var allEmployees = DAOFactory.GenericDAO.GetAllActive<Employee>();
|
||||
//var allCustomers = DAOFactory
|
||||
|
||||
//var appointments = LoadFilteredAppointments(true, employeeOid, start, end, )
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
167
ReportImp/BetreuWoReports/FlsAuslastungsauswertung.cs
Normal file
167
ReportImp/BetreuWoReports/FlsAuslastungsauswertung.cs
Normal file
@@ -0,0 +1,167 @@
|
||||
using System;
|
||||
using BeWo.Report;
|
||||
using BeWo.Report.ReportObjects;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BeWo.Data.Access;
|
||||
using BeWo.Data.Entities;
|
||||
using BS.Shared;
|
||||
using BS.Shared.Extensions;
|
||||
using DevExpress.Utils.Extensions;
|
||||
|
||||
namespace BeWo.BetreuWoReports.Alt
|
||||
{
|
||||
public partial class FlsAuslastungsauswertung : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<QueryRO>
|
||||
{
|
||||
public FlsAuslastungsauswertung()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public void SetReportDataSource(QueryRO pRO)
|
||||
{
|
||||
|
||||
bindingSource1.DataSource = CreateDataSource(pRO);
|
||||
}
|
||||
|
||||
private FlsAuslastungsauswertungRO CreateDataSource(QueryRO ro)
|
||||
{
|
||||
/*
|
||||
* Parameter:
|
||||
* start, end, oid, isTeam, interval
|
||||
* in Field1, Field2, Field3, Field4 etc.
|
||||
* Klient, Restliche FLS pro Woche, Differenz Soll/Ist Auswertungszeitraum, Auslastung nach Enddatum Kunde,
|
||||
* TODO: Objekt erstellen, dass eine Liste mit Objekt hat in denen die Werte "Soll", "Ist", "Differenz Soll/Ist", "Zeitdings"
|
||||
*/
|
||||
|
||||
var flsAuslastungsauswertungRo = new FlsAuslastungsauswertungRO();
|
||||
|
||||
if(ro.Rows.Count == 1)
|
||||
{
|
||||
var firstRow = ro.Rows.First();
|
||||
var objectOidUnparsed = firstRow.Field1;
|
||||
var startDateUnparsed = firstRow.Field2;
|
||||
var intervalUnitUnparsed = firstRow.Field3;
|
||||
|
||||
var analysisType = int.Parse(firstRow.Field4.ToString());
|
||||
|
||||
var objectOid = long.Parse(objectOidUnparsed.ToString());
|
||||
var startDate = DateTime.Parse(startDateUnparsed.ToString());
|
||||
var endDate = startDate.AddDays(30);
|
||||
|
||||
var intervalUnit = FLSAuswertungstyp.Weekly;
|
||||
|
||||
switch(intervalUnitUnparsed.ToString())
|
||||
{
|
||||
case "Tag":
|
||||
intervalUnit = FLSAuswertungstyp.Daily;
|
||||
break;
|
||||
case "Monat":
|
||||
intervalUnit = FLSAuswertungstyp.Monthly;
|
||||
break;
|
||||
}
|
||||
|
||||
var customers = new List<Customer>();
|
||||
|
||||
|
||||
if(analysisType == 1)
|
||||
{
|
||||
var employee = DAOFactory.GenericDAO.LoadByID<Employee>(objectOid);
|
||||
|
||||
customers = employee.Employee2CustomerList.Select(s => s.Customer).ToList();
|
||||
}
|
||||
else if(analysisType == 2)
|
||||
{
|
||||
var team = DAOFactory.GenericDAO.LoadByID<Team>(objectOid);
|
||||
|
||||
customers.Clear();
|
||||
team.MemberList.DoForEach(member => customers.AddRangeIfElementsNotIn(member.Employee2CustomerList.Select(e2c => e2c.Customer)));
|
||||
}
|
||||
|
||||
var names = customers.Select(c => c.Person.FirstNameLastName);
|
||||
|
||||
// Termine (Soll-FLS) mit den Klienten laden:
|
||||
var customerAppointments = DAOFactory.SearchDAO.FindActiveAppointmentsForCustomers(customers.Select(customer => customer.Oid.Value).ToList(), startDate, endDate);
|
||||
|
||||
//var customerToAppointmentTime = new Dictionar
|
||||
|
||||
/*
|
||||
* Customer
|
||||
* IntervalUnit: Day, Week, Month
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
// TODO: Serientermine berücksichtigen
|
||||
|
||||
|
||||
var customer2Days = new Dictionary<long, double[]>();
|
||||
|
||||
customers.DoForEach(customer => customer2Days.Add(customer.Oid.Value, new double[30]));
|
||||
|
||||
foreach(var customerAppointment in customerAppointments.Where(appointment => appointment.RecurrenceInfo == null))
|
||||
{
|
||||
if(customerAppointment.StartDate == null || customerAppointment.EndDate == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var start = customerAppointment.StartDate.Value;
|
||||
var end = customerAppointment.EndDate.Value;
|
||||
|
||||
var sameDay = start.Date == end.Date;
|
||||
|
||||
|
||||
var durationInMinutes = (end - start).TotalMinutes;
|
||||
|
||||
var customerCount = customerAppointment.CustomerList.Count;
|
||||
|
||||
// TODO: Täglich feststellen und dann summieren für Woche oder Monat
|
||||
var durationPerCustomer = durationInMinutes / customerCount;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return flsAuslastungsauswertungRo;
|
||||
}
|
||||
}
|
||||
|
||||
internal class HeaderRow
|
||||
{
|
||||
public string CustomerName { get; set; }
|
||||
public string SollHeader => "Soll";
|
||||
public string IstHeader => "Ist";
|
||||
public decimal RemainingFlsPerWeek { get; set; }
|
||||
public decimal IntervalDifferenceReferenceValueActualValue { get; set; }
|
||||
public decimal CapacityAfterEndCustomer { get; set; }
|
||||
|
||||
public List<ValueRow> CustomerValueRows { get; set; } = new List<ValueRow>();
|
||||
|
||||
public HeaderRow(string customerName, decimal remainingFlsPerWeek, decimal intervalDifferenceReferenceValueActualValue, decimal capacityAfterEndCustomer)
|
||||
{
|
||||
CustomerName = customerName;
|
||||
RemainingFlsPerWeek = remainingFlsPerWeek;
|
||||
IntervalDifferenceReferenceValueActualValue = intervalDifferenceReferenceValueActualValue;
|
||||
CapacityAfterEndCustomer = capacityAfterEndCustomer;
|
||||
}
|
||||
}
|
||||
|
||||
internal class ValueRow
|
||||
{
|
||||
public string Interval { get; set; }
|
||||
public decimal ReferenceValue { get; set; }
|
||||
public decimal ActualValue { get; set; }
|
||||
public decimal DifferenceReferenceValueActualValue => ReferenceValue - ActualValue;
|
||||
|
||||
public ValueRow(string interval, decimal referenceValue, decimal actualValue)
|
||||
{
|
||||
Interval = interval;
|
||||
ReferenceValue = referenceValue;
|
||||
ActualValue = actualValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
3095
ReportImp/BetreuWoReports/FlsAuslastungsauswertung.designer.cs
generated
Normal file
3095
ReportImp/BetreuWoReports/FlsAuslastungsauswertung.designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
123
ReportImp/BetreuWoReports/FlsAuslastungsauswertung.resx
Normal file
123
ReportImp/BetreuWoReports/FlsAuslastungsauswertung.resx
Normal 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>
|
||||
41
ReportImp/BetreuWoReports/Service/QueryService.cs
Normal file
41
ReportImp/BetreuWoReports/Service/QueryService.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BeWo.Service.Plugins;
|
||||
using BS.Shared;
|
||||
using BS.Shared.DataContracts;
|
||||
using BS.Shared.Extensions;
|
||||
|
||||
namespace BetreuWoReports.Service
|
||||
{
|
||||
public class CustomQueryService : QueryService
|
||||
{
|
||||
public override List<QueryDC> GetAllQueriesOfType(QueryType pType)
|
||||
{
|
||||
var list = base.GetAllQueriesOfType(pType);
|
||||
|
||||
list.DoForEach(query =>
|
||||
{
|
||||
if(query.ReportTypeName?.Equals("BeWo.BetreuWoReports.Alt.FlsAuslastungsauswertung") ?? false)
|
||||
{
|
||||
if(query.Parameter?.Any() ?? false)
|
||||
{
|
||||
query.Parameter.DoForEach(parameter =>
|
||||
{
|
||||
if(parameter.ParamType == QueryParameterType.Custom)
|
||||
{
|
||||
parameter.CustomValues = new List<string>
|
||||
{
|
||||
"Tag",
|
||||
"Woche",
|
||||
"Monat"
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
||||
}
|
||||
14
ReportImp/demo_reports/DemoReportCreator.cs
Normal file
14
ReportImp/demo_reports/DemoReportCreator.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using BeWo.Report;
|
||||
|
||||
namespace demo_reports
|
||||
{
|
||||
public class DemoReportCreator : DefaultReportCreator
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
41
ReportImp/demo_reports/Service/QueryService.cs
Normal file
41
ReportImp/demo_reports/Service/QueryService.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BeWo.Service.Plugins;
|
||||
using BS.Shared;
|
||||
using BS.Shared.DataContracts;
|
||||
using BS.Shared.Extensions;
|
||||
|
||||
namespace demo_reports.Service
|
||||
{
|
||||
public class CustomQueryService : QueryService
|
||||
{
|
||||
public override List<QueryDC> GetAllQueriesOfType(QueryType pType)
|
||||
{
|
||||
var list = base.GetAllQueriesOfType(pType);
|
||||
|
||||
list.DoForEach(query =>
|
||||
{
|
||||
if(query.ReportTypeName?.Equals("FlsAuslastungsauswertung") ?? false)
|
||||
{
|
||||
if(query.Parameter?.Any() ?? false)
|
||||
{
|
||||
query.Parameter.DoForEach(parameter =>
|
||||
{
|
||||
if(parameter.ParamType == QueryParameterType.Custom)
|
||||
{
|
||||
parameter.CustomValues = new List<string>
|
||||
{
|
||||
"Tag",
|
||||
"Woche",
|
||||
"Monat"
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user