Files
BeWoPlaner/ReportImp/GpzBiberachReports/ServiceInvoiceReportPflege.cs

119 lines
4.3 KiB
C#

using System;
using System.Collections.Generic;
using System.Text;
using BeWo.Report;
using BeWo.Report.ReportObjects;
using BS.Shared.Core;
using DevExpress.XtraReports.UI;
namespace BeWo.GpzBiberachReports
{
[IDSpecificClass(Identifier = "Pflege")]
public partial class RechnungPflege : XtraReport, IBeWoReport<ServiceInvoiceRO>
{
public RechnungPflege()
{
this.InitializeComponent();
}
public void SetReportDataSource(ServiceInvoiceRO pRO)
{
//if (String.IsNullOrWhiteSpace(pRO.RecipientOrganisation) ||
// !pRO.RecipientOrganisation.ToLower().Contains("landratsamt biberach"))
//{
// this.Watermark.Image = null;
//}
StringBuilder sb = new StringBuilder();
if (!String.IsNullOrEmpty(pRO.RecipientOrganisation) && !String.IsNullOrEmpty(pRO.RecipientOrganisation.Trim()))
{
sb.AppendLine(pRO.RecipientOrganisation);
}
if (!String.IsNullOrEmpty(pRO.RecipientContactPerson) && !String.IsNullOrEmpty(pRO.RecipientContactPerson.Trim()))
{
sb.AppendLine(pRO.RecipientContactPerson);
}
if (!String.IsNullOrEmpty(pRO.RecipientDivision) && !String.IsNullOrEmpty(pRO.RecipientDivision.Trim()))
{
sb.AppendLine(pRO.RecipientDivision);
}
if (!String.IsNullOrEmpty(pRO.RecipientStreet) && !String.IsNullOrEmpty(pRO.RecipientStreet.Trim()))
{
sb.AppendLine(pRO.RecipientStreet);
}
if (!String.IsNullOrEmpty(pRO.RecipientPoBox) && !String.IsNullOrEmpty(pRO.RecipientPoBox.Trim()))
{
sb.AppendLine(pRO.RecipientPoBox);
}
if (!String.IsNullOrEmpty(pRO.RecipientPostCodeAndTown) && !String.IsNullOrEmpty(pRO.RecipientPostCodeAndTown.Trim()))
{
sb.AppendLine("");
sb.AppendLine(pRO.RecipientPostCodeAndTown);
}
lblAddress.Text = sb.ToString();
decimal minutesGespraeche = 0;
decimal betragGespraeche = 0;
decimal kmTotal = 0;
decimal betragFahrtkosten = 0;
decimal kmPauschale = 0;
pRO.InvoiceNumber = String.Format("8235-{0}", pRO.InvoiceNumber);
if (pRO.ServiceInvoicePeriods != null && pRO.ServiceInvoicePeriods.Count > 0)
{
foreach (var p in pRO.ServiceInvoicePeriods)
{
var listToDelete = new List<ServiceInvoiceItemRO>();
if (p.ServiceInvoiceItems != null && p.ServiceInvoiceItems.Count > 0)
{
foreach (var i in p.ServiceInvoiceItems)
{
if (!String.IsNullOrEmpty(i.ServiceDescription))
{
if (i.ServiceDescription.Contains("Fahrtkosten"))
{
kmPauschale = i.AmountPerUnit ?? 0;
betragFahrtkosten += i.NetAmount ?? 0;
kmTotal += i.UnitCount ?? 0;
listToDelete.Add(i);
}
else
{
i.Hours = i.Hours * 60;
//if (i.ServiceDescription.ToLower().IndexOf("ET") >= 0)
//{
minutesGespraeche += i.Hours ?? 0;
betragGespraeche += i.NetAmount ?? 0;
//}
}
}
}
foreach (var serviceInvoiceItemRo in listToDelete)
{
p.ServiceInvoiceItems.Remove(serviceInvoiceItemRo);
}
}
}
}
cellGespraecheGesamt.Text = String.Format("{0:0} Minuten", minutesGespraeche);
cellGespraecheBetrag.Text = String.Format("{0:c}", betragGespraeche);
cellFahrtkosten.Text = "Fahrtkosten";
cellFahrtkostenAnzahl.Text = String.Format("{0:0.##} km á {1:c}", kmTotal, kmPauschale);
cellBetragFahrtkosten.Text = String.Format("{0:c}", betragFahrtkosten);
cellGespraecheBetrag.Text = String.Format("{0:c}", betragGespraeche);
cellBetrag.Text = pRO.GrossClaim;
this.bindingSource1.DataSource = pRO;
}
}
}