102 lines
3.7 KiB
C#
102 lines
3.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using BeWo.Report;
|
|
using BeWo.Report.ReportObjects;
|
|
using DevExpress.XtraPrinting.Native;
|
|
|
|
namespace HshNetzwerk
|
|
{
|
|
public partial class Stundenzettel : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<ServicesOverviewRO>
|
|
{
|
|
public Stundenzettel()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(ServicesOverviewRO pRO)
|
|
{
|
|
cellDatum.Text = String.Format("{0:dd.MM.yyyy}", DateTime.Now);
|
|
lblHeader.Text = "Leistungsnachweis";
|
|
|
|
|
|
if (pRO.CostBearer2SupportConceptList != null && pRO.CostBearer2SupportConceptList.Count > 0)
|
|
{
|
|
var c2s = pRO.CostBearer2SupportConceptList[0];
|
|
var org = c2s.CostBearer.Organisation;
|
|
|
|
if (org.Name.Contains("Jugendamt"))
|
|
{
|
|
lblHeader.Text = "Leistungsnachweis für das Jugendamt\r\n";
|
|
var name = org.Name.Replace("Jugendamt", "").Trim();
|
|
lblHeader.Text += name;
|
|
}
|
|
else if (org.Name.Contains("Bezirksjugendamt"))
|
|
{
|
|
lblHeader.Text = "Leistungsnachweis für das Bezirksjugendamt\r\n";
|
|
var name = org.Name.Replace("Bezirksjugendamt", "").Trim();
|
|
lblHeader.Text += name;
|
|
}
|
|
else if (org.Name.Contains("Landratsamt"))
|
|
{
|
|
lblHeader.Text = "Leistungsnachweis für das Landratsamt\r\n";
|
|
var name = org.Name.Replace("Landratsamt", "").Trim();
|
|
lblHeader.Text += name;
|
|
}
|
|
else if (org.Name.StartsWith("JA"))
|
|
{
|
|
lblHeader.Text = "Leistungsnachweis für das Jugendamt\r\n";
|
|
var name = org.Name.Replace("JA", "").Trim();
|
|
lblHeader.Text += name;
|
|
}
|
|
else
|
|
{
|
|
lblHeader.Text = "Leistungsnachweis für ";
|
|
lblHeader.Text += org.Name;
|
|
}
|
|
|
|
if (c2s.CostBearerContactPerson != null)
|
|
{
|
|
cellAsd.Text = c2s.CostBearerContactPerson.FirstNameLastName;
|
|
}
|
|
}
|
|
|
|
var c = DAOFactory.GenericDAO.LoadByID<Customer>(pRO.CustomerOid);
|
|
cellKinder.Text = c.Childs;
|
|
Dictionary<String, String> empDict = new Dictionary<string, string>();
|
|
String emp = "";
|
|
double gesamtStunden = 0;
|
|
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 (!empDict.ContainsKey(s.EmployeeFullname))
|
|
{
|
|
empDict.Add(s.EmployeeFullname, s.EmployeeFullname);
|
|
}
|
|
|
|
emp = s.EmployeeFullname;
|
|
s.TimeRangeString = String.Format("{0:ddd}./{0:dd.MM.}", s.StartDate);
|
|
double stunden = Math.Round(s.Minutes / 60, 2, MidpointRounding.AwayFromZero);
|
|
gesamtStunden += stunden;
|
|
}
|
|
|
|
//pRO.Services = servicesBillable;
|
|
}
|
|
|
|
cellSumme.Text = String.Format("{0:0.00}", gesamtStunden);
|
|
if (empDict.Count == 1)
|
|
{
|
|
pRO.MainAttendant = emp;
|
|
}
|
|
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
}
|
|
}
|