Files
BeWoPlaner/ReportImp/LebenshilfeAhrweiler/Sammelrechnung.cs
2020-08-17 15:50:00 +02:00

134 lines
4.1 KiB
C#

using System;
using System.Text;
using BeWo.Report;
using BeWo.Report.ReportObjects;
using BS.Shared.Core;
using DevExpress.XtraReports.UI;
namespace LebenshilfeAhrweiler
{
public partial class Rechnung : XtraReport, IBeWoReport<ServiceInvoiceRO>
{
public Rechnung()
{
this.InitializeComponent();
}
public void SetReportDataSource(ServiceInvoiceRO pRO)
{
DateTime start = pRO.AccountingPeriodStart;
DateTime end = pRO.AccountingPeriodEnd;
if (pRO.RecipientOrganisation == "Kreisverwaltung Ahrweiler")
{
pRO.RecipientContactPerson = "Bereich Soziales 2.4";
}
if (pRO.CustomerSalutation == "Herr")
{
pRO.CustomerSalutation = "Herrn";
}
decimal approved = 0;
decimal approvedFactor = 0;
//if (pRO.AccountingPeriodStart.Date.Year == pRO.AccountingPeriodEnd.Date.Year
// && pRO.AccountingPeriodStart.Date.Month == pRO.AccountingPeriodEnd.Date.Month)
//{
// lblMonth.Text = String.Format("{0:MMMM yyyy}", pRO.AccountingPeriodStart);
//}
//else
//{
lblMonth.Text = String.Format("{0:dd.MM.yyyy} - {1:dd.MM.yyyy}", pRO.AccountingPeriodStart,
pRO.AccountingPeriodEnd);
//}
String udText = String.Format("{0:dd.MM.yy} - {1:dd.MM.yy}", pRO.AccountingPeriodStart,
pRO.AccountingPeriodEnd);
//decimal amountTotal = 0;
foreach (var sip in pRO.ServiceInvoicePeriods)
{
approved += sip.ApprovedHours ?? 0;
foreach (var ii in sip.ServiceInvoiceItems)
{
ii.UnitDescription = udText;
if (ii.ServiceDescription == "FL-Stunde")
{
ii.ServiceDescription = "FL Fachleistungsstunden";
//if (String.IsNullOrWhiteSpace(lblFlsBewilligung.Text))
//{
// lblFlsBewilligung.Text = String.Format("{0:0.00}", sip.ApprovedHours);
//}
}
else if (ii.ServiceDescription == "AH-Stunde")
{
ii.ServiceDescription = "aH alltagsbegleitende Hilfen";
//if (String.IsNullOrWhiteSpace(lblaHBewilligung.Text))
//{
// lblaHBewilligung.Text = String.Format("{0:0.00}", sip.ApprovedHours);
//}
}
//ii.ServiceDescription = String.Format("{0:dd.MM.yyyy} bis {1:dd.MM.yyyy}: {2:0.##} Std. {3}x {4:c}", ii.AccountingPeriodStart, ii.AccountingPeriodEnd,
// ii.UnitCount, "", ii.AmountPerUnit);
//amountTotal += ii.NetAmount ?? 0;
}
}
/*cellApproved.Text = String.Format("{0:0.##}", approved);
//cellApprovedWithFactor.Text = String.Format("{0:0.##}", approvedFactor);
cellAmountTotal.Text = pRO.GrossClaim;
cellAbschlag.Text = pRO.AmountAdvancedPayments;
cellRechnungsbetrag.Text = pRO.NetClaim;
if (String.IsNullOrEmpty(pRO.Notice))
{
lblNotice.Visible = false;
}
*
*/
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.RecipientPoBox))
{
sb.Append("Postfach ");
sb.AppendLine(pRO.RecipientPoBox.Replace("Postfach", "").Trim());
}
if (!String.IsNullOrEmpty(pRO.RecipientPostCodeAndTown))
{
sb.AppendLine(pRO.RecipientPostCodeAndTown);
}
lblAnschrift.Text = sb.ToString();
this.bindingSource1.DataSource = pRO;
}
}
}