85 lines
2.7 KiB
C#
85 lines
2.7 KiB
C#
using System;
|
|
using System.Text;
|
|
using BeWo.Data.Entities;
|
|
using BeWo.Report;
|
|
using BeWo.Report.ReportObjects;
|
|
using BS.Shared;
|
|
|
|
namespace PerspektivenEV
|
|
{
|
|
public partial class InvoiceCustomerReport : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<InvoiceCustomerRO>
|
|
{
|
|
public InvoiceCustomerReport()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(InvoiceCustomerRO pRO)
|
|
{
|
|
string poBox = null;
|
|
if (pRO.InvoiceBase.RecipientContactInformations.Count > 0)
|
|
{
|
|
foreach (var i in pRO.InvoiceBase.RecipientContactInformations)
|
|
{
|
|
if (i.ContactType == BS.Shared.ContactType.business_POBox)
|
|
poBox = i.ContactValue;
|
|
}
|
|
}
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
if (!String.IsNullOrEmpty(pRO.RecipientOrganisation) && !String.IsNullOrEmpty(pRO.RecipientOrganisation.Trim()))
|
|
{
|
|
sb.AppendLine(pRO.RecipientOrganisation);
|
|
}
|
|
if (!String.IsNullOrEmpty(pRO.RecipientDivision) && !String.IsNullOrEmpty(pRO.RecipientDivision.Trim()))
|
|
{
|
|
sb.AppendLine(pRO.RecipientDivision);
|
|
}
|
|
if ((!String.IsNullOrEmpty(pRO.RecipientFirstName) && !String.IsNullOrEmpty(pRO.RecipientFirstName.Trim()))
|
|
|| (!String.IsNullOrEmpty(pRO.RecipientLastName) && !String.IsNullOrEmpty(pRO.RecipientLastName.Trim())))
|
|
{
|
|
sb.AppendLine(String.Format("{0} {1}", pRO.RecipientFirstName, pRO.RecipientLastName).Trim());
|
|
}
|
|
if (!String.IsNullOrEmpty(poBox))
|
|
{
|
|
sb.AppendLine(poBox);
|
|
}
|
|
else if (!String.IsNullOrEmpty(pRO.RecipientStreet))
|
|
{
|
|
sb.AppendLine(pRO.RecipientStreet);
|
|
}
|
|
if (!String.IsNullOrEmpty(pRO.RecipientPostCode) && !String.IsNullOrEmpty(pRO.RecipientPostCode.Trim()))
|
|
{
|
|
sb.AppendLine("");
|
|
sb.Append(pRO.RecipientPostCode);
|
|
sb.Append(" ");
|
|
}
|
|
if (!String.IsNullOrEmpty(pRO.RecipientTown) && !String.IsNullOrEmpty(pRO.RecipientTown.Trim()))
|
|
{
|
|
sb.Append(pRO.RecipientTown);
|
|
}
|
|
if (pRO.InvoiceBase.Type.ToString() == "General")
|
|
lblBetreff.Text = "";
|
|
|
|
lblAdresse.Text = sb.ToString();
|
|
if (sb.ToString().Contains("Frau") && sb.ToString().Contains("Heinemann"))
|
|
pRO.RecipientSalutation = "Sehr geehrte Frau Heinemann";
|
|
else if (pRO.RecipientSalutation == "Sehr geehrte Damen und Herren,")
|
|
pRO.RecipientSalutation = "Sehr geehrte Damen und Herren";
|
|
|
|
//Sonderlösung um im Notice-Feld bei Bedarf Teilzahlungen anzeigen zu können
|
|
int index = 0;
|
|
if (!String.IsNullOrEmpty(pRO.Notice))
|
|
{
|
|
index = pRO.Notice.IndexOf("\r\n");
|
|
if (index == 0)
|
|
index = pRO.Notice.IndexOf("BEZAHLT");
|
|
if (index > 0)
|
|
pRO.Notice = pRO.Notice.Remove(index);
|
|
}
|
|
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
|
|
}
|
|
} |