103 lines
3.7 KiB
C#
103 lines
3.7 KiB
C#
using System;
|
|
using System.Drawing;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Text;
|
|
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using DevExpress.XtraReports.UI;
|
|
using BeWo.Report.ReportObjects;
|
|
using BeWo.Report;
|
|
using BS.Shared.DataContracts;
|
|
using BS.Shared.Extensions;
|
|
using System.Text.RegularExpressions;
|
|
|
|
namespace BeWo.DieWohnhelfer.Neu
|
|
{
|
|
public partial class Spitzabrechnung : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<Settlement2RO>
|
|
{
|
|
public Spitzabrechnung()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(Settlement2RO pRO)
|
|
{
|
|
bool hasRatefactor = false;
|
|
|
|
if (!String.IsNullOrWhiteSpace(pRO.RateFactorText2))
|
|
{
|
|
hasRatefactor = true;
|
|
}
|
|
|
|
if (pRO.InvoiceItems != null)
|
|
{
|
|
foreach (var ii in pRO.InvoiceItems)
|
|
{
|
|
ii.ItemDescription = "Fachleistungen";
|
|
ii.DetailDescription = String.Format("Fachleistungen ab {0:dd.MM.yyyy} bis {1:dd.MM.yyyy}: {2:0.##} Stunden x {3:c} = {4:c}",
|
|
ii.PeriodStartDate, ii.PeriodEndDate, ii.UnitCount, ii.AmountPerUnit, ii.GrossAmountTotal);
|
|
|
|
if (!pRO.FehlkontakteString.IsNullOrEmpty() && ii.RateFactor == 0)
|
|
{
|
|
Zwischensumme.Visible = true;
|
|
ii.ItemDescription = "Fehlkontakte";
|
|
ii.DetailDescription = Regex.Replace(ii.DetailDescription, "Fachleistungen", "Fehlkontakte");
|
|
}
|
|
}
|
|
}
|
|
|
|
decimal total = 0;
|
|
decimal flsTotal = 0;
|
|
if (pRO.InvoiceItems != null)
|
|
{
|
|
foreach (var ii in pRO.InvoiceItems)
|
|
{
|
|
total += ii.GrossAmountTotal ?? 0;
|
|
flsTotal += ii.UnitCount ?? 0;
|
|
}
|
|
}
|
|
lblGesamtanspruch.Text = String.Format("Summe des resultierenden Gesamtanspruchs: {0:c}", total);
|
|
lblFlsInsgesamt.Text = String.Format("FLS insgesamt geleistet: {0:0.##} Stunden", flsTotal);
|
|
|
|
if (String.IsNullOrEmpty(pRO.AbsenceTimes))
|
|
{
|
|
pRO.AbsenceTimes = "keine";
|
|
}
|
|
else
|
|
{
|
|
StringBuilder sb = new StringBuilder();
|
|
if (pRO.AbsenceStartDate1.HasValue)
|
|
{
|
|
sb.Append(String.Format("{0:dd.MM.yyyy} - {1}", pRO.AbsenceStartDate1, GetAbsenceEndDate(pRO.AbsenceEndDate1)));
|
|
}
|
|
if (pRO.AbsenceStartDate2.HasValue)
|
|
{
|
|
sb.Append(String.Format(", {0:dd.MM.yyyy} - {1}", pRO.AbsenceStartDate2, GetAbsenceEndDate(pRO.AbsenceEndDate2)));
|
|
}
|
|
if (pRO.AbsenceStartDate3.HasValue)
|
|
{
|
|
sb.Append(String.Format(", {0:dd.MM.yyyy} - {1}", pRO.AbsenceStartDate3, GetAbsenceEndDate(pRO.AbsenceEndDate3)));
|
|
}
|
|
if (pRO.AbsenceStartDate4.HasValue)
|
|
{
|
|
sb.Append(String.Format(", {0:dd.MM.yyyy} - {1}", pRO.AbsenceStartDate4, GetAbsenceEndDate(pRO.AbsenceEndDate4)));
|
|
}
|
|
pRO.AbsenceTimes = sb.ToString();
|
|
}
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
|
|
private String GetAbsenceEndDate(DateTime? dt)
|
|
{
|
|
if (dt.HasValue)
|
|
{
|
|
return String.Format("{0:dd.MM.yyyy}", dt);
|
|
}
|
|
return "unbekannt";
|
|
}
|
|
|
|
}
|
|
}
|