Files
2025-02-20 00:20:46 +01:00

120 lines
3.5 KiB
C#

using System;
using System.Text;
using BeWo.Report;
using BeWo.Report.ReportObjects;
using DevExpress.XtraReports.UI;
namespace HphBersenbrueckFreizeitUndReisen
{
public partial class Rechnung : XtraReport, IBeWoReport<ServiceInvoiceRO>
{
public Rechnung()
{
this.InitializeComponent();
}
public void SetReportDataSource(ServiceInvoiceRO pRO)
{
//decimal hourlyRate = 0;
//decimal rateFactor = 1;
//decimal hours = 0;
StringBuilder sb = new StringBuilder();
if (!String.IsNullOrEmpty(pRO.RecipientOrganisation))
{
sb.AppendLine(pRO.RecipientOrganisation);
}
if (!String.IsNullOrEmpty(pRO.RecipientContactPerson))
{
sb.AppendLine(pRO.RecipientContactPerson);
}
if (!String.IsNullOrEmpty(pRO.RecipientDivision))
{
sb.AppendLine(pRO.RecipientDivision);
}
if (!String.IsNullOrEmpty(pRO.RecipientStreet))
{
sb.AppendLine(pRO.RecipientStreet);
}
if (!String.IsNullOrEmpty(pRO.RecipientPostCodeAndTown))
{
sb.AppendLine(pRO.RecipientPostCodeAndTown);
}
lblAdresse.Text = sb.ToString();
String satz = "";
if (pRO.ServiceInvoicePeriods != null && pRO.ServiceInvoicePeriods.Count > 0)
{
foreach (var p in pRO.ServiceInvoicePeriods)
{
if (p.ServiceInvoiceItems != null && p.ServiceInvoiceItems.Count > 0)
{
foreach (var i in p.ServiceInvoiceItems)
{
if (!String.IsNullOrEmpty(i.UnitDescription))
{
if (i.UnitDescription.Contains("45"))
{
satz = "Es handelt sich hierbei um ein Angebot zur Unterstützung im Alltag nach § 45 B SGB XI.";
}
else if (i.UnitDescription.Contains("39"))
{
satz = "Es handelt sich hierbei um ein Betreuungsangebot der Verhinderungspflege nach § 39 SGB XI.";
}
}
if (!String.IsNullOrEmpty(i.ServiceDescription) && i.ServiceDescription.Contains("Betreuungskosten Kurzurlaub"))
{
i.ServiceDescription = i.ServiceDescription.Replace("Betreuungskosten Kurzurlaub", "Betreuungskosten");
}
//if (i.HourlyRate.HasValue)
//{
// hourlyRate = i.HourlyRate.Value;
// if (!String.IsNullOrEmpty(i.RateFactor))
// {
// var rfStr = i.RateFactor.Replace("%", "").Replace(",00", "").Trim();
// int rfInt = 0;
// Int32.TryParse(rfStr, out rfInt);
// rateFactor = (100m + rfInt) / 100m;
// }
//}
//if (i.Hours.HasValue)
// hours += i.Hours.Value;
}
}
}
}
lblAbschlusssatz.Text = satz;
//hours *= rateFactor;
//lblSatz.Text = String.Format("{0:c}", hourlyRate);
//lblAnzahl.Text = String.Format("{0:0.##}", hours);
//lblBetrag.Text = String.Format("{0}", pRO.NetClaim);
//if (!String.IsNullOrEmpty(pRO.CustomerSalutation))
//{
// if (pRO.CustomerSalutation.ToLower() == "frau")
// {
// lblAnrede.Text = String.Format("Sehr geehrte Frau {0}", pRO.CustomerLastName);
// }
// else
// {
// lblAnrede.Text = String.Format("Sehr geehrter Herr {0}", pRO.CustomerLastName);
// }
//}
this.bindingSource1.DataSource = pRO;
}
}
}