148 lines
6.6 KiB
C#
148 lines
6.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
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 AutismusKoelnBonn
|
|
{
|
|
public partial class ServiceInvoiceReport : XtraReport, IBeWoReport<ServiceInvoiceRO>
|
|
{
|
|
public ServiceInvoiceReport()
|
|
{
|
|
this.InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(ServiceInvoiceRO pRO)
|
|
{
|
|
// Die haben verschiedene Standorte/Schwerpunkte und das über Teams abgebildet -> eine Vorlage verschiedene "Absender" je nach Team
|
|
// jeder Klient ist derzeit wirklich nur in einem Team
|
|
DateTime start = pRO.AccountingPeriodStart;
|
|
DateTime end = pRO.AccountingPeriodEnd;
|
|
string poBox = null;
|
|
if (pRO.RecipientOrganisation.ToLower() != "selbstzahler" && pRO.InvoiceBase.RecipientContactInformations.Count > 0)
|
|
{
|
|
foreach (var i in pRO.InvoiceBase.RecipientContactInformations)
|
|
{
|
|
if (i.ContactType == BS.Shared.ContactType.private_POBox)
|
|
poBox = i.ContactValue;
|
|
}
|
|
}
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
//if (!String.IsNullOrEmpty(pRO.RecipientAddressLine1) && !String.IsNullOrEmpty(pRO.RecipientAddressLine1.Trim()) && pRO.RecipientOrganisation.Contains(pRO.CustomerLastName))
|
|
//{
|
|
// sb.AppendLine(pRO.RecipientAddressLine1);
|
|
//}
|
|
if (!String.IsNullOrEmpty(pRO.RecipientOrganisation) && !String.IsNullOrEmpty(pRO.RecipientOrganisation.Trim()) && pRO.RecipientOrganisation.ToLower() != "selbstzahler")
|
|
{
|
|
sb.AppendLine(pRO.RecipientOrganisation);
|
|
}
|
|
else if (!String.IsNullOrEmpty(pRO.RecipientOrganisation) && !String.IsNullOrEmpty(pRO.RecipientOrganisation.Trim()) && pRO.RecipientOrganisation.ToLower() == "selbstzahler")
|
|
{
|
|
sb.AppendLine(pRO.CustomerFirstName + " " + pRO.CustomerLastName);
|
|
}
|
|
if (!String.IsNullOrEmpty(pRO.RecipientDivision) && !String.IsNullOrEmpty(pRO.RecipientDivision.Trim()))
|
|
{
|
|
sb.AppendLine(pRO.RecipientDivision);
|
|
}
|
|
if (!String.IsNullOrEmpty(pRO.RecipientAddressLine1) && !String.IsNullOrEmpty(pRO.RecipientAddressLine1.Trim()))
|
|
{
|
|
sb.AppendLine(pRO.RecipientAddressLine1);
|
|
}
|
|
//if (!String.IsNullOrEmpty(pRO.RecipientContactPerson) && !String.IsNullOrEmpty(pRO.RecipientContactPerson.Trim()))
|
|
//{
|
|
// sb.AppendLine(pRO.RecipientContactPerson);
|
|
//}
|
|
if (pRO.RecipientOrganisation.ToLower() != "selbstzahler" && !String.IsNullOrEmpty(poBox))
|
|
{
|
|
sb.AppendLine(poBox);
|
|
}
|
|
//else if (!String.IsNullOrEmpty(pRO.RecipientPoBox))
|
|
//{
|
|
// sb.AppendLine(pRO.RecipientPoBox);
|
|
//}
|
|
if (pRO.RecipientOrganisation.ToLower() == "selbstzahler" && !String.IsNullOrEmpty(pRO.RecipientStreet))
|
|
{
|
|
sb.AppendLine(pRO.RecipientStreet);
|
|
}
|
|
if (!String.IsNullOrEmpty(pRO.RecipientPostCodeAndTown))
|
|
{
|
|
sb.AppendLine(pRO.RecipientPostCodeAndTown);
|
|
}
|
|
lblAdresse.Text = sb.ToString();
|
|
|
|
string team = "MoveAut Team Köln";
|
|
Customer c;
|
|
if (pRO.ServiceInvoicePeriods.Count > 0 && pRO.ServiceInvoicePeriods[0].Customer.Oid.HasValue)
|
|
{
|
|
c = DAOFactory.GenericDAO.LoadByID<Customer>(pRO.ServiceInvoicePeriods[0].Customer.Oid ?? 0);
|
|
if (c.Team2CustomerList.Count > 0)
|
|
team = c.Team2CustomerList[0].Team.Name;
|
|
if (c.Person.Sex == Sex.Divers)
|
|
pRO.CustomerSalutation = "Liebe*r";
|
|
}
|
|
|
|
if (team.Contains("BeWo Bonn"))
|
|
{
|
|
lblAbsenderBonn.Visible = true;
|
|
lblTeamBonn.Visible = true;
|
|
lblAbsenderKoeln.Visible = false;
|
|
lblHeaderKoeln.Visible = false;
|
|
lblTeamKoeln.Visible = false;
|
|
}
|
|
else if (team.Contains("HZE Bonn"))
|
|
{
|
|
lblAbsenderBonn.Visible = true;
|
|
lblTeamBonn.Visible = false;
|
|
lblBonnHZE.Visible = true;
|
|
lblAbsenderKoeln.Visible = false;
|
|
lblHeaderKoeln.Visible = false;
|
|
lblTeamKoeln.Visible = false;
|
|
}
|
|
else if (team.Contains("HZE Köln"))
|
|
{
|
|
lblTeamKoelnHZE.Visible = true;
|
|
lblHeaderKoelnHZE.Visible = true;
|
|
lblHeaderKoeln.Visible = false;
|
|
lblTeamKoeln.Visible = false;
|
|
}
|
|
|
|
foreach (var sip in pRO.ServiceInvoicePeriods)
|
|
{
|
|
foreach (var ii in sip.ServiceInvoiceItems)
|
|
{
|
|
if (ii.ServiceDescription.ToLower().Contains("fehlkontakt"))
|
|
continue;
|
|
if (ii.ServiceDescription != "Fallpauschale")
|
|
ii.ServiceDescription = "Fachleistungsstunden";
|
|
}
|
|
}
|
|
|
|
//Anpassungen um die Selbstzahler Rechnung mit abzubilden
|
|
if (pRO.RecipientOrganisation.ToLower() == "selbstzahler")
|
|
{
|
|
lbl1.Visible = false;
|
|
lbl2.Visible = false;
|
|
lbl3.Visible = false;
|
|
lblAnrede.Visible = true;
|
|
lblVerwaltung.Visible = true;
|
|
lblMfg.Visible = true;
|
|
lblAbrechnungszeitraum.Text = "Wir erlauben uns, gemäß beigefügter Leistungsnachweise, folgende Leistungen in Rechnung zu stellen:";
|
|
|
|
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);
|
|
else if (!String.IsNullOrEmpty(pRO.CustomerSalutation) && pRO.CustomerSalutation.ToLower().Contains("liebe"))
|
|
lblAnrede.Text = String.Format("{0} {1} {2},", pRO.CustomerSalutation, pRO.CustomerFirstName, pRO.CustomerLastName);
|
|
}
|
|
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
}
|
|
} |