70 lines
2.2 KiB
C#
70 lines
2.2 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Linq;
|
|
using DevExpress.XtraReports.UI;
|
|
using BeWo.Report.ReportObjects;
|
|
using BeWo.Report;
|
|
using DevExpress.XtraPrinting;
|
|
|
|
namespace BeWo.LebenshilfeMannheimEV
|
|
{
|
|
public partial class Stundenzettel : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<ServicesOverviewRO>
|
|
{
|
|
public Stundenzettel()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(ServicesOverviewRO pRO)
|
|
{
|
|
Dictionary<String, double> art2FlsDict = new Dictionary<string, double>();
|
|
|
|
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);
|
|
|
|
if (!art2FlsDict.ContainsKey(s.ServiceCategoryAbbr))
|
|
{
|
|
art2FlsDict.Add(s.ServiceCategoryAbbr, 0);
|
|
}
|
|
art2FlsDict[s.ServiceCategoryAbbr] += s.Minutes;
|
|
}
|
|
}
|
|
|
|
pRO.Services = servicesBillable;
|
|
}
|
|
|
|
CreateFlsSummaryTable(art2FlsDict);
|
|
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
|
|
private void CreateFlsSummaryTable(Dictionary<string, double> art2FlsDict)
|
|
{
|
|
foreach (var art in art2FlsDict.Keys.OrderBy(s => s))
|
|
{
|
|
var newRow = tblFlsProArt.InsertRowBelow(rowFlsProArt);
|
|
|
|
newRow.Cells[0].Text = art;
|
|
newRow.Cells[1].Text = String.Format("{0:0.00}", art2FlsDict[art] / 60);
|
|
|
|
newRow.Cells[0].Padding = new PaddingInfo(3, 0, 0, 0);
|
|
newRow.Cells[1].Padding = new PaddingInfo(0, 0, 0, 0);
|
|
|
|
newRow.Cells[0].TextAlignment = TextAlignment.MiddleLeft;
|
|
newRow.Cells[1].TextAlignment = TextAlignment.MiddleCenter;
|
|
}
|
|
|
|
rowFlsProArt.Visible = false;
|
|
}
|
|
}
|
|
}
|