111 lines
3.6 KiB
C#
111 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 BeWoDreilichPastorDreilich
|
|
{
|
|
public partial class Stundenzettel : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<ServicesOverviewRO>
|
|
{
|
|
public Stundenzettel()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(ServicesOverviewRO pRO)
|
|
{
|
|
bool showMinutes = true;
|
|
if (pRO.StartDate < new DateTime(2019, 1, 1))
|
|
{
|
|
showMinutes = false;
|
|
}
|
|
if (pRO.Services != null)
|
|
{
|
|
List<ServicesOverviewRO.ServiceDetail> servicesBillable = new List<ServicesOverviewRO.ServiceDetail>();
|
|
|
|
foreach (ServicesOverviewRO.ServiceDetail s in pRO.Services)
|
|
{
|
|
if (s.IsBillable)
|
|
{
|
|
if (!showMinutes)
|
|
{
|
|
s.Minutes = s.Minutes / 60;
|
|
}
|
|
|
|
s.Notice5 = "E";
|
|
if (s.ServiceDescription.ToLower().Contains("fehlkontakt"))
|
|
{
|
|
s.Notice5 = "F";
|
|
}
|
|
|
|
servicesBillable.Add(s);
|
|
}
|
|
}
|
|
|
|
pRO.Services = servicesBillable;
|
|
}
|
|
|
|
if (showMinutes)
|
|
{
|
|
cellMinutenFLSHeader.Text = "Geleistete Minuten";
|
|
|
|
cellGesamt.Text = String.Format("{0:0.##}", pRO.TotalFLMBillable);
|
|
cellGesamtFaktor.Text = String.Format("{0:0.##}", pRO.TotalFLMBillable * 1.2);
|
|
}
|
|
else
|
|
{
|
|
cellGesamt.Text = String.Format("{0:0.##}", pRO.TotalFLMBillable / 60);
|
|
cellGesamtFaktor.Text = String.Format("{0:0.##}", (pRO.TotalFLMBillable / 60) * 1.2);
|
|
}
|
|
|
|
this.bindingSource1.DataSource = pRO;
|
|
|
|
ErstelleAbwesenheitenTabelle(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++;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|