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

72 lines
2.5 KiB
C#

using System;
using BeWo.Report.ReportObjects;
using BeWo.Report;
using DevExpress.XtraReports.UI;
using BeWo.Data.Entities;
using System.Collections.Generic;
using BeWo.Data.Access;
namespace BeWo.SelwoReports
{
public partial class FLSAuswertung : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<FLSReportRO>
{
public FLSAuswertung()
{
InitializeComponent();
}
public void SetReportDataSource(FLSReportRO pRO)
{
if (pRO.GroupTypeHeader == "Kostenträger")
{
XRTableCell cell = new DevExpress.XtraReports.UI.XRTableCell();
this.xrTableRow2.Cells.Add(cell);
cell.Name = "cellKlientHeader";
cell.Text = "Klient/in";
cell.Weight = 1.75;
cell = new DevExpress.XtraReports.UI.XRTableCell();
this.xrTableRow4.Cells.Add(cell);
cell.Name = "cellKlient";
cell.Weight = 1.75;
cell.Font = new System.Drawing.Font("Arial", 9.75F);
cell.StylePriority.UseFont = false;
cell.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] {
new DevExpress.XtraReports.UI.XRBinding("Text", null, "FLSReportGroups.FLSReportDetails.ServiceRecords.CustomValue1")});
cellDoku.Weight = 3;
cellHeaderDoku.Weight = 3;
IList<Customer> customers = DAOFactory.GenericDAO.GetAll<Customer>();
Dictionary<long, Customer> oid2Customer = new Dictionary<long, Customer>();
foreach (var item in customers)
{
oid2Customer.Add(item.Oid.Value, item);
}
foreach (var group in pRO.FLSReportGroups)
{
foreach (var detail in group.FLSReportDetails)
{
foreach (var sr in detail.ServiceRecords)
{
if (sr.CustomerOid.HasValue && oid2Customer.ContainsKey(sr.CustomerOid.Value))
{
Customer c = oid2Customer[sr.CustomerOid.Value];
sr.CustomValue1 = String.Format("{0}, {1}", c.Person.LastName, c.Person.FirstName);
}
}
}
}
}
this.bindingSource1.DataSource = pRO;
}
}
}