125 lines
3.7 KiB
C#
125 lines
3.7 KiB
C#
using System;
|
|
using System.Linq;
|
|
using BS.Shared;
|
|
using BeWo.Report;
|
|
using BeWo.Report.ReportObjects;
|
|
using BeWo.Data.Entities;
|
|
using BeWo.Data.Access;
|
|
using System.Collections.Generic;
|
|
using BS.Shared.Core;
|
|
using BS.Shared.Services;
|
|
using BS.Shared.DataContracts;
|
|
using BeWo.Service.DCEntityMapper;
|
|
using BeWo.Service.ServiceImplementations;
|
|
using DevExpress.XtraPrinting;
|
|
|
|
namespace HausTheresia
|
|
{
|
|
public partial class Finanzauswertung : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<FinanceRO>
|
|
{
|
|
public Finanzauswertung()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(FinanceRO pRO)
|
|
{
|
|
pRO.CalculateBillableAmountInReportTimeSpan();
|
|
|
|
if (pRO.ReportStartDate.HasValue && pRO.ReportEndDate.HasValue)
|
|
{
|
|
DateTime start = pRO.ReportStartDate.Value;
|
|
DateTime end = pRO.ReportEndDate.Value;
|
|
|
|
if (start.Year == end.Year && start.Month == end.Month && start.Day == 1 &&
|
|
end.Day == DateTime.DaysInMonth(end.Year, end.Month))
|
|
{
|
|
lblTitel.Text = String.Format("Finanzauswertung {0:MMMM yyyy}", start);
|
|
cellBewilligtImZeitraumHeader.Text = String.Format("bewilligte FLS {0:MMMM}", start);
|
|
cellGeleistetImZeitraumHeader.Text = String.Format("geleistete Std. {0:MMMM}", start);
|
|
cellFehlkontakteHeader.Text = String.Format("Fehl-\nkontakte {0:MMMM}", start);
|
|
}
|
|
else
|
|
{
|
|
lblTitel.Text = String.Format("Finanzauswertung {0:dd.MM.yyyy}-{1:dd.MM.yyyy}", start, end);
|
|
cellBewilligtImZeitraumHeader.Text = String.Format("bewilligte FLS {0:dd.MM.yyyy}-{1:dd.MM.yyyy}", start, end);
|
|
cellGeleistetImZeitraumHeader.Text = String.Format("geleistete Std. {0:dd.MM.yyyy}-{1:dd.MM.yyyy}", start, end);
|
|
//cellFehlkontakteHeader.Text = String.Format("Fehl-\nkontakte {0:dd.MM.yyyy}-{1:dd.MM.yyyy}", start, end);
|
|
}
|
|
if (pRO.RateFactor.HasValue)
|
|
{
|
|
cellRateFactorHeader.Text = String.Format("geleistete Std. x {0:0.##}", pRO.RateFactor);
|
|
}
|
|
else
|
|
{
|
|
//cellRateFactorHeader.Visible = false;
|
|
//cellRateFactor.Visible = false;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
cellBewilligtImZeitraumHeader.Visible = false;
|
|
cellBewilligteFLSImBereich.Visible = false;
|
|
cellGeleistetImBereich.Visible = false;
|
|
cellGeleistetImZeitraumHeader.Visible = false;
|
|
cellRateFactorHeader.Visible = false;
|
|
cellRateFactor.Visible = false;
|
|
}
|
|
|
|
if (pRO.GruppierungLeistungskategorie && pRO.SupportConceptFinanceList != null)
|
|
{
|
|
GroupHeader1.Visible = true;
|
|
GroupFooter1.Visible = true;
|
|
foreach (var scRo in pRO.SupportConceptFinanceList)
|
|
{
|
|
if (String.IsNullOrEmpty(scRo.Leistungskategorie))
|
|
{
|
|
scRo.GruppierungsKategorie = " ";
|
|
}
|
|
else
|
|
{
|
|
scRo.GruppierungsKategorie = String.Format("Leistungskategorie {0}", scRo.Leistungskategorie);
|
|
}
|
|
}
|
|
}
|
|
if (pRO.SupportConceptFinanceList != null)
|
|
{
|
|
foreach (var scRo in pRO.SupportConceptFinanceList)
|
|
{
|
|
scRo.Custom1 = GetRegion(scRo);
|
|
scRo.Custom2 = GetTeam(scRo);
|
|
}
|
|
}
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
|
|
private String GetRegion(FinanceRO.SupportConceptFinanceRO f)
|
|
{
|
|
if (f.Costbearer2Supportconcept != null)
|
|
{
|
|
var c = DAOFactory.GenericDAO.LoadByID<Customer>(f.Costbearer2Supportconcept.SupportConcept.Customer.Oid.Value);
|
|
if (c.RegionType != null)
|
|
{
|
|
return c.RegionType.Value;
|
|
}
|
|
else
|
|
{
|
|
return "";
|
|
}
|
|
}
|
|
return "";
|
|
}
|
|
|
|
private string GetTeam(FinanceRO.SupportConceptFinanceRO scRo)
|
|
{
|
|
string team = " ";
|
|
Customer c = DAOFactory.GenericDAO.LoadByID<Customer>(scRo.Costbearer2Supportconcept.SupportConcept.Customer.Oid ?? 0);
|
|
if (c.Team2CustomerList.Count > 0)
|
|
{
|
|
team = "Team " + c.Team2CustomerList[0].Team.Name;
|
|
}
|
|
return team;
|
|
}
|
|
}
|
|
}
|