Files
BeWoPlaner/ReportImp/Fortis/Quittierungsbeleg.cs

145 lines
5.6 KiB
C#

using System;
using System.Collections;
using System.Collections.Generic;
using BeWo.Data.Access;
using BeWo.Data.Entities;
using BeWo.Report;
using BeWo.Report.ReportObjects;
using DevExpress.XtraReports.UI;
namespace Fortis
{
public partial class Quittierungsbeleg : XtraReport, IBeWoReport<ServicesOverviewRO>
{
private Dictionary<string, Dictionary<String, bool>> key2TagesDict = new Dictionary<string, Dictionary<String, bool>>();
public Quittierungsbeleg()
{
InitializeComponent();
}
public void SetReportDataSource(ServicesOverviewRO pRO)
{
if (pRO.Services != null)
{
List<ServicesOverviewRO.ServiceDetail> servicesBillable = new List<ServicesOverviewRO.ServiceDetail>();
Dictionary<long, FortisServiceRecord> tag2Details = new Dictionary<long, FortisServiceRecord>();
foreach (var sr in pRO.Services)
{
if (sr.ProzentAbrechenbar < 100)
{
sr.Minutes = Math.Round((sr.Minutes / 100) * (double)sr.ProzentAbrechenbar, 0, MidpointRounding.AwayFromZero);
}
var fsr = FortisServiceRecord.CreateFromServiceDescription(sr.ServiceCategory, sr.ServiceDescription, sr.Minutes, sr.StartDate, sr.EndDate);
if (fsr != null)
{
tag2Details.Add(sr.ServiceRecordOid, fsr);
fsr.AnzahlMA = sr.EmployeeCount;
fsr.Groesse += sr.CustomerCount;
servicesBillable.Add(sr);
}
}
pRO.Services = servicesBillable;
foreach (var sr in pRO.Services)
{
sr.Notice = "";
sr.Notice2 = "";
sr.Notice3 = "";
sr.Notice4 = "";
sr.Notice5 = "";
sr.ServiceCategory = "";
sr.GefahreneKilometer = "";
sr.EmployeeFirstName = "";
sr.EmployeeFullname = "";
sr.EmployeeLastName = "";
//String key = String.Format("{0:yyyyMMdd}", dt);
if (tag2Details.ContainsKey(sr.ServiceRecordOid))
{
var fsr = tag2Details[sr.ServiceRecordOid];
//var sr = new ServicesOverviewRO.ServiceDetail();
//sr.StartDate = dt;
//H Hausbesuch = Notice
//B Begleitung im Sozialraum = Notice2
//T Kontakt per Telefon etc. = Notice3
//GD Kontakt mit Leistungsberechtigten in der Dienststelle = Notice4
//KL Kompensatorische Leistung ohne LB = Notice5
//AK Assistenz im Krankenhaus = ServiceCategory
//MA Anzahl Mitarbeitende = ServiceCategoryAbbr (EmployeeCount)
//GI Gemeinsame Inanspruchnahme = GefahreneKilometer
//Größe = StartDateString (CustomerCount)
//Summe1 = TimeRangeString
//Beginn = EmployeeFirstName
//Ende = EmployeeFullname
//Summe2 = EmployeeLastname
if (fsr.MinutenH > 0)
{
sr.Notice = String.Format("{0:0}", fsr.MinutenH);
}
if (fsr.MinutenB > 0)
{
sr.Notice2 = String.Format("{0:0}", fsr.MinutenB);
}
if (fsr.MinutenT > 0)
{
sr.Notice3 = String.Format("{0:0}", fsr.MinutenT);
}
if (fsr.MinutenGD > 0)
{
sr.Notice4 = String.Format("{0:0}", fsr.MinutenGD);
}
if (fsr.MinutenKL > 0)
{
sr.Notice5 = String.Format("{0:0}", fsr.MinutenKL);
}
if (fsr.MinutenAK > 0)
{
sr.ServiceCategory = String.Format("{0:0}", fsr.MinutenAK);
}
if (fsr.MinutenGI > 0)
{
sr.GefahreneKilometer = String.Format("{0:0}", fsr.MinutenGI);
}
sr.EmployeeCount = fsr.AnzahlMA;
sr.CustomerCount = fsr.Groesse;
sr.TimeRangeString = String.Format("{0:0}", fsr.BerechneDirekteMinutenGesamt());
if (fsr.FehlkontaktBeginn.HasValue && fsr.FehlkontaktEnde.HasValue)
{
sr.EmployeeFirstName = String.Format("{0:HH:mm}", fsr.FehlkontaktBeginn);
sr.EmployeeFullname = String.Format("{0:HH:mm}", fsr.FehlkontaktEnde);
sr.EmployeeLastName = String.Format("{0:0}", fsr.FehlkontaktMinuten);
}
//newServices.Add(sr);
}
//dt = dt.AddDays(1);
}
//pRO.Services = newServices;
}
bindingSource1.DataSource = pRO;
}
}
}