Files
BeWoPlaner/ReportImp/HausTheresia/Budgetnachweis2.cs

78 lines
3.0 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BeWo.Data.Access;
using BeWo.Data.Entities;
using BeWo.Report.ReportObjects;
using BeWo.Report;
using BS.Shared.DataContracts;
using DevExpress.XtraReports.UI;
namespace HausTheresia.Neu
{
public partial class Budgetnachweis : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<Settlement2RO>
{
public Budgetnachweis()
{
InitializeComponent();
}
public void SetReportDataSource(Settlement2RO pRO)
{
if (!String.IsNullOrEmpty(pRO.SenderContactPersonPhone))
{
pRO.SenderContactPersonPhone = pRO.SenderContactPersonPhone.Replace("Tel.:", "").Trim();
}
if (!String.IsNullOrEmpty(pRO.SenderContactPersonFax))
{
pRO.SenderContactPersonFax = pRO.SenderContactPersonFax.Replace("Fax:", "").Trim();
}
if (!String.IsNullOrEmpty(pRO.SenderContactPersonMail))
{
pRO.SenderContactPersonMail = pRO.SenderContactPersonMail.Replace("E-Mail:", "").Trim();
}
xrCheckBox2.Checked = true;
if (pRO.TerminationDate.HasValue)
{
xrCheckBox1.Text = String.Format(" Die Betreuung wurde beendet am {0:dd.MM.yyyy}.",
pRO.TerminationDate);
xrCheckBox2.Checked = false;
xrCheckBox1.Checked = true;
}
SetzeWohnortUZad(pRO);
bindingSource1.DataSource = pRO;
}
private void SetzeWohnortUZad(Settlement2RO pRo)
{
if (pRo.InvoiceBaseOid.HasValue)
{
var ib = DAOFactory.GenericDAO.LoadByID<InvoiceBase>(pRo.InvoiceBaseOid.Value);
if (ib.CostBearer2SupportConcept != null)
{
var c = ib.CostBearer2SupportConcept.SupportConcept.Customer;
if (c != null)
{
if (c.Person.Address != null)
{
lblCustomer.Text = String.Format("{0}, {1}, {2} {3}", pRo.CustomerName, c.Person.Address.Street, c.Person.Address.PostalCode, c.Person.Address.Town);
}
lblOrtDatum.Text = String.Format("Hattingen, {0:dd.MM.yyyy}", pRo.InvoiceDate);
// AB, 20.03.2026: ursprünglich nur Ennepetal, Team Bochum ist neu
var team = c.Team2CustomerList.Select(x => x.Team.Name).FirstOrDefault();
if (team != null && team.Contains("Bochum"))
{
lblZAD.Text = "ZAD - Nr.LWL: 9029857 ";
lblOrtDatum.Text = String.Format("Bochum, {0:dd.MM.yyyy}", pRo.InvoiceDate);
lblAbsender.Text = "Theresia Albers gGmbH \nCramerstr.10, 44793 Bochum";
}
}
}
}
}
}
}