73 lines
1.9 KiB
C#
73 lines
1.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using BeWo.Report;
|
|
using BeWo.Report.ReportObjects;
|
|
using DevExpress.XtraReports.UI;
|
|
using BS.Shared.Extensions;
|
|
|
|
namespace RatPlusTat
|
|
{
|
|
public partial class Spitzabrechnung : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<Settlement2RO>
|
|
{
|
|
public Spitzabrechnung()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(Settlement2RO pRO)
|
|
{
|
|
if (String.IsNullOrEmpty(pRO.Notice))
|
|
{
|
|
lblNotice.Visible = false;
|
|
}
|
|
|
|
decimal rateFactor = 1;
|
|
|
|
foreach (var ii in pRO.InvoiceItems)
|
|
{
|
|
if (ii.RateFactor.HasValue)
|
|
{
|
|
rateFactor = (100 + ii.RateFactor.Value) / 100;
|
|
}
|
|
|
|
if (!pRO.FehlkontakteString.IsNullOrEmpty() && ii.RateFactor == 0)
|
|
{
|
|
GroupFooter2.Visible = true;
|
|
ii.AbrechnungsText = ii.AbrechnungsText.Replace("FLS", "Std.");
|
|
ii.ItemDescription = "Fehlkontakte";
|
|
}
|
|
else if (ii.ItemDescription.IsNullOrEmpty())
|
|
{
|
|
ii.ItemDescription = "Fachleistungsstunden";
|
|
}
|
|
}
|
|
pRO.RateFactor = (double)rateFactor;
|
|
|
|
if (pRO.FinalSentence.IndexOf("Die geleistete Überzahlung") == 0)
|
|
pRO.FinalSentence = "Wir bitten Sie um eine Verrechnung der Überzahlung.";
|
|
|
|
SetzeWohnort(pRO);
|
|
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
|
|
private void SetzeWohnort(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 && c.Person.Address != null)
|
|
{
|
|
lblCustomerDaten.Text = String.Format("{0}, {1} {2}, geb. {3:dd.MM.yyyy}", c.Person.Address.Street, c.Person.Address.PostalCode, c.Person.Address.Town, pRo.CustomerBirthday);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|