Files
BeWoPlaner/ReportImp/BeWoKerpen/ServicesOverviewReport.cs
2016-06-27 01:45:38 +02:00

74 lines
1.8 KiB
C#

using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using BeWo.Data.Entities;
using DevExpress.XtraReports.UI;
using DevExpress.XtraReports.UI;
using BeWo.Report.ReportObjects;
using BeWo.Report;
using System.Collections.Generic;
namespace BeWoKerpen
{
public partial class Stundenzettel : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<ServicesOverviewRO>
{
public Stundenzettel()
{
InitializeComponent();
}
public void SetReportDataSource(ServicesOverviewRO pRO)
{
if (pRO.Services != null)
{
var servicesBillable = new List<ServicesOverviewRO.ServiceDetail>();
foreach (ServicesOverviewRO.ServiceDetail s in pRO.Services)
{
if (s.IsBillable)
servicesBillable.Add(s);
}
pRO.Services = servicesBillable;
}
var sb = new StringBuilder();
var org = GetOrganisation(pRO);
if (org != null)
{
sb.AppendLine(org.Name);
sb.AppendLine("");
if (org.Address != null)
{
sb.AppendLine(org.Address.Street);
sb.AppendLine("");
sb.Append(org.Address.PostalCode);
sb.Append(" ");
sb.Append(org.Address.Town);
}
}
lblAnschrift.Text = sb.ToString();
this.bindingSource1.DataSource = pRO;
}
private Organisation GetOrganisation(ServicesOverviewRO pRO)
{
if (pRO.CostBearer2SupportConceptList != null && pRO.CostBearer2SupportConceptList.Count > 0)
{
var c2s = pRO.CostBearer2SupportConceptList[0];
return c2s.CostBearer.Organisation;
}
return null;
}
}
}