262 lines
11 KiB
C#
262 lines
11 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using BeWo.Report;
|
|
using BeWo.Report.DefaultReports.Invoices;
|
|
using BeWo.Report.ReportObjects;
|
|
using BeWo.Service.DCEntityMapper;
|
|
using BeWo.Service.Plugins;
|
|
using BS.Shared;
|
|
using BS.Shared.Core;
|
|
using BS.Shared.DataContracts;
|
|
using BS.Shared.Services;
|
|
using DevExpress.XtraReports.UI;
|
|
|
|
namespace AsbRheinErftDuerenSBD
|
|
{
|
|
// [IDSpecificClass(Identifier = "SBD")]
|
|
public partial class ServiceInvoiceReport : XtraReport, IBeWoReport<ServiceInvoiceRO>
|
|
{
|
|
public ServiceInvoiceReport()
|
|
{
|
|
this.InitializeComponent();
|
|
}
|
|
|
|
public void SetReportDataSource(ServiceInvoiceRO pRO)
|
|
{
|
|
SetzeEmpfaengerAdresse(pRO);
|
|
SetzeBetraege(pRO);
|
|
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
|
|
private static Organisation SucheSchule(Customer customer)
|
|
{
|
|
foreach (var c2o in customer.Customer2OrganisationList)
|
|
{
|
|
foreach (var v2o in c2o.ValueList)
|
|
{
|
|
if (v2o.Entry.Value != null && v2o.Entry.Value.Contains("Schule"))
|
|
{
|
|
return c2o.Organisation;
|
|
}
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
|
|
private void SetzeBetraege(ServiceInvoiceRO pRo)
|
|
{
|
|
//lblZuschlagText.Text = "";
|
|
//lblAnzahlZuschlag.Text = "";
|
|
//lblBetragEinheitZuschlag.Text = "";
|
|
//lblGesamtBetragZuschlag.Text = "";
|
|
lblZeitraum.Text = String.Format("Abrechnung {0:MM} / {0:yyyy}", pRo.AccountingPeriodStart);
|
|
|
|
decimal stundenAnzahl = 0;
|
|
decimal stundenSatz = 0;
|
|
string bezeichnung = "Stundenabrechnung Nicht-Fachkraft";
|
|
|
|
decimal stundenAnzahl2 = 0;
|
|
decimal stundenSatz2 = 0;
|
|
string bezeichnung2 = "Stundenabrechnung Nicht-Fachkraft";
|
|
|
|
String prozentZuschlag = "";
|
|
decimal anzahlZuschlag = 0;
|
|
decimal betragEinheitZuschlag = 0;
|
|
|
|
|
|
if (pRo.ServiceInvoicePeriods != null)
|
|
{
|
|
for (int i = 0; i < pRo.ServiceInvoicePeriods.Count; i++)
|
|
{
|
|
var sip = pRo.ServiceInvoicePeriods[i];
|
|
|
|
if (sip.ServiceInvoiceItems != null)
|
|
{
|
|
sip.ServiceInvoiceItems = sip.ServiceInvoiceItems.Where(item => item.NetAmount.HasValue && item.NetAmount.Value != 0).ToList();
|
|
|
|
foreach (var ii in sip.ServiceInvoiceItems)
|
|
{
|
|
if (ii.ServiceDescription != null)
|
|
{
|
|
if (ii.NetAmount < 0)
|
|
{
|
|
ii.AmountPerUnit *= -1;
|
|
if (i == 0)
|
|
bezeichnung = ii.ServiceDescription.Substring(ii.ServiceDescription.IndexOf('(') + 1, ii.ServiceDescription.Length - ii.ServiceDescription.IndexOf('(') - 2);
|
|
else if (i == 1)
|
|
bezeichnung2 = ii.ServiceDescription.Substring(ii.ServiceDescription.IndexOf('(') + 1, ii.ServiceDescription.Length - ii.ServiceDescription.IndexOf('(') - 2); ;
|
|
}
|
|
|
|
if (ii.ServiceDescription.Contains("Betreuungseinsätze") || ii.ServiceDescription.Contains("Integrationshilfe"))
|
|
{
|
|
if (i == 0)
|
|
{
|
|
stundenAnzahl = ii.UnitCount ?? 0;
|
|
stundenSatz = ii.AmountPerUnit ?? 0;
|
|
if (ii.ServiceDescription.Contains("Integrationshilfe"))
|
|
lblBezeichnung.Text = ii.ServiceDescription;
|
|
}
|
|
else if (i == 1)
|
|
{
|
|
stundenAnzahl2 = ii.UnitCount ?? 0;
|
|
stundenSatz2 = ii.AmountPerUnit ?? 0;
|
|
if (ii.ServiceDescription.Contains("Integrationshilfe"))
|
|
lblBezeichnung2.Text = ii.ServiceDescription;
|
|
}
|
|
}
|
|
else if (ii.ServiceDescription.Contains("Zuschlag auf Betreuungszeit"))
|
|
{
|
|
anzahlZuschlag = ii.UnitCount ?? 0;
|
|
betragEinheitZuschlag = ii.AmountPerUnit ?? 0;
|
|
|
|
prozentZuschlag = ii.RateFactor;
|
|
prozentZuschlag = prozentZuschlag.Replace(",00%", "%");
|
|
}
|
|
else if (ii.ServiceDescription.ToLower().Contains("minipool"))
|
|
{
|
|
if (i == 0)
|
|
{
|
|
stundenAnzahl = ii.UnitCount ?? 0;
|
|
stundenSatz = ii.AmountPerUnit ?? 0;
|
|
lblBezeichnung.Text = ii.ServiceDescription;
|
|
}
|
|
else if (i == 1)
|
|
{
|
|
stundenAnzahl2 = ii.UnitCount ?? 0;
|
|
stundenSatz2 = ii.AmountPerUnit ?? 0;
|
|
lblBezeichnung2.Text = ii.ServiceDescription;
|
|
}
|
|
}
|
|
else if (ii.ServiceDescription.ToLower().Contains("fahrtkostenpauschale"))
|
|
{
|
|
if (i == 0)
|
|
{
|
|
stundenAnzahl = ii.UnitCount ?? 0;
|
|
stundenSatz = ii.AmountPerUnit ?? 0;
|
|
lblBezeichnung.Text = "Fahrtkostenpauschale";
|
|
}
|
|
else if (i == 1)
|
|
{
|
|
stundenAnzahl2 = ii.UnitCount ?? 0;
|
|
stundenSatz2 = ii.AmountPerUnit ?? 0;
|
|
lblBezeichnung2.Text = "Fahrtkostenpauschale";
|
|
}
|
|
}
|
|
else if (ii.ServiceDescription.Contains("Abzug"))
|
|
{
|
|
if (i == 0)
|
|
{
|
|
stundenAnzahl = ii.UnitCount ?? 0;
|
|
stundenSatz = ii.NetAmount ?? 0;
|
|
lblBezeichnung.Text = ii.ServiceDescription;
|
|
}
|
|
else if (i == 1)
|
|
{
|
|
stundenAnzahl2 = ii.UnitCount ?? 0;
|
|
stundenSatz2 = ii.NetAmount ?? 0;
|
|
lblBezeichnung2.Text = ii.ServiceDescription;
|
|
}
|
|
}
|
|
i++;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
if (pRo.InvoiceId.Contains("SBD Aldenhoven"))
|
|
{
|
|
if (pRo.ServiceInvoicePeriods != null)
|
|
{
|
|
for (int i = 0; i < pRo.ServiceInvoicePeriods.Count; i++)
|
|
{
|
|
var sip = pRo.ServiceInvoicePeriods[i];
|
|
|
|
if (sip.ServiceInvoiceItems != null)
|
|
{
|
|
foreach (var ii in sip.ServiceInvoiceItems)
|
|
{
|
|
if (i == 0)
|
|
{
|
|
stundenAnzahl = ii.UnitCount ?? 0;
|
|
stundenSatz = ii.AmountPerUnit ?? 0;
|
|
}
|
|
else if (i == 1)
|
|
{
|
|
stundenAnzahl2 = ii.UnitCount ?? 0;
|
|
stundenSatz2 = ii.AmountPerUnit ?? 0;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
lblStunden.Text = String.Format("{0:0.00}", stundenAnzahl);
|
|
lblStundensatz.Text = String.Format("{0:c}", stundenSatz);
|
|
lblBetragStunden.Text = String.Format("{0:c}", stundenAnzahl * stundenSatz);
|
|
lblBezeichnung.Text = bezeichnung;
|
|
|
|
if (stundenAnzahl2 == 0 && stundenSatz2 == 0)
|
|
{
|
|
lblBezeichnung2.Text = null;
|
|
lblStunden2.Text = null;
|
|
lblStundensatz2.Text = null;
|
|
lblBetragStunden2.Text = null;
|
|
}
|
|
else
|
|
{
|
|
lblStunden2.Text = String.Format("{0:0.00}", stundenAnzahl2);
|
|
lblStundensatz2.Text = String.Format("{0:c}", stundenSatz2);
|
|
lblBetragStunden2.Text = String.Format("{0:c}", stundenAnzahl2 * stundenSatz2);
|
|
lblBezeichnung2.Text = bezeichnung2;
|
|
}
|
|
|
|
|
|
//if (!String.IsNullOrWhiteSpace(prozentZuschlag))
|
|
//{
|
|
// lblZuschlagText.Text = String.Format("{0} Zuschlag auf Betreuungszeit", prozentZuschlag);
|
|
// lblAnzahlZuschlag.Text = String.Format("{0:0.00}", anzahlZuschlag);
|
|
// lblBetragEinheitZuschlag.Text = String.Format("{0:c}", betragEinheitZuschlag);
|
|
// lblGesamtBetragZuschlag.Text = String.Format("{0:c}", anzahlZuschlag * betragEinheitZuschlag);
|
|
//}
|
|
|
|
lblGesamtBetrag.Text = pRo.GrossClaim;
|
|
}
|
|
|
|
private void SetzeEmpfaengerAdresse(ServiceInvoiceRO pRO)
|
|
{
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
if (!String.IsNullOrEmpty(pRO.RecipientOrganisation))
|
|
{
|
|
sb.AppendLine(pRO.RecipientOrganisation);
|
|
}
|
|
if (!String.IsNullOrEmpty(pRO.RecipientDivision))
|
|
{
|
|
sb.AppendLine(pRO.RecipientDivision);
|
|
}
|
|
if (!String.IsNullOrEmpty(pRO.RecipientAddressLine1))
|
|
{
|
|
sb.AppendLine(pRO.RecipientAddressLine1);
|
|
}
|
|
if (!String.IsNullOrEmpty(pRO.RecipientStreet))
|
|
{
|
|
sb.AppendLine(pRO.RecipientStreet);
|
|
}
|
|
if (!String.IsNullOrEmpty(pRO.RecipientPostCodeAndTown))
|
|
{
|
|
sb.AppendLine(pRO.RecipientPostCodeAndTown);
|
|
}
|
|
lblAdresse.Text = sb.ToString();
|
|
}
|
|
}
|
|
} |