Files

136 lines
5.8 KiB
C#
Raw Permalink Normal View History

2016-06-27 01:45:38 +02:00
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;
2016-06-27 01:45:38 +02:00
namespace BeWo.SprungbrettTheresia.Alt
2016-06-27 01:45:38 +02:00
{
public partial class Spitzabrechnung : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<SettlementRO>
{
// 01/2025 abgeschafft mit "neuem" Budgetnachweis LWL
2016-06-27 01:45:38 +02:00
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();
2021-07-07 15:05:45 +02:00
if (pRO.Approvals != null && pRO.Approvals.Count > 0)
{
pRO.ApprovedFLSWeekly = pRO.Approvals[0].ApprovedPerUnit ?? 0;
pRO.ApprovedFLSWeeklyString = String.Format("{0:0.00}", pRO.ApprovedFLSWeekly);
}
2016-06-27 01:45:38 +02:00
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;
}
}
2016-06-27 01:45:38 +02:00
xrPanel1Amount.Location = xrPanel2Amounts.Location;
xrPanel3Amounts.Location = xrPanel2Amounts.Location;
2021-07-07 15:05:45 +02:00
if (pRO.InvoiceItems.Count == 1)
2016-06-27 01:45:38 +02:00
{
xrPanel2Amounts.Visible = false;
xrPanel3Amounts.Visible = false;
xrPanel1Amount.Visible = true;
2021-07-07 15:05:45 +02:00
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);
2016-06-27 01:45:38 +02:00
}
2021-07-07 15:05:45 +02:00
else if (pRO.InvoiceItems.Count == 2)
2016-06-27 01:45:38 +02:00
{
xrPanel2Amounts.Visible = true;
xrPanel3Amounts.Visible = false;
xrPanel1Amount.Visible = false;
2021-07-07 15:05:45 +02:00
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);
2016-06-27 01:45:38 +02:00
}
2021-07-07 15:05:45 +02:00
else if (pRO.InvoiceItems.Count == 3)
2016-06-27 01:45:38 +02:00
{
xrPanel3Amounts.Visible = true;
xrPanel2Amounts.Visible = false;
xrPanel1Amount.Visible = false;
2021-07-07 15:05:45 +02:00
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);
2016-06-27 01:45:38 +02:00
}
this.bindingSource1.DataSource = pRO;
}
2021-07-07 15:05:45 +02:00
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);
2021-07-07 15:05:45 +02:00
}
return null;
}
2016-06-27 01:45:38 +02:00
}
}