89 lines
3.2 KiB
C#
89 lines
3.2 KiB
C#
using System;
|
|
using System.Text;
|
|
using BeWo.Report;
|
|
using BeWo.Report.ReportObjects;
|
|
|
|
using DevExpress.XtraReports.UI;
|
|
|
|
namespace LyvieKupfer
|
|
{
|
|
public partial class ServiceInvoiceReport : XtraReport, IBeWoReport<ServiceInvoiceRO>
|
|
{
|
|
public ServiceInvoiceReport()
|
|
{
|
|
this.InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(ServiceInvoiceRO pRO)
|
|
{
|
|
// die rechnen in Fördereinheiten aka 45 Minuten ab
|
|
DateTime start = pRO.AccountingPeriodStart;
|
|
DateTime end = pRO.AccountingPeriodEnd;
|
|
decimal hours = 0;
|
|
decimal rateFactor = 1.3333m;
|
|
|
|
if (pRO.ServiceInvoicePeriods != null)
|
|
{
|
|
foreach (var sip in pRO.ServiceInvoicePeriods)
|
|
{
|
|
if (sip.ServiceInvoiceItems != null)
|
|
{
|
|
foreach (var ii in sip.ServiceInvoiceItems)
|
|
{
|
|
var u = ii.Hours ?? 0;
|
|
u *= rateFactor;
|
|
ii.UnitCountString = Math.Round(u, 2, MidpointRounding.AwayFromZero).ToString();
|
|
hours += u;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
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ädagogische Leistungen für die Frühförderung für das Kind {3}, {4}.", start, end, hours, pRO.CustomerLastName, pRO.CustomerFirstName);
|
|
|
|
SetzeAdresse(pRO);
|
|
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
|
|
private void SetzeAdresse(ServiceInvoiceRO pRO)
|
|
{
|
|
StringBuilder sb = new StringBuilder();
|
|
if (!String.IsNullOrEmpty(pRO.RecipientOrganisation) && pRO.RecipientOrganisation.ToLower() != "selbstzahler")
|
|
{
|
|
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);
|
|
}
|
|
}
|
|
} |