148 lines
6.1 KiB
C#
148 lines
6.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using BeWo.Service.Reporting.Straffaelligenhilfe;
|
|
using DevExpress.XtraReports.UI;
|
|
|
|
namespace BeWo.Report.DefaultReports.Straffaelligenhilfe
|
|
{
|
|
/// <summary>
|
|
/// XtraReport für die "Statistik der Treuhänderischen Geldverwaltung (TGV)" (V 2014.1).
|
|
///
|
|
/// Verwendung:
|
|
/// var rows = TgvStatistikReport.CreateRows(tgv);
|
|
/// var report = new TgvStatistikReport();
|
|
/// report.Parameters["Vermittlungsstelle"].Value = "Musterstadt";
|
|
/// report.Parameters["Staatsanwaltschaft"].Value = "GESAMT";
|
|
/// report.Parameters["Berichtszeitraum"].Value = new DateTime(2025, 6, 30);
|
|
/// report.SetReportDataSource(rows);
|
|
/// report.ShowPreview();
|
|
/// </summary>
|
|
public partial class TgvStatistikReport : XtraReport
|
|
{
|
|
public TgvStatistikReport()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Setzt die Datenquelle des Reports.
|
|
/// </summary>
|
|
public void SetReportDataSource(TgvStatistic statistik)
|
|
{
|
|
lblBerichtszeitraum.Text = String.Format("{0:dd.MM.yyyy}-{1:dd.MM.yyyy}", statistik.StartDate, statistik.EndDate);
|
|
this.bindingSource1.DataSource = CreateRows(statistik);
|
|
}
|
|
|
|
// ── Factory ─────────────────────────────────────────────────────────────
|
|
|
|
/// <summary>
|
|
/// Konvertiert ein ausgefülltes TgvStatistic-Objekt in die Zeilenliste für den Report.
|
|
/// </summary>
|
|
public static List<TgvStatistikReportRow> CreateRows(TgvStatistic tgv)
|
|
{
|
|
TgvStatistikReportRow Row(string pos, string beschr, string wert,
|
|
TgvReportRowType type = TgvReportRowType.Normal) =>
|
|
new TgvStatistikReportRow
|
|
{
|
|
Position = pos,
|
|
Beschreibung = beschr,
|
|
Wert = wert,
|
|
RowType = type
|
|
};
|
|
|
|
TgvStatistikReportRow RowInt(string pos, string beschr, int val,
|
|
TgvReportRowType type = TgvReportRowType.Normal) =>
|
|
Row(pos, beschr, val.ToString("N0"), type);
|
|
|
|
return new List<TgvStatistikReportRow>
|
|
{
|
|
// ── Auftragsbestand ────────────────────────────────────────────
|
|
RowInt("0.1",
|
|
"Anzahl der aus dem vorhergehenden Berichtszeitraum übernommenen offenen Aufträge",
|
|
tgv.AnzahlAlt),
|
|
|
|
RowInt("0.2",
|
|
"Anzahl der im aktuellen Berichtszeitraum erteilten Aufträge",
|
|
tgv.AnzahlNeu, TgvReportRowType.Highlighted),
|
|
|
|
RowInt("1.",
|
|
"Anzahl der insges. erteilten Aufträge (Summe Zeilen 0.1 + 0.2)",
|
|
tgv.AnzahlInsgesamt, TgvReportRowType.Highlighted),
|
|
|
|
Row("2.",
|
|
"Höhe der Geldstrafe in € (gem. Zeile 0.2)",
|
|
tgv.Betrag2.ToString("N2"), TgvReportRowType.Highlighted),
|
|
|
|
// ── Erledigte Aufträge ─────────────────────────────────────────
|
|
RowInt("3.",
|
|
"Anzahl aller erledigten Aufträge",
|
|
tgv.Anzahl3),
|
|
|
|
RowInt("3.1.",
|
|
"davon Anzahl der gescheiterten Fälle",
|
|
tgv.Anzahl3_1),
|
|
|
|
RowInt("3.2.",
|
|
"davon Anzahl der positiv erledigten Aufträge",
|
|
tgv.Anzahl3_2, TgvReportRowType.Highlighted),
|
|
|
|
// ── Zahlungen und Arbeitsstunden (Abschnittsüberschrift) ────────
|
|
TgvStatistikReportRow.SectionHeader(
|
|
"4.",
|
|
"Geleistete Zahlungen und Arbeitsstunden (im Quartal)"),
|
|
|
|
Row("4.1.",
|
|
"Summe der nachgewiesenen (Raten) oder Einmalzahlungen in €",
|
|
tgv.Betrag4_1.ToString("N2")),
|
|
|
|
Row("4.2.",
|
|
"Anzahl der geleisteten Arbeitsstunden (in TGV)",
|
|
tgv.Anzahl4_2.ToString("N2")),
|
|
|
|
// ── Hafttage / Aufsuchen ───────────────────────────────────────
|
|
Row("5.",
|
|
"Anzahl der vermiedenen Hafttage (nur durch TGV)",
|
|
tgv.Anzahl5.ToString("N2"), TgvReportRowType.Highlighted),
|
|
|
|
RowInt("6.",
|
|
"Klient wurde durch BGBW aufgesucht (gem. Zeile 0.2)",
|
|
tgv.Anzahl6),
|
|
};
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Zeilentyp für die bedingte Formatierung im TGV-Statistik Report.
|
|
/// </summary>
|
|
public enum TgvReportRowType
|
|
{
|
|
Normal = 0,
|
|
Highlighted = 1, // Orangefarbener Hintergrund (z. B. Zeilen 0.2, 1., 2., 3.2., 5.)
|
|
SectionHeader = 2 // Blauer Hintergrund (Abschnittsüberschrift 4.)
|
|
}
|
|
|
|
/// <summary>
|
|
/// Datenmodell für eine Zeile im TGV-Statistik Report.
|
|
/// </summary>
|
|
public class TgvStatistikReportRow
|
|
{
|
|
public string Position { get; set; } = "";
|
|
public string Beschreibung { get; set; } = "";
|
|
public string Wert { get; set; } = "";
|
|
public TgvReportRowType RowType { get; set; } = TgvReportRowType.Normal;
|
|
|
|
/// <summary>
|
|
/// Erstellt eine Abschnittsüberschrift (blauer Hintergrund).
|
|
/// </summary>
|
|
internal static TgvStatistikReportRow SectionHeader(string position, string beschreibung)
|
|
{
|
|
return new TgvStatistikReportRow
|
|
{
|
|
Position = position,
|
|
Beschreibung = beschreibung,
|
|
RowType = TgvReportRowType.SectionHeader
|
|
};
|
|
}
|
|
}
|
|
}
|