108 lines
2.7 KiB
C#
108 lines
2.7 KiB
C#
using System;
|
|
using System.Text;
|
|
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using BeWo.Report;
|
|
using BeWo.Report.ReportObjects;
|
|
using BS.Shared;
|
|
using BS.Shared.Core;
|
|
using DevExpress.XtraReports.UI;
|
|
|
|
namespace BeWo.LebenshilfeDuisburgReports
|
|
{
|
|
[IDSpecificClass(Identifier = "LH-FF")]
|
|
public partial class ServiceInvoiceReportFF : XtraReport, IBeWoReport<ServiceInvoiceRO>
|
|
{
|
|
public ServiceInvoiceReportFF()
|
|
{
|
|
this.InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(ServiceInvoiceRO pRO)
|
|
{
|
|
pRO.Notice = "";
|
|
|
|
|
|
if (pRO.InvoiceDateTime.HasValue)
|
|
pRO.Notice = String.Format("{0:dd.MM.yyyy}", pRO.InvoiceDateTime.Value.AddDays(30));
|
|
|
|
if (pRO.ServiceInvoicePeriods != null)
|
|
{
|
|
foreach (var sip in pRO.ServiceInvoicePeriods)
|
|
{
|
|
if (sip.ServiceInvoiceItems != null)
|
|
{
|
|
foreach (var ii in sip.ServiceInvoiceItems)
|
|
{
|
|
ii.ServiceDescription = String.Format("{0}\n{1}", ii.ServiceDescription, ii.Notice);
|
|
|
|
ii.CustomerFirstname = String.Format("{0:c}", ii.AmountPerUnit);
|
|
if (!String.IsNullOrEmpty(ii.RateFactor))
|
|
{
|
|
|
|
var rfStr = ii.RateFactor.Replace("%", "").Replace(",00", "").Trim();
|
|
int rfInt = 0;
|
|
Int32.TryParse(rfStr, out rfInt);
|
|
|
|
decimal rateFactor = (100m + rfInt) / 100m;
|
|
|
|
if (rateFactor > 1)
|
|
{
|
|
ii.CustomerFirstname = String.Format("{0} x {1:0.##}", ii.CustomerFirstname, rateFactor);
|
|
}
|
|
else
|
|
{
|
|
ii.CustomerFirstname = String.Format("{0}", ii.CustomerFirstname);
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
|
|
SetCustomerInfos(pRO);
|
|
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
|
|
private void SetCustomerInfos(ServiceInvoiceRO pRO)
|
|
{
|
|
Customer c = null;
|
|
if (pRO.CustomerOid.HasValue)
|
|
{
|
|
c = DAOFactory.GenericDAO.LoadByID<Customer>(pRO.CustomerOid.Value);
|
|
}
|
|
if (c == null)
|
|
{
|
|
if (pRO.ServiceInvoicePeriods.Count > 0)
|
|
{
|
|
var c2s = pRO.ServiceInvoicePeriods[0].CostBearer2SupportConcept;
|
|
c = c2s.SupportConcept.Customer;
|
|
}
|
|
}
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
if (c != null)
|
|
{
|
|
if (c.Person.InvoiceAddress != null)
|
|
{
|
|
sb.AppendLine(c.Person.InvoiceAddress.AddressLine1);
|
|
}
|
|
else
|
|
{
|
|
sb.AppendLine(c.Person.FirstNameLastName);
|
|
}
|
|
}
|
|
|
|
sb.AppendLine("über Stadt Duisburg");
|
|
sb.AppendLine(pRO.RecipientOrganisation);
|
|
sb.AppendLine(pRO.RecipientStreet);
|
|
sb.Append(pRO.RecipientPostCodeAndTown);
|
|
lblAnschrift.Text = sb.ToString();
|
|
|
|
}
|
|
}
|
|
} |