Files
BeWoPlaner/ReportImp/BehindertNaUnd/AssistenzRechung.cs

54 lines
1.4 KiB
C#

using System;
using BeWo.Data.Access;
using BeWo.Report;
using BeWo.Report.ReportObjects;
using BeWo.Service.DCEntityMapper;
using BS.Shared;
using BS.Shared.Core;
using BS.Shared.Extensions;
namespace BehindertNaUnd
{
[IDSpecificClass(Identifier = "Assistenz")]
public partial class Rechnung : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<ServiceInvoiceRO>
{
public Rechnung()
{
InitializeComponent();
}
public void SetReportDataSource(ServiceInvoiceRO pRO)
{
DateTime start = pRO.AccountingPeriodStart;
DateTime end = pRO.AccountingPeriodEnd;
decimal hourlyRate = 0;
decimal rateFactor = 1;
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";
lblAbrechnungstext.Text = String.Format("{0:0.##} Stunden x {1:c} = {2}", hours, hourlyRate, pRO.NetClaim);
this.bindingSource1.DataSource = pRO;
}
}
}