154 lines
6.1 KiB
C#
154 lines
6.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using BeWo.Report;
|
|
using BeWo.Report.ReportObjects;
|
|
|
|
using BS.Shared.DataContracts;
|
|
|
|
namespace BeWoRichartz.Neu
|
|
{
|
|
public partial class Spitzabrechnung : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<Settlement2RO>
|
|
{
|
|
public Spitzabrechnung()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(Settlement2RO pRO)
|
|
{
|
|
if(pRO.RateFactorText2 == "1,2")
|
|
{
|
|
pRO.RateFactorText2 = "1,20";
|
|
}
|
|
|
|
pRO.ApprovedFLS = pRO.ApprovedFLS.Replace("FLS", "").Trim();
|
|
|
|
if (pRO.InvoiceItems != null)
|
|
{
|
|
int index = 1;
|
|
foreach (var ii in pRO.InvoiceItems)
|
|
{
|
|
if (index == 1)
|
|
{
|
|
ii.AbrechnungsText = "abzurechnende FLS";
|
|
}
|
|
else
|
|
{
|
|
ii.AbrechnungsText = "";
|
|
}
|
|
|
|
if (index < pRO.InvoiceItems.Count)
|
|
{
|
|
ii.ItemDescription = String.Format("({0:dd.MM.yy}-{1:dd.MM.yy})", ii.PeriodStartDate,
|
|
ii.PeriodEndDate);
|
|
}
|
|
else
|
|
{
|
|
ii.ItemDescription = String.Format(" ab {0:dd.MM.yy}", ii.PeriodStartDate);
|
|
}
|
|
|
|
//GrossAmountTotal = pRO.GeleisteteFLSMitStundensatz3 * pRO.RateFactor * pRO.HourlyRate3,
|
|
//ii.UnitCount = pRO.GeleisteteFLSMitStundensatz3,
|
|
if (ii.RateFactor.HasValue)
|
|
{
|
|
ii.RateFactor = (ii.RateFactor.Value + 100) / 100;
|
|
}
|
|
|
|
//AmountPerUnit = pRO.HourlyRate3,
|
|
//Notice = "abzurechnende FLS"
|
|
|
|
//ii.ItemDescription = String.Format("{0:dd.MM.yyyy} - {1:dd.MM.yyyy}:\n{2:0.##} FLS {3}x {4:c}",
|
|
// ii.PeriodStartDate, ii.PeriodEndDate,
|
|
// ii.UnitCount, ii.RateFactor == 0 ? "" : "x " + pRO.RateFactorText2 + " ",
|
|
// ii.AmountPerUnit);
|
|
index++;
|
|
}
|
|
}
|
|
|
|
bindingSource1.DataSource = pRO;
|
|
}
|
|
|
|
|
|
|
|
private static IList<InvoiceItemDC> CreateDefaultSpitzabrechnungInvoiceItems(SettlementRO pRO)
|
|
{
|
|
IList<InvoiceItemDC> itemList = new List<InvoiceItemDC>();
|
|
if (pRO.DifferentHourlyRateCount == 3) // 3 Zeiträume -----------------------------------------------------------------------------
|
|
{
|
|
itemList.Add(new InvoiceItemDC
|
|
{
|
|
ItemDescription = String.Format("({0}-{1})", pRO.AccountingStartDateString.Replace(".20", "."), pRO.HourlyRate3EndDateString.Replace(".20", ".")),
|
|
GrossAmountTotal = pRO.GeleisteteFLSMitStundensatz3 * pRO.RateFactor * pRO.HourlyRate3,
|
|
UnitCount = pRO.GeleisteteFLSMitStundensatz3,
|
|
RateFactor = pRO.RateFactor,
|
|
AmountPerUnit = pRO.HourlyRate3,
|
|
Notice = "abzurechnende FLS"
|
|
});
|
|
|
|
itemList.Add(new InvoiceItemDC
|
|
{
|
|
ItemDescription = String.Format("({0}-{1})", pRO.HourlyRateOldStartDateString.Replace(".20", "."), pRO.HourlyRateOldEndDateString.Replace(".20", ".")),
|
|
GrossAmountTotal = pRO.GeleisteteFLSMitStundensatzAlt * pRO.RateFactor * pRO.HourlyRateOld,
|
|
UnitCount = pRO.GeleisteteFLSMitStundensatzAlt,
|
|
RateFactor = pRO.RateFactor,
|
|
AmountPerUnit = pRO.HourlyRateOld,
|
|
Notice = ""
|
|
});
|
|
|
|
itemList.Add(new InvoiceItemDC
|
|
{
|
|
ItemDescription = String.Format("ab {0}", pRO.HourlyRateNewStartDateString.Replace(".20", ".")),
|
|
GrossAmountTotal = pRO.GeleisteteFLSMitStundensatzAktuell * pRO.RateFactor * pRO.HourlyRateNew,
|
|
UnitCount = pRO.GeleisteteFLSMitStundensatzAktuell,
|
|
RateFactor = pRO.RateFactor,
|
|
AmountPerUnit = pRO.HourlyRateNew,
|
|
Notice = ""
|
|
});
|
|
|
|
}
|
|
else if (pRO.DifferentHourlyRateCount == 2) // 2 Zeiträume -----------------------------------------------------------------------------
|
|
{
|
|
itemList.Add(new InvoiceItemDC
|
|
{
|
|
ItemDescription = String.Format("({0}-{1})", pRO.AccountingStartDateString.Replace(".20", "."), pRO.HourlyRateOldEndDateString.Replace(".20", ".")),
|
|
GrossAmountTotal = pRO.GeleisteteFLSMitStundensatzAlt * pRO.RateFactor * pRO.HourlyRateOld,
|
|
UnitCount = pRO.GeleisteteFLSMitStundensatzAlt,
|
|
RateFactor = pRO.RateFactor,
|
|
AmountPerUnit = pRO.HourlyRateOld,
|
|
Notice = "abzurechnende FLS"
|
|
});
|
|
|
|
itemList.Add(new InvoiceItemDC
|
|
{
|
|
ItemDescription = String.Format("ab {0}", pRO.HourlyRateNewStartDateString.Replace(".20", ".")),
|
|
GrossAmountTotal = pRO.GeleisteteFLSMitStundensatzAktuell * pRO.RateFactor * pRO.HourlyRateNew,
|
|
UnitCount = pRO.GeleisteteFLSMitStundensatzAktuell,
|
|
RateFactor = pRO.RateFactor,
|
|
AmountPerUnit = pRO.HourlyRateNew,
|
|
Notice = ""
|
|
});
|
|
|
|
}
|
|
else // -----------------------------------------------------------------------------------------------------------------------------
|
|
{
|
|
itemList.Add(new InvoiceItemDC
|
|
{
|
|
//ItemDescription = String.Format("({0}-{1})", pRO.HourlyRateNewStartDateString.Replace(".20", "."), pRO.AccountingEndDateString.Replace(".20", ".")),
|
|
ItemDescription = "",
|
|
GrossAmountTotal = pRO.GeleisteteFLSMitStundensatzAktuell * pRO.RateFactor * pRO.HourlyRateNew,
|
|
UnitCount = pRO.GeleisteteFLSMitStundensatzAktuell,
|
|
RateFactor = pRO.RateFactor,
|
|
AmountPerUnit = pRO.HourlyRateNew,
|
|
Notice = "abzurechnende FLS"
|
|
});
|
|
|
|
}
|
|
|
|
return itemList;
|
|
}
|
|
}
|
|
}
|