55 lines
1.6 KiB
C#
55 lines
1.6 KiB
C#
using System;
|
|
using BeWo.Report.ReportObjects;
|
|
using BeWo.Report;
|
|
using DevExpress.XtraReports.UI;
|
|
using System.Data;
|
|
|
|
namespace BeWo.SchoengeistReports
|
|
{
|
|
public partial class Monatsabrechnung : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<QueryRO>
|
|
{
|
|
public Monatsabrechnung()
|
|
{
|
|
InitializeComponent();
|
|
|
|
}
|
|
|
|
public void SetReportDataSource(QueryRO pRO)
|
|
{
|
|
InitTable(pRO);
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
|
|
private void InitTable(QueryRO ro)
|
|
{
|
|
decimal gesamt = 0;
|
|
decimal gesamtOffen = 0;
|
|
|
|
DateTime monat = DateTime.MinValue;
|
|
foreach (BeWo.Report.ReportObjects.QueryRO.Row row in ro.Rows)
|
|
{
|
|
if (monat == DateTime.MinValue)
|
|
{
|
|
monat = DateTime.Parse(row.Field5.ToString());
|
|
lblHeader.Text = String.Format("Abrechnung {0:yyyy}", monat);
|
|
}
|
|
|
|
|
|
decimal betrag = 0;
|
|
if (row.Field7 != null && Decimal.TryParse(row.Field7.ToString(), out betrag))
|
|
{
|
|
gesamt += betrag;
|
|
row.Field7 = String.Format("{0:c}", betrag);
|
|
if (row.Field12 == null || row.Field12.ToString() != "Ja")
|
|
{
|
|
gesamtOffen += betrag;
|
|
}
|
|
}
|
|
}
|
|
|
|
lblGesamt.Text = String.Format("Gesamt: {0:c}", gesamt);
|
|
lblGesamtOffen.Text = String.Format("Gesamt noch offen: {0:c}", gesamtOffen);
|
|
}
|
|
}
|
|
}
|