153 lines
4.9 KiB
C#
153 lines
4.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text.RegularExpressions;
|
|
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using BeWo.Report;
|
|
using BeWo.Report.ReportObjects;
|
|
using BS.Shared.DataContracts;
|
|
using BS.Shared.Extensions;
|
|
|
|
namespace BeWo.AidshilfeDortmund.Alt
|
|
{
|
|
public partial class Spitzabrechnung : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<SettlementRO>
|
|
{
|
|
public Spitzabrechnung()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(SettlementRO pRO)
|
|
{
|
|
xrCheckBox2.Checked = true;
|
|
|
|
if (pRO.CostBearer2SupportConceptOid > 0)
|
|
{
|
|
var c2s = DAOFactory.GenericDAO.LoadByID<CostBearer2SupportConcept>(pRO.CostBearer2SupportConceptOid);
|
|
|
|
if (c2s.SupportConcept.Customer.TerminationDate.HasValue)
|
|
{
|
|
xrCheckBox1.Text = String.Format(" Die Betreuung wurde beendet am {0:dd.MM.yyyy}", c2s.SupportConcept.Customer.TerminationDate);
|
|
xrCheckBox2.Checked = false;
|
|
xrCheckBox1.Checked = true;
|
|
}
|
|
}
|
|
|
|
bool isOldVersion = true;
|
|
|
|
if (pRO.HourlyRate3 == 0 && !pRO.HourlyRateOld.HasValue && !pRO.HourlyRateNew.HasValue)
|
|
isOldVersion = false;
|
|
if (pRO.InvoiceItems == null)
|
|
pRO.InvoiceItems = new List<InvoiceItemDC>();
|
|
|
|
if (isOldVersion)
|
|
{
|
|
pRO.InvoiceItems.Clear();
|
|
if (pRO.DifferentHourlyRateCount == 1)
|
|
{
|
|
pRO.TotalApprovedFLSWithNewHourlyRate = Math.Round(pRO.ApprovedFLSWeekly * pRO.WeeksWithNewHourlyRate, 2);
|
|
pRO.TotalApprovedFLSWithNewHourlyRateString = string.Format("{0:0.00}", pRO.TotalApprovedFLSWithNewHourlyRate);
|
|
|
|
var ii = new InvoiceItemDC();
|
|
ii.ItemDescription = String.Format("{0} - {1} {2} FLS x {3} € =", pRO.AccountingStartDateString,
|
|
pRO.AccountingEndDateString, pRO.RecordedFLSWithNewHourlyRateString, pRO.HourlyRateNewString);
|
|
|
|
ii.AmountTotal = pRO.AmountTotalWithNewHourlyRate;
|
|
|
|
pRO.InvoiceItems.Add(ii);
|
|
}
|
|
|
|
else if (pRO.DifferentHourlyRateCount == 2)
|
|
{
|
|
var ii = new InvoiceItemDC();
|
|
ii.ItemDescription = String.Format("{0} - {1} {2} FLS x {3} € =", pRO.AccountingStartDateString,
|
|
pRO.HourlyRateOldEndDateString, pRO.RecordedFLSWithOldHourlyRateString, pRO.HourlyRateOldString);
|
|
|
|
ii.AmountTotal = pRO.AmountTotalWithOldHourlyRate;
|
|
|
|
pRO.InvoiceItems.Add(ii);
|
|
|
|
ii = new InvoiceItemDC();
|
|
ii.ItemDescription = String.Format("{0} - {1} {2} FLS x {3} € =", pRO.HourlyRateNewStartDateString,
|
|
pRO.AccountingEndDateString, pRO.RecordedFLSWithNewHourlyRateString, pRO.HourlyRateNewString);
|
|
|
|
ii.AmountTotal = pRO.AmountTotalWithNewHourlyRate;
|
|
|
|
pRO.InvoiceItems.Add(ii);
|
|
}
|
|
else if (pRO.DifferentHourlyRateCount == 3)
|
|
{
|
|
var ii = new InvoiceItemDC();
|
|
ii.ItemDescription = String.Format("{0} - {1} {2} FLS x {3} € =", pRO.AccountingStartDateString,
|
|
pRO.HourlyRate3EndDateString, pRO.RecordedFLSWithHourlyRate3String, pRO.HourlyRate3String);
|
|
|
|
ii.AmountTotal = pRO.AmountTotalWithHourlyRate3;
|
|
|
|
pRO.InvoiceItems.Add(ii);
|
|
|
|
ii = new InvoiceItemDC();
|
|
ii.ItemDescription = String.Format("{0} - {1} {2} FLS x {3} € =", pRO.HourlyRateOldStartDateString,
|
|
pRO.HourlyRateOldEndDateString, pRO.RecordedFLSWithOldHourlyRateString, pRO.HourlyRateOldString);
|
|
|
|
ii.AmountTotal = pRO.AmountTotalWithOldHourlyRate;
|
|
|
|
pRO.InvoiceItems.Add(ii);
|
|
|
|
ii = new InvoiceItemDC();
|
|
ii.ItemDescription = String.Format("{0} - {1} {2} FLS x {3} € =", pRO.HourlyRateNewStartDateString,
|
|
pRO.AccountingEndDateString, pRO.RecordedFLSWithNewHourlyRateString, pRO.HourlyRateNewString);
|
|
|
|
ii.AmountTotal = pRO.AmountTotalWithNewHourlyRate;
|
|
|
|
pRO.InvoiceItems.Add(ii);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
foreach (var ii in pRO.InvoiceItems)
|
|
{
|
|
ii.ItemDescription = String.Format("{0:dd.MM.yyyy} - {1:dd.MM.yyyy}: {2:0.00} FLS x {3:c} =", ii.ItemPeriodStart,
|
|
ii.ItemPeriodEnd, ii.UnitCount, ii.AmountPerUnit);
|
|
}
|
|
|
|
var id = GetCustomerId(pRO);
|
|
if (id == "LWLNEU")
|
|
{
|
|
pRO.RateFactorText = null;
|
|
pRO.RateFactorText2 = null;
|
|
}
|
|
}
|
|
|
|
decimal rateFactor = 1;
|
|
|
|
foreach (var ii in pRO.InvoiceItems)
|
|
{
|
|
if (ii.RateFactor.HasValue)
|
|
{
|
|
rateFactor = (100 + ii.RateFactor.Value) / 100;
|
|
}
|
|
|
|
ii.UnitDescription = "FLS";
|
|
|
|
if (!pRO.FehlkontakteString.IsNullOrEmpty() && ii.RateFactor == 0)
|
|
{
|
|
Zwischensumme.Visible = true;
|
|
if (!ii.ItemDescription.IsNullOrEmpty())
|
|
{
|
|
ii.ItemDescription = Regex.Replace(ii.ItemDescription, "FLS", "Fehlkontakte");
|
|
}
|
|
ii.UnitDescription = "Fehlkontakte";
|
|
}
|
|
}
|
|
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
|
|
private String GetCustomerId(SettlementRO pRO)
|
|
{
|
|
var cb2sc = DAOFactory.GenericDAO.LoadByID<CostBearer2SupportConcept>(pRO.CostBearer2SupportConceptOid);
|
|
return cb2sc.CostBearer.ID;
|
|
}
|
|
}
|
|
}
|