136 lines
5.8 KiB
C#
136 lines
5.8 KiB
C#
using System;
|
|
using System.Drawing;
|
|
using System.Collections;
|
|
using System.ComponentModel;
|
|
using System.Text;
|
|
using DevExpress.XtraReports.UI;
|
|
using BeWo.Report.ReportObjects;
|
|
using BeWo.Report;
|
|
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
|
|
namespace BeWo.SprungbrettTheresia.Alt
|
|
{
|
|
public partial class Spitzabrechnung : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<SettlementRO>
|
|
{
|
|
// 01/2025 abgeschafft mit "neuem" Budgetnachweis LWL
|
|
public Spitzabrechnung()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(SettlementRO pRO)
|
|
{
|
|
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.Append(pRO.RecipientPostCodeAndTown);
|
|
}
|
|
lblAdresse.Text = sb.ToString();
|
|
|
|
if (pRO.Approvals != null && pRO.Approvals.Count > 0)
|
|
{
|
|
pRO.ApprovedFLSWeekly = pRO.Approvals[0].ApprovedPerUnit ?? 0;
|
|
pRO.ApprovedFLSWeeklyString = String.Format("{0:0.00}", pRO.ApprovedFLSWeekly);
|
|
}
|
|
|
|
chkNichtBeendet.Checked = true;
|
|
if (pRO.CostBearer2SupportConceptOid > 0)
|
|
{
|
|
var c2s = DAOFactory.GenericDAO.LoadByID<CostBearer2SupportConcept>(pRO.CostBearer2SupportConceptOid);
|
|
|
|
if (c2s.SupportConcept.Customer.TerminationDate.HasValue)
|
|
{
|
|
chkBeendet.Text = String.Format(" Die Betreuung wurde am {0:dd.MM.yyyy} beendet.",
|
|
c2s.SupportConcept.Customer.TerminationDate);
|
|
chkNichtBeendet.Checked = false;
|
|
chkBeendet.Checked = true;
|
|
}
|
|
}
|
|
|
|
xrPanel1Amount.Location = xrPanel2Amounts.Location;
|
|
xrPanel3Amounts.Location = xrPanel2Amounts.Location;
|
|
|
|
if (pRO.InvoiceItems.Count == 1)
|
|
{
|
|
xrPanel2Amounts.Visible = false;
|
|
xrPanel3Amounts.Visible = false;
|
|
xrPanel1Amount.Visible = true;
|
|
pRO.AmountTotalWithNewHourlyRate = pRO.InvoiceItems[0].AmountTotal;
|
|
|
|
var weeks = BerechneWochen(pRO.InvoiceItems[0].ItemPeriodStart, pRO.InvoiceItems[0].ItemPeriodEnd);
|
|
pRO.WeeksWithNewHourlyRateString = String.Format("{0:0.00}", weeks);
|
|
|
|
pRO.TotalApprovedFLSWithNewHourlyRateString = String.Format("{0:0.00}", (weeks ?? 0) * pRO.ApprovedFLSWeekly);
|
|
}
|
|
|
|
else if (pRO.InvoiceItems.Count == 2)
|
|
{
|
|
xrPanel2Amounts.Visible = true;
|
|
xrPanel3Amounts.Visible = false;
|
|
xrPanel1Amount.Visible = false;
|
|
pRO.AmountTotalWithNewHourlyRate = pRO.InvoiceItems[1].AmountTotal;
|
|
|
|
var weeks = BerechneWochen(pRO.InvoiceItems[0].ItemPeriodStart, pRO.InvoiceItems[0].ItemPeriodEnd);
|
|
pRO.WeeksWithOldHourlyRateString = String.Format("{0:0.00}", weeks);
|
|
pRO.TotalApprovedFLSWithOldHourlyRateString = String.Format("{0:0.00}", (weeks ?? 0) * pRO.ApprovedFLSWeekly);
|
|
|
|
weeks = BerechneWochen(pRO.InvoiceItems[1].ItemPeriodStart, pRO.InvoiceItems[1].ItemPeriodEnd);
|
|
pRO.WeeksWithNewHourlyRateString = String.Format("{0:0.00}", weeks);
|
|
pRO.TotalApprovedFLSWithNewHourlyRateString = String.Format("{0:0.00}", (weeks ?? 0) * pRO.ApprovedFLSWeekly);
|
|
|
|
}
|
|
else if (pRO.InvoiceItems.Count == 3)
|
|
{
|
|
xrPanel3Amounts.Visible = true;
|
|
xrPanel2Amounts.Visible = false;
|
|
xrPanel1Amount.Visible = false;
|
|
pRO.AmountTotalWithHourlyRate3 = pRO.InvoiceItems[0].AmountTotal ?? 0;
|
|
pRO.AmountTotalWithOldHourlyRate = pRO.InvoiceItems[1].AmountTotal;
|
|
pRO.AmountTotalWithNewHourlyRate = pRO.InvoiceItems[2].AmountTotal;
|
|
|
|
var weeks = BerechneWochen(pRO.InvoiceItems[0].ItemPeriodStart, pRO.InvoiceItems[0].ItemPeriodEnd);
|
|
pRO.WeeksWithHourlyRate3String = String.Format("{0:0.00}", weeks);
|
|
pRO.TotalApprovedFLSWithHourlyRate3String = String.Format("{0:0.00}", (weeks ?? 0) * pRO.ApprovedFLSWeekly);
|
|
|
|
weeks = BerechneWochen(pRO.InvoiceItems[1].ItemPeriodStart, pRO.InvoiceItems[1].ItemPeriodEnd);
|
|
pRO.WeeksWithOldHourlyRateString = String.Format("{0:0.00}", weeks);
|
|
pRO.TotalApprovedFLSWithOldHourlyRateString = String.Format("{0:0.00}", (weeks ?? 0) * pRO.ApprovedFLSWeekly);
|
|
|
|
weeks = BerechneWochen(pRO.InvoiceItems[2].ItemPeriodStart, pRO.InvoiceItems[2].ItemPeriodEnd);
|
|
pRO.WeeksWithNewHourlyRateString = String.Format("{0:0.00}", weeks);
|
|
pRO.TotalApprovedFLSWithNewHourlyRateString = String.Format("{0:0.00}", (weeks ?? 0) * pRO.ApprovedFLSWeekly);
|
|
}
|
|
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
|
|
private decimal? BerechneWochen(DateTime? itemPeriodStart, DateTime? itemPeriodEnd)
|
|
{
|
|
if (itemPeriodStart.HasValue && itemPeriodEnd.HasValue)
|
|
{
|
|
var days = (decimal)itemPeriodEnd.Value.Subtract(itemPeriodStart.Value).TotalDays + 1;
|
|
return Math.Round(days * 0.1427m, 2);
|
|
}
|
|
return null;
|
|
}
|
|
}
|
|
}
|