Files
BeWoPlaner/ReportImp/AwoDortmund/ServiceInvoiceReport.cs

81 lines
3.0 KiB
C#

using System;
using BeWo.Report;
using BeWo.Report.ReportObjects;
using DevExpress.XtraReports.UI;
namespace AwoDortmund
{
public partial class ServiceInvoiceReport : XtraReport, IBeWoReport<ServiceInvoiceRO>
{
public ServiceInvoiceReport()
{
this.InitializeComponent();
}
public void SetReportDataSource(ServiceInvoiceRO pRO)
{
if (pRO.InvoiceBase.InvoiceId == "RechnungSoziotherapie" && pRO.InvoiceDateTime >= new DateTime(2024, 01, 01))
lblBankverbindung.Text = "Steuernummer: 314/5702/4217 \nBankverbindung \nAssistenzagentur der AWO UB Dortmund \nIBAN DE26 4405 0199 0001 2465 93 \nBIC DORTDE33XXX";
if (!String.IsNullOrEmpty(pRO.CustomerName))
{
pRO.CustomerName = pRO.CustomerName.Replace("_", "");
pRO.CustomerName = pRO.CustomerName.Replace("++", "");
}
if (!String.IsNullOrEmpty(pRO.CustomerSalutation) && pRO.CustomerSalutation == "Herr")
{
pRO.CustomerSalutation = "Herrn";
}
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);
}
String f = GetFunction(pRO);
if (f != null && f.ToLower().Contains("kasse"))
lblIK.Visible = true;
if (pRO.ServiceInvoicePeriods != null)
{
foreach (var sip in pRO.ServiceInvoicePeriods)
{
if (sip.ServiceInvoiceItems != null)
{
foreach (var ii in sip.ServiceInvoiceItems)
{
if (!String.IsNullOrEmpty(ii.RateFactor))
{
var rfStr = ii.RateFactor.Replace("%", "").Replace(",00", "").Trim();
int rfInt = 0;
Int32.TryParse(rfStr, out rfInt);
decimal rateFactor = (100m + rfInt) / 100m;
ii.RateFactor = String.Format("{0:0.##}", rateFactor);
}
}
}
}
}
this.bindingSource1.DataSource = pRO;
}
private String GetFunction(ServiceInvoiceRO pRO)
{
if (pRO.InvoiceBase != null && pRO.InvoiceBase.SupportConceptCostBearerRelDc != null)
{
var c2s = pRO.InvoiceBase.SupportConceptCostBearerRelDc;
return c2s.CostBearer.Function;
}
return null;
}
}
}