67 lines
1.9 KiB
C#
67 lines
1.9 KiB
C#
using System;
|
|
using BeWo.Report;
|
|
using BeWo.Report.ReportObjects;
|
|
|
|
using DevExpress.XtraReports.UI;
|
|
|
|
namespace BeWo.SprungbrettTheresia
|
|
{
|
|
public partial class ServiceInvoiceReport : XtraReport, IBeWoReport<ServiceInvoiceRO>
|
|
{
|
|
public ServiceInvoiceReport()
|
|
{
|
|
this.InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(ServiceInvoiceRO pRO)
|
|
{
|
|
decimal hourlyRate = 0;
|
|
decimal rateFactor = 1;
|
|
decimal hours = 0;
|
|
|
|
if (pRO.ServiceInvoicePeriods != null && pRO.ServiceInvoicePeriods.Count > 0)
|
|
{
|
|
foreach (var p in pRO.ServiceInvoicePeriods)
|
|
{
|
|
if (p.ServiceInvoiceItems != null && p.ServiceInvoiceItems.Count > 0)
|
|
{
|
|
foreach (var i in p.ServiceInvoiceItems)
|
|
{
|
|
if (i.HourlyRate.HasValue)
|
|
{
|
|
hourlyRate = i.HourlyRate.Value;
|
|
|
|
if (!String.IsNullOrEmpty(i.RateFactor))
|
|
{
|
|
var rfStr = i.RateFactor.Replace("%", "").Replace(",00", "").Trim();
|
|
int rfInt = 0;
|
|
Int32.TryParse(rfStr, out rfInt);
|
|
|
|
rateFactor = (100m + rfInt) / 100m;
|
|
}
|
|
}
|
|
|
|
if (i.Hours.HasValue)
|
|
hours += i.Hours.Value;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
int days = (int)pRO.AccountingPeriodEnd.Subtract(pRO.AccountingPeriodStart).TotalDays + 1;
|
|
|
|
if (pRO.InvoiceDateTime > new DateTime(2024, 06, 15))
|
|
{
|
|
pRO.Notice = String.Format("Zeitraum: {0:MMMM yyyy} (4 FLS / Woche * {1:0.00} * {2:c} =", pRO.AccountingPeriodStart, rateFactor, hourlyRate);
|
|
}
|
|
else
|
|
{
|
|
pRO.Notice = String.Format("Zeitraum: {0:MMMM yyyy} ({1:0} Tage) * {2:c} =", pRO.AccountingPeriodStart, days, hourlyRate);
|
|
}
|
|
|
|
//pRO.Notice = String.Format("{0:0.##} ({1:0.##} * {3:0.0}) * {2:c} = {4}", Math.Round(hours * rateFactor, 2, MidpointRounding.AwayFromZero), hours, hourlyRate, rateFactor, pRO.NetClaim);
|
|
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
}
|
|
} |