Files
BeWoPlaner/ReportImp/SchillingerReports/ServiceInvoiceReport.cs

126 lines
3.9 KiB
C#
Raw Permalink Normal View History

2016-06-27 01:45:38 +02:00
using System;
using System.Text;
using BeWo.Report.ReportObjects;
using DevExpress.XtraReports.UI;
namespace BeWo.Report.DefaultReports
{
public partial class ServiceInvoiceReport : XtraReport, IBeWoReport<ServiceInvoiceRO>
{
public ServiceInvoiceReport()
{
this.InitializeComponent();
}
public void SetReportDataSource(ServiceInvoiceRO pRO)
{
if (String.IsNullOrEmpty(pRO.Notice))
{
lblNotice.Visible = false;
}
2016-06-27 01:45:38 +02:00
decimal hourlyRate = 0;
decimal rateFactor = 1;
decimal hours = 0;
2017-06-11 15:50:31 +02:00
StringBuilder sb = new StringBuilder();
if (!String.IsNullOrEmpty(pRO.RecipientOrganisation))
{
if (pRO.RecipientOrganisation.Contains("Ass.Leistung"))
{
pRO.RecipientOrganisation = "Landschaftsverband Rheinland";
}
2017-06-11 15:50:31 +02:00
sb.AppendLine(pRO.RecipientOrganisation);
}
if (!String.IsNullOrEmpty(pRO.RecipientContactPerson))
{
sb.AppendLine(pRO.RecipientContactPerson);
}
if (!String.IsNullOrEmpty(pRO.RecipientDivision))
{
sb.AppendLine(pRO.RecipientDivision);
}
if (!String.IsNullOrEmpty(pRO.RecipientStreet))
{
sb.AppendLine(pRO.RecipientStreet);
}
if (!String.IsNullOrEmpty(pRO.RecipientPostCodeAndTown))
{
sb.AppendLine(pRO.RecipientPostCodeAndTown);
}
lblAdresse.Text = sb.ToString();
if (pRO.ServiceInvoicePeriods != null && pRO.ServiceInvoicePeriods.Count > 0)
2016-06-27 01:45:38 +02:00
{
foreach (var p in pRO.ServiceInvoicePeriods)
{
if (p.ServiceInvoiceItems != null && p.ServiceInvoiceItems.Count > 0)
{
foreach (var i in p.ServiceInvoiceItems)
{
//nach Assistungen filtern
2016-06-27 01:45:38 +02:00
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;
lblSatz.Text = String.Format("{0:c}", hourlyRate);
lblAnzahl.Text = String.Format("{0:0.##}", hours);
lblBetrag.Text = String.Format("{0}", pRO.NetClaim);
//if (!String.IsNullOrEmpty(pRO.CustomerSalutation))
//{
// if (pRO.CustomerSalutation.ToLower() == "frau")
// {
// lblAnrede.Text = String.Format("Sehr geehrte Frau {0}", pRO.CustomerLastName);
// }
// else
// {
// lblAnrede.Text = String.Format("Sehr geehrter Herr {0}", pRO.CustomerLastName);
// }
//}
lblBewilligungszeitraum.Text = "";
if (pRO.InvoiceBase != null && pRO.InvoiceBase.SupportConceptCostBearerRelDc != null)
{
if (pRO.InvoiceBase.SupportConceptCostBearerRelDc.CostBearer != null)
{
if (pRO.InvoiceBase.SupportConceptCostBearerRelDc.CostBearer.Name.Contains("Ass.Leistung"))
{
cellPosten.Text = "Assistenzleistungsstunden";
}
}
var start = pRO.InvoiceBase.SupportConceptCostBearerRelDc.StartDate;
var end = pRO.InvoiceBase.SupportConceptCostBearerRelDc.EndDate;
lblBewilligungszeitraum.Text = String.Format("Bewilligungszeitraum: {0:dd.MM.yyyy} - {1:dd.MM.yyyy}", start, end);
}
this.bindingSource1.DataSource = pRO;
2016-06-27 01:45:38 +02:00
}
}
}