- Arbeitszeit Kopieren im EmployeeView eingebaut - Diverse Kundenanpassungen (Christopherus Haus, Prof Eggers Stiftung, Trias) - Bugfix History für Klienten
107 lines
2.9 KiB
C#
107 lines
2.9 KiB
C#
using System;
|
|
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using BeWo.Report;
|
|
using BeWo.Report.ReportObjects;
|
|
|
|
using DevExpress.XtraReports.UI;
|
|
|
|
namespace ProfEggersStiftung
|
|
{
|
|
public partial class ServiceInvoiceReport : XtraReport, IBeWoReport<ServiceInvoiceRO>
|
|
{
|
|
public ServiceInvoiceReport()
|
|
{
|
|
this.InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(ServiceInvoiceRO pRO)
|
|
{
|
|
DateTime start = pRO.AccountingPeriodStart;
|
|
DateTime end = pRO.AccountingPeriodEnd;
|
|
if (start.Month == end.Month && start.Year == end.Year)
|
|
{
|
|
lblMonat.Text = String.Format("Betreuungskosten {0:MMMM yyyy}", start);
|
|
}
|
|
else
|
|
{
|
|
lblMonat.Text = String.Format("Betreuungskosten {0:MMMM yyyy} - {1:MMMM yyyy}", start, end);
|
|
}
|
|
|
|
|
|
decimal hourlyRate = 0;
|
|
|
|
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 (i.Hours.HasValue)
|
|
hours += i.Hours.Value;
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if (!String.IsNullOrEmpty(pRO.CustomerSalutation) && pRO.CustomerSalutation.ToLower() == "herr")
|
|
pRO.CustomerSalutation = "Herrn";
|
|
|
|
if (pRO.SenderContactPersonPhone == null)
|
|
{
|
|
pRO.SenderContactPersonPhone = "0201-8953322";
|
|
}
|
|
lblAbrechnungstext.Text = String.Format("{0:0.##} FLS x {1:c} = ", hours, hourlyRate);
|
|
|
|
CheckLogoVisibility(pRO);
|
|
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
|
|
private void CheckLogoVisibility(ServiceInvoiceRO pRO)
|
|
{
|
|
bool showLogo = false;
|
|
|
|
if (pRO.InvoiceBase.CustomerOid > 0)
|
|
{
|
|
var c = DAOFactory.GenericDAO.LoadByID<Customer>(pRO.InvoiceBase.CustomerOid);
|
|
|
|
foreach (var vv in c.VarFieldValueList)
|
|
{
|
|
if (vv.VarFieldDefOid.Value == 9)
|
|
{
|
|
var varFieldValue = BS.Shared.Core.Utils.XMLDeserializeFromString(vv.SerializedValue, Type.GetType(vv.TypeName));
|
|
if (varFieldValue != null)
|
|
{
|
|
var vfv = varFieldValue.ToString();
|
|
|
|
if (String.IsNullOrEmpty(vfv) || vfv == "True")
|
|
{
|
|
showLogo = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
picLogo.Visible = showLogo;
|
|
if (Watermarks.Count > 0 && !showLogo)
|
|
{
|
|
this.Watermarks[0].ImageSource = null;
|
|
}
|
|
|
|
}
|
|
}
|
|
} |