Files
BeWoPlaner/ReportImp/BeWoImFlow/SettlementReport2.cs

114 lines
3.5 KiB
C#
Raw Normal View History

2020-10-29 10:59:13 +01:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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;
2020-10-29 10:59:13 +01:00
namespace BeWoImFlow
{
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);
sb.AppendLine("");
}
String line = "";
if (!String.IsNullOrEmpty(pRO.RecipientDivision))
{
line = pRO.RecipientDivision;
}
if (!String.IsNullOrEmpty(pRO.RecipientContactPerson))
{
if (line.Length > 0)
line += ", ";
line += pRO.RecipientContactPerson;
}
if (!String.IsNullOrWhiteSpace(line))
{
sb.AppendLine(line);
}
if (!String.IsNullOrEmpty(pRO.RecipientStreet))
{
sb.AppendLine(pRO.RecipientStreet);
}
if (!String.IsNullOrEmpty(pRO.RecipientPostCodeAndTown))
{
sb.AppendLine(pRO.RecipientPostCodeAndTown);
}
lblAdresse.Text = sb.ToString();
if (pRO.Claim < 0)
{
pRO.FinalSentence = "Bitte ziehen Sie die <20>berzahlung bei Ihren n<>chsten Zahlungen ab.";
}
else
{
pRO.FinalSentence = "Ich bitte Sie, die Differenz in meiner n<>chsten Avis zu verrechnen.";
}
bool hasRatefactor = false;
if (!String.IsNullOrWhiteSpace(pRO.RateFactorText2))
{
hasRatefactor = true;
if (pRO.RateFactorText2 == "1,2")
{
pRO.RateFactorText2 = "1,20";
}
}
decimal hours = 0;
if (pRO.InvoiceItems != null)
{
foreach (var ii in pRO.InvoiceItems)
{
hours += ii.UnitCount ?? 0;
ii.AbrechnungsText = String.Format("{0:dd.MM.yyyy} bis {1:dd.MM.yyyy}: {2:0.##} FLS {3}x {4:c}",
2020-10-29 10:59:13 +01:00
ii.PeriodStartDate, ii.PeriodEndDate,
ii.UnitCount, !hasRatefactor ? "" : "x " + pRO.RateFactorText2 + " ",
ii.AmountPerUnit);
ii.ItemDescription = "Fachleistungsstunden";
if (!pRO.FehlkontakteString.IsNullOrEmpty() && ii.RateFactor == 0)
{
Zwischensumme.Visible = true;
ii.AbrechnungsText = String.Format("{0:dd.MM.yyyy} bis {1:dd.MM.yyyy}: {2:0.##} Std. x {3:c}",
ii.PeriodStartDate, ii.PeriodEndDate, ii.UnitCount, ii.AmountPerUnit);
ii.ItemDescription = "Fehlkontakte";
}
2020-10-29 10:59:13 +01:00
}
}
cellGeleisteteStd.Text = String.Format("{0:0.00} FLS", hours);
this.bindingSource1.DataSource = pRO;
}
}
}