Files
BeWoPlaner/ReportImp/LyvieKupfer/CollectiveBillingReport.cs

91 lines
3.3 KiB
C#
Raw Permalink Normal View History

using System;
using System.Text;
using BeWo.Report;
using BeWo.Report.ReportObjects;
using BS.Shared.Core;
using DevExpress.XtraReports.UI;
namespace LyvieKupfer
{
[IDSpecificClass(Identifier = "Sammelrechnung")]
public partial class Sammelrechnung : XtraReport, IBeWoReport<ServiceInvoiceRO>
{
public Sammelrechnung()
{
this.InitializeComponent();
}
// F<>r die Erstgespr<70>che legt sie einen komplett leeren Hilfeplan an und kann die Beratung ganz separat irgendwelcher Bewilligungen abrechnen
// Also alle Hilfen mit Bewilligungsdaten etc entfernt
public void SetReportDataSource(ServiceInvoiceRO pRO)
{
DateTime start = pRO.AccountingPeriodStart;
DateTime end = pRO.AccountingPeriodEnd;
decimal hours = 0;
if (pRO.ServiceInvoicePeriods != null)
{
foreach (var sip in pRO.ServiceInvoicePeriods)
{
if (sip.ServiceInvoiceItems != null)
{
foreach (var ii in sip.ServiceInvoiceItems)
{
hours += ii.Hours.Value;
}
}
}
}
lblAbrechnungszeitraum.Text = String.Format("F<>r den Zeitraum vom {0:d. MMMM yyyy} bis zum {1:dd. MMMM yyyy} berechne ich Ihnen {2:0.##} Stunden " +
"heilp<6C>dagogische Leistungen f<>r die Erstgespr<70>che.", start, end, hours);
SetzeAdresse(pRO);
this.bindingSource1.DataSource = pRO;
}
private void SetzeAdresse(ServiceInvoiceRO pRO)
{
StringBuilder sb = new StringBuilder();
if (!String.IsNullOrEmpty(pRO.RecipientOrganisation) && pRO.RecipientOrganisation.ToLower() != "selbstzahler")
{
if (pRO.RecipientOrganisation.Contains("Erstkontakt Landratsamt"))
{
pRO.RecipientOrganisation = "Landratsamt Bodenseekreis";
}
sb.AppendLine(pRO.RecipientOrganisation);
}
//if (!String.IsNullOrEmpty(pRO.RecipientAddressLine1))
//{
// sb.AppendLine(pRO.RecipientAddressLine1);
//}
if (!String.IsNullOrEmpty(pRO.RecipientContactPerson))
{
sb.AppendLine(pRO.RecipientContactPerson);
}
if (!String.IsNullOrEmpty(pRO.RecipientDivision) && !String.IsNullOrEmpty(pRO.RecipientOrganisation) && pRO.RecipientOrganisation.ToLower() != "selbstzahler")
{
sb.AppendLine(pRO.RecipientDivision);
}
if (!String.IsNullOrEmpty(pRO.RecipientPoBox))
{
sb.AppendLine(pRO.RecipientPoBox);
}
else if (!String.IsNullOrEmpty(pRO.RecipientStreet))
{
sb.AppendLine(pRO.RecipientStreet);
}
if (!String.IsNullOrEmpty(pRO.RecipientPostCodeAndTown))
{
sb.AppendLine(pRO.RecipientPostCodeAndTown);
}
lblAdresse.Text = sb.ToString();
}
private void ChangeName(object sender, EventArgs e)
{
PrintingSystem.Document.Name = String.Format("{0}", lblRechnungstext.Text);
}
}
}