69 lines
1.7 KiB
C#
69 lines
1.7 KiB
C#
using System;
|
|
using BeWo.Report;
|
|
using BeWo.Report.ReportObjects;
|
|
|
|
using DevExpress.XtraReports.UI;
|
|
|
|
namespace ProfEggersStiftung
|
|
{
|
|
public partial class ServiceInvoiceReport : XtraReport, IBeWoReport<ServiceInvoiceRO>
|
|
{
|
|
public ServiceInvoiceReport()
|
|
{
|
|
this.InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(ServiceInvoiceRO pRO)
|
|
{
|
|
DateTime start = pRO.AccountingPeriodStart;
|
|
DateTime end = pRO.AccountingPeriodEnd;
|
|
if (start.Month == end.Month && start.Year == end.Year)
|
|
{
|
|
lblMonat.Text = String.Format("Betreuungskosten {0:MMMM yyyy}", start);
|
|
}
|
|
else
|
|
{
|
|
lblMonat.Text = String.Format("Betreuungskosten {0:MMMM yyyy} - {1:MMMM yyyy}", start, end);
|
|
}
|
|
|
|
|
|
decimal hourlyRate = 0;
|
|
|
|
decimal hours = 0;
|
|
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 (i.HourlyRate.HasValue)
|
|
{
|
|
hourlyRate = i.HourlyRate.Value;
|
|
|
|
}
|
|
|
|
if (i.Hours.HasValue)
|
|
hours += i.Hours.Value;
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if (!String.IsNullOrEmpty(pRO.CustomerSalutation) && pRO.CustomerSalutation.ToLower() == "herr")
|
|
pRO.CustomerSalutation = "Herrn";
|
|
|
|
if (pRO.SenderContactPersonPhone == null)
|
|
{
|
|
pRO.SenderContactPersonPhone = "0201-8953322";
|
|
}
|
|
lblAbrechnungstext.Text = String.Format("{0:0.##} FLS x {1:c} = ", hours, hourlyRate);
|
|
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
}
|
|
} |