- Klientennamen im Jahresbericht eingebaut - Bugfix Reports für fehlende Unterschriften - Bugfix History
181 lines
5.4 KiB
C#
181 lines
5.4 KiB
C#
using System;
|
|
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using BeWo.Report;
|
|
using BeWo.Report.ReportObjects;
|
|
using BS.Shared.Core;
|
|
using DevExpress.XtraReports.UI;
|
|
|
|
namespace ProfEggersStiftung
|
|
{
|
|
[IDSpecificClass(Identifier = "RechnungPflege")]
|
|
public partial class RechnungPflege : XtraReport, IBeWoReport<ServiceInvoiceRO>
|
|
{
|
|
public RechnungPflege()
|
|
{
|
|
this.InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(ServiceInvoiceRO pRO)
|
|
{
|
|
DateTime start = pRO.AccountingPeriodStart;
|
|
DateTime end = pRO.AccountingPeriodEnd;
|
|
if (start.Month == end.Month && start.Year == end.Year)
|
|
{
|
|
lblMonat.Text = String.Format("Pflegekostenrechnung {0:MMMM yyyy}", start);
|
|
}
|
|
else
|
|
{
|
|
lblMonat.Text = String.Format("Pflegekostenrechnung {0:MMMM yyyy} - {1:MMMM yyyy}", start, end);
|
|
}
|
|
|
|
decimal hourlyRate = 0;
|
|
decimal hours = 0;
|
|
|
|
if (pRO.ServiceInvoicePeriods != null && pRO.ServiceInvoicePeriods.Count > 0)
|
|
{
|
|
foreach (var p in pRO.ServiceInvoicePeriods)
|
|
{
|
|
if (p.ServiceInvoiceItems != null && p.ServiceInvoiceItems.Count > 0)
|
|
{
|
|
foreach (var i in p.ServiceInvoiceItems)
|
|
{
|
|
if (i.HourlyRate.HasValue)
|
|
{
|
|
hourlyRate = i.HourlyRate.Value;
|
|
}
|
|
|
|
if (i.Hours.HasValue)
|
|
{
|
|
hours += i.Hours.Value;
|
|
}
|
|
|
|
if (!String.IsNullOrEmpty(i.UnitDescription))
|
|
{
|
|
i.UnitCountString = i.UnitDescription;
|
|
}
|
|
if (String.IsNullOrEmpty(i.UnitCountString) && i.UnitCount.HasValue)
|
|
{
|
|
i.UnitCountString = String.Format("{0:0.##}", i.UnitCount.Value);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if (pRO.ServiceInvoicePeriods.Count > 1) // Packe alle InvoiceItems zur ersten ServiceInvoicePeriod
|
|
{
|
|
for (int i = 1; i < pRO.ServiceInvoicePeriods.Count; i++)
|
|
{
|
|
var sip = pRO.ServiceInvoicePeriods[i];
|
|
|
|
foreach (var item in sip.ServiceInvoiceItems)
|
|
{
|
|
pRO.ServiceInvoicePeriods[0].ServiceInvoiceItems.Add(item);
|
|
}
|
|
|
|
if (sip.SupportConceptApprovalPeriod != null && sip.SupportConceptApprovalPeriod.ServiceCategory != null &&
|
|
sip.SupportConceptApprovalPeriod.ServiceCategory.Name.Contains("Stationär") && sip.SupportConceptApprovalPeriod.ServiceCategory.Name.Contains("TA"))
|
|
{
|
|
if (sip.SupportConceptApprovalPeriod.StartDate > pRO.AccountingPeriodStart && sip.SupportConceptApprovalPeriod.StartDate <= pRO.AccountingPeriodEnd)
|
|
{
|
|
//Auf dem Formular soll angegeben werden, wenn im Abrechnungsmonat ein Wechsel ins TA (Trainingsappartement) durchgeführt wurde
|
|
lblUmzugTZ.Text = String.Format("Umzug ins TA {0:dd.MM.}\n\n", sip.SupportConceptApprovalPeriod.StartDate);
|
|
}
|
|
}
|
|
|
|
}
|
|
pRO.ServiceInvoicePeriods.RemoveRange(1, pRO.ServiceInvoicePeriods.Count - 1);
|
|
|
|
pRO.ServiceInvoicePeriods[0].ServiceInvoiceItems.Sort((a, b) => a.Notice != null ? a.Notice.CompareTo(b.Notice) : 1);
|
|
}
|
|
}
|
|
|
|
if (!String.IsNullOrEmpty(pRO.CustomerSalutation) && pRO.CustomerSalutation.ToLower() == "herr")
|
|
{
|
|
pRO.CustomerSalutation = "Herrn";
|
|
}
|
|
|
|
if (pRO.SenderContactPersonPhone == null)
|
|
{
|
|
pRO.SenderContactPersonPhone = "0201-8953322";
|
|
}
|
|
|
|
var absencetimes = pRO.InvoiceBase.SupportConceptCostBearerRelDc.SupportConcept.Customer.AbsenceTimes;
|
|
|
|
String abwStr = "";
|
|
foreach (var at in absencetimes)
|
|
{
|
|
if ((!at.End.HasValue || at.End.Value >= pRO.AccountingPeriodStart) && at.Start.Value <= pRO.AccountingPeriodEnd)
|
|
{
|
|
DateTime endDt = pRO.AccountingPeriodEnd;
|
|
|
|
if (at.End.HasValue && at.End.Value < endDt)
|
|
{
|
|
endDt = at.End.Value;
|
|
}
|
|
|
|
DateTime startDt = pRO.AccountingPeriodStart;
|
|
if (at.Start > startDt)
|
|
{
|
|
startDt = at.Start.Value;
|
|
}
|
|
|
|
int days = (int)endDt.Subtract(startDt).TotalDays + 1;
|
|
|
|
if (abwStr.Length > 0)
|
|
{
|
|
abwStr += ", ";
|
|
}
|
|
String tage = "Tage";
|
|
if (days == 1)
|
|
{
|
|
tage = "Tag";
|
|
}
|
|
abwStr += String.Format("{0} {1} {2:dd}.-{3:dd.MM}", days, tage, startDt, endDt);
|
|
}
|
|
}
|
|
|
|
String abwesenheiten = "";
|
|
if (abwStr.Length > 0)
|
|
{
|
|
abwesenheiten = "Abwesenheiten: " + abwStr;
|
|
}
|
|
lblAbwesenheiten.Text = abwesenheiten;
|
|
|
|
String team = GetTeam(pRO);
|
|
if (team.ToLower().Contains("trialog"))
|
|
{
|
|
picAdresseBlau.Visible = false;
|
|
picLogoBlau.Visible = false;
|
|
|
|
picAdresseOrange.Visible = true;
|
|
picLogoOrange.Visible = true;
|
|
}
|
|
else
|
|
{
|
|
picAdresseBlau.Visible = true;
|
|
picLogoBlau.Visible = true;
|
|
|
|
picAdresseOrange.Visible = false;
|
|
picLogoOrange.Visible = false;
|
|
}
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
|
|
private string GetTeam(ServiceInvoiceRO pRO)
|
|
{
|
|
String team = "";
|
|
|
|
if (pRO.InvoiceBase.CustomerOid > 0)
|
|
{
|
|
var c = DAOFactory.GenericDAO.LoadByID<Customer>(pRO.InvoiceBase.CustomerOid);
|
|
|
|
foreach (var t2c in c.Team2CustomerList)
|
|
{
|
|
team = t2c.Team.Name;
|
|
}
|
|
}
|
|
return team;
|
|
}
|
|
}
|
|
} |