73 lines
2.3 KiB
C#
73 lines
2.3 KiB
C#
using System;
|
|
using DevExpress.XtraReports.UI;
|
|
using BeWo.Report.ReportObjects;
|
|
using BeWo.Report;
|
|
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using BS.Shared;
|
|
using BS.Shared.Extensions;
|
|
|
|
namespace Ambewo
|
|
{
|
|
public partial class Spitzabrechnung : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<Settlement2RO>
|
|
{
|
|
public Spitzabrechnung()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(Settlement2RO pRO)
|
|
{
|
|
if (pRO.InvoiceBaseOid.HasValue)
|
|
{
|
|
var ib = DAOFactory.GenericDAO.LoadByID<InvoiceBase>(pRO.InvoiceBaseOid.Value);
|
|
if (ib.CostBearer2SupportConcept != null)
|
|
{
|
|
var cb2sc = ib.CostBearer2SupportConcept;
|
|
if (!String.IsNullOrEmpty(pRO.RecipientContactPerson))
|
|
{
|
|
if (cb2sc.CostBearerContactPerson != null && cb2sc.CostBearerContactPerson.Sex.HasValue)
|
|
{
|
|
string anrede = "Sehr geehrte Frau";
|
|
|
|
if (cb2sc.CostBearerContactPerson.Sex.Value == Sex.Male)
|
|
anrede = "Sehr geehrter Herr";
|
|
|
|
lblAnrede.Text = String.Format("{0} {1},", anrede, cb2sc.CostBearerContactPerson.LastName);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
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)
|
|
{
|
|
Zwischensumme.Visible = true;
|
|
ii.AbrechnungsText = ii.AbrechnungsText.Replace("FLS", "Std.");
|
|
ii.ItemDescription = "Fehlkontakte";
|
|
}
|
|
else if (ii.ItemDescription.IsNullOrEmpty())
|
|
{
|
|
ii.ItemDescription = "Fachleistungsstunden";
|
|
}
|
|
}
|
|
pRO.RateFactor = (double)rateFactor;
|
|
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
}
|
|
}
|