87 lines
2.2 KiB
C#
87 lines
2.2 KiB
C#
|
|
using System;
|
|||
|
|
using BeWo.Report;
|
|||
|
|
using BeWo.Report.ReportObjects;
|
|||
|
|
using BeWo.Service.ServiceImplementations;
|
|||
|
|
using BS.Shared.Core;
|
|||
|
|
using BS.Shared.DataContracts;
|
|||
|
|
using DevExpress.XtraReports.UI;
|
|||
|
|
|
|||
|
|
namespace BloemelingUndTeckhaus
|
|||
|
|
{
|
|||
|
|
[IDSpecificClass(Identifier = "Assistenz")]
|
|||
|
|
public partial class RechnungAssistenzstunden : XtraReport, IBeWoReport<ServiceInvoiceRO>
|
|||
|
|
{
|
|||
|
|
public RechnungAssistenzstunden()
|
|||
|
|
{
|
|||
|
|
this.InitializeComponent();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public void SetReportDataSource(ServiceInvoiceRO pRO)
|
|||
|
|
{
|
|||
|
|
//if (String.IsNullOrEmpty(pRO.Notice))
|
|||
|
|
//{
|
|||
|
|
// lblNotice.Text = "";
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
DateTime start = pRO.AccountingPeriodStart;
|
|||
|
|
DateTime end = pRO.AccountingPeriodEnd;
|
|||
|
|
if (start.Month == end.Month && start.Year == end.Year)
|
|||
|
|
{
|
|||
|
|
lblMonat.Text = String.Format("F<>r den Monat {0:MMMM yyyy}", start);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
lblMonat.Text = String.Format("F<>r den Monat {0:MMMM yyyy} - {1:MMMM yyyy}", start, end);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
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;
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
hours *= rateFactor;
|
|||
|
|
|
|||
|
|
if (!String.IsNullOrEmpty(pRO.CustomerSalutation) && pRO.CustomerSalutation.ToLower() == "herr")
|
|||
|
|
pRO.CustomerSalutation = "Herrn";
|
|||
|
|
|
|||
|
|
lblAbrechnungstext.Text = String.Format("{0:0.##} Stunden x {1:c} = {2}", hours, hourlyRate, pRO.NetClaim);
|
|||
|
|
|
|||
|
|
this.bindingSource1.DataSource = pRO;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|