Files
BeWoPlaner/ReportImp/VSDHammReports/ServicesOverviewReport.cs

115 lines
5.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using BeWo.Report;
using BeWo.Report.ReportObjects;
using BS.Shared;
using BS.Shared.Core;
using DevExpress.XtraReports.UI;
namespace VSDHammReports
{
public partial class Stundenzettel : XtraReport, IBeWoReport<ServicesOverviewRO>
{
public Stundenzettel()
{
InitializeComponent();
}
public void SetReportDataSource(ServicesOverviewRO pRO)
{
if (pRO.StartDate.Day > 1 || pRO.EndDate.Day < DateTime.DaysInMonth(pRO.EndDate.Year, pRO.EndDate.Month))
{
pRO.Month = String.Format("{0:dd.MM.yyyy} - {1:dd.MM.yyyy}", pRO.StartDate, pRO.EndDate);
lblYear.Visible = false;
lblYear2.Visible = false;
}
if (!String.IsNullOrEmpty(pRO.Costbearer) && pRO.Costbearer.ToLower().Contains("lwl"))
{
lblAktenzeichen.Text = "Aktenzeichen Landschaftsverband";
}
else
{
lblAktenzeichen.Text = pRO.Costbearer + " / Aktenzeichen";
}
if (pRO.StartDate >= new DateTime (2022, 09, 01))
AnzeigeExtraStunden(pRO);
bool hatGruppe = false;
if (pRO.Services != null)
{
List<ServicesOverviewRO.ServiceDetail> servicesBillable = new List<ServicesOverviewRO.ServiceDetail>();
foreach (ServicesOverviewRO.ServiceDetail s in pRO.Services)
{
if (s.IsBillable)
{
if (s.IsGroup)
{
s.Notice5 = s.CustomerCount.ToString();
s.Notice4 = s.EmployeeCount.ToString();
hatGruppe = true;
}
servicesBillable.Add(s);
}
}
pRO.Services = servicesBillable;
if (hatGruppe)
{
lblGruppenangebot.Visible = true;
}
}
bindingSource1.DataSource = pRO;
// rechnungsDatum.Text = DateTime.Now.ToShortDateString();
//summeMinuten.Text = string.Format("{0:0.##}", pRO.TotalFLMBillable);
//if (pRO.SupportConceptCostBearer != null)
// aktenzeichenLV.Text = pRO.SupportConceptCostBearer.CustomerReferenceNumber ?? string.Empty;
//bewilligteFLSW.Text = string.Format("{0:0.##}", pRO.ApprovedFLSPerWeek);
}
private void AnzeigeExtraStunden(ServicesOverviewRO pRo)
{
if (pRo.SupportConceptCostBearer != null && pRo.SupportConceptCostBearer.CostBearer2SupportConceptOid != null && pRo.SupportConceptCostBearer.ApprovalPeriodList != null)
{
if (pRo.SupportConceptCostBearer.StartDate != null)
{
if (pRo.SupportConceptCostBearer.ApprovalPeriodList.Count > 1)
{
foreach (var ap in pRo.SupportConceptCostBearer.ApprovalPeriodList)
{
if (pRo.SupportConceptCostBearer.ApprovalPeriodList.Any(approval => ap.StartDate <= approval.EndDate && ap.EndDate >= approval.StartDate && ap.StartDate >= approval.StartDate
&& ap.EndDate <= approval.EndDate && ap.SupportConceptApprovalPeriodOid != approval.SupportConceptApprovalPeriodOid)
&& ap.StartDate <= pRo.EndDate && ap.EndDate >= pRo.StartDate && (ap.StartDate >= pRo.StartDate || ap.EndDate <= pRo.EndDate))
{
lblExtraFLS.Visible = true;
if (ap.ApprovedBETotal != null)
lblExtraFLS.Text = String.Format("zzgl. {0:0.##} FLS vom {1:dd.MM.yy} bis {2:dd.MM.yy}", ap.ApprovedBETotal, ap.StartDate, ap.EndDate);
else if (ap.ApprovedBEPerInterval != null && ap.ApprovedBEInterval != null)
lblExtraFLS.Text = String.Format("zzgl. {0:0.##} FLS pro {1} vom {2:dd.MM.yy} bis {3:dd.MM.yy}", ap.ApprovedBEPerInterval,
ap.ApprovedBEInterval != null ? EnumTranslations.SupportConceptApprovalInterval2Translations[(SupportConceptApprovalInterval)ap.ApprovedBEInterval] : null, ap.StartDate, ap.EndDate);
else
lblExtraFLS.Text = String.Format("zzgl. Extra FLS vom {0:dd.MM.yy} bis {1:dd.MM.yy}", ap.StartDate, ap.EndDate);
}
//if (ap.StartDate <= pRo.EndDate && ap.EndDate >= pRo.StartDate && ap.StartDate >= pRo.StartDate && ap.EndDate <= pRo.EndDate)
//{
// lblExtraFLS.Visible = true;
// if (ap.ApprovedBETotal != null)
// lblExtraFLS.Text = String.Format("zzgl. {0:0.##} FLS vom {1:dd.MM.yy} bis {2:dd.MM.yy}", ap.ApprovedBETotal, ap.StartDate, ap.EndDate);
// else if (ap.ApprovedBEPerInterval != null && ap.ApprovedBEInterval != null)
// lblExtraFLS.Text = String.Format("zzgl. {0:0.##} FLS pro {1} vom {2:dd.MM.yy} bis {3:dd.MM.yy}", ap.ApprovedBEPerInterval,
// ap.ApprovedBEInterval != null ? EnumTranslations.SupportConceptApprovalInterval2Translations[(SupportConceptApprovalInterval)ap.ApprovedBEInterval] : null, ap.StartDate, ap.EndDate);
// else
// lblExtraFLS.Text = String.Format("zzgl. Extra FLS vom {0:dd.MM.yy} bis {1:dd.MM.yy}", ap.StartDate, ap.EndDate);
//}
}
}
}
}
}
}
}