Files
BeWoPlaner/ReportImp/PariSozial/ServiceInvoiceReport.cs
2024-09-25 09:11:13 +02:00

75 lines
2.4 KiB
C#

using System;
using BeWo.Report.ReportObjects;
using BeWo.Report;
using DevExpress.XtraReports.UI;
using System.Text;
using BeWo.Data.Access;
using BeWo.Data.Entities;
namespace PariSozial
{
public partial class ServiceInvoiceReport : XtraReport, IBeWoReport<ServiceInvoiceRO>
{
public ServiceInvoiceReport()
{
this.InitializeComponent();
}
public void SetReportDataSource(ServiceInvoiceRO pRO)
{
StringBuilder sb = new StringBuilder();
if (!String.IsNullOrEmpty(pRO.RecipientOrganisation))
{
sb.AppendLine(pRO.RecipientOrganisation);
}
if (pRO.InvoiceBase != null)
{
var ib = DAOFactory.GenericDAO.LoadByID<InvoiceBase>(pRO.InvoiceBase.InvoiceBaseOid.Value);
var org = ib.CostBearer2SupportConcept.CostBearer.Organisation;
if (org.InvoiceAddress != null && !String.IsNullOrWhiteSpace(org.InvoiceAddress.AddressLine1))
{
pRO.RecipientDivision = org.InvoiceAddress.AddressLine1;
}
pRO.DebitorNumber = org.DebitorNumber;
}
if (!String.IsNullOrEmpty(pRO.RecipientDivision))
{
sb.AppendLine(pRO.RecipientDivision);
}
if (!String.IsNullOrEmpty(pRO.RecipientPoBox))
{
sb.AppendLine(pRO.RecipientPoBox);
}
else
{
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.BusinessPartnerId))
{
lblKontaktdaten.Text = lblKontaktdaten.Text.Replace("GP-Nummer: ", "");
}
if (!String.IsNullOrEmpty(pRO.Notice))
{
lblNotice.Text = "Bemerkung:\n" + pRO.Notice;
}
lblHinweise.Text = lblHinweise.Text.Replace("xxxxx", String.Format("{0:dd.MM.yyyy}", pRO.InvoiceDateTime.Value.AddDays(14))).Replace("rrrrr", pRO.InvoiceNumber);
this.bindingSource1.DataSource = pRO;
}
}
}