Files
BeWoPlaner/ReportImp/DomizielAnsbach/RechnungPB.cs

78 lines
2.6 KiB
C#

using System;
using System.Text;
using BeWo.Report;
using BeWo.Report.ReportObjects;
using BS.Shared.Core;
using DevExpress.XtraReports.UI;
namespace DomizielAnsbach
{
[IDSpecificClass(Identifier = "RechnungPB")]
public partial class RechnungPB : XtraReport, IBeWoReport<ServiceInvoiceRO>
{
public RechnungPB()
{
this.InitializeComponent();
}
public void SetReportDataSource(ServiceInvoiceRO pRO)
{
var sb = new StringBuilder();
if (!String.IsNullOrEmpty(pRO.RecipientOrganisation))
{
sb.AppendLine(pRO.RecipientOrganisation);
}
if (!String.IsNullOrEmpty(pRO.RecipientAddressLine1))
{
sb.AppendLine(pRO.RecipientAddressLine1);
}
if (!String.IsNullOrEmpty(pRO.RecipientDivision))
{
sb.AppendLine(pRO.RecipientDivision);
}
//if (!String.IsNullOrEmpty(pRO.RecipientContactPerson) && pRO.RecipientContactPerson != pRO.RecipientOrganisation)
//{
// sb.AppendLine(pRO.RecipientContactPerson);
//}
if (!String.IsNullOrEmpty(pRO.RecipientStreet))
{
sb.AppendLine(pRO.RecipientStreet);
}
if (!String.IsNullOrEmpty(pRO.RecipientPostCodeAndTown))
{
sb.AppendLine(pRO.RecipientPostCodeAndTown);
}
lblAdresse.Text = sb.ToString();
if (String.IsNullOrEmpty(pRO.Notice))
{
lblNotice.Visible = false;
}
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);
}
if (!String.IsNullOrEmpty(pRO.CustomerSalutation) && pRO.CustomerSalutation.ToLower().Contains("herr"))
{
lblAnrede.Text = String.Format("Sehr geehrter Herr {0},", pRO.CustomerLastName);
}
else if (!String.IsNullOrEmpty(pRO.CustomerSalutation) && pRO.CustomerSalutation.ToLower().Contains("frau"))
{
lblAnrede.Text = String.Format("Sehr geehrte Frau {0},", pRO.CustomerLastName);
}
this.bindingSource1.DataSource = pRO;
}
}
}