150 lines
5.1 KiB
C#
150 lines
5.1 KiB
C#
using System;
|
|
using System.Drawing;
|
|
using System.Collections;
|
|
using System.ComponentModel;
|
|
using DevExpress.XtraReports.UI;
|
|
using BeWo.Report.ReportObjects;
|
|
using BeWo.Report;
|
|
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using System.Text;
|
|
|
|
namespace AutismusKoelnBonn
|
|
{
|
|
public partial class Spitzabrechnung : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<Settlement2RO>
|
|
{
|
|
public Spitzabrechnung()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(Settlement2RO pRO)
|
|
{
|
|
string AddressLine1 = null;
|
|
decimal rateFactor = 1;
|
|
|
|
foreach (var ii in pRO.InvoiceItems)
|
|
{
|
|
if (ii.RateFactor.HasValue)
|
|
{
|
|
rateFactor = (100 + ii.RateFactor.Value) / 100;
|
|
}
|
|
}
|
|
pRO.RateFactor = (double)rateFactor;
|
|
|
|
if (pRO.Eigenbeteiligung != 0)
|
|
pRO.AmountBillableTotal = pRO.AmountBillableTotal - pRO.Eigenbeteiligung ?? 0;
|
|
|
|
if (pRO.AbsenceTimes == "")
|
|
pRO.AbsenceTimes = String.Format("Stationärer Aufenthalt: keiner");
|
|
else
|
|
pRO.AbsenceTimes = String.Format("Stationärer Aufenthalt: {0}, siehe Quittierungsbeleg(e).", pRO.AbsenceTimes);
|
|
|
|
string team = "MoveAut Team Köln";
|
|
if (pRO.InvoiceBaseOid.HasValue)
|
|
{
|
|
var ib = DAOFactory.GenericDAO.LoadByID<InvoiceBase>(pRO.InvoiceBaseOid.Value);
|
|
var c = ib.CostBearer2SupportConcept.SupportConcept.Customer;
|
|
if (ib.CostBearer2SupportConcept.CostBearer != null && ib.CostBearer2SupportConcept.CostBearer.Organisation != null)
|
|
{
|
|
if (ib.CostBearer2SupportConcept.CostBearer.Organisation.InvoiceAddress != null &&
|
|
!String.IsNullOrEmpty(ib.CostBearer2SupportConcept.CostBearer.Organisation.InvoiceAddress.Street) || !String.IsNullOrEmpty(ib.CostBearer2SupportConcept.CostBearer.Organisation.InvoiceAddress.Town))
|
|
{
|
|
pRO.RecipientPostCodeAndTown = String.Format("{0} {1}", ib.CostBearer2SupportConcept.CostBearer.Organisation.InvoiceAddress.PostalCode, ib.CostBearer2SupportConcept.CostBearer.Organisation.InvoiceAddress.Town);
|
|
pRO.RecipientStreet = ib.CostBearer2SupportConcept.CostBearer.Organisation.InvoiceAddress.Street;
|
|
if (ib.CostBearer2SupportConcept.CostBearer.Organisation.Contacts.Count > 0)
|
|
{
|
|
foreach (var i in ib.CostBearer2SupportConcept.CostBearer.Organisation.Contacts)
|
|
{
|
|
if (i.Type == BS.Shared.ContactType.private_POBox)
|
|
pRO.RecipientPostBox = i.Value;
|
|
}
|
|
}
|
|
}
|
|
else if (ib.CostBearer2SupportConcept.CostBearer.Organisation.Address != null)
|
|
{
|
|
pRO.RecipientPostCodeAndTown = String.Format("{0} {1}", ib.CostBearer2SupportConcept.CostBearer.Organisation.Address.PostalCode, ib.CostBearer2SupportConcept.CostBearer.Organisation.Address.Town);
|
|
pRO.RecipientStreet = ib.CostBearer2SupportConcept.CostBearer.Organisation.Address.Street;
|
|
}
|
|
}
|
|
|
|
if (!String.IsNullOrEmpty(ib.CostBearer2SupportConcept.CostBearer.Organisation.InvoiceAddress.AddressLine1))
|
|
AddressLine1 = ib.CostBearer2SupportConcept.CostBearer.Organisation.InvoiceAddress.AddressLine1;
|
|
|
|
|
|
if (c.Team2CustomerList.Count > 0)
|
|
team = c.Team2CustomerList[0].Team.Name;
|
|
|
|
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;
|
|
//}
|
|
}
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
if (!String.IsNullOrEmpty(pRO.RecipientOrganisation))
|
|
{
|
|
sb.AppendLine(pRO.RecipientOrganisation);
|
|
}
|
|
if (!String.IsNullOrEmpty(pRO.RecipientDivision))
|
|
{
|
|
sb.AppendLine(pRO.RecipientDivision);
|
|
}
|
|
//Angaben aus Rechnungsadresse
|
|
//var cb2sc = DAOFactory.GenericDAO.LoadByID<CostBearer2SupportConcept>(pRO.CostBearer2SupportConceptOid);
|
|
if (!String.IsNullOrEmpty(AddressLine1))
|
|
{
|
|
sb.AppendLine(AddressLine1);
|
|
}
|
|
//if (!String.IsNullOrEmpty(pRO.RecipientContactPerson))
|
|
//{
|
|
// sb.AppendLine(pRO.RecipientContactPerson);
|
|
//}
|
|
if (!String.IsNullOrEmpty(pRO.RecipientPostBox))
|
|
{
|
|
sb.AppendLine(pRO.RecipientPostBox);
|
|
}
|
|
else if (!String.IsNullOrEmpty(pRO.RecipientStreet))
|
|
{
|
|
sb.AppendLine(pRO.RecipientStreet);
|
|
}
|
|
if (!String.IsNullOrEmpty(pRO.RecipientPostCodeAndTown))
|
|
{
|
|
sb.AppendLine(pRO.RecipientPostCodeAndTown);
|
|
}
|
|
|
|
lblAdresse.Text = sb.ToString();
|
|
|
|
foreach (var i in pRO.InvoiceItems)
|
|
{
|
|
i.DetailDescription = String.Format("Summe der Betreuungsminuten /60x{4:0.00}{3}Faktor in der Zeit von {0:dd.MM.yyyy} bis {1:dd.MM.yyyy} gemäß Anlage: ",
|
|
i.PeriodStartDate, i.PeriodEndDate, i.UnitCount, pRO.RateFactor == 1 ? "" : "x" + pRO.RateFactorText2 + " ", i.AmountPerUnit);
|
|
}
|
|
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
}
|
|
}
|