77 lines
2.4 KiB
C#
77 lines
2.4 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.DerKarren
|
|
{
|
|
public partial class Stundenzettel : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<ServicesOverviewRO>
|
|
{
|
|
public Stundenzettel()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(ServicesOverviewRO pRO)
|
|
{
|
|
Dictionary<string, string> cats = new Dictionary<string, string>();
|
|
|
|
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 (!cats.ContainsKey(s.ServiceCategory))
|
|
{
|
|
cats.Add(s.ServiceCategory, s.ServiceCategory);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
pRO.Services = servicesBillable;
|
|
}
|
|
|
|
bool istAssistenz = false;
|
|
if (cats.Count == 1 && cats.ContainsKey("Assistenzleistung"))
|
|
{
|
|
istAssistenz = true;
|
|
}
|
|
|
|
|
|
|
|
var minutesWithFactor = pRO.TotalFLMBillable*(double)pRO.RateFactor;
|
|
|
|
DateTime dt = DateTime.Now.Date.AddMinutes(minutesWithFactor);
|
|
TimeSpan tspan = dt.Subtract(DateTime.Now.Date);
|
|
|
|
double d = tspan.TotalHours;
|
|
d = Math.Floor(d);
|
|
|
|
|
|
cellHoursMinutes.Text = pRO.TotalFLHoursMinutesString;
|
|
cellHoursMinutesFactor.Text = String.Format("{0}:{1:00}", d, tspan.Minutes);
|
|
cellHoursFactor.Text = String.Format("{0:0.00}", minutesWithFactor / 60);
|
|
|
|
if (istAssistenz)
|
|
{
|
|
cellHoursMinutesFactor.Visible = false;
|
|
cellHoursFactor.Visible = false;
|
|
cellFactorText.Visible = false;
|
|
cellFactorBorder.Visible = false;
|
|
lblTitel.Text = "Quittierungsbeleg über Assistenzleistungen";
|
|
}
|
|
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
}
|
|
}
|