Files
BeWoPlaner/ReportImp/IntegraReports/SettlementReport2.cs
2017-06-11 16:01:01 +02:00

75 lines
2.7 KiB
C#

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using BS.Shared;
using BS.Shared.DataContracts;
using DevExpress.XtraReports.UI;
using BeWo.Report.ReportObjects;
using BeWo.Report;
namespace BeWo.IntegraReports
{
public partial class Spitzabrechnung : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<Settlement2RO>
{
public Spitzabrechnung()
{
InitializeComponent();
}
public void SetReportDataSource(Settlement2RO pRO)
{
if (pRO.TerminationDate.HasValue)
{
lblTermination.Text = String.Format("{0:dd.MM.yyyy} {1}", pRO.TerminationDate, pRO.TerminationReason);
}
bool isOldVersion = true;
//if (pRO.HourlyRate3 == 0 && !pRO.HourlyRateOld.HasValue && !pRO.HourlyRateNew.HasValue)
// isOldVersion = false;
if (pRO.Claim >= 0)
lblClaimText.Text = "Rückzahlungsanspruch";
//if (!isOldVersion && pRO.ApprovedFLSWeekly == 0 && pRO.Approvals != null && pRO.Approvals.Count > 0)
//{
// var app = pRO.Approvals[0];
// if (app.ApprovalUnit.HasValue && app.ApprovalUnit.Value == AccountingIntervalType.Weekly && app.ApprovedPerUnit.HasValue)
// pRO.ApprovedFLSWeekly = app.ApprovedPerUnit.Value;
//}
//else
//{
pRO.ApprovedFLSWeekly *= (decimal)pRO.RateFactor;
//}
pRO.ApprovedFLSWeekly = Math.Round(pRO.ApprovedFLSWeekly, 2, MidpointRounding.AwayFromZero);
DateTime dt1 = pRO.AccountingStartDate;
DateTime dt2 = pRO.AccountingEndDate;
TimeSpan sp = dt2.Subtract(dt1);
lblTage3.Text = String.Format("{0:0.#}", sp.TotalDays + 1);
lblWeeks3.Text = String.Format("{0:0.##}", (sp.TotalDays + 1) * 0.1427);
lblFLSTotal3.Text = String.Format("{0:0.##} FLS", Math.Round((sp.TotalDays + 1) * 0.1427, 2) * (double)pRO.ApprovedFLSWeekly);
lblHourlyRate.Text = "";
decimal total = 0;
foreach (var ii in pRO.InvoiceItems)
{
total += ii.GrossAmountTotal ?? 0;
lblHourlyRate.Text = String.Format("{0:c}", ii.AmountPerUnit);
ii.ItemDescription = String.Format("{0:dd.MM.yyyy} - {1:dd.MM.yyyy} {2:0.00} Std. x {3:c} =", ii.PeriodStartDate,
ii.PeriodEndDate, ii.UnitCount * ((100 + (ii.RateFactor ?? 0)) / 100), ii.AmountPerUnit);
}
lblAnspruch.Text = String.Format("{0:c}", total);
lblVerbleiben.Text = String.Format("{0:c}", total - pRO.Eigenbeteiligung ?? 0);
this.bindingSource1.DataSource = pRO;
}
}
}