Files
BeWoPlaner/ReportImp/Intego/Assistenzabrechnung.cs

71 lines
2.9 KiB
C#

using System;
using System.Text;
using BeWo.Data.Access;
using BeWo.Data.Entities;
using BeWo.Report.ReportObjects;
using DevExpress.XtraReports.UI;
namespace BeWo.Report.DefaultReports
{
public partial class Assistenzabrechnung : XtraReport, IBeWoReport<ServiceInvoiceRO>
{
public Assistenzabrechnung()
{
this.InitializeComponent();
}
public void SetReportDataSource(ServiceInvoiceRO pRO)
{
DateTime start = pRO.AccountingPeriodStart;
DateTime end = pRO.AccountingPeriodEnd;
if (pRO.ServiceInvoicePeriods != null && pRO.ServiceInvoicePeriods.Count > 0)
{
if (pRO.ServiceInvoicePeriods[0].CostBearer2SupportConcept.SupportConcept.ApprovalDate.HasValue)
lblBewilligungsbescheid.Text = string.Format("{0:dd.MM.yyyy}", pRO.ServiceInvoicePeriods[0].CostBearer2SupportConcept.SupportConcept.ApprovalDate);
lblBewilligtVon.Text = pRO.ServiceInvoicePeriods[0].SupportConceptApprovalPeriod.StartDate.HasValue ? string.Format("{0:dd.MM.yyyy}", pRO.ServiceInvoicePeriods[0].SupportConceptApprovalPeriod.StartDate.Value) : "";
lblBewilligtBis.Text = pRO.ServiceInvoicePeriods[pRO.ServiceInvoicePeriods.Count - 1].SupportConceptApprovalPeriod.EndDate.HasValue ? string.Format("{0:dd.MM.yyyy}", pRO.ServiceInvoicePeriods[0].SupportConceptApprovalPeriod.EndDate.Value) : "";
}
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();
}
}
}