81 lines
2.9 KiB
C#
81 lines
2.9 KiB
C#
using System;
|
|
using System.Text;
|
|
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using BeWo.Report;
|
|
using BeWo.Report.ReportObjects;
|
|
using BS.Shared;
|
|
using DevExpress.XtraReports.UI;
|
|
|
|
namespace Kimm
|
|
{
|
|
public partial class AllgemeineRechnung : XtraReport, IBeWoReport<InvoiceCustomerRO>
|
|
{
|
|
public AllgemeineRechnung()
|
|
{
|
|
this.InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(InvoiceCustomerRO pRO)
|
|
{
|
|
|
|
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(pRO.RecipientStreet) && !String.IsNullOrEmpty(pRO.RecipientStreet.Trim()))
|
|
{
|
|
sb.AppendLine(pRO.RecipientStreet);
|
|
}
|
|
if (!String.IsNullOrEmpty(pRO.RecipientPostCode) && !String.IsNullOrEmpty(pRO.RecipientPostCode.Trim()))
|
|
{
|
|
sb.Append(pRO.RecipientPostCode);
|
|
sb.Append(" ");
|
|
}
|
|
if (!String.IsNullOrEmpty(pRO.RecipientTown) && !String.IsNullOrEmpty(pRO.RecipientTown.Trim()))
|
|
{
|
|
sb.Append(pRO.RecipientTown);
|
|
}
|
|
lblAddress.Text = sb.ToString();
|
|
|
|
lblBetreuungsart.Text = GetBetreuungsart(pRO);
|
|
|
|
//Warnhinweis auf neue Kontoverbindung nur bis 28.02.2022 sichtbar - kann danach weg
|
|
if (pRO.InvoiceDateTime >= new DateTime(2021, 11, 8) && pRO.InvoiceDateTime < new DateTime(2022, 03, 01))
|
|
rtbNeueBank.Visible = true;
|
|
else
|
|
rtbNeueBank.Visible = false;
|
|
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
|
|
public String GetBetreuungsart(InvoiceCustomerRO pRO)
|
|
{
|
|
if (pRO.InvoiceBase != null && pRO.InvoiceBase.RecipientCustomerOid.HasValue)
|
|
{
|
|
var c = DAOFactory.GenericDAO.LoadByID<Customer>(pRO.InvoiceBase.RecipientCustomerOid.Value);
|
|
|
|
foreach (var v2o in c.ValueList)
|
|
{
|
|
if (v2o.Entry.Type == ValueListEntryType.CustomerCareType)
|
|
{
|
|
return v2o.Entry.Value;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return "";
|
|
}
|
|
}
|
|
} |