diff --git a/BeWo/ServiceProxy/Generated.cs b/BeWo/ServiceProxy/Generated.cs index 51a3a60e4..33c78e5e0 100644 --- a/BeWo/ServiceProxy/Generated.cs +++ b/BeWo/ServiceProxy/Generated.cs @@ -4218,9 +4218,9 @@ namespace BeWo.ServiceProxy public interface IOperationsService { - [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsService/GetAllFlexibleReportEntrys", ReplyAction="http://tempuri.org/IOperationsService/GetAllFlexibleReportEntrysResponse")] - [System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsService/GetAllFlexibleReportEntrysBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] - System.Collections.Generic.List GetAllFlexibleReportEntrys(BS.Shared.DataContracts.FlexibleReportFilterDC filter); + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsService/GetFlexibleReportResult", ReplyAction="http://tempuri.org/IOperationsService/GetFlexibleReportResultResponse")] + [System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsService/GetFlexibleReportResultBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] + BS.Shared.DataContracts.FlexibleReportResultDC GetFlexibleReportResult(BS.Shared.DataContracts.FlexibleReportFilterDC filter); [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsService/GetFlexibleReportLayouts", ReplyAction="http://tempuri.org/IOperationsService/GetFlexibleReportLayoutsResponse")] [System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsService/GetFlexibleReportLayoutsBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] @@ -5135,9 +5135,9 @@ namespace BeWo.ServiceProxy { } - public System.Collections.Generic.List GetAllFlexibleReportEntrys(BS.Shared.DataContracts.FlexibleReportFilterDC filter) + public BS.Shared.DataContracts.FlexibleReportResultDC GetFlexibleReportResult(BS.Shared.DataContracts.FlexibleReportFilterDC filter) { - return base.Channel.GetAllFlexibleReportEntrys(filter); + return base.Channel.GetFlexibleReportResult(filter); } public System.Collections.Generic.List GetFlexibleReportLayouts() diff --git a/BeWo/View/Detail/Report/FlexibleReportView.xaml b/BeWo/View/Detail/Report/FlexibleReportView.xaml index 9b07a97e1..e3246be41 100644 --- a/BeWo/View/Detail/Report/FlexibleReportView.xaml +++ b/BeWo/View/Detail/Report/FlexibleReportView.xaml @@ -74,7 +74,7 @@ - + @@ -92,9 +92,9 @@ - - - + + + diff --git a/BeWo/View/Detail/Report/FlexibleReportView.xaml.cs b/BeWo/View/Detail/Report/FlexibleReportView.xaml.cs index 66e3e0bc6..f56d4254b 100644 --- a/BeWo/View/Detail/Report/FlexibleReportView.xaml.cs +++ b/BeWo/View/Detail/Report/FlexibleReportView.xaml.cs @@ -48,11 +48,11 @@ namespace BeWo.View.Detail.Report { InitializeComponent(); - FlexibleAnzahlMinIst.CellFormat = "{0:N0}"; - FlexibleAnzahlStdIst.CellFormat = "{0:N2}"; + FlexibleAnzahlMinIst.CellFormat = "{0:N0}"; + FlexibleAnzahlStdIst.CellFormat = "{0:N2}"; - FlexibleAnzahlMinSoll.CellFormat = "{0:N0}"; - FlexibleAnzahlStdSoll.CellFormat = "{0:N2}"; + FlexibleAnzahlMinSoll.CellFormat = "{0:N0}"; + FlexibleAnzahlStdSoll.CellFormat = "{0:N2}"; FlexibleDifferenzIstSollMin.CellFormat = "{0:N0}"; FlexibleDifferenzIstSollStd.CellFormat = "{0:N2}"; @@ -70,56 +70,59 @@ namespace BeWo.View.Detail.Report FlexibleGefahreneKilometer.CellFormat = "{0:N0}"; FlexibleKlient.TotalValueFormat = "{0}"; - FlexibleMitarbeiter.TotalValueFormat = "{0}"; - FlexibleLeistung.TotalValueFormat = "{0}"; - FlexibleLeistungskategorie.TotalValueFormat = "{0}"; + FlexibleMitarbeiter.TotalValueFormat = "{0}"; + FlexibleLeistung.TotalValueFormat = "{0}"; + FlexibleLeistungskategorie.TotalValueFormat = "{0}"; datePickerStartDate.DateTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1); datePickerEndDate.DateTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddMonths(1).AddDays(-1); - myPivotGridControl.PrintColumnHeaders = false; myPivotGridControl.PrintRowHeaders = false; myPivotGridControl.PrintFilterHeaders = false; myPivotGridControl.PrintDataHeaders = false; myPivotGridControl.PrintUnusedFilterFields = false; myPivotGridControl.PrintHeadersOnEveryPage = false; - } #endregion #region Events private void buttonRefresh_Click(object sender, RoutedEventArgs e) { - var test = ChartControl.DataSource; - - if (myPivotGridControl.Visibility == Visibility.Hidden) - myPivotGridControl.Visibility = Visibility.Visible; - var filter = new FlexibleReportFilterDC() { StartDatum = datePickerStartDate.DateTime, EndDatum = datePickerEndDate.DateTime, - NullDaten = checkNullEntries.IsChecked.Value + ReduzierteAnsicht = checkReduzierteAnsicht.IsChecked.Value }; ServiceFacade.DoOperationsServiceAsync( - s => s.GetAllFlexibleReportEntrys(filter), + s => s.GetFlexibleReportResult(filter), r => { this.Dispatch(delegate { var liste = new List(); - foreach (var item in r) - { - liste.Add(FlexibleReportEntry.InitByFlexibleReportEntryDC(item)); - } + + if (r.Entries != null) + foreach (var item in r.Entries) + { + liste.Add(FlexibleReportEntry.InitByFlexibleReportEntryDC(item)); + } + + if (r.Dummies != null) + foreach (var item in r.Dummies) + { + liste.AddRange(FlexibleReportEntry.InitByFlexibleReportDummyDC(item)); + } + + if (r.Employees != null) + liste.AddRange(FlexibleReportEntry.InitByFlexibleReportEmployeeDictornary(r.Employees, filter.StartDatum)); + myPivotGridControl.DataSource = liste; checkBoxChart.IsEnabled = true; }); }); - - ButtonLayoutSave.IsEnabled = true; } private void GridControl_CustomCellDisplayText(object sender, PivotCellDisplayTextEventArgs e) @@ -138,19 +141,19 @@ namespace BeWo.View.Detail.Report e.DisplayText = ""; } - private void GridControl_CustomFieldValueCells(object sender, PivotCustomFieldValueCellsEventArgs e) - { - PivotGridControl pivot = (PivotGridControl)sender; + private void GridControl_CustomFieldValueCells(object sender, PivotCustomFieldValueCellsEventArgs e) + { + PivotGridControl pivot = (PivotGridControl)sender; - if (pivot.DataSource == null) - return; + if (pivot.DataSource == null) + return; - // Iterates through all row headers. - for (int i = e.GetCellCount(false) - 1; i >= 0; i--) - { - var cell = e.GetCell(false, i); - if (cell == null) - continue; + // Iterates through all row headers. + for (int i = e.GetCellCount(false) - 1; i >= 0; i--) + { + var cell = e.GetCell(false, i); + if (cell == null) + continue; // If the current header corresponds to the "Employee B" // field value, and is not the Total Row header, @@ -545,9 +548,17 @@ namespace BeWo.View.Detail.Report #region Classes public class FlexibleReportEntry { - public string Customer { get; set; } + public long? CustomerOid { get; set; } - public string Employee { get; set; } + public string CustomerString { get; set; } + + public long? SupportConceptOid { get; set; } + + public string SupportConceptString { get; set; } + + public long? EmployeeOid { get; set; } + + public string EmployeeString { get; set; } public string Team { get; set; } @@ -555,27 +566,13 @@ namespace BeWo.View.Detail.Report public string Leistung { get; set; } - public string SupportConcept { get; set; } - public decimal AnzahlMinutenIst { get; set; } - public decimal AnzahlStundenIst - { - get - { - return AnzahlMinutenIst / 60; - } - } + public decimal AnzahlStundenIst { get { return AnzahlMinutenIst / 60; } } public decimal? AnzahlMinutenSoll { get; set; } - public decimal? AnzahlStundenSoll - { - get - { - return AnzahlMinutenSoll / 60; - } - } + public decimal? AnzahlStundenSoll { get { return AnzahlMinutenSoll / 60; } } public DateTime Datum { get; set; } @@ -589,31 +586,21 @@ namespace BeWo.View.Detail.Report public decimal Rundungspotenzial { get; set; } - public decimal? DifferenzIstSollMinuten - { - get - { - return AnzahlMinutenIst - AnzahlMinutenSoll; - } - } + public decimal? DifferenzIstSollMinuten { get { return AnzahlMinutenIst - AnzahlMinutenSoll; } } - public decimal? DifferenzIstSollStunden - { - get - { - return DifferenzIstSollMinuten / 60; - } - } + public decimal? DifferenzIstSollStunden { get { return DifferenzIstSollMinuten / 60; } } public string Organisation { get; set; } public static FlexibleReportEntry InitByFlexibleReportEntryDC(FlexibleReportEntryDC entryDC) { - var returnValue = new FlexibleReportEntry() + var entry = new FlexibleReportEntry() { + CustomerOid = entryDC.CustomerOid, + EmployeeOid = entryDC.EmployeeOid, + SupportConceptOid = entryDC.SupportConceptOid, AnzahlMinutenIst = entryDC.AnzahlMinuten, Datum = entryDC.StartDatum, - SupportConcept = entryDC.SupportConcept == null ? "" : string.Format("{0:dd.MM.yyyy} - {1:dd.MM.yyyy}", entryDC.SupportConcept.StartDate, entryDC.SupportConcept.EndDate), Leistung = entryDC.Leistung, Leistungskategorie = entryDC.Leistungskategorie, Team = entryDC.Team, @@ -626,44 +613,70 @@ namespace BeWo.View.Detail.Report Stundensatz = entryDC.Stundensatz }; - if (entryDC.Customer == null) + if (entryDC.Type == FlexibleReportEntryType.ServiceRecordEntry) { - if (entryDC.Type == FlexibleReportEntryType.ServiceRecordEntry) - { - returnValue.Customer = ""; - } - else - { - returnValue.Customer = null; - } + entry.CustomerString = entryDC.CustomerString == null ? "" : entryDC.CustomerString; + entry.EmployeeString = entryDC.EmployeeString == null ? "" : entryDC.EmployeeString; + entry.SupportConceptString = entryDC.SupportConceptString == null ? "" : entryDC.SupportConceptString; } else { - returnValue.Customer = string.Format("{0}, {1}", entryDC.Customer.LastName, entryDC.Customer.FirstName); + entry.CustomerString = null; + entry.EmployeeString = null; + entry.SupportConceptString = null; } - if (entryDC.Employee == null) - { - if (entryDC.Type == FlexibleReportEntryType.ServiceRecordEntry) - { - returnValue.Employee = ""; - } - else - { - returnValue.Employee = null; - } - } - else - { - returnValue.Employee = string.Format("{0}, {1}", entryDC.Employee.LastName, entryDC.Employee.FirstName); - } - - return returnValue; + return entry; } - public override string ToString() + public static IList InitByFlexibleReportDummyDC(FlexibleReportDummyDC dummyDC) { - return "'" + Employee + " -> " + Customer; + var flexibleReports = new List(); + + for (DateTime date = dummyDC.StartDate; date.Date <= dummyDC.EndDate; date = date.AddDays(1.0)) + { + flexibleReports.Add(new FlexibleReportEntry() + { + AnzahlMinutenSoll = dummyDC.Soll, + AnzahlMinutenIst = 0m, + Betrag = 0, + CustomerOid = dummyDC.CustomerOid, + CustomerString = dummyDC.CustomerString, + Datum = date, + EmployeeOid = dummyDC.EmployeeOid, + EmployeeString = dummyDC.EmployeeString, + Kilometer = null, + Leistung = null, + Leistungskategorie = dummyDC.Leistungskategorie, + Organisation = dummyDC.Organisation, + Rundungspotenzial = 0m, + Stundensatz = 0m, + SupportConceptOid = dummyDC.SupportConceptOid, + SupportConceptString = dummyDC.SupportConceptString, + Team = null, + Type = dummyDC.EntryType + }); + } + + return flexibleReports; + } + + public static IList InitByFlexibleReportEmployeeDictornary(Dictionary dic, DateTime date) + { + var flexibleReports = new List(); + + foreach (var item in dic) + { + flexibleReports.Add(new FlexibleReportEntry() + { + EmployeeOid = item.Key, + EmployeeString = item.Value, + Type = FlexibleReportEntryType.EmployeeNullEntry, + Datum = date + }); + } + + return flexibleReports; } } diff --git a/Service/Plugins/FlexibleReportService.cs b/Service/Plugins/FlexibleReportService.cs index 371816685..e87868b58 100644 --- a/Service/Plugins/FlexibleReportService.cs +++ b/Service/Plugins/FlexibleReportService.cs @@ -23,24 +23,28 @@ namespace BeWo.Service.Plugins private Dictionary> costbearerOid2Stundensatz; private Dictionary> costbearerOid2RateFactor; - public virtual IList GetAllFlexibleReportEntrys(FlexibleReportFilterDC filter) + public virtual FlexibleReportResultDC GetAllFlexibleReportEntrys(FlexibleReportFilterDC filter) { + var result = new FlexibleReportResultDC(); + result.StartDatum = filter.StartDatum; + result.EndDatum = filter.EndDatum; + BuildStundensatzDictionaries(); var calc = PluginLoader.FindClass(); - var dict = new Dictionary(); - var result = new List(); var span = new DateTimeSpan() { StartDateTime = filter.StartDatum.Date, EndDateTime = filter.EndDatum.Date.AddDays(1).AddTicks(-1) }; var alleRec = DAOFactory.SearchDAO.FindServiceRecordsInSpan(span, null).ToList(); - if (filter.NullDaten) + if (!filter.ReduzierteAnsicht) { + result.Dummies = new List(); + // Zwischenspeicher für die richtigen Zeiträume var dateTimeSpan = new DateTimeSpan(); - var alleHps = DAOFactory.SearchDAO.FindSupportConceptsInSpan(span); - var alleEmps = DAOFactory.GenericDAO.GetAllActive(); + var alleHps = DAOFactory.GenericDAO.GetAllActiveAndArchived(); + var alleEmps = DAOFactory.GenericDAO.GetAllActiveAndArchived(); foreach (var hilfePlan in alleHps.Where(x => span.StartDate <= x.EndDate && span.EndDate >= x.StartDate)) { @@ -48,8 +52,6 @@ namespace BeWo.Service.Plugins dateTimeSpan.StartDate = span.StartDate > hilfePlan.StartDate ? span.StartDate : hilfePlan.StartDate.Value; dateTimeSpan.EndDate = span.EndDate < hilfePlan.EndDate ? span.EndDate : hilfePlan.EndDate.Value; - result.AddRange(CreateFlexibleReportsInTimeSpan(dateTimeSpan, null, hilfePlan, FlexibleReportEntryType.CustomerNullEntry, 0)); - foreach (var c2s in hilfePlan.CostBearer2SupportConceptList.Where(x => span.StartDate <= x.EndDate && span.EndDate >= x.StartDate)) { foreach (var approvalPeriod in c2s.ApprovalPeriodList.Where(x => span.StartDate <= x.EndDate && span.EndDate >= x.StartDate)) @@ -68,7 +70,7 @@ namespace BeWo.Service.Plugins { decimal? soll = GetSollPerDay(hilfePlan.Customer, dateTimeSpan.StartDate, approvalPeriod, calc); if (soll != null) - result.AddRange(CreateFlexibleReportsInTimeSpan(dateTimeSpan, null, hilfePlan, FlexibleReportEntryType.SollEntry, soll.Value)); + result.Dummies.Add(CreateFlexibleReportsDummyDC(dateTimeSpan, null, hilfePlan, c2s.CostBearer, approvalPeriod, soll.Value)); } // Wenn der Klient ein oder mehr Hauptbetreuer hat else @@ -80,7 +82,7 @@ namespace BeWo.Service.Plugins decimal sollAnteil = soll.Value / hauptbetreuer.Count; foreach (var betreuer in hauptbetreuer) { - result.AddRange(CreateFlexibleReportsInTimeSpan(dateTimeSpan, betreuer, hilfePlan, FlexibleReportEntryType.SollEntry, sollAnteil)); + result.Dummies.Add(CreateFlexibleReportsDummyDC(dateTimeSpan, betreuer, hilfePlan, c2s.CostBearer, approvalPeriod, sollAnteil)); } } } @@ -95,7 +97,7 @@ namespace BeWo.Service.Plugins decimal? soll = GetSollPerDay(hilfePlan.Customer, employee, approvalPeriod.StartDate.Value, approvalPeriod, calc); if (soll != null) { - result.AddRange(CreateFlexibleReportsInTimeSpan(dateTimeSpan, employee, hilfePlan, FlexibleReportEntryType.SollEntry, soll.Value)); + result.Dummies.Add(CreateFlexibleReportsDummyDC(dateTimeSpan, employee, hilfePlan, c2s.CostBearer, approvalPeriod, soll.Value)); } } } @@ -103,75 +105,52 @@ namespace BeWo.Service.Plugins } } - foreach (var item in alleEmps) + if(alleEmps.Count > 0) { - for (DateTime date = span.StartDate; date <= span.EndDate; date = date.AddDays(1)) + result.Employees = new Dictionary(); + + foreach (var employee in alleEmps) { - result.Add(new FlexibleReportEntryDC() - { - Employee = MapperFactory.CompactEmployeeDC_Employee.MapToNewDC(item), - Type = FlexibleReportEntryType.EmployeeNullEntry, - StartDatum = date, - EndDatum = date - }); + result.Employees.Add(employee.Oid.Value, string.Format("{0}, {1}", employee.Person.LastName, employee.Person.FirstName)); } } } - foreach (var serviceRecordListEntry in alleRec) + if(alleRec.Count > 0) { - var resultEntry = result.Where(x => - x.Type == FlexibleReportEntryType.SollEntry && - x.CustomerOid == serviceRecordListEntry.CustomerOid && - x.EmployeeOid == serviceRecordListEntry.EmployeeOid && - x.StartDatum.Date == serviceRecordListEntry.Start.Value.Date).FirstOrDefault(); + result.Entries = new List(); - // Falls kein passendes Entry gefunden wurde - if (resultEntry == null) + foreach (var serviceRecordListEntry in alleRec) { - resultEntry = result.Where(x => - x.CustomerOid == serviceRecordListEntry.CustomerOid && - x.Type == FlexibleReportEntryType.CustomerNullEntry && - x.StartDatum == serviceRecordListEntry.Start.Value.Date) - .FirstOrDefault(); + var stundensatz = GetStundensatz(serviceRecordListEntry); - // Falls immernoch kein passendes Entry gefunden wurde - if (resultEntry == null) + if (serviceRecordListEntry.CostBearer2SupportConcept == null) + continue; + + result.Entries.Add(new FlexibleReportEntryDC() { - resultEntry = new FlexibleReportEntryDC(); - result.Add(resultEntry); - } + AnzahlMinuten = serviceRecordListEntry.RoundedDuration, + AnzahlMinutenSoll = 0, + Betrag = stundensatz.HasValue ? stundensatz * (serviceRecordListEntry.RoundedDuration / 60) : null, + CustomerOid = serviceRecordListEntry.Customer?.Oid, + CustomerString = serviceRecordListEntry.Customer != null ? string.Format("{0}, {1}", serviceRecordListEntry.Customer.Person.LastName, serviceRecordListEntry.Customer.Person.FirstName) : null, + EmployeeOid = serviceRecordListEntry.Employee?.Oid, + EmployeeString = serviceRecordListEntry.Employee != null ? string.Format("{0}, {1}", serviceRecordListEntry.Employee.Person.LastName, serviceRecordListEntry.Employee.Person.FirstName) : null, + EndDatum = serviceRecordListEntry.End.Value, + Kilometer = serviceRecordListEntry.DistanceInMeter, + Leistung = serviceRecordListEntry.ServiceDescription.Name, + Leistungskategorie = serviceRecordListEntry.ServiceDescription.ServiceCategory.Name, + Organisation = serviceRecordListEntry.CostBearer2SupportConcept.CostBearer.Organisation.Name, + StartDatum = serviceRecordListEntry.Start.Value, + Stundensatz = stundensatz, + SupportConceptOid = serviceRecordListEntry.SupportConcept?.Oid, + SupportConceptString = serviceRecordListEntry.SupportConcept != null ? string.Format("{0:dd.MM.yyyy} - {1:dd.MM.yyyy}", serviceRecordListEntry.SupportConcept.StartDate, serviceRecordListEntry.SupportConcept.EndDate) : null, + Team = serviceRecordListEntry.Customer != null ? GetTeamNameByTeam2CustomerList(serviceRecordListEntry.Customer.Team2CustomerList) : null, + Type = FlexibleReportEntryType.ServiceRecordEntry + }); } - - resultEntry.AnzahlMinuten = serviceRecordListEntry.RoundedDuration; - resultEntry.EndDatum = serviceRecordListEntry.End.Value; - resultEntry.Kilometer = serviceRecordListEntry.DistanceInMeter; - resultEntry.Leistung = serviceRecordListEntry.ServiceDescription.Name; - resultEntry.Leistungskategorie = serviceRecordListEntry.ServiceDescription.ServiceCategory.Name; - resultEntry.StartDatum = serviceRecordListEntry.Start.Value; - resultEntry.Type = FlexibleReportEntryType.ServiceRecordEntry; - resultEntry.Stundensatz = GetStundensatz(serviceRecordListEntry); - if (resultEntry.Stundensatz.HasValue) - { - resultEntry.Betrag = resultEntry.Stundensatz * (resultEntry.AnzahlMinuten / 60); - } - if (serviceRecordListEntry.Customer != null) - { - resultEntry.Customer = MapperFactory.CompactCustomerDC_Customer.MapToNewDC(serviceRecordListEntry.Customer); - resultEntry.Team = GetTeamNameByTeam2CustomerList(serviceRecordListEntry.Customer.Team2CustomerList); - } - if (serviceRecordListEntry.Employee != null) - resultEntry.Employee = MapperFactory.CompactEmployeeDC_Employee.MapToNewDC(serviceRecordListEntry.Employee); - if (serviceRecordListEntry.SupportConcept != null) - resultEntry.SupportConcept = MapperFactory.CompactSupportConceptDC_SupportConcept.MapToNewDC(serviceRecordListEntry.SupportConcept); - if (serviceRecordListEntry.CostBearer2SupportConcept != null) - resultEntry.Organisation = serviceRecordListEntry.CostBearer2SupportConcept.CostBearer.Organisation.Name; - - if (!filter.NullDaten) - CreateFlexibleReportSoll(resultEntry, serviceRecordListEntry, new DateTime(), PluginLoader.FindClass()); } - var i = result.FindAll(x => x.Employee?.LastName == "Wolf"); return result; } @@ -278,33 +257,6 @@ namespace BeWo.Service.Plugins } } - //protected virtual IEnumerable CreateFlexibleNullEntries(ServiceRecord sr, DateTime start, DateTime ende, decimal? soll) - //{ - // for (DateTime date = start; date <= ende; date = date.AddDays(1.0)) - // { - // var flex = new FlexibleReportEntryDC() - // { - // Customer = sr.Customer != null ? MapperFactory.CompactCustomerDC_Customer.MapToNewDC(sr.Customer) : null, - // Employee = sr.Employee != null ? MapperFactory.CompactEmployeeDC_Employee.MapToNewDC(sr.Employee) : null, - // StartDatum = date, - // AnzahlMinuten = 0, - // AnzahlMinutenSoll = soll, - // Leistung = sr.ServiceDescription.Name, - // Leistungskategorie = sr.ServiceDescription.ServiceCategory.Name, - // SupportConcept = MapperFactory.CompactSupportConceptDC_SupportConcept.MapToNewDC(sr.SupportConcept) ?? null, - // }; - - // if (sr.Customer != null) - // { - // flex.Customer = MapperFactory.CompactCustomerDC_Customer.MapToNewDC(sr.Customer); - - // flex.Team = GetTeamNameByTeam2CustomerList(sr.Customer.Team2CustomerList); - // } - - // yield return flex; - // } - //} - protected virtual string GetTeamNameByTeam2CustomerList(IList team2Customers) { string name = ""; @@ -447,21 +399,55 @@ namespace BeWo.Service.Plugins } } - protected virtual IEnumerable CreateFlexibleReportsInTimeSpan(DateTimeSpan span, Employee employee, SupportConcept supportConcept, FlexibleReportEntryType type, decimal soll) + protected virtual FlexibleReportDummyDC CreateFlexibleReportsDummyDC(DateTimeSpan span, Employee employee, SupportConcept supportConcept, CostBearer costBearer, SupportConceptApprovalPeriod approvalPeriod, decimal soll) { - for (DateTime date = span.StartDate; date <= span.EndDate; date = date.AddDays(1)) + var dummy = new FlexibleReportDummyDC() { - yield return new FlexibleReportEntryDC() - { - Employee = employee != null ? MapperFactory.CompactEmployeeDC_Employee.MapToNewDC(employee) : null, - Customer = supportConcept.Customer != null ? MapperFactory.CompactCustomerDC_Customer.MapToNewDC(supportConcept.Customer) : null, - Type = type, - StartDatum = date, - EndDatum = date, - SupportConcept = MapperFactory.CompactSupportConceptDC_SupportConcept.MapToNewDC(supportConcept), - AnzahlMinutenSoll = soll - }; + CustomerOid = null, + CustomerString = null, + EmployeeOid = null, + EmployeeString = null, + EndDate = span.EndDate, + EntryType = FlexibleReportEntryType.SollEntry, + Leistungskategorie = null, + Organisation = null, + Soll = soll, + StartDate = span.StartDate, + SupportConceptOid = null, + SupportConceptString = null + }; + + if (supportConcept != null) + { + dummy.SupportConceptOid = supportConcept.Oid; + dummy.SupportConceptString = string.Format("{0:dd.MM.yyyy} - {1:dd.MM.yyyy}", supportConcept.StartDate, supportConcept.EndDate); + + dummy.CustomerOid = supportConcept.Oid; + dummy.CustomerString = string.Format("{0}, {1}", supportConcept.Customer.Person.LastName, supportConcept.Customer.Person.FirstName); + + dummy.Organisation = costBearer.Organisation.Name; + dummy.Leistungskategorie = approvalPeriod.ServiceCategory?.Name; } + + if (employee != null) + { + dummy.EmployeeOid = employee.Oid; + dummy.EmployeeString = string.Format("{0}, {1}", employee.Person.LastName, employee.Person.FirstName); + } + + return dummy; + } + + protected virtual FlexibleReportDummyDC CreateFlexibleReportsDummyDC(DateTimeSpan span, Employee employee) + { + return new FlexibleReportDummyDC() + { + EndDate = span.EndDate, + StartDate = span.StartDate, + EmployeeOid = employee.Oid, + EmployeeString = string.Format("{0}, {1}", employee.Person.LastName, employee.Person.FirstName), + EntryType = FlexibleReportEntryType.EmployeeNullEntry + }; } } } diff --git a/Service/ServiceContracts/IOperationsService.cs b/Service/ServiceContracts/IOperationsService.cs index 3d237a467..18e1f9e3d 100644 --- a/Service/ServiceContracts/IOperationsService.cs +++ b/Service/ServiceContracts/IOperationsService.cs @@ -814,7 +814,7 @@ namespace BeWo.Service.ServiceContracts [FaultContract(typeof(BeWoFault))] [OperationContract] - IList GetAllFlexibleReportEntrys(FlexibleReportFilterDC filter); + FlexibleReportResultDC GetFlexibleReportResult(FlexibleReportFilterDC filter); [FaultContract(typeof(BeWoFault))] [OperationContract] @@ -824,7 +824,6 @@ namespace BeWo.Service.ServiceContracts [OperationContract] void InsertNewFlexibleReportLayout(FlexibleReportLayoutDC flexibleReportLayoutDC); - [FaultContract(typeof(BeWoFault))] [OperationContract] void UpdateFlexibleReportLayouts(IList flexibleReportLayouts); diff --git a/Service/ServiceImplementations/OperationsServiceImp.cs b/Service/ServiceImplementations/OperationsServiceImp.cs index 5eb9f97cc..0e7b3c4c0 100644 --- a/Service/ServiceImplementations/OperationsServiceImp.cs +++ b/Service/ServiceImplementations/OperationsServiceImp.cs @@ -5641,24 +5641,20 @@ namespace BeWo.Service.ServiceImplementations } } - public IList GetAllFlexibleReportEntrys(FlexibleReportFilterDC filter) + public FlexibleReportResultDC GetFlexibleReportResult(FlexibleReportFilterDC filter) { try { var s = PluginLoader.FindClass(); - - var test = s.GetAllFlexibleReportEntrys(filter); - return test; + return s.GetAllFlexibleReportEntrys(filter); } catch (Exception e) { throw Utils.CreateBeWoFaultException(e); } } - - public IList GetFlexibleReportLayouts() { var result = new List(); diff --git a/Shared/DataContracts/FlexibleReportDummyDC.cs b/Shared/DataContracts/FlexibleReportDummyDC.cs new file mode 100644 index 000000000..31ece64e5 --- /dev/null +++ b/Shared/DataContracts/FlexibleReportDummyDC.cs @@ -0,0 +1,50 @@ +using BS.Shared.DataContracts.Compact; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Threading.Tasks; + +namespace BS.Shared.DataContracts +{ + [DataContract] + public class FlexibleReportDummyDC : IDataContract + { + [DataMember] + public DateTime StartDate { get; set; } + + [DataMember] + public DateTime EndDate { get; set; } + + [DataMember] + public string EmployeeString { get; set; } + + [DataMember] + public long? EmployeeOid { get; set; } + + [DataMember] + public string CustomerString { get; set; } + + [DataMember] + public long? CustomerOid { get; set; } + + [DataMember] + public string SupportConceptString { get; set; } + + [DataMember] + public long? SupportConceptOid { get; set; } + + [DataMember] + public string Leistungskategorie { get; set; } + + [DataMember] + public string Organisation { get; set; } + + [DataMember] + public FlexibleReportEntryType EntryType { get; set; } + + [DataMember] + public decimal Soll { get; set; } + } +} diff --git a/Shared/DataContracts/FlexibleReportEntryDC.cs b/Shared/DataContracts/FlexibleReportEntryDC.cs index d3e62a832..933f2541c 100644 --- a/Shared/DataContracts/FlexibleReportEntryDC.cs +++ b/Shared/DataContracts/FlexibleReportEntryDC.cs @@ -13,13 +13,22 @@ namespace BS.Shared.DataContracts public class FlexibleReportEntryDC : IDataContract { [DataMember] - public CompactCustomerDC Customer { get; set; } + public long? CustomerOid { get; set; } [DataMember] - public CompactSupportConceptDC SupportConcept { get; set; } + public string CustomerString { get; set; } [DataMember] - public CompactEmployeeDC Employee { get; set; } + public long? SupportConceptOid { get; set; } + + [DataMember] + public string SupportConceptString { get; set; } + + [DataMember] + public long? EmployeeOid { get; set; } + + [DataMember] + public string EmployeeString { get; set; } [DataMember] public string Team { get; set; } @@ -56,21 +65,5 @@ namespace BS.Shared.DataContracts [DataMember] public string Organisation { get; set; } - - public long? CustomerOid - { - get - { - return Customer?.Oid; - } - } - - public long? EmployeeOid - { - get - { - return Employee?.EmployeeOid; - } - } } } diff --git a/Shared/DataContracts/FlexibleReportFilterDC.cs b/Shared/DataContracts/FlexibleReportFilterDC.cs index 7a33d29a2..e00f8f4a6 100644 --- a/Shared/DataContracts/FlexibleReportFilterDC.cs +++ b/Shared/DataContracts/FlexibleReportFilterDC.cs @@ -24,6 +24,6 @@ namespace BS.Shared.DataContracts public IList Leistungen { get; set; } [DataMember] - public bool NullDaten { get; set; } + public bool ReduzierteAnsicht { get; set; } } } diff --git a/Shared/DataContracts/FlexibleReportResultDC.cs b/Shared/DataContracts/FlexibleReportResultDC.cs new file mode 100644 index 000000000..cfd7eb875 --- /dev/null +++ b/Shared/DataContracts/FlexibleReportResultDC.cs @@ -0,0 +1,33 @@ +using BS.Shared.DataContracts.Compact; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Threading.Tasks; + +namespace BS.Shared.DataContracts +{ + [DataContract] + public class FlexibleReportResultDC : IDataContract + { + [DataMember] + public DateTime StartDatum { get; set; } + + [DataMember] + public DateTime EndDatum { get; set; } + + [DataMember] + public Dictionary Employees { get; set; } + + [DataMember] + public Dictionary Customers { get; set; } + + [DataMember] + public IList Dummies { get; set; } + + [DataMember] + public IList Entries { get; set; } + + } +} diff --git a/Shared/Shared.csproj b/Shared/Shared.csproj index c76887d53..3ee33d96e 100644 --- a/Shared/Shared.csproj +++ b/Shared/Shared.csproj @@ -152,6 +152,8 @@ + +