2019-07-12 17:36:37 +02:00
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2023-06-01 11:24:23 +02:00
|
|
|
using System.Text.RegularExpressions;
|
2019-07-12 17:36:37 +02:00
|
|
|
using BeWo.Data.Access;
|
|
|
|
|
using BeWo.Data.Entities;
|
|
|
|
|
using BeWo.Report.ReportObjects;
|
|
|
|
|
using BS.Shared.DataContracts;
|
2023-06-01 11:24:23 +02:00
|
|
|
using BS.Shared.Extensions;
|
|
|
|
|
|
2019-07-12 17:36:37 +02:00
|
|
|
namespace BeWo.Report.DefaultReports
|
|
|
|
|
{
|
|
|
|
|
public partial class Spitzabrechnung : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<Settlement2RO>
|
|
|
|
|
{
|
|
|
|
|
public Spitzabrechnung()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SetReportDataSource(Settlement2RO pRO)
|
|
|
|
|
{
|
|
|
|
|
if (pRO.InvoiceItems != null)
|
2023-06-01 11:24:23 +02:00
|
|
|
{
|
|
|
|
|
decimal rateFactor = 1;
|
|
|
|
|
|
|
|
|
|
foreach (var ii in pRO.InvoiceItems)
|
|
|
|
|
{
|
|
|
|
|
if (ii.RateFactor.HasValue)
|
|
|
|
|
{
|
|
|
|
|
rateFactor = (100 + ii.RateFactor.Value) / 100;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ii.ItemDescription = String.Format("{0:c}{1}", ii.AmountPerUnit, rateFactor.Equals(1) ? "" : " x " + rateFactor.ToString("F2"));
|
|
|
|
|
ii.DetailDescription = "geleistete Fachleistungsstunden";
|
|
|
|
|
|
|
|
|
|
if (!pRO.FehlkontakteString.IsNullOrEmpty() && ii.RateFactor == 0)
|
|
|
|
|
{
|
|
|
|
|
ii.DetailDescription = "Fehlkontakte";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-07-12 17:36:37 +02:00
|
|
|
|
|
|
|
|
SetzeWohnort(pRO);
|
|
|
|
|
|
|
|
|
|
this.bindingSource1.DataSource = pRO;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void SetzeWohnort(Settlement2RO pRo)
|
|
|
|
|
{
|
|
|
|
|
if (pRo.InvoiceBaseOid.HasValue)
|
|
|
|
|
{
|
|
|
|
|
var ib = DAOFactory.GenericDAO.LoadByID<InvoiceBase>(pRo.InvoiceBaseOid.Value);
|
|
|
|
|
if (ib.CostBearer2SupportConcept != null)
|
|
|
|
|
{
|
|
|
|
|
var c = ib.CostBearer2SupportConcept.SupportConcept.Customer;
|
|
|
|
|
|
|
|
|
|
if (c != null && c.Person.Address != null)
|
|
|
|
|
{
|
|
|
|
|
lblWohnort.Text = String.Format("{0} in {1} {2}", c.Person.Address.Street, c.Person.Address.PostalCode, c.Person.Address.Town);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String GetCustomerId(SettlementRO pRO)
|
|
|
|
|
{
|
|
|
|
|
var cb2sc = DAOFactory.GenericDAO.LoadByID<CostBearer2SupportConcept>(pRO.CostBearer2SupportConceptOid);
|
|
|
|
|
return cb2sc.CostBearer.ID;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private IList<InvoiceItemDC> CreateDefaultSpitzabrechnungInvoiceItems(SettlementRO pRO)
|
|
|
|
|
{
|
|
|
|
|
IList<InvoiceItemDC> itemList = new List<InvoiceItemDC>();
|
|
|
|
|
if (pRO.DifferentHourlyRateCount == 3)
|
|
|
|
|
{
|
|
|
|
|
itemList.Add(new InvoiceItemDC
|
|
|
|
|
{
|
|
|
|
|
ItemDescription = String.Format("{0:c}{1}", pRO.HourlyRate3, pRO.RateFactor == 1 ? "" : " x " + pRO.RateFactorText2),
|
|
|
|
|
|
|
|
|
|
GrossAmountTotal = pRO.GeleisteteFLSMitStundensatz3 * pRO.RateFactor * pRO.HourlyRate3,
|
|
|
|
|
UnitCount = pRO.GeleisteteFLSMitStundensatz3
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
itemList.Add(new InvoiceItemDC
|
|
|
|
|
{
|
|
|
|
|
ItemDescription = String.Format("{0:c}{1}", pRO.HourlyRateOld, pRO.RateFactor == 1 ? "" : " x " + pRO.RateFactorText2),
|
|
|
|
|
|
|
|
|
|
GrossAmountTotal = pRO.GeleisteteFLSMitStundensatzAlt * pRO.RateFactor * pRO.HourlyRateOld,
|
|
|
|
|
UnitCount = pRO.GeleisteteFLSMitStundensatzAlt
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
itemList.Add(new InvoiceItemDC
|
|
|
|
|
{
|
|
|
|
|
ItemDescription = String.Format("{0:c}{1}", pRO.HourlyRateNew, pRO.RateFactor == 1 ? "" : " x " + pRO.RateFactorText2),
|
|
|
|
|
|
|
|
|
|
GrossAmountTotal = pRO.GeleisteteFLSMitStundensatzAktuell * pRO.RateFactor * pRO.HourlyRateNew,
|
|
|
|
|
UnitCount = pRO.GeleisteteFLSMitStundensatzAktuell
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if (pRO.DifferentHourlyRateCount == 2)
|
|
|
|
|
{
|
|
|
|
|
itemList.Add(new InvoiceItemDC
|
|
|
|
|
{
|
|
|
|
|
ItemDescription = String.Format("{0:c}{1}", pRO.HourlyRateOld, pRO.RateFactor == 1 ? "" : " x " + pRO.RateFactorText2),
|
|
|
|
|
|
|
|
|
|
GrossAmountTotal = pRO.GeleisteteFLSMitStundensatzAlt * (decimal)pRO.RateFactor * pRO.HourlyRateOld,
|
|
|
|
|
UnitCount = pRO.GeleisteteFLSMitStundensatzAlt
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
itemList.Add(new InvoiceItemDC
|
|
|
|
|
{
|
|
|
|
|
ItemDescription = String.Format("{0:c}{1}", pRO.HourlyRateNew, pRO.RateFactor == 1 ? "" : " x " + pRO.RateFactorText2),
|
|
|
|
|
|
|
|
|
|
GrossAmountTotal = pRO.GeleisteteFLSMitStundensatzAktuell * pRO.RateFactor * pRO.HourlyRateNew,
|
|
|
|
|
UnitCount = pRO.GeleisteteFLSMitStundensatzAktuell
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
itemList.Add(new InvoiceItemDC
|
|
|
|
|
{
|
|
|
|
|
ItemDescription = String.Format("{0:c}{1}", pRO.HourlyRateNew, pRO.RateFactor == 1 ? "" : " x " + pRO.RateFactorText2),
|
|
|
|
|
|
|
|
|
|
GrossAmountTotal = pRO.GeleisteteFLSMitStundensatzAktuell * pRO.RateFactor * pRO.HourlyRateNew,
|
|
|
|
|
UnitCount = pRO.GeleisteteFLSMitStundensatzAktuell
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return itemList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|