84 lines
2.7 KiB
C#
84 lines
2.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text.RegularExpressions;
|
|
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using BeWo.Report;
|
|
using BeWo.Report.ReportObjects;
|
|
using BS.Shared;
|
|
using BS.Shared.DataContracts;
|
|
using BS.Shared.Extensions;
|
|
|
|
namespace ChristinaFrommen
|
|
{
|
|
public partial class Spitzabrechnung : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<Settlement2RO>
|
|
{
|
|
public Spitzabrechnung()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(Settlement2RO pRO)
|
|
{
|
|
decimal rateFactor = 1;
|
|
decimal gelFLS = 0;
|
|
|
|
foreach (var ii in pRO.InvoiceItems)
|
|
{
|
|
gelFLS += ii.UnitCount ?? 0;
|
|
if (ii.RateFactor.HasValue)
|
|
{
|
|
rateFactor = (100 + ii.RateFactor.Value) / 100;
|
|
}
|
|
|
|
if (!pRO.FehlkontakteString.IsNullOrEmpty() && ii.RateFactor == 0)
|
|
{
|
|
Zwischensumme.Visible = true;
|
|
if (!ii.ItemDescription.IsNullOrEmpty())
|
|
{
|
|
ii.DetailDescription = Regex.Replace(ii.DetailDescription, ii.ItemDescription, "Fehlkontakte");
|
|
}
|
|
ii.ItemDescription = "Fehlkontakte";
|
|
}
|
|
}
|
|
pRO.RateFactor = (double)rateFactor;
|
|
|
|
SetzeAnrede(pRO);
|
|
|
|
lblGeleisteteFLS.Text = String.Format("{0:0.00} FLS", gelFLS);
|
|
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
|
|
private String GetCustomerId(SettlementRO pRO)
|
|
{
|
|
var cb2sc = DAOFactory.GenericDAO.LoadByID<CostBearer2SupportConcept>(pRO.CostBearer2SupportConceptOid);
|
|
return cb2sc.CostBearer.ID;
|
|
}
|
|
|
|
private void SetzeAnrede(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);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|