Files
BeWoPlaner/ReportImp/AlphaEv/SettlementReport2.cs

81 lines
2.5 KiB
C#

using System;
using DevExpress.XtraReports.UI;
using BeWo.Report.ReportObjects;
using BeWo.Report;
using BS.Shared.Extensions;
using System.Text;
namespace AlphaEv
{
public partial class Spitzabrechnung : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<Settlement2RO>
{
public Spitzabrechnung()
{
InitializeComponent();
}
public void SetReportDataSource(Settlement2RO pRO)
{
StringBuilder sb = new StringBuilder();
if (!String.IsNullOrEmpty(pRO.RecipientOrganisation))
{
sb.AppendLine(pRO.RecipientOrganisation);
}
if (!String.IsNullOrEmpty(pRO.RecipientContactPerson))
{
sb.AppendLine(pRO.RecipientContactPerson);
}
if (!String.IsNullOrEmpty(pRO.RecipientDivision))
{
sb.AppendLine(pRO.RecipientDivision);
}
if (!String.IsNullOrEmpty(pRO.RecipientStreet))
{
sb.AppendLine(pRO.RecipientStreet);
}
if (!String.IsNullOrEmpty(pRO.RecipientPostCodeAndTown))
{
sb.AppendLine(pRO.RecipientPostCodeAndTown);
}
lblAdresse.Text = sb.ToString();
decimal rateFactor = 1;
foreach (var ii in pRO.InvoiceItems)
{
if (ii.RateFactor.HasValue)
{
rateFactor = (100 + ii.RateFactor.Value) / 100;
ii.RateFactor = rateFactor;
}
if (!pRO.FehlkontakteString.IsNullOrEmpty() && ii.RateFactor == 0)
{
Zwischensumme.Visible = true;
ii.ItemDescription = "Fehlkontakte";
}
else if (ii.ItemDescription.IsNullOrEmpty())
{
ii.ItemDescription = "Fachleistungsstunden";
}
}
pRO.RateFactor = (double)rateFactor;
if (pRO.AmountBillableTotal - (pRO.Claim + pRO.AmountAdvancedPayments) != 0)
{
lblDifferenzrechnungText.Text = "Höhe der bereits gestellten Rechnung vor Stundensatzanpassung:";
lblDifferenzrechnung.Text = string.Format("{0:c}", pRO.AmountBillableTotal - (pRO.AmountAdvancedPayments + pRO.Claim));
}
if (pRO.Claim > 0)
{
lblNotice.Text += "Die Rechnung ist zahlbar innerhalb von 30 Tagen.";
}
this.bindingSource1.DataSource = pRO;
}
}
}