Files
BeWoPlaner/ReportImp/FaerberReports/SettlementReport2.cs
2019-08-09 16:44:13 +02:00

66 lines
2.1 KiB
C#

using System;
using System.Drawing;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using DevExpress.XtraReports.UI;
using BeWo.Report.ReportObjects;
using BeWo.Report;
using BS.Shared.DataContracts;
namespace BeWo.FaerberReport.Neu
{
public partial class Spitzabrechnung : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<Settlement2RO>
{
public Spitzabrechnung()
{
InitializeComponent();
}
public void SetReportDataSource(Settlement2RO pRO)
{
if (pRO.Claim > 0)
{
pRO.FinalSentence = "Bitte überweisen Sie unsere Forderung nach Prüfung der Schlussabrechnung auf folgendes Konto IBAN DE 57 3706 2600 3110 2420 25 BIC GENODED1PAF (VR Bank Berg. Gladbach)";
}
bool hasRatefactor = false;
if (!String.IsNullOrWhiteSpace(pRO.RateFactorText2))
{
hasRatefactor = true;
if (pRO.RateFactorText2 == "1,2")
{
pRO.RateFactorText2 = "1,20";
}
}
decimal rateFactorAmount = 0;
if (pRO.InvoiceItems != null)
{
foreach (var ii in pRO.InvoiceItems)
{
ii.ItemDescription = String.Format("{0:dd.MM.yyyy} bis {1:dd.MM.yyyy}: {2:0.##} FLS {3}x {4:c}",
ii.PeriodStartDate, ii.PeriodEndDate,
ii.UnitCount, !hasRatefactor ? "" : "x " + pRO.RateFactorText2 + " ",
ii.AmountPerUnit);
if (hasRatefactor && ii.AmountTotal.HasValue && ii.GrossAmountTotal.HasValue)
{
rateFactorAmount += ii.GrossAmountTotal.Value - ii.AmountTotal.Value;
}
}
}
if (hasRatefactor)
{
cellInklRatefactorText.Text = "Inkl.pauschaler Faktor";
cellRateFactorAmount.Text = String.Format("{0:c}", rateFactorAmount);
}
this.bindingSource1.DataSource = pRO;
}
}
}