Files
BeWoPlaner/ReportImp/TeamPfeil/ServiceInvoiceReportQualifikation.cs

93 lines
3.2 KiB
C#

using System;
using System.Text;
using BeWo.Report;
using BeWo.Report.ReportObjects;
using BS.Shared.Core;
using DevExpress.XtraReports.UI;
namespace TeamPfeil
{
[IDSpecificClass(Identifier = "Qualifikation")]
public partial class ServiceInvoiceReportQuali : XtraReport, IBeWoReport<ServiceInvoiceRO>
{
public ServiceInvoiceReportQuali()
{
this.InitializeComponent();
}
public void SetReportDataSource(ServiceInvoiceRO pRO)
{
StringBuilder sb = new StringBuilder();
if (!String.IsNullOrEmpty(pRO.RecipientOrganisation))
{
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();
DateTime start = pRO.AccountingPeriodStart;
DateTime end = pRO.AccountingPeriodEnd;
if (start.Month == end.Month && start.Year == end.Year)
{
Label_InvoiceMonth.Text = String.Format("{0:MMMM yyyy}", start);
}
else
{
Label_InvoiceMonth.Text = String.Format("{0:MMMM yyyy} - {1:MMMM yyyy}", start, end);
}
if (pRO.CustomerSalutation == "Herr")
{
pRO.CustomerSalutation = "Herrn";
}
if (pRO.OrganisationDebitorNumber != null && pRO.OrganisationDebitorNumber.StartsWith("ZE-Nummer"))
{
lblZeNummer.Text = pRO.OrganisationDebitorNumber;
}
pRO.NotBillableNote = "";
decimal hours = 0;
if (pRO.ServiceInvoicePeriods != null)
{
foreach (var sip in pRO.ServiceInvoicePeriods)
{
if (sip.ServiceInvoiceItems != null)
{
//pRO.NetClaim = string.Format("{0:0.00}", sip.ServiceInvoiceItems[0].HourlyRate);
foreach (var ii in sip.ServiceInvoiceItems)
{
hours += (decimal)ii.Hours;
if (pRO.NotBillableNote.Length > 0)
{
pRO.NotBillableNote += "\n \t \t \t ";
}
pRO.NotBillableNote += string.Format("{0:0.##} h x {1:0.00} € {2} = {3:c}", ii.Hours, ii.HourlyRate, ii.ServiceDescription, ii.NetAmount);
}
}
}
}
pRO.NetClaim = string.Format("{0:0.00}", hours);
this.bindingSource1.DataSource = pRO;
}
}
}