108 lines
3.6 KiB
C#
108 lines
3.6 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.ComponentModel;
|
|
using DevExpress.XtraReports.UI;
|
|
using BeWo.Report.ReportObjects;
|
|
using BeWo.Report;
|
|
using System.Collections.Generic;
|
|
|
|
namespace BeWo.FlingernMobilReports
|
|
{
|
|
public partial class Stundenzettel : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<ServicesOverviewRO>
|
|
{
|
|
public Stundenzettel()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(ServicesOverviewRO pRO)
|
|
{
|
|
bool hatGruppen = false;
|
|
|
|
if (pRO.Services != null)
|
|
{
|
|
List<ServicesOverviewRO.ServiceDetail> servicesBillable = new List<ServicesOverviewRO.ServiceDetail>();
|
|
|
|
foreach (ServicesOverviewRO.ServiceDetail sd in pRO.Services)
|
|
{
|
|
if (sd.IsBillable || sd.ServiceDescription.ToLower().Contains("fehlkontakt"))
|
|
{
|
|
sd.Notice5 = "E";
|
|
sd.Notice = String.Format("{0:0.##} min", sd.Minutes);
|
|
|
|
if (sd.IsGroup)
|
|
{
|
|
sd.Notice5 = "GR";
|
|
hatGruppen = true;
|
|
sd.Notice = String.Format("Gruppe/{0:0.##} min/{1} TN", sd.Minutes, sd.CustomerCount);
|
|
}
|
|
else if (sd.ServiceDescription.ToLower().Contains("fehlkontakt"))
|
|
{
|
|
sd.Notice5 = "F";
|
|
}
|
|
|
|
servicesBillable.Add(sd);
|
|
}
|
|
}
|
|
|
|
pRO.TotalFLSQualifiedString = (pRO.TotalFLSoFehlkontakte * 1.2).ToString("F2");
|
|
|
|
pRO.Services = servicesBillable;
|
|
}
|
|
|
|
if (String.IsNullOrWhiteSpace(pRO.AbsenceTimes))
|
|
{
|
|
lblHatAbwesenheiten.Text = "X";
|
|
}
|
|
|
|
if (!hatGruppen)
|
|
{
|
|
lblHatGruppen.Text = "X";
|
|
}
|
|
|
|
ErstelleAbwesenheitenTabelle(pRO);
|
|
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
|
|
private void ErstelleAbwesenheitenTabelle(ServicesOverviewRO pRo)
|
|
{
|
|
if (pRo.Abwesenheiten != null)
|
|
{
|
|
int newRows = 0;
|
|
int index = 1;
|
|
foreach (var at in pRo.Abwesenheiten)
|
|
{
|
|
DevExpress.XtraReports.UI.XRTableRow row = null;
|
|
if (index < xrTableAbwesenheiten.Rows.Count)
|
|
{
|
|
row = xrTableAbwesenheiten.Rows[index];
|
|
}
|
|
else
|
|
{
|
|
row = xrTableAbwesenheiten.InsertRowBelow(xrTableAbwesenheiten.Rows[xrTableAbwesenheiten.Rows.Count - 1]);
|
|
newRows++;
|
|
}
|
|
|
|
row.Cells[0].Text = String.Format("{0:dd.MM.yyyy}", at.Start);
|
|
int? days = null;
|
|
|
|
if (at.End.HasValue)
|
|
{
|
|
row.Cells[1].Text = String.Format("{0:dd.MM.yyyy}", at.End);
|
|
days = (int)at.End.Value.Subtract(at.Start.Value).TotalDays + 1;
|
|
}
|
|
else
|
|
{
|
|
row.Cells[1].Text = "unbekannt";
|
|
}
|
|
|
|
row.Cells[2].Text = String.Format("{0:0}", days);
|
|
|
|
index++;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|