Files
BeWoPlaner/ReportImp/LebenshilfeDuisburgHPFH/SettlementReport2.cs
2021-07-07 15:05:45 +02:00

134 lines
6.2 KiB
C#

using System;
using System.Text;
using BeWo.Data.Access;
using BeWo.Data.Entities;
using BeWo.Report;
using BeWo.Report.ReportObjects;
namespace BeWo.LebenshilfeDuisburgReports
{
public partial class Spitzabrechnung : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<Settlement2RO>
{
public Spitzabrechnung()
{
InitializeComponent();
}
public void SetReportDataSource(Settlement2RO pRO)
{
if (!String.IsNullOrWhiteSpace(pRO.InvoiceNumber) && !pRO.InvoiceNumber.Contains("LH-BeWo"))
{
pRO.InvoiceNumber = "LH-BeWo" + pRO.InvoiceNumber;
}
pRO.Notice = String.Format("{0:dd.MM.yyyy}", pRO.InvoiceDate.AddDays(30));
bool hasRatefactor = false;
if (!String.IsNullOrWhiteSpace(pRO.RateFactorText2))
{
hasRatefactor = true;
if (pRO.RateFactorText2 == "1,2")
{
pRO.RateFactorText2 = "1,20";
}
}
if (pRO.InvoiceItems != null)
{
foreach (var ii in pRO.InvoiceItems)
{
ii.ItemDescription = "Eingliederungshilfe Gem.§§ 53,54 SGB XII\n" +
"\"Betreutes Wohnen\" ambulante Eingliederungshilfe.\n" +
String.Format("Bewilligungszeitraum {0:dd.MM.yyyy} bis {1:dd.MM.yyyy}\n ",
pRO.AccountingStartDate, pRO.AccountingEndDate);
ii.UnitCount = (ii.UnitCount ?? 0) * (((ii.RateFactor ?? 0) + 100) / 100);
// 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, !hasRatefactor ? "" : "x " + pRO.RateFactorText2 + " ",
// ii.AmountPerUnit);
}
}
// if (pRO.DifferentHourlyRateCount == 3)
// {
// //Erbrachte Leistungen (FLS) - bis [HourlyRateOldEndDateString] à [HourlyRateOldString] €
// pRO.Abrechnungstext1 = "Eingliederungshilfe Gem.§§ 53,54 SGB XII\n" +
// "\"Betreutes Wohnen\" ambulante Eingliederungshilfe.\n" +
// String.Format("Bewilligungszeitraum {0} bis {1}\n ",
// pRO.AccountingStartDateString, pRO.AccountingEndDateString);
// pRO.Abrechnungstext2 = pRO.Abrechnungstext1;
//pRO.Abrechnungstext3 = pRO.Abrechnungstext1;
//cellEinheiten1.Text = String.Format("{0:0.00}", pRO.GeleisteteFLSMitStundensatz3 * (decimal)pRO.RateFactor);
// cellPreis1.Text = String.Format("{0:0.00}", pRO.HourlyRate3);
//pRO.Betrag1 = String.Format("{0:c}", pRO.GeleisteteFLSMitStundensatz3 * (decimal)pRO.RateFactor * pRO.HourlyRate3);
//cellEinheiten2.Text = String.Format("{0:0.00}", pRO.GeleisteteFLSMitStundensatzAlt * (decimal)pRO.RateFactor);
//cellPreis2.Text = String.Format("{0:0.00}", pRO.HourlyRateOld);
//pRO.Betrag2 = String.Format("{0:c}", pRO.GeleisteteFLSMitStundensatzAlt * (decimal)pRO.RateFactor * pRO.HourlyRateOld);
//cellEinheiten3.Text = String.Format("{0:0.00}", pRO.GeleisteteFLSMitStundensatzAktuell * (decimal)pRO.RateFactor);
//cellPreis3.Text = String.Format("{0:0.00}", pRO.HourlyRateNew);
//pRO.Betrag3 = String.Format("{0:c}", pRO.GeleisteteFLSMitStundensatzAktuell * (decimal)pRO.RateFactor * pRO.HourlyRateNew);
// }
// else if (pRO.DifferentHourlyRateCount == 2)
// {
//pRO.Abrechnungstext2 = "Eingliederungshilfe Gem.§§ 53,54 SGB XII\n" +
// "\"Betreutes Wohnen\" ambulante Eingliederungshilfe.\n" +
// String.Format("Bewilligungszeitraum {0} bis {1}\n ",
// pRO.AccountingStartDateString, pRO.AccountingEndDateString);
//pRO.Abrechnungstext3 = pRO.Abrechnungstext2;
//cellEinheiten2.Text = String.Format("{0:0.00}", pRO.GeleisteteFLSMitStundensatzAlt * (decimal)pRO.RateFactor);
//cellPreis2.Text = String.Format("{0:0.00}", pRO.HourlyRateOld);
//pRO.Betrag2 = String.Format("{0:c}", pRO.GeleisteteFLSMitStundensatzAlt * (decimal)pRO.RateFactor * pRO.HourlyRateOld);
//cellEinheiten3.Text = String.Format("{0:0.00}", pRO.GeleisteteFLSMitStundensatzAktuell * (decimal)pRO.RateFactor);
//cellPreis3.Text = String.Format("{0:0.00}", pRO.HourlyRateNew);
//pRO.Betrag3 = String.Format("{0:c}", pRO.GeleisteteFLSMitStundensatzAktuell * (decimal)pRO.RateFactor * pRO.HourlyRateNew);
// }
// else
// {
//pRO.Abrechnungstext3 = "Eingliederungshilfe Gem.§§ 53,54 SGB XII\n" +
// "\"Betreutes Wohnen\" ambulante Eingliederungshilfe.\n" +
// String.Format("Bewilligungszeitraum {0} bis {1}\n ",
// pRO.AccountingStartDateString, pRO.AccountingEndDateString);
//cellEinheiten3.Text = String.Format("{0:0.00}", pRO.GeleisteteFLSMitStundensatzAktuell * (decimal)pRO.RateFactor);
//cellPreis3.Text = String.Format("{0:0.00}", pRO.HourlyRateNew);
// pRO.Betrag3 = String.Format("{0:c}", pRO.GeleisteteFLSMitStundensatzAktuell * (decimal)pRO.RateFactor * pRO.HourlyRateNew);
// }
SetzeWohnort(pRO);
this.bindingSource1.DataSource = pRO;
}
private void SetzeWohnort(Settlement2RO pRo)
{
StringBuilder sb = new StringBuilder();
sb.AppendLine(pRo.CustomerName);
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)
{
sb.AppendLine(c.Person.Address.Street);
sb.Append(String.Format("{0} {1}", c.Person.Address.PostalCode, c.Person.Address.Town));
}
}
}
lblCustomerInfos.Text = sb.ToString();
}
}
}