181 lines
7.8 KiB
C#
181 lines
7.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using BeWo.Report;
|
|
using BeWo.Report.ReportObjects;
|
|
using BS.Shared.DataContracts;
|
|
using DevExpress.XtraPrinting.Native;
|
|
|
|
namespace SkmRheydt
|
|
{
|
|
public partial class Spitzabrechnung : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<Settlement2RO>
|
|
{
|
|
public Spitzabrechnung()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(Settlement2RO pRO)
|
|
{
|
|
// ab Februar 2026 skm moenchengladbach, vorher skm rheydt
|
|
if (pRO.InvoiceDate < new DateTime(2026, 01, 01))
|
|
{
|
|
richTextHeaderMg.Visible = false;
|
|
richTextFooterMg.Visible = false;
|
|
richTextHeaderRy.Visible = true;
|
|
richTextFooterRy.Visible = true;
|
|
}
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
if (!String.IsNullOrEmpty(pRO.RecipientOrganisation))
|
|
{
|
|
sb.AppendLine(pRO.RecipientOrganisation);
|
|
}
|
|
if (!String.IsNullOrEmpty(pRO.RecipientContactPerson))
|
|
{
|
|
sb.AppendLine(pRO.RecipientContactPerson);
|
|
}
|
|
if (!String.IsNullOrEmpty(pRO.RecipientDivision))
|
|
{
|
|
sb.AppendLine(pRO.RecipientDivision);
|
|
}
|
|
if (!String.IsNullOrEmpty(pRO.RecipientStreet))
|
|
{
|
|
sb.AppendLine(pRO.RecipientStreet);
|
|
}
|
|
if (!String.IsNullOrEmpty(pRO.RecipientPostCodeAndTown))
|
|
{
|
|
sb.AppendLine(pRO.RecipientPostCodeAndTown);
|
|
}
|
|
lblAdresse.Text = sb.ToString();
|
|
|
|
decimal rateFactor = 1;
|
|
|
|
foreach (var ii in pRO.InvoiceItems)
|
|
{
|
|
if (ii.RateFactor.HasValue)
|
|
{
|
|
rateFactor = (100 + ii.RateFactor.Value) / 100;
|
|
}
|
|
}
|
|
pRO.RateFactor = (double)rateFactor;
|
|
pRO.RateFactorText2 = String.Format("{0:0.00}", rateFactor);
|
|
|
|
this.bindingSource1.DataSource = pRO;
|
|
|
|
|
|
if (pRO.InvoiceItems != null)
|
|
{
|
|
foreach (var ii in pRO.InvoiceItems)
|
|
{
|
|
ii.ItemDescription = String.Format("{0:dd.MM.yyyy} bis {1:dd.MM.yyyy}: {2:0.##} FLS {3}x {4:c}",
|
|
ii.PeriodStartDate, ii.PeriodEndDate,
|
|
ii.UnitCount, ii.RateFactor == 0 ? "" : "x " + pRO.RateFactorText2 + " ",
|
|
ii.AmountPerUnit);
|
|
|
|
ii.UnitDescription = String.Format("{1:c}{0}", rateFactor == 0 ? "" : " x " + pRO.RateFactorText2,
|
|
ii.AmountPerUnit);
|
|
}
|
|
}
|
|
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
|
|
|
|
|
|
private IList<InvoiceItemDC> CreateDefaultSpitzabrechnungInvoiceItems(SettlementRO pRO)
|
|
{
|
|
|
|
IList<InvoiceItemDC> itemList = new List<InvoiceItemDC>();
|
|
if (pRO.DifferentHourlyRateCount == 3)
|
|
{
|
|
itemList.Add(new InvoiceItemDC
|
|
{
|
|
ItemDescription = String.Format("{0} bis {1}: {2:0.##} FLS {3}x {4:c}",
|
|
pRO.AccountingStartDateString, pRO.HourlyRate3EndDateString,
|
|
pRO.GeleisteteFLSMitStundensatz3, pRO.RateFactor == 1 ? "" : "x " + pRO.RateFactorText2 + " ", pRO.HourlyRate3),
|
|
|
|
ItemPeriodStart = DateTime.Parse(pRO.AccountingStartDateString),
|
|
ItemPeriodEnd = DateTime.Parse(pRO.HourlyRate3EndDateString),
|
|
UnitCount = pRO.GeleisteteFLSMitStundensatz3,
|
|
UnitDescription = String.Format("{1:c}{0}", pRO.RateFactor == 1 ? " x " : pRO.RateFactorText2, pRO.HourlyRate3),
|
|
GrossAmountTotal = pRO.GeleisteteFLSMitStundensatz3 * pRO.RateFactor * pRO.HourlyRate3
|
|
});
|
|
|
|
itemList.Add(new InvoiceItemDC
|
|
{
|
|
ItemDescription = String.Format("{0} bis {1}: {2:0.##} FLS {3}x {4:c}",
|
|
pRO.HourlyRateOldStartDateString, pRO.HourlyRateOldEndDateString,
|
|
pRO.GeleisteteFLSMitStundensatzAlt, pRO.RateFactor == 1 ? "" : "x " + pRO.RateFactorText2 + " ", pRO.HourlyRateOld),
|
|
ItemPeriodStart = DateTime.Parse(pRO.HourlyRateOldStartDateString),
|
|
ItemPeriodEnd = DateTime.Parse(pRO.HourlyRateOldEndDateString),
|
|
UnitCount = pRO.GeleisteteFLSMitStundensatzAlt,
|
|
UnitDescription = String.Format("{1:c}{0}", pRO.RateFactor == 1 ? " x " : pRO.RateFactorText2, pRO.HourlyRateOld),
|
|
GrossAmountTotal = pRO.GeleisteteFLSMitStundensatzAlt * pRO.RateFactor * pRO.HourlyRateOld
|
|
});
|
|
|
|
itemList.Add(new InvoiceItemDC
|
|
{
|
|
ItemDescription = String.Format("{0} bis {1}: {2:0.##} FLS {3}x {4:c}",
|
|
pRO.HourlyRateNewStartDateString, pRO.AccountingEndDateString,
|
|
pRO.GeleisteteFLSMitStundensatzAktuell, pRO.RateFactor == 1 ? "" : "x " + pRO.RateFactorText2 + " ", pRO.HourlyRateNew),
|
|
ItemPeriodStart = DateTime.Parse(pRO.HourlyRateNewStartDateString),
|
|
ItemPeriodEnd = DateTime.Parse(pRO.AccountingEndDateString),
|
|
UnitCount = pRO.GeleisteteFLSMitStundensatzAktuell,
|
|
UnitDescription = String.Format("{1:c}{0}", pRO.RateFactor == 1 ? " x " : pRO.RateFactorText2, pRO.HourlyRateNew),
|
|
GrossAmountTotal = pRO.GeleisteteFLSMitStundensatzAktuell * pRO.RateFactor * pRO.HourlyRateNew
|
|
});
|
|
|
|
}
|
|
else if (pRO.DifferentHourlyRateCount == 2)
|
|
{
|
|
itemList.Add(new InvoiceItemDC
|
|
{
|
|
ItemDescription = String.Format("{0} bis {1}: {2:0.##} FLS {3}x {4:c}",
|
|
pRO.AccountingStartDateString, pRO.HourlyRateOldEndDateString,
|
|
pRO.GeleisteteFLSMitStundensatzAlt, pRO.RateFactor == 1 ? "" : "x " + pRO.RateFactorText2 + " ", pRO.HourlyRateOld),
|
|
ItemPeriodStart = DateTime.Parse(pRO.AccountingStartDateString),
|
|
ItemPeriodEnd = DateTime.Parse(pRO.HourlyRateOldEndDateString),
|
|
UnitCount = pRO.GeleisteteFLSMitStundensatzAlt,
|
|
UnitDescription = String.Format("{1:c}{0}", pRO.RateFactor == 1 ? " x " : pRO.RateFactorText2, pRO.HourlyRateOld),
|
|
GrossAmountTotal = pRO.GeleisteteFLSMitStundensatzAlt * (decimal)pRO.RateFactor * pRO.HourlyRateOld
|
|
});
|
|
|
|
itemList.Add(new InvoiceItemDC
|
|
{
|
|
ItemDescription = String.Format("{0} bis {1}: {2:0.##} FLS {3}x {4:c}",
|
|
pRO.HourlyRateNewStartDateString, pRO.AccountingEndDateString,
|
|
pRO.GeleisteteFLSMitStundensatzAktuell, pRO.RateFactor == 1 ? "" : "x " + pRO.RateFactorText2 + " ", pRO.HourlyRateNew),
|
|
ItemPeriodStart = DateTime.Parse(pRO.HourlyRateNewStartDateString),
|
|
ItemPeriodEnd = DateTime.Parse(pRO.AccountingEndDateString),
|
|
UnitCount = pRO.GeleisteteFLSMitStundensatzAktuell,
|
|
UnitDescription = String.Format("{1:c}{0}", pRO.RateFactor == 1 ? " x " : pRO.RateFactorText2, pRO.HourlyRateNew),
|
|
GrossAmountTotal = pRO.GeleisteteFLSMitStundensatzAktuell * pRO.RateFactor * pRO.HourlyRateNew
|
|
});
|
|
|
|
}
|
|
else
|
|
{
|
|
itemList.Add(new InvoiceItemDC
|
|
{
|
|
ItemDescription = String.Format("{0} bis {1}: {2:0.##} FLS {3}x {4:c}",
|
|
pRO.AccountingStartDateString, pRO.AccountingEndDateString,
|
|
pRO.GeleisteteFLSMitStundensatzAktuell, pRO.RateFactor == 1 ? "" : "x " + pRO.RateFactorText2 + " ", pRO.HourlyRateNew),
|
|
ItemPeriodStart = DateTime.Parse(pRO.AccountingStartDateString),
|
|
ItemPeriodEnd = DateTime.Parse(pRO.AccountingEndDateString),
|
|
UnitCount = pRO.GeleisteteFLSMitStundensatzAktuell,
|
|
UnitDescription = String.Format("{1:c}{0}", pRO.RateFactor == 1 ? " x " : pRO.RateFactorText2, pRO.HourlyRateNew),
|
|
GrossAmountTotal = pRO.GeleisteteFLSMitStundensatzAktuell * pRO.RateFactor * pRO.HourlyRateNew
|
|
});
|
|
|
|
}
|
|
|
|
return itemList;
|
|
}
|
|
|
|
|
|
}
|
|
}
|