130 lines
4.1 KiB
C#
130 lines
4.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using BeWo.Report;
|
|
using BeWo.Report.ReportObjects;
|
|
using BS.Shared;
|
|
|
|
namespace BeWoDarmstadt
|
|
{
|
|
public partial class JahresuebersichtFLS : DevExpress.XtraReports.UI.XtraReport//, IBeWoReport<FinanceRO>
|
|
{
|
|
public JahresuebersichtFLS()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(FinanceRO pRO)
|
|
{
|
|
//soweit fertig, nur auf Gruppierung warten und die Prozente in summieren
|
|
// Achtung noch auf Kostenträger LWV eindampfen
|
|
|
|
//decimal flsIst = 0;
|
|
//decimal flsFKmH = 0;
|
|
|
|
if (pRO.SupportConceptFinanceList != null)
|
|
{
|
|
Dictionary<string, FinanceRO.SupportConceptFinanceRO> klientenListe = new Dictionary<string, FinanceRO.SupportConceptFinanceRO>();
|
|
foreach (var scRo in pRO.SupportConceptFinanceList)
|
|
{
|
|
if (scRo.Costbearer2Supportconcept.SupportConcept.Customer.CustomerAlias == null)
|
|
scRo.Costbearer2Supportconcept.SupportConcept.Customer.CustomerAlias = scRo.Costbearer2Supportconcept.SupportConcept.CustomerFullName;
|
|
|
|
var alias = scRo.Costbearer2Supportconcept.SupportConcept.Customer.CustomerAlias;
|
|
if (!klientenListe.ContainsKey(alias))
|
|
{
|
|
klientenListe.Add(alias, scRo);
|
|
}
|
|
else
|
|
{
|
|
klientenListe[alias].ApprovedHoursInReportTimeSpan += scRo.ApprovedHoursInReportTimeSpan;
|
|
klientenListe[alias].BillableHoursInReportTimeSpan += scRo.BillableHoursInReportTimeSpan;
|
|
klientenListe[alias].ServiceRecords.AddRange(scRo.ServiceRecords);
|
|
}
|
|
}
|
|
pRO.SupportConceptFinanceList = klientenListe.Values.ToList();
|
|
|
|
foreach (var scRo in pRO.SupportConceptFinanceList)
|
|
{
|
|
String team = GetTeams(scRo);
|
|
if (String.IsNullOrEmpty(team))
|
|
{
|
|
scRo.Custom1 = " ";
|
|
}
|
|
else
|
|
{
|
|
scRo.Custom1 = team;
|
|
}
|
|
|
|
//pRO.CalculateBillableAmountInReportTimeSpan();
|
|
|
|
scRo.AmountInReportTimeSpan = 0; //FKmH
|
|
scRo.AmountPaid = 0;
|
|
scRo.AmountPaidInReportTimeSpan = 0; //FKoH
|
|
scRo.AmountTotal = 0;
|
|
scRo.BillableHoursInReportTimeSpanWithFactor = 0; //nFK
|
|
scRo.BillableAmountUntilNow = 0;
|
|
|
|
if (scRo.ServiceRecords != null)
|
|
{
|
|
foreach (var sr in scRo.ServiceRecords)
|
|
{
|
|
if (sr.ServiceDescription.Category.IsBillable)
|
|
{
|
|
var qualificationOIDs = sr.Employee.ValueListEntries
|
|
.Where(i => i.Value == ValueListEntryType.StaffQualificationsType)
|
|
.Select(i => i.Key)
|
|
.ToList();
|
|
|
|
foreach (var oid in qualificationOIDs)
|
|
{
|
|
if (oid == 529) // 529 FKmH
|
|
{
|
|
scRo.AmountInReportTimeSpan += sr.RoundedDuration;
|
|
}
|
|
else if (oid == 455) //455 FKoH
|
|
{
|
|
scRo.AmountPaidInReportTimeSpan += sr.RoundedDuration;
|
|
}
|
|
else if (oid == 456) //456 nFK
|
|
{
|
|
scRo.BillableHoursInReportTimeSpanWithFactor += sr.RoundedDuration;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
scRo.AmountInReportTimeSpan /= 60;
|
|
scRo.AmountPaidInReportTimeSpan /= 60;
|
|
scRo.BillableHoursInReportTimeSpanWithFactor /= 60;
|
|
|
|
if (scRo.BillableHoursInReportTimeSpan != 0)
|
|
{
|
|
scRo.AmountPaid = scRo.AmountInReportTimeSpan / scRo.BillableHoursInReportTimeSpan ?? 0 ;
|
|
scRo.AmountTotal = scRo.AmountPaidInReportTimeSpan / scRo.BillableHoursInReportTimeSpan;
|
|
scRo.BillableAmountUntilNow = scRo.BillableHoursInReportTimeSpanWithFactor / scRo.BillableHoursInReportTimeSpan;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if (pRO.ReportStartDate.HasValue && pRO.ReportEndDate.HasValue)
|
|
{
|
|
DateTime start = pRO.ReportStartDate.Value;
|
|
DateTime end = pRO.ReportEndDate.Value;
|
|
}
|
|
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
|
|
private string GetTeams(FinanceRO.SupportConceptFinanceRO scRo)
|
|
{
|
|
var c = DAOFactory.GenericDAO.GetByID<Customer>(scRo.Costbearer2Supportconcept.SupportConcept.Customer.CustomerOid);
|
|
scRo.Costbearer2Supportconcept.SupportConcept.Customer.RelatedTeams = c.Team2CustomerList[0].Team.Name;
|
|
|
|
return scRo.Costbearer2Supportconcept.SupportConcept.Customer.RelatedTeams;
|
|
}
|
|
}
|
|
}
|