Files
BeWoPlaner/ReportImp/Kette2/ServicesOverviewReport.cs
2021-05-24 21:40:02 +02:00

87 lines
2.5 KiB
C#

using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using BeWo.Report.ReportObjects;
using BeWo.Report;
namespace BeWo.KetteReports
{
public partial class Stundenzettel : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<ServicesOverviewRO>
{
public Stundenzettel()
{
InitializeComponent();
}
public void SetReportDataSource(ServicesOverviewRO pRO)
{
pRO.CalculateFLSSollIst();
String adresse = GetCustomerAdresse(pRO);
bool hatGruppen = false;
if (pRO.Services != null)
{
List<ServicesOverviewRO.ServiceDetail> servicesBillable = new List<ServicesOverviewRO.ServiceDetail>();
foreach (var sd in pRO.Services)
{
if (sd.IsBillable)
{
servicesBillable.Add(sd);
sd.Notice5 = "";
if (sd.IsGroup)
{
sd.Notice5 = String.Format("{0} Teilnehmer", sd.CustomerCount);
hatGruppen = true;
}
if (String.IsNullOrEmpty(sd.Notice3))
{
sd.Notice3 = adresse;
}
}
}
pRO.Services = servicesBillable;
}
if (String.IsNullOrWhiteSpace(pRO.AbsenceTimes))
{
chkKeineKrankenhaus.Checked = true;
}
if (!hatGruppen)
{
chkKeineGruppen.Checked = true;
}
this.bindingSource1.DataSource = pRO;
}
private string GetCustomerAdresse(ServicesOverviewRO ro)
{
StringBuilder adresse = new StringBuilder();
if (ro.CostBearer2SupportConceptList != null && ro.CostBearer2SupportConceptList.Count > 0)
{
var c = ro.CostBearer2SupportConceptList[0].SupportConcept.Customer;
if (c.Person.Address != null)
{
adresse.Append(String.Format("{0} {1}", c.Person.Address.PostalCode, c.Person.Address.Town));
if (adresse.Length > 0)
{
adresse.Append(", ");
}
adresse.Append(c.Person.Address.Street);
}
}
return adresse.ToString();
}
}
}