194 lines
7.7 KiB
C#
194 lines
7.7 KiB
C#
using System;
|
|
using BeWo.Report;
|
|
using BeWo.Report.ReportObjects;
|
|
|
|
using DevExpress.XtraReports.UI;
|
|
|
|
namespace BeWo.DiakonieKKKleve
|
|
{
|
|
public partial class ServiceInvoiceReport : XtraReport, IBeWoReport<ServiceInvoiceRO>
|
|
{
|
|
public ServiceInvoiceReport()
|
|
{
|
|
this.InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(ServiceInvoiceRO pRO)
|
|
{
|
|
if (!String.IsNullOrEmpty(pRO.SenderContactPersonMail))
|
|
{
|
|
pRO.SenderContactPersonMail = pRO.SenderContactPersonMail.Replace("E-Mail.:", "").Trim();
|
|
}
|
|
if (!String.IsNullOrEmpty(pRO.SenderContactPersonPhone))
|
|
{
|
|
pRO.SenderContactPersonPhone = pRO.SenderContactPersonPhone.Replace("Tel.:", "").Trim();
|
|
}
|
|
if (!String.IsNullOrEmpty(pRO.SenderContactPersonFax))
|
|
{
|
|
pRO.SenderContactPersonFax = pRO.SenderContactPersonFax.Replace("Fax:", "").Trim();
|
|
}
|
|
lblAddress.Text = "";
|
|
if (!String.IsNullOrEmpty(pRO.RecipientOrganisation) && !String.IsNullOrEmpty(pRO.RecipientOrganisation.Trim()))
|
|
{
|
|
lblAddress.Text += pRO.RecipientOrganisation + "\n";
|
|
}
|
|
if (!String.IsNullOrEmpty(pRO.RecipientContactPerson) && !String.IsNullOrEmpty(pRO.RecipientContactPerson.Trim()))
|
|
{
|
|
lblAddress.Text += pRO.RecipientContactPerson + "\n";
|
|
}
|
|
if (!String.IsNullOrEmpty(pRO.RecipientDivision) && !String.IsNullOrEmpty(pRO.RecipientDivision.Trim()))
|
|
{
|
|
lblAddress.Text += pRO.RecipientDivision + "\n";
|
|
}
|
|
if (!String.IsNullOrEmpty(pRO.RecipientStreet) && !String.IsNullOrEmpty(pRO.RecipientStreet.Trim()))
|
|
{
|
|
lblAddress.Text += pRO.RecipientStreet + "\n";
|
|
}
|
|
if (!String.IsNullOrEmpty(pRO.RecipientPostCodeAndTown) && !String.IsNullOrEmpty(pRO.RecipientPostCodeAndTown.Trim()))
|
|
{
|
|
lblAddress.Text += pRO.RecipientPostCodeAndTown;
|
|
}
|
|
|
|
|
|
|
|
DateTime start = pRO.AccountingPeriodStart;
|
|
DateTime end = pRO.AccountingPeriodEnd;
|
|
|
|
|
|
if (start.Month == end.Month && start.Year == end.Year)
|
|
{
|
|
lblAbrechnungszeitraum.Text = String.Format("hiermit berechnen wir für den Monat {0:MMMM yyyy} folgende erbrachte Tätigkeiten:", start);
|
|
}
|
|
else
|
|
{
|
|
lblAbrechnungszeitraum.Text = String.Format("hiermit berechnen wir für den Zeitraum {0:MMMM yyyy} - {1:MMMM yyyy} folgende erbrachte Tätigkeiten:", start, end);
|
|
}
|
|
|
|
decimal rateFactor = 1;
|
|
decimal hourlyRate = 0;
|
|
decimal minutenGesamt = 0;
|
|
|
|
bool isAlltagsbegleitung = false;
|
|
bool isVerhinderungspflege = false;
|
|
|
|
if (pRO.ServiceInvoicePeriods != null)
|
|
{
|
|
foreach (var p in pRO.ServiceInvoicePeriods)
|
|
{
|
|
if (p.ServiceInvoiceItems != null)
|
|
{
|
|
foreach (var i in p.ServiceInvoiceItems)
|
|
{
|
|
if (!String.IsNullOrEmpty(i.ServiceDescription) && i.ServiceDescription.StartsWith("Assistenz"))
|
|
{
|
|
i.ServiceDescription = "Assistenz";
|
|
}
|
|
else if (i.ServiceRecord != null && i.ServiceRecord.ServiceDescription.CategoryName.StartsWith("Alltagsbegleitung"))
|
|
{
|
|
i.ServiceDescription = "Betreuungsleistungen";
|
|
isAlltagsbegleitung = true;
|
|
}
|
|
else if (!String.IsNullOrEmpty(i.ServiceDescription) && i.ServiceDescription.StartsWith("Alltagsbegleitung"))
|
|
{
|
|
i.ServiceDescription = "Betreuungsleistungen";
|
|
isAlltagsbegleitung = true;
|
|
}
|
|
else if (i.ServiceRecord != null && i.ServiceRecord.ServiceDescription.CategoryName.StartsWith("Verhinderungspflege"))
|
|
{
|
|
i.ServiceDescription = "Verhinderungspflege";
|
|
isVerhinderungspflege = true;
|
|
}
|
|
else if (!String.IsNullOrEmpty(i.ServiceDescription) && i.ServiceDescription.StartsWith("Verhinderungspflege"))
|
|
{
|
|
i.ServiceDescription = "Verhinderungspflege";
|
|
isVerhinderungspflege = true;
|
|
}
|
|
else
|
|
{
|
|
i.ServiceDescription = "BEWO";
|
|
}
|
|
if (i.UnitCount.HasValue)
|
|
{
|
|
minutenGesamt += i.UnitCount.Value*60;
|
|
}
|
|
if (!String.IsNullOrEmpty(i.RateFactor))
|
|
{
|
|
var rfStr = i.RateFactor.Replace("%", "").Replace(",00", "").Trim();
|
|
int rfInt = 0;
|
|
Int32.TryParse(rfStr, out rfInt);
|
|
|
|
rateFactor = (100m + rfInt)/100m;
|
|
}
|
|
if (i.HourlyRate.HasValue)
|
|
{
|
|
hourlyRate = i.HourlyRate.Value;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
if (pRO.AccountingPeriodStart >= new DateTime(2020, 1, 1))
|
|
{
|
|
lblRechnungstext.Text = @"Rechnung über Leistungen der Eingliederungshilfe gem. §§ 113,78 SGB IX
|
|
(Ambulant Betreutes Wohnen)
|
|
Klient[CustomerName] Aktenzeichen[CustomerReferenceNumber]
|
|
Rechnungsnummer: [InvoiceNumber] Datum: [InvoiceDate]";
|
|
|
|
|
|
}
|
|
|
|
if (isAlltagsbegleitung)
|
|
{
|
|
lblRechnungstext.Text = @"Rechnung über Leistungen im Bereich Betreuungsleistungen § 45b
|
|
Klient [CustomerName] Aktenzeichen [CustomerReferenceNumber]
|
|
Rechnungsnummer: [InvoiceNumber] Datum: [InvoiceDate]";
|
|
|
|
lblKonto.Text = @"Zahlungsziel 14 Tage nach Rechnungsdatum
|
|
|
|
Bitte überweisen Sie den Betrag auf unser Konto IBAN DE13 3206 1384 5103 3680 16
|
|
bei der Volksbank an der Niers e.V.
|
|
|
|
Freundliche Grüße";
|
|
}
|
|
|
|
|
|
if (isVerhinderungspflege)
|
|
{
|
|
lblRechnungstext.Text = @"Rechnung über Verhinderungspflege
|
|
Klient [CustomerName] Aktenzeichen [CustomerReferenceNumber]
|
|
Rechnungsnummer: [InvoiceNumber] Datum: [InvoiceDate]";
|
|
|
|
lblKonto.Text = @"Zahlungsziel 14 Tage nach Rechnungsdatum
|
|
|
|
Bitte überweisen Sie den Betrag auf unser Konto IBAN DE13 3206 1384 5103 3680 16
|
|
bei der Volksbank an der Niers e.V.
|
|
|
|
Freundliche Grüße";
|
|
}
|
|
minutenGesamt = Math.Round(minutenGesamt, 0, MidpointRounding.AwayFromZero);
|
|
|
|
if (rateFactor == 1)
|
|
{
|
|
lblFaktorMinuten.Visible = false;
|
|
lblRatefactorLabel.Visible = false;
|
|
}
|
|
|
|
decimal faktorMinuten = (minutenGesamt * rateFactor) - minutenGesamt;
|
|
lblGesamtMinuten.Text = String.Format("{0:0} Minuten", minutenGesamt);
|
|
lblFaktorMinuten.Text = String.Format("{0:0} Minuten", faktorMinuten);
|
|
lblGesamtUndFaktorMinuten.Text = String.Format("{0:0} Minuten", faktorMinuten + minutenGesamt);
|
|
lblGesamtUndFaktorStunden.Text = String.Format("{0:0.##} Stunden", (faktorMinuten + minutenGesamt) / 60);
|
|
lblGesamtBetrag.Text = pRO.GrossClaim.Replace("€", "EUR");
|
|
lblGesamtBetrag2.Text = lblGesamtBetrag.Text;
|
|
|
|
lblXMinutenEntsprechen.Text = String.Format("{0:0} Minuten entsprechen", faktorMinuten + minutenGesamt);
|
|
|
|
lblRechnungsbetragText.Text = String.Format("Rechnungsbetrag für {0:0.##} Stunden zu {1:0.00} EUR/Std.", (faktorMinuten + minutenGesamt) / 60, hourlyRate);
|
|
lblRechnungsbetragText2.Text = String.Format("Von Ihnen zu zahlender Betrag für\r\n{0:0.##} Stunden zu {1:0.00} EUR/Std.", (faktorMinuten + minutenGesamt) / 60, hourlyRate);
|
|
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
}
|
|
} |