134 lines
4.4 KiB
C#
134 lines
4.4 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using BeWo.Data.Entities;
|
|
using DevExpress.XtraReports.UI;
|
|
using BeWo.Report.ReportObjects;
|
|
using BeWo.Report;
|
|
|
|
namespace BeWo.LebenshilfeEssenReports
|
|
{
|
|
public partial class Stundenzettel : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<ServicesOverviewRO>
|
|
{
|
|
public Stundenzettel()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(ServicesOverviewRO pRO)
|
|
{
|
|
bool hatGruppen = false;
|
|
bool istAssistenz = false;
|
|
decimal gerundeteFls = 0;
|
|
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";
|
|
if (sd.IsGroup)
|
|
{
|
|
sd.Notice5 = "G (" + sd.CustomerCount + " TN)";
|
|
hatGruppen = true;
|
|
}
|
|
else if (sd.ServiceDescription.ToLower().Contains("fehlkontakt"))
|
|
{
|
|
sd.Notice5 = "F";
|
|
}
|
|
|
|
servicesBillable.Add(sd);
|
|
}
|
|
}
|
|
|
|
pRO.Services = servicesBillable;
|
|
}
|
|
|
|
if (istAssistenz)
|
|
{
|
|
lblBewilligteFls.Text = "bewilligte ASS:";
|
|
cellFls.Text = "ASS";
|
|
}
|
|
|
|
if (String.IsNullOrWhiteSpace(pRO.AbsenceTimes))
|
|
{
|
|
lblHatAbwesenheiten.Text = "X";
|
|
}
|
|
|
|
if (!hatGruppen)
|
|
{
|
|
lblHatGruppen.Text = "X";
|
|
}
|
|
|
|
ErstelleAbwesenheitenTabelle(pRO);
|
|
|
|
var customer = GetCustomer(pRO);
|
|
if (customer != null)
|
|
{
|
|
if (!String.IsNullOrEmpty(customer.CostCenter))
|
|
{
|
|
lblKostenstelle.Text = customer.CostCenter;
|
|
}
|
|
if (!String.IsNullOrEmpty(customer.DebitorNumber))
|
|
{
|
|
lblDebNr.Text = customer.DebitorNumber;
|
|
}
|
|
}
|
|
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++;
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
private Customer GetCustomer(ServicesOverviewRO ro)
|
|
{
|
|
if (ro.CostBearer2SupportConceptList != null && ro.CostBearer2SupportConceptList.Count > 0)
|
|
{
|
|
return ro.CostBearer2SupportConceptList[0].SupportConcept.Customer;
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|
|
}
|