99 lines
3.7 KiB
C#
99 lines
3.7 KiB
C#
using System;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
using BeWo.Report;
|
|
using BeWo.Report.ReportObjects;
|
|
|
|
using DevExpress.XtraReports.UI;
|
|
|
|
namespace MuenchenerAidsHilfeEV
|
|
{
|
|
public partial class ServiceInvoiceReport : XtraReport, IBeWoReport<ServiceInvoiceRO>
|
|
{
|
|
public ServiceInvoiceReport()
|
|
{
|
|
this.InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(ServiceInvoiceRO pRO)
|
|
{
|
|
pRO.InvoiceDate = String.Format("{0:dd.MM.yyyy}", new DateTime(pRO.InvoiceDateTime.Value.Year, pRO.InvoiceDateTime.Value.Month, 1));
|
|
|
|
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.AppendLine(pRO.RecipientPostCodeAndTown);
|
|
}
|
|
lblAdresse.Text = sb.ToString();
|
|
|
|
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 Leistungen:", start);
|
|
}
|
|
else
|
|
{
|
|
lblAbrechnungszeitraum.Text = String.Format("hiermit berechnen wir für den Zeitraum {0:MMMM yyyy} - {1:MMMM yyyy} folgende erbrachte Leistungen:", start, end);
|
|
}
|
|
String einrichtungsnummer = "TWG102106";
|
|
|
|
foreach (var sip in pRO.ServiceInvoicePeriods)
|
|
{
|
|
foreach (var item in sip.ServiceInvoiceItems)
|
|
{
|
|
if (item.ServiceDescription.Contains("1:6") || item.ServiceDescription.Contains("1:8") || item.ServiceDescription.Contains("1:10"))
|
|
{
|
|
einrichtungsnummer = "BEW102021";
|
|
}
|
|
}
|
|
}
|
|
lblEinrichtungsnummer.Text = "Einrichtungsnummer " + einrichtungsnummer;
|
|
|
|
lblDatum.Text = pRO.InvoiceDate;
|
|
|
|
pRO.InvoiceDateTime = pRO.AccountingPeriodEnd;
|
|
pRO.InvoiceDate = String.Format("{0:dd.MM.yyyy}", pRO.InvoiceDateTime);
|
|
pRO.AccountingPeriodStart = pRO.InvoiceBase.SupportConceptCostBearerRelDc.StartDate.Value;
|
|
pRO.AccountingPeriodEnd = pRO.InvoiceBase.SupportConceptCostBearerRelDc.EndDate.Value;
|
|
|
|
if (pRO.AmountAdvancedPayments == null || pRO.AmountEquityContribution != null && pRO.AmountEquityContribution == "0,00 €")
|
|
{
|
|
rowEigenanteil.Visible = false;
|
|
rowEndbetrag.Visible = false;
|
|
}
|
|
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
|
|
private void ChangeName(object sender, System.ComponentModel.CancelEventArgs e)
|
|
{
|
|
var report = sender as XtraReport;
|
|
var source = report.DataSource as BindingSource;
|
|
var ro = source.DataSource as ServiceInvoiceRO;
|
|
|
|
var start = ro.AccountingPeriodStart;
|
|
var end = ro.AccountingPeriodEnd;
|
|
var klient = ro.CustomerFirstName + ro.CustomerLastName;
|
|
|
|
this.DisplayName = String.Format("{0:dd.MM.yy}-{1:dd.MM.yy}_{2}", start, end, klient);
|
|
}
|
|
}
|
|
} |