Files
BeWoPlaner/ReportImp/ASBBergischGladbachReports/ServicesOverviewReportAlt.cs
2017-06-11 16:01:01 +02:00

188 lines
5.3 KiB
C#

using System;
using System.Collections;
using System.ComponentModel;
using System.Text;
using System.Windows.Forms;
using BeWo.Report.ReportObjects;
using BeWo.Report;
using System.Collections.Generic;
namespace BeWo.ASBBergischGladbachReports
{
public partial class StundenzettelAlt : DevExpress.XtraReports.UI.XtraReport//, IBeWoReport<ServicesOverviewRO>
{
public StundenzettelAlt()
{
InitializeComponent();
}
public void SetReportDataSource(ServicesOverviewRO pRO)
{
if (pRO.Services != null)
{
List<ServicesOverviewRO.ServiceDetail> servicesBillable = new List<ServicesOverviewRO.ServiceDetail>();
foreach (ServicesOverviewRO.ServiceDetail s in pRO.Services)
{
if (s.IsBillable)
servicesBillable.Add(s);
}
pRO.Services = servicesBillable;
Dictionary<int, double> minutesPerDay = new Dictionary<int, double>();
Dictionary<int, string> day2ServiceDescription = new Dictionary<int, string>();
foreach (var sd in pRO.Services)
{
if (minutesPerDay.ContainsKey(sd.StartDate.Day))
minutesPerDay[sd.StartDate.Day] += sd.Minutes;
else
minutesPerDay[sd.StartDate.Day] = sd.Minutes;
if (!day2ServiceDescription.ContainsKey(sd.StartDate.Day))
day2ServiceDescription[sd.StartDate.Day] = sd.ServiceDescription;
}
foreach (var key in minutesPerDay.Keys)
{
String text = day2ServiceDescription[key];
double minutes = minutesPerDay[key];
switch (key)
{
case 1:
cellLeistung1.Text = text;
cellMinutes1.Text = String.Format("{0}", minutesPerDay[key]);
break;
case 2:
cellLeistung2.Text = text;
cellMinutes2.Text = String.Format("{0}", minutes);
break;
case 3:
cellLeistung3.Text = text;
cellMinutes3.Text = String.Format("{0}", minutes);
break;
case 4:
cellLeistung4.Text = text;
cellMinutes4.Text = String.Format("{0}", minutes);
break;
case 5:
cellLeistung5.Text = text;
cellMinutes5.Text = String.Format("{0}", minutes);
break;
case 6:
cellLeistung6.Text = text;
cellMinutes6.Text = String.Format("{0}", minutes);
break;
case 7:
cellLeistung7.Text = text;
cellMinutes7.Text = String.Format("{0}", minutes);
break;
case 8:
cellLeistung8.Text = text;
cellMinutes8.Text = String.Format("{0}", minutes);
break;
case 9:
cellLeistung9.Text = text;
cellMinutes9.Text = String.Format("{0}", minutes);
break;
case 10:
cellLeistung10.Text = text;
cellMinutes10.Text = String.Format("{0}", minutes);
break;
case 11:
cellLeistung11.Text = text;
cellMinutes11.Text = String.Format("{0}", minutes);
break;
case 12:
cellLeistung12.Text = text;
cellMinutes12.Text = String.Format("{0}", minutes);
break;
case 13:
cellLeistung13.Text = text;
cellMinutes13.Text = String.Format("{0}", minutes);
break;
case 14:
cellLeistung14.Text = text;
cellMinutes14.Text = String.Format("{0}", minutes);
break;
case 15:
cellLeistung15.Text = text;
cellMinutes15.Text = String.Format("{0}", minutes);
break;
case 16:
cellLeistung16.Text = text;
cellMinutes16.Text = String.Format("{0}", minutes);
break;
case 17:
cellLeistung17.Text = text;
cellMinutes17.Text = String.Format("{0}", minutes);
break;
case 18:
cellLeistung18.Text = text;
cellMinutes18.Text = String.Format("{0}", minutes);
break;
case 19:
cellLeistung19.Text = text;
cellMinutes19.Text = String.Format("{0}", minutes);
break;
case 20:
cellLeistung20.Text = text;
cellMinutes20.Text = String.Format("{0}", minutes);
break;
case 21:
cellLeistung21.Text = text;
cellMinutes21.Text = String.Format("{0}", minutes);
break;
case 22:
cellLeistung22.Text = text;
cellMinutes22.Text = String.Format("{0}", minutes);
break;
case 23:
cellLeistung23.Text = text;
cellMinutes23.Text = String.Format("{0}", minutes);
break;
case 24:
cellLeistung24.Text = text;
cellMinutes24.Text = String.Format("{0}", minutes);
break;
case 25:
cellLeistung25.Text = text;
cellMinutes25.Text = String.Format("{0}", minutes);
break;
case 26:
cellLeistung26.Text = text;
cellMinutes26.Text = String.Format("{0}", minutes);
break;
case 27:
cellLeistung27.Text = text;
cellMinutes27.Text = String.Format("{0}", minutes);
break;
case 28:
cellLeistung28.Text = text;
cellMinutes28.Text = String.Format("{0}", minutes);
break;
case 29:
cellLeistung29.Text = text;
cellMinutes29.Text = String.Format("{0}", minutes);
break;
case 30:
cellLeistung30.Text = text;
cellMinutes30.Text = String.Format("{0}", minutes);
break;
case 31:
cellLeistung31.Text = text;
cellMinutes31.Text = String.Format("{0}", minutes);
break;
}
}
}
this.bindingSource1.DataSource = pRO;
}
}
}