MH: Bewertungsstatistik Wirksamkeitskontrolle

This commit is contained in:
2024-12-17 09:52:43 +01:00
parent 67413b9930
commit d021f9c412
5 changed files with 137 additions and 46 deletions

View File

@@ -32,11 +32,16 @@
</Grid.RowDefinitions>
<TextBlock Foreground="Black" FontSize="12" Grid.Column="0" VerticalAlignment="Center" Text="{markup:Translate Hilfeplan:}" />
<TextBlock x:Name="textblockHilfeplan" Foreground="Black" FontSize="12" Grid.Column="0" VerticalAlignment="Center" Text="{markup:Translate Hilfeplan:}" />
<uc:PopUpEdit x:Name="popupedit_CostBeaerer" Width="250" Height="23" Margin="3" Grid.Column="1"
IsReadOnly="True" DeleteButtonVisibility="Collapsed"
PopUpClick="popupedit_CostBeaerer_PopUpClick" MaxWidth="300"
Cursor="Arrow" PreviewMouseDoubleClick="Popupedit_CostBeaerer_OnPreviewMouseDoubleClick"/>
<dxe:CheckEdit x:Name="chkAllSupportConcepts" Margin="3 5 3 3" Foreground="Black" FontSize="12"
Grid.Column="2" Grid.Row="0" VerticalAlignment="Center"
Content="Alle Hilfepläne"
IsChecked="False" Checked="chkAllSupportConcepts_Checked" Unchecked="chkAllSupportConcepts_Unchecked" />
<Popup Margin="10" x:Name="popup_costBearer" StaysOpen="False" Placement="MousePoint" Width="450" Grid.Row="4" Grid.ColumnSpan="5" Height="400" Closed="popup_Closed" Opened="popup_Opened">
<localSearchView:SupportConceptSearchView x:Name="supportconceptsearchview" ItemSelected="SupportConceptSearchView_ItemSelected" SearchMode="All" />
</Popup>

View File

@@ -79,9 +79,19 @@ namespace BeWo.View.Report.Rating
private void LinkPdfExport_OnRequestNavigate(object sender, RequestNavigateEventArgs e)
{
string url = GenerateURL();
BeWoUtils.NavigateToReportUri(url, Translator.Translate("Bewertungsstatistik"));
//System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo((sender as System.Windows.Documents.Hyperlink).NavigateUri.ToString()));
// Wenn das Häkchen für alle Hilfepläne gesetzt ist wird eine andere URL erstellt, in der der Hilfeplan null ist
if (chkAllSupportConcepts.IsChecked.HasValue && chkAllSupportConcepts.IsChecked.Value)
{
string url = GenerateURLForAllSupportConcepts();
BeWoUtils.NavigateToReportUri(url, Translator.Translate("Bewertungsstatistik"));
}
// Sonst Standard
else
{
string url = GenerateURL();
BeWoUtils.NavigateToReportUri(url, Translator.Translate("Bewertungsstatistik"));
//System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo((sender as System.Windows.Documents.Hyperlink).NavigateUri.ToString()));
}
}
private string GenerateURL()
@@ -144,6 +154,57 @@ namespace BeWo.View.Report.Rating
return url;
}
private string GenerateURLForAllSupportConcepts()
{
string url = "";
url += BeWoApp.SiteOfOrigin + "/ReportView.aspx?";
DateTime? start = SupportConceptRatingView.StartDate;
DateTime? end = SupportConceptRatingView.EndDate;
try
{
// Ist das Häkchen für den gesamten Zeitraum gesetzt, werden auf dem Server Start und Ende auf den ersten bzw. letzten Hilfeplan gesetzt
if (chkTotalTimeSpan.IsChecked == true)
{
SupportConceptRatingView.StartDate = null;
SupportConceptRatingView.EndDate = null;
start = null;
end = null;
}
// Sonst den Wert aus den Datumsfeldern nehmen
else
{
SupportConceptRatingView.StartDate = dp_start.DateTime;
SupportConceptRatingView.EndDate = dp_end.DateTime;
start = dp_start.DateTime;
end = dp_end.DateTime;
}
}
catch
{
// nix
}
if (start != null)
{
url += "&start=" + start;
}
if (end != null)
{
url += "&end=" + end;
}
url += "&type=" + Utils.EnumName(ReportTypes.BewertungsstatistikReport);
url = BeWoWpfUtils.GetHTMLEncodedURL(url);
this.linkPdfExport.NavigateUri = new Uri(url);
return url;
}
private void UpdateRatingView()
{
VMFactory.CreateSupportConceptVMAsync(_SelectedSupportConcept.SupportConceptOid,
@@ -177,7 +238,21 @@ namespace BeWo.View.Report.Rating
}
private void chkAllSupportConcepts_Checked(object sender, RoutedEventArgs e)
{
button_generate.Visibility = Visibility.Hidden;
popupedit_CostBeaerer.Visibility = Visibility.Hidden;
BorderRatingView.Visibility = Visibility.Hidden;
textblockHilfeplan.Visibility = Visibility.Hidden;
GenerateURLForAllSupportConcepts();
}
private void chkAllSupportConcepts_Unchecked(object sender, RoutedEventArgs e)
{
button_generate.Visibility = Visibility.Visible;
popupedit_CostBeaerer.Visibility = Visibility.Visible;
textblockHilfeplan.Visibility = Visibility.Visible;
}
}
}

View File

@@ -587,12 +587,18 @@ namespace Host
supportConcept = MapperFactory.SupportConceptDC_SupportConcept.MapToNewDC(DAOFactory.GenericDAO.GetByID<SupportConcept>(long.Parse(Request.Params["scOid"])));
if (Request.Params["start"] != null)
start = DateTime.Parse(Request.Params["start"]);
else
else if (supportConcept != null)
start = supportConcept.Ratings[0].StartDate;
else
start = null;
if (Request.Params["end"] != null)
end = DateTime.Parse(Request.Params["end"]);
else
else if (supportConcept != null)
end = supportConcept.Ratings[supportConcept.Ratings.Count - 1].StartDate;
else
end = null;
if (Request.Params["ze"] != null)
inclZeiterfassung = (Request.Params["ze"] == "1") ? true : false;
if (Request.Params["goals"] != null)

View File

@@ -972,10 +972,20 @@ namespace BeWo.Report
public override XtraReport CreateBewertungsstatistikReport(DateTime? start, DateTime? end, SupportConceptDC supportConcept, bool inclZeiterfassung, List<ValueListEntryDC> ziele, List<RatingDC> scZiele)
{
var report = FindReportImp<BewertungsstatistikRO>();
report.SetReportDataSource(BewertungsstatistikRO.Create(start, end, supportConcept, inclZeiterfassung, ziele, scZiele));
return report as XtraReport;
// Ist kein Hilfeplan gesetzt, wird die Tabelle für die Auswertung aller Bewertungen in einem Zeitraum gebaut
if (supportConcept == null)
{
var report = new Bewertungsstatistik();
report.SetReportDataSource(BewertungsstatistikRO.Create(start, end, supportConcept, inclZeiterfassung, null, null));
return report as XtraReport;
}
// Ist der Hilfeplan als Parameter gesetzt, Bericht für einen HP erstellen
else
{
var report = FindReportImp<BewertungsstatistikRO>();
report.SetReportDataSource(BewertungsstatistikRO.Create(start, end, supportConcept, inclZeiterfassung, ziele, scZiele));
return report as XtraReport;
}
}
public override XtraReport CreateCustomReport(long employeeOid, String reportName)

View File

@@ -53,12 +53,36 @@ namespace BeWo.Report.ReportObjects
result.StartDay = start;
result.EndDay = end;
// Ist kein Hilfeplan gesetzt und die Listen null, dann wird für ALLE Hilfepläne erstellt
if (supportConcept == null && ausgewaehlteZiele == null && scZiele == null)
{
// Hier neu
// In diesem Dictionary wird jeder Benotung aus der Verwaltung die vergebene Menge im Zeitraum zugeordnet
Dictionary<string, decimal> ratingTypeZuAnzahl = new Dictionary<string, decimal>();
// Zuerst alle GoalRating holen und in ein Dict packen, damit man schon mal nach der Bewertung sortiert hat
var allGoalRatings = MapperFactory.GoalRatingDC_GoalRating.MapToNewDCs(DAOFactory.GenericDAO.GetAllActive<GoalRating>());
// Alle Ratings (Hilfeplanbewertungen) holen, die (im gewählten Zeitraum) gemacht wurden, und nachfolgend nur die GoalRatings (einzelne Zielbewertungen)
// ins Dict holen, deren RatingOid hier drin sind
List<RatingDC> allRatings = new List<RatingDC>();
if (start != null && end != null)
allRatings = MapperFactory.RatingDC_Rating.MapToNewDCs(DAOFactory.GenericDAO.GetAllActive<Rating>())
.Where(r => r.StartDate >= start && r.StartDate <= end).ToList();
else
allRatings = MapperFactory.RatingDC_Rating.MapToNewDCs(DAOFactory.GenericDAO.GetAllActive<Rating>());
// Wurde in der RatingReportView kein Start- und Enddatum angegeben, dann hier die neuste und die älteste Bewertung als Datum setzen
if (start == null && end == null && allRatings != null && allRatings.Count > 0)
{
allRatings = allRatings.OrderBy(r => r.StartDate).ToList();
result.StartDay = allRatings[0].StartDate;
result.EndDay = allRatings[allRatings.Count - 1].StartDate;
}
// Zuerst GoalRatings (einzelne Zielbewertungen) aus Hilfeplanbewertungen in Liste packen
List<GoalRatingDC> allGoalRatings = new List<GoalRatingDC>();
foreach (var rating in allRatings)
foreach (var goalRating in rating.GoalRatingList)
allGoalRatings.Add(goalRating);
// Dann in oben genanntes Dictionary packen, um nach Bewertung zu gruppieren und die Anzahl der vergebenen Bewertung zu zählen
foreach (var rating in allGoalRatings)
{
if (!ratingTypeZuAnzahl.ContainsKey(rating.RatingType.DisplayName))
@@ -67,8 +91,10 @@ namespace BeWo.Report.ReportObjects
ratingTypeZuAnzahl[rating.RatingType.DisplayName]++;
}
// Gesamte Anzahl an Bewertungen im Zeitraum ausrechnen
decimal gesamt = ratingTypeZuAnzahl.Sum(r => r.Value);
// Für jede Benotung, die vergeben wurde, eine Spalte erstellen mit Name, Anzahl und %
foreach (var pair in ratingTypeZuAnzahl)
{
result.Wirkungskontolle.Add(new Wirkungskontrolle()
@@ -79,6 +105,7 @@ namespace BeWo.Report.ReportObjects
});
}
}
// Ist SupportConcept gesetzt, nur für einen Hilfeplan Auswertung erstellen
else
{
result.ZeiterfassungEinbinden = inclZeiterfassung;
@@ -121,37 +148,6 @@ namespace BeWo.Report.ReportObjects
datensatz.GesamtzeitInvestiert = 0;
datensatz.BewertungsstatistikZielDetailList = new List<BewertungsstatistikZielDetail>();
//foreach (var sr in serviceRecords)
//{
// var detail = new BewertungsstatistikZielDetail();
// foreach (var item in passendeZielBewertungen)
// {
// if (item.GoalEntry.ValueListEntryOid == ziel.ValueListEntryOid)
// {
// if (item.ServiceRecord.ServiceRecordOid == sr.Oid && item.GoalRatingOid == null && item.RatingType?.RatingId != null)
// {
// if (item.ServiceRecord.Start >= start && item.ServiceRecord.Start <= end)
// {
// detail.Note = item.RatingType.RatingId.Value;
// anzahl++; // Zähler für Schnittberechnung
// detail.MinutenInvestiert = sr.DurationMinutes;
// detail.Datum = sr.Start;
// passendeZielBewertungen.Remove(item);
// break;
// }
// }
// }
// }
// if (detail.MinutenInvestiert != 0)
// {
// datensatz.GesamtzeitInvestiert += detail.MinutenInvestiert;
// datensatz.Durchschnitt += detail.Note;
// }
// if (detail.Datum != null)
// datensatz.BewertungsstatistikZielDetailList.Add(detail);
//}
foreach (var item in passendeZielBewertungen)
{
@@ -173,7 +169,6 @@ namespace BeWo.Report.ReportObjects
datensatz.BewertungsstatistikZielDetailList.Add(detail);
}
//}
}
datensatz.Durchschnitt /= anzahl;