101 lines
3.0 KiB
C#
101 lines
3.0 KiB
C#
using System;
|
|
using BeWo.Report.ReportObjects;
|
|
using BS.Shared.Core;
|
|
using System.Data;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using BeWo.Report;
|
|
|
|
namespace FrauenhausEWFRA
|
|
{
|
|
public partial class JahresReport : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<JahresReportRO>
|
|
{
|
|
|
|
|
|
public JahresReport()
|
|
{
|
|
InitializeComponent();
|
|
|
|
}
|
|
|
|
public void SetReportDataSource(JahresReportRO pRO)
|
|
{
|
|
JahresReportRO b = new JahresReportRO();
|
|
//b.CreateReport(pRO);
|
|
|
|
JoinCustomerNames(pRO);
|
|
|
|
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
|
|
private void JoinCustomerNames(JahresReportRO pRO)
|
|
{
|
|
foreach (var tab in pRO.JahresReportTabelleList)
|
|
{
|
|
bool join = true;
|
|
|
|
foreach (var item in tab.JahresReportDetailList)
|
|
{
|
|
if (item.Name.Contains(String.Format("{0:yyyy}", pRO.ReportStartDate)))
|
|
{
|
|
join = false; // Vereine die Klientennamen nur bei den Berichten, die nicht pro Jahr ausgewertet werden
|
|
}
|
|
}
|
|
|
|
if (join)
|
|
{
|
|
var allCustomerNames = new List<String>();
|
|
foreach (var item in tab.JahresReportDetailList)
|
|
{
|
|
foreach (var name in item.CustomerNames)
|
|
{
|
|
if (!allCustomerNames.Contains(name))
|
|
{
|
|
allCustomerNames.Add(name);
|
|
}
|
|
}
|
|
|
|
}
|
|
var sorted = allCustomerNames.OrderBy(a => a).ToList();
|
|
|
|
String names = "";
|
|
foreach (var name in sorted)
|
|
{
|
|
if (names.Length > 0)
|
|
{
|
|
names += "; ";
|
|
}
|
|
names += name;
|
|
}
|
|
foreach (var item in tab.JahresReportDetailList)
|
|
{
|
|
item.CustomerNames = sorted;
|
|
item.AllCustomerString = names;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
/*private DataTable CreateChartData() {
|
|
// Create an empty table.
|
|
DataTable table = new DataTable("Table1");
|
|
|
|
// Add three columns to the table.
|
|
table.Columns.Add("Anzahl", typeof(Int32));
|
|
table.Columns.Add("Weiblich", typeof(Int32));
|
|
table.Columns.Add("Männlich", typeof(Int32));
|
|
|
|
// Add data rows to the table.
|
|
table.Rows.Add(new object[] { "1", "Section1", 10 });
|
|
table.Rows.Add(new object[] { "2", "Section2", 20 });
|
|
table.Rows.Add(new object[] { "3", "Section1", 20 });
|
|
table.Rows.Add(new object[] { "4", "Section2", 30 });
|
|
table.Rows.Add(new object[] { "5", "Section1", 15 });
|
|
table.Rows.Add(new object[] { "6", "Section2", 25 });
|
|
|
|
return table;
|
|
}*/
|
|
|
|
}
|
|
}
|