Files
BeWoPlaner/ReportImp/ProIntegra/SettlementReport2.cs

93 lines
2.8 KiB
C#
Raw Permalink Normal View History

2021-08-03 14:08:22 +02:00
using System;
using System.Collections.Generic;
using BeWo.Data.Access;
using BeWo.Data.Entities;
using BeWo.Report;
using BeWo.Report.ReportObjects;
using BS.Shared;
using BS.Shared.DataContracts;
namespace ProIntegra.Neu
{
public partial class Spitzabrechnung : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<Settlement2RO>
{
public Spitzabrechnung()
{
InitializeComponent();
}
public void SetReportDataSource(Settlement2RO pRO) // RecipientContactPerson Trim wenn != null
{
SetzeAnsprechpartner(pRO);
if (!String.IsNullOrEmpty(pRO.RecipientContactPerson))
{
pRO.RecipientContactPerson = pRO.RecipientContactPerson.Trim();
}
bool isDefaultSpitzabrechnung = false;
if (String.IsNullOrEmpty(pRO.Notice))
{
lblNotice.Visible = false;
}
bool hasRatefactor = false;
if (!String.IsNullOrWhiteSpace(pRO.RateFactorText2))
{
hasRatefactor = true;
if (pRO.RateFactorText2 == "1,2")
{
pRO.RateFactorText2 = "1,20";
}
}
if (pRO.InvoiceItems != null)
{
foreach (var ii in pRO.InvoiceItems)
{
2024-01-10 16:09:49 +01:00
string einheit = ii.ItemDescription == "Kontaktpauschale" ? "Fahrten" : "FLS";
ii.ItemDescription = String.Format("{0:dd.MM.yyyy} bis {1:dd.MM.yyyy}: {2:0.##} " + einheit + " {3}x {4:c}",
2021-08-03 14:08:22 +02:00
ii.PeriodStartDate, ii.PeriodEndDate,
ii.UnitCount, !hasRatefactor ? "" : "x " + pRO.RateFactorText2 + " ",
ii.AmountPerUnit);
}
}
if (pRO.RecipientContactPerson != null)
pRO.RecipientContactPerson = pRO.RecipientContactPerson.Trim();
this.bindingSource1.DataSource = pRO;
}
private void SetzeAnsprechpartner(Settlement2RO pRo)
{
if (pRo.InvoiceBaseOid.HasValue)
{
var ib = DAOFactory.GenericDAO.LoadByID<InvoiceBase>(pRo.InvoiceBaseOid.Value);
if (ib.CostBearer2SupportConcept != null)
{
var cb2sc = ib.CostBearer2SupportConcept;
if (cb2sc.CostBearerContactPerson != null && cb2sc.CostBearerContactPerson.Sex.HasValue)
{
String anrede = "Frau";
if (cb2sc.CostBearerContactPerson.Sex.Value == Sex.Male)
{
anrede = "Herr";
}
pRo.RecipientContactPerson =
String.Format("{0} {1}", anrede, cb2sc.CostBearerContactPerson.LastName);
}
}
}
}
}
}