Files
BeWoPlaner/ReportImp/VSDHammReports/Budgetnachweis2.cs
Christian 49a5f5e7dd cb
2022-04-29 20:37:37 +02:00

116 lines
3.2 KiB
C#

using System;
using BeWo.Report.ReportObjects;
using BeWo.Report;
using BeWo.Data.Access;
using BeWo.Data.Entities;
using BS.Shared.Core;
namespace VSDHammReports
{
[IDSpecificClass(Identifier = "LWLMITANHANG")]
public partial class Budgetnachweis2 : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<Settlement2RO>
{
public Budgetnachweis2()
{
InitializeComponent();
}
public void SetReportDataSource(Settlement2RO pRO)
{
bool replaceFF = true;
if (String.IsNullOrEmpty(pRO.RecipientOrganisation) || !pRO.RecipientOrganisation.ToLower().StartsWith("lwl"))
{
lblAZ.Text = "";
lblAZLabel.Text = "";
lblZad.Text = "60-9011896.1";
}
else
{
lblZad.Text = "60-9011897.1";
}
//if (!pRO.HourlyRateNew.HasValue && pRO.DifferentHourlyRateCount > 0 && pRO.InvoiceItems != null &&
// pRO.InvoiceItems.Count > 0)
//{
// pRO.RateFactor = 1;
// replaceFF = true;
// cellBewilligteFLSText.Text = "Bewilligte FLS";
// cellRateFactorFLSText.Text = "";
// cellApprovedFLSWithRF.Text = "";
//}
cellBewilligteFLSText.Text = "Bewilligte FLS";
//cellRateFactorFLSText.Text = "";
//cellApprovedFLSWithRF.Text = "";
if (!String.IsNullOrEmpty(pRO.SenderContactPersonMail))
{
pRO.SenderContactPersonMail = pRO.SenderContactPersonMail.Replace("Email: ", "").Trim();
}
if (!String.IsNullOrEmpty(pRO.SenderContactPersonPhone))
{
pRO.SenderContactPersonPhone = pRO.SenderContactPersonPhone.Replace("Tel.: ", "").Trim();
}
decimal ratefactor = 0;
if (pRO.InvoiceItems != null)
{
foreach (var ii in pRO.InvoiceItems)
{
ii.DetailDescription = String.Format("{0:dd.MM.yyyy} bis {1:dd.MM.yyyy}",
ii.PeriodStartDate, ii.PeriodEndDate);
ii.DetailDescription += String.Format(": {0:0.##} FF x {1:c}",
ii.UnitCount, ii.AmountPerUnit);
if (replaceFF)
{
ii.DetailDescription = ii.DetailDescription.Replace(" FF ", " FLS ");
}
ratefactor = ii.RateFactor ?? 1;
}
}
pRO.ApprovedFLSTotal *= (100 + ratefactor) / 100;
xrCheckBox2.Checked = true;
DateTime? terminationDate = null;
if (pRO.TerminationDate.HasValue)
{
terminationDate = pRO.TerminationDate;
xrCheckBox1.Text = String.Format(" Die Betreuung wurde am {0:dd.MM.yyyy} beendet.",
pRO.TerminationDate);
xrCheckBox2.Checked = false;
xrCheckBox1.Checked = true;
}
SetzeWohnort(pRO);
//var anhang = new BudgetnachweisAnhang();
//xrSubreport1.ReportSource = anhang;
////anhang.SetReportDataSource(pRO);
this.bindingSource1.DataSource = pRO;
}
private void SetzeWohnort(Settlement2RO pRo)
{
if (pRo.InvoiceBaseOid.HasValue)
{
var ib = DAOFactory.GenericDAO.LoadByID<InvoiceBase>(pRo.InvoiceBaseOid.Value);
if (ib.CostBearer2SupportConcept != null)
{
var c = ib.CostBearer2SupportConcept.SupportConcept.Customer;
if (c != null && c.Person.Address != null)
{
lblWohnort.Text = String.Format("{0} in {1} {2}", c.Person.Address.Street, c.Person.Address.PostalCode, c.Person.Address.Town);
}
}
}
}
}
}