Files

66 lines
1.8 KiB
C#
Raw Permalink Normal View History

using System;
using DevExpress.XtraReports.UI;
using BeWo.Report.ReportObjects;
using BS.Shared.Extensions;
using DevExpress.XtraPrinting.Drawing;
using BS.Shared.DataContracts.Invoicing;
using BeWo.Report;
namespace InklusioElmarBauer
{
public partial class Spitzabrechnung : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<Settlement2RO>
{
public Spitzabrechnung()
{
InitializeComponent();
}
public void SetReportDataSource(Settlement2RO pRO)
{
if (pRO.Mandator.Logo?.Original is object)
pictureBoxLogo.ImageSource = new ImageSource(false, pRO.Mandator.Logo.Original);
if (pRO.Mandator.Street.ToNullIfEmpty() is null || pRO.Mandator.Town.ToNullIfEmpty() is null)
lblSenderAdresse.Visible = false;
if (String.IsNullOrEmpty(pRO.Notice))
{
lblNotice.Visible = false;
}
BankAccountDC bankAccount = pRO.Mandator.BankAccount;
if (bankAccount.BankName.ToNullIfEmpty() is null || bankAccount.IBAN.ToNullIfEmpty() is null)
lblBankverbindung.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;
if (pRO.RecipientOrganisation.Contains("LVR"))
{
pRO.CreatorName = "Elmar Bauer";
}
this.bindingSource1.DataSource = pRO;
}
}
}