AppError + GkvAbrechnungRO auf OrgaDC.GetDatenannahmestelle

This commit is contained in:
2025-05-23 11:02:31 +02:00
parent 3e006f785f
commit d0794f29f4
5 changed files with 85 additions and 7 deletions

View File

@@ -75,15 +75,18 @@ namespace BeWo.Report.ReportObjects
var receiver_last = invoicebase.RecipientPersonLastName;
var receiver_first_last = receiver_first.ToFormatFollows(receiver_last);
var receiver_postcode = invoicebase.RecipientPostCode;
var receiver_town = invoicebase.RecipientTown;
var receiver_postcode_town = receiver_postcode.ToFormatFollows(receiver_town);
result.ReceiverDatenannahmestelle = invoicebase.RecipientOrganisation.ToNullIfEmpty();
result.ReceiverContactPerson = receiver_first_last;
result.ReceiverDivision = invoicebase.RecipientDivision.ToNullIfEmpty();
result.ReceiverStreet = invoicebase.RecipientStreet.ToNullIfEmpty();
result.ReceiverPostCodeAndTown = receiver_postcode_town;
var datenannahmestelle = organisation.GetDatenannahmestelleAddress();
var datenannahme_postcode = datenannahmestelle.PostalCode;
var datenannahme_town = datenannahmestelle.Town;
var datenannahme_postcode_town = datenannahme_postcode.ToFormatFollows(datenannahme_town);
//result.ReceiverDivision = datenannahmestelle.AddressLine1.ToNullIfEmpty();
result.ReceiverStreet = datenannahmestelle.Street.ToNullIfEmpty();
result.ReceiverPostCodeAndTown = datenannahme_postcode_town;
result.KrankenkasseIK = organisation.IKKostentrager;
result.KrankenkasseName = organisation.Name;

26
Shared/Core/AppError.cs Normal file
View File

@@ -0,0 +1,26 @@
using BS.Shared.DataContracts;
using BS.Shared.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BS.Shared.Core
{
public class AppError
{
public string Code { get; set; }
public string Message { get; set; }
public string Displayname => $"AppError {Code}: {Message}";
// Private damit zentral alle Er
private AppError(string code, string message)
{
Code = code;
Message = message;
}
public static readonly Func<OrganisationDC, AppError> GkvDatenannahmestelleAdresseNotFound = (dc) => new AppError("GKV.70001", $"Unbekannte Datenannahmestelle. Bitte neu in der Organisation {dc.Name} ermitteln");
}
}

View File

@@ -1,5 +1,7 @@
using BS.Shared.Core;
using BS.Shared.Exceptions;
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
@@ -93,5 +95,23 @@ namespace BS.Shared.DataContracts
this.InvoiceAddressTown,
this.InvoiceAddressLine1);
}
public AddressDC GetDatenannahmestelleAddress()
{
var lst = new List<AddressDC>() {
HausanschriftDatenannahmestelle,
PostfachanschriftDatenannahmestelle,
GroßkundenanschriftDatenannahmestelle};
foreach (var add in lst)
{
if (add is AddressDC)
return add;
}
throw new BeWoInvalidOperationException(AppError.GkvDatenannahmestelleAdresseNotFound(this));
return null;
}
}
}

View File

@@ -0,0 +1,27 @@
using BS.Shared.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BS.Shared.Exceptions
{
public class BeWoInvalidOperationException : InvalidOperationException
{
public BeWoInvalidOperationException() : base()
{
}
public BeWoInvalidOperationException(AppError appError) : base(appError.Displayname)
{
}
public BeWoInvalidOperationException(AppError appError, Exception innerException)
{
}
}
}

View File

@@ -138,6 +138,7 @@
<Compile Include="Attributes\RequireNoTenantAttribute.cs" />
<Compile Include="Attributes\RequirePermissionAttribute.cs" />
<Compile Include="BeWoEntityEnums.cs" />
<Compile Include="Core\AppError.cs" />
<Compile Include="Core\AppSettingReader.cs" />
<Compile Include="Core\ComplexWohnheimbuchungsRelationHelper.cs" />
<Compile Include="Core\AbstractIDSpecificDefaultClass.cs" />
@@ -382,6 +383,7 @@
<Compile Include="DataContracts\Reports\AuslastungAnalysisSupportConceptDC.cs" />
<Compile Include="DataContracts\ServiceRecordHistoryDC.cs" />
<Compile Include="DataContracts\SupportPinDC.cs" />
<Compile Include="Exceptions\BeWoInvalidOperationException.cs" />
<Compile Include="Exceptions\GkvException.cs" />
<Compile Include="Extensions\BoolExtensions.cs" />
<Compile Include="Extensions\EnumExtensions.cs" />