SKMAachen/Invoicing/CustomInvoiceNumberGenerator - Rechnungsschema mit Hauptbetreuer

This commit is contained in:
2024-05-22 14:26:24 +02:00
parent b4f2200eea
commit 96d4155e7b
3 changed files with 118 additions and 60 deletions

View File

@@ -0,0 +1,57 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.Eventing.Reader;
using System.Linq;
using System.Text;
using BeWo.Data.Access;
using BeWo.Data.Entities;
using BeWo.Service.DCEntityMapper;
using BeWo.Service.Invoicing;
using BeWo.Service.Plugins;
using BS.Shared;
using BS.Shared.Core;
using BS.Shared.DataContracts;
using BS.Shared.Services;
namespace SKMAachen.Invoicing
{
internal class CustomInvoiceNumberGenerator : InvoiceNumberGenerator
{
public override string GetNextInvoiceNumber(int increment, InvoiceBase invoiceBase)
{
string next = base.GetNextInvoiceNumber(increment, invoiceBase);
String maAbb = "";
Customer c = null;
if (invoiceBase.Type == InvoiceType.General && invoiceBase.RecipientCustomerOid.HasValue
|| invoiceBase.Type == InvoiceType.CustomerEquity && invoiceBase.RecipientCustomerOid.HasValue)
{
c = DAOFactory.GenericDAO.LoadByID<Customer>(invoiceBase.RecipientCustomerOid.Value);
}
else if (invoiceBase.CostBearer2SupportConcept != null)
{
c = invoiceBase.CostBearer2SupportConcept.SupportConcept.Customer;
}
if (c != null)
{
var hauptbetreuer = c.Employee2CustomerList.FirstOrDefault(
e2c => e2c.ValueList.Any(ve => ve.Entry.SystemEntryID.HasValue
&& ve.Entry.SystemEntryID.Value == SystemEntryID.EmployeeRoleMainAttendant));
if (hauptbetreuer != null)
{
if (hauptbetreuer.Employee.Person.Abbreviation != null)
{
maAbb = hauptbetreuer.Employee.Person.Abbreviation;
}
else
{
maAbb = String.Format("{0}{1}", hauptbetreuer.Employee.Person.LastName, hauptbetreuer.Employee.Person.FirstName);
}
}
next = next.Replace("{MA}", maAbb);
}
return next;
}
}
}

View File

@@ -1,64 +1,64 @@
using System;
using BeWo.Data.Access;
using BeWo.Data.Entities;
using BeWo.Report;
using BeWo.Report.ReportObjects;
using BS.Shared.Core;
using DevExpress.XtraReports.UI;
namespace SKMAachen
{
[IDSpecificClass(Identifier = "BeWo67")]
public partial class RechnungBeWo67 : XtraReport, IBeWoReport<ServiceInvoiceRO>
{
public RechnungBeWo67()
{
this.InitializeComponent();
}
public void SetReportDataSource(ServiceInvoiceRO pRO)
{
decimal hourlyRate = 0;
decimal hours = 0;
if (pRO.ServiceInvoicePeriods != null && pRO.ServiceInvoicePeriods.Count > 0)
{
foreach (var p in pRO.ServiceInvoicePeriods)
{
if (p.ServiceInvoiceItems != null && p.ServiceInvoiceItems.Count > 0)
{
foreach (var i in p.ServiceInvoiceItems)
{
if (i.HourlyRate.HasValue)
{
hourlyRate = i.HourlyRate.Value;
if (!String.IsNullOrEmpty(i.RateFactor))
{
var rfStr = i.RateFactor.Replace("%", "").Replace(",00", "").Trim();
int rfInt = 0;
Int32.TryParse(rfStr, out rfInt);
}
}
using System;
using BeWo.Data.Access;
using BeWo.Data.Entities;
using BeWo.Report;
using BeWo.Report.ReportObjects;
using BS.Shared.Core;
using DevExpress.XtraReports.UI;
namespace SKMAachen
{
[IDSpecificClass(Identifier = "BeWo67")]
public partial class RechnungBeWo67 : XtraReport, IBeWoReport<ServiceInvoiceRO>
{
public RechnungBeWo67()
{
this.InitializeComponent();
}
public void SetReportDataSource(ServiceInvoiceRO pRO)
{
decimal hourlyRate = 0;
decimal hours = 0;
if (pRO.ServiceInvoicePeriods != null && pRO.ServiceInvoicePeriods.Count > 0)
{
foreach (var p in pRO.ServiceInvoicePeriods)
{
if (p.ServiceInvoiceItems != null && p.ServiceInvoiceItems.Count > 0)
{
foreach (var i in p.ServiceInvoiceItems)
{
if (i.HourlyRate.HasValue)
{
hourlyRate = i.HourlyRate.Value;
if (!String.IsNullOrEmpty(i.RateFactor))
{
var rfStr = i.RateFactor.Replace("%", "").Replace(",00", "").Trim();
int rfInt = 0;
Int32.TryParse(rfStr, out rfInt);
}
}
if (i.Hours.HasValue)
{
hours += i.Hours.Value;
}
}
}
}
}
lblForderung.Text =
String.Format("Hieraus ergibt sich eine Forderung von {0:0.00} Std. x {1:0.00} EUR = {2:0.00} EUR.", hours, hourlyRate, pRO.NetClaim);
lblAbrechnungszeitraum.Text =
String.Format(
"Im Zeitraum vom {0:dd.MM.yyyy} bis {1:dd.MM.yyyy} wurden {2:0.00} Dienstleistungsstunden unmittelbare Betreuungsleistungen des Ambulant Betreuten Wohnens erbracht.",
pRO.AccountingPeriodStart, pRO.AccountingPeriodEnd, hours);
this.bindingSource1.DataSource = pRO;
}
}
}
}
}
}
}
lblForderung.Text =
String.Format("Hieraus ergibt sich eine Forderung von {0:0.00} Std. x {1:0.00} EUR = {2:0.00} EUR.", hours, hourlyRate, pRO.NetClaim);
lblAbrechnungszeitraum.Text =
String.Format(
"Im Zeitraum vom {0:dd.MM.yyyy} bis {1:dd.MM.yyyy} wurden {2:0.00} Dienstleistungsstunden unmittelbare Betreuungsleistungen des Ambulant Betreuten Wohnens erbracht.",
pRO.AccountingPeriodStart, pRO.AccountingPeriodEnd, hours);
this.bindingSource1.DataSource = pRO;
}
}
}

View File

@@ -61,6 +61,7 @@
<Compile Include="CustomMitarbeiterstundenkontoBerechnungMonate.cs" />
<Compile Include="Invoicing\CustomBeWo67InvoiceCreation.cs" />
<Compile Include="Invoicing\CustomInvoiceFactory.cs" />
<Compile Include="Invoicing\CustomInvoiceNumberGenerator.cs" />
<Compile Include="Invoicing\SettlementInvoiceCreation.cs" />
<Compile Include="Mitarbeiterarbeitszeitkonto.cs">
<SubType>Component</SubType>