Files
BeWoPlaner/ReportImp/BeWoRichartz/ServicesOverviewReport.cs
Christian 5d82fcfe75 cb
2017-12-15 10:47:43 +01:00

69 lines
2.2 KiB
C#

using System;
using System.Linq;
using BeWo.Report;
using BeWo.Report.ReportObjects;
using BS.Shared.Extensions;
namespace BeWoRichartz
{
public partial class Stundenzettel : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<ServicesOverviewRO>
{
public Stundenzettel()
{
InitializeComponent();
}
public void SetReportDataSource(ServicesOverviewRO pRO)
{
if (pRO.Services != null)
{
var servicesBillable = pRO.Services.Where(s => s.IsBillable).ToList();
var parsedMonthDate = DateTime.Parse(String.Format("01. {0} {1}", pRO.Month, pRO.Year));
var tageImMonat = DateTime.DaysInMonth(parsedMonthDate.Year, parsedMonthDate.Month);
for (var i = 0; i < tageImMonat; i++)
{
var date = new DateTime(pRO.Year, parsedMonthDate.Month, i + 1);
if (!servicesBillable.Any(a => a.StartDate.CompareShortDates(date)))
{
servicesBillable.Add(new ServicesOverviewRO.ServiceDetail { StartDate = date });
}
}
pRO.Services = servicesBillable.OrderBy(o => o.StartDate).ToList();
}
if (pRO.TotalFLMBillable > 0)
{
lblFlsGesamt.Text = String.Format("{0:0.##}", pRO.TotalFLMBillable/60);
lblFlsRateFactorTotal.Text = String.Format("{0:0.##}", (pRO.TotalFLMBillable/60)*1.2);
}
if (IstBewilligt(pRO))
{
lblFLSPerWeek.Text = String.Format("{0:0.00}", pRO.ApprovedFLSPerWeek);
}
else
{
lblFLSPerWeek.Text = "";
}
bindingSource1.DataSource = pRO;
}
private bool IstBewilligt(ServicesOverviewRO pRo)
{
if (pRo.CostBearer2SupportConceptList.Count > 0)
{
if (pRo.CostBearer2SupportConceptList[0].ApprovedStartDate.HasValue)
{
return true;
}
}
return false;
}
}
}