ZukunftLeben: SoziotherapieRechnung
to be tested
This commit is contained in:
31
ReportImp/ZukunftLeben/Invoicing/CustomInvoiceFactory.cs
Normal file
31
ReportImp/ZukunftLeben/Invoicing/CustomInvoiceFactory.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using BeWo.Service.Invoicing;
|
||||
using BS.Shared.DataContracts;
|
||||
using BS.Shared.DataContracts.Compact;
|
||||
|
||||
namespace ZukunftLeben.Invoicing
|
||||
{
|
||||
public class CustomInvoiceFactory : InvoiceFactory
|
||||
{
|
||||
|
||||
public override InvoiceCreation CreateInvoiceCreator(string specificId, string tenant, Dictionary<CompactSupportConceptDC, List<ServiceRecordDC>> supportConcepts2ServiceRecords)
|
||||
{
|
||||
foreach (var list in supportConcepts2ServiceRecords.Values)
|
||||
{
|
||||
foreach (var sr in list)
|
||||
{
|
||||
var cat = sr.ServiceDescription.Category;
|
||||
|
||||
if (sr.CostBearer != null && !sr.CostBearer.Name.Contains("LWL") && !sr.CostBearer.Name.Contains("LVR") &&
|
||||
!String.IsNullOrEmpty(cat.Name) && cat.Name.ToLower().Contains("soziotherapie"))
|
||||
{
|
||||
return new SoziotherapieInvoiceCreation();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return base.CreateInvoiceCreator(specificId, tenant, supportConcepts2ServiceRecords);
|
||||
}
|
||||
}
|
||||
}
|
||||
221
ReportImp/ZukunftLeben/Invoicing/SoziotherapieInvoiceCreation.cs
Normal file
221
ReportImp/ZukunftLeben/Invoicing/SoziotherapieInvoiceCreation.cs
Normal file
@@ -0,0 +1,221 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using BeWo.Data.Entities;
|
||||
using BeWo.Service.Invoicing;
|
||||
using BS.Shared.Core;
|
||||
using BS.Shared.DataContracts;
|
||||
using BS.Shared.DataContracts.Compact;
|
||||
using BS.Shared.Extensions;
|
||||
using BS.Shared.Services;
|
||||
|
||||
namespace ZukunftLeben.Invoicing
|
||||
{
|
||||
public class SoziotherapieInvoiceCreation : InvoiceCreation
|
||||
{
|
||||
public override ServiceInvoice CreateSingleInvoice(int invoiceCounter, CostBearer costBearer, DateTimeSpan invoicePeriod, CompactSupportConceptDC supportConcept, List<ServiceRecordDC> serviceRecords)
|
||||
{
|
||||
var invoice = new ServiceInvoice();
|
||||
|
||||
var supportConceptList = new List<CompactSupportConceptDC> { supportConcept };
|
||||
|
||||
SetSenderInformation(invoice);
|
||||
SetInvoiceBaseData(invoiceCounter, invoice, costBearer, invoicePeriod, supportConceptList);
|
||||
SetSingleInvoiceBaseData(invoiceCounter, invoice, costBearer, invoicePeriod, supportConcept);
|
||||
|
||||
SetRecipientInformation(invoice, costBearer);
|
||||
|
||||
SetServiceInvoicePeriods(invoice, invoice.InvoiceBase.CostBearer2SupportConcept, invoicePeriod, serviceRecords);
|
||||
|
||||
SetServiceInvoicePeriodAmounts(invoice);
|
||||
|
||||
if (invoicePeriod == null)
|
||||
{
|
||||
SetAmountAdvancePayments(invoice);
|
||||
SetAmountEquityContribution(invoice);
|
||||
}
|
||||
|
||||
base.CreateSingleInvoice(invoiceCounter, costBearer, invoicePeriod, supportConcept, serviceRecords);
|
||||
return invoice;
|
||||
}
|
||||
|
||||
public override IList<InvoiceItem> CreateInvoiceItems(List<ServiceRecordDC> serviceRecordsInPeriod, DateTimeSpan invoicePeriod, SupportConceptApprovalPeriod scap, Calculations calc)
|
||||
{
|
||||
var list = base.CreateInvoiceItems(serviceRecordsInPeriod, invoicePeriod, scap, calc);
|
||||
var ii = CreateHausbesuchspauschale(serviceRecordsInPeriod, invoicePeriod, scap);
|
||||
list.AddRange(ii);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public override InvoiceItem CreateInvoiceItem(ServiceRecordDC iServiceRecord, SupportConceptApprovalPeriod scap, Calculations calc)
|
||||
{
|
||||
var ii = base.CreateInvoiceItem(iServiceRecord, scap, calc);
|
||||
ii.ItemDescription = iServiceRecord.ServiceDescription.Name;
|
||||
|
||||
if (ii.ItemDescription.ToLower().Contains("gruppe"))
|
||||
{
|
||||
//if (iServiceRecord.RoundedDuration <= 45)
|
||||
// ii.UnitDescription = "GPos: 2002678";
|
||||
//else if (iServiceRecord.RoundedDuration <= 60)
|
||||
// ii.UnitDescription = "GPos: 2002677";
|
||||
|
||||
ii.UnitDescription = "GPos: 2002672"; // 90 min, 2-5 Personen
|
||||
ii.AmountPerUnit = GetGruppenPreis(scap.CostBearer2SupportConcept, iServiceRecord.Start.Value);
|
||||
ii.AmountTotal = ii.AmountPerUnit * ii.UnitCount;
|
||||
ii.GrossAmountTotal = ii.AmountTotal;
|
||||
}
|
||||
else
|
||||
{
|
||||
ii.AmountPerUnit = GetEinzelPreis(scap.CostBearer2SupportConcept, iServiceRecord.Start.Value);
|
||||
ii.AmountTotal = ii.AmountPerUnit * ii.UnitCount;
|
||||
ii.GrossAmountTotal = ii.AmountTotal;
|
||||
|
||||
if (ii.ItemDescription.ToLower().Contains("video"))
|
||||
{
|
||||
if (iServiceRecord.RoundedDuration <= 30)
|
||||
{
|
||||
ii.UnitDescription = "GPos: 2001616";
|
||||
}
|
||||
else
|
||||
{
|
||||
ii.UnitDescription = "GPos: 2001615";
|
||||
}
|
||||
}
|
||||
else if (ii.ItemDescription.ToLower().Contains("telefonat"))
|
||||
{
|
||||
if (iServiceRecord.RoundedDuration <= 30)
|
||||
{
|
||||
ii.UnitDescription = "GPos: 2001618";
|
||||
}
|
||||
else
|
||||
{
|
||||
ii.UnitDescription = "GPos: 2001617";
|
||||
}
|
||||
}
|
||||
else if (ii.ItemDescription.ToLower().Contains("aufsuchende einheit"))
|
||||
{
|
||||
if (iServiceRecord.RoundedDuration <= 30)
|
||||
{
|
||||
ii.UnitDescription = "GPos: 2001612 / 2009690";
|
||||
}
|
||||
else
|
||||
{
|
||||
ii.UnitDescription = "GPos: 2001610 / 2009690";
|
||||
}
|
||||
}
|
||||
else if (ii.ItemDescription.ToLower().Contains("aufsuchende probatorik"))
|
||||
{
|
||||
ii.UnitDescription = "GPos: 2001607 / 2009690";
|
||||
}
|
||||
else if (ii.ItemDescription.ToLower().Contains("büroprobatorik"))
|
||||
{
|
||||
ii.UnitDescription = "GPos: 2001607";
|
||||
}
|
||||
else if (ii.ItemDescription.ToLower().Contains("büroeinheit"))
|
||||
{
|
||||
ii.UnitDescription = "GPos: 2001610";
|
||||
}
|
||||
}
|
||||
|
||||
return ii;
|
||||
}
|
||||
|
||||
public virtual IList<InvoiceItem> CreateHausbesuchspauschale(List<ServiceRecordDC> serviceRecordsInPeriod, DateTimeSpan invoicePeriod, SupportConceptApprovalPeriod scap)
|
||||
{
|
||||
IList<InvoiceItem> items = new List<InvoiceItem>();
|
||||
decimal hausbesuchspauschale = 8.53m;
|
||||
hausbesuchspauschale = GetHausbesuchspauschale(scap.CostBearer2SupportConcept, invoicePeriod.StartDate);
|
||||
int countHausbesuch = 0;
|
||||
foreach (var sr in serviceRecordsInPeriod)
|
||||
{
|
||||
if (sr.ServiceDescription.Name.ToLower().Contains("aufsuchend"))
|
||||
{
|
||||
countHausbesuch++;
|
||||
}
|
||||
}
|
||||
|
||||
if (countHausbesuch > 0)
|
||||
{
|
||||
var invoiceItem = new InvoiceItem();
|
||||
|
||||
decimal anzahlHausbesuche = countHausbesuch;
|
||||
|
||||
invoiceItem.AmountPerUnit = hausbesuchspauschale;
|
||||
invoiceItem.UnitCount = anzahlHausbesuche;
|
||||
invoiceItem.AmountTotal = anzahlHausbesuche * hausbesuchspauschale;
|
||||
invoiceItem.ItemPeriodStart = invoicePeriod.StartDate;
|
||||
invoiceItem.ItemPeriodEnd = invoicePeriod.EndDate;
|
||||
invoiceItem.RateFactor = null;
|
||||
invoiceItem.GrossAmountTotal = invoiceItem.AmountTotal;
|
||||
invoiceItem.ItemDescription = "Hausbesuchspauschale";
|
||||
invoiceItem.UnitDescription = "GPos: 2009690";
|
||||
if (scap != null)
|
||||
invoiceItem.SupportConceptApprovalPeriodOid = scap.Oid;
|
||||
|
||||
items.Add(invoiceItem);
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
private decimal GetHausbesuchspauschale(CostBearer2SupportConcept c2s, DateTime dt)
|
||||
{
|
||||
String preisName = "Hausbesuchspauschale Primärkasse";
|
||||
|
||||
if (c2s.CostBearer.Organisation.Function != null)
|
||||
{
|
||||
if (c2s.CostBearer.Organisation.Function.Value.Contains("Ersatzkasse"))
|
||||
{
|
||||
preisName = "Hausbesuchspauschale Ersatzkasse";
|
||||
}
|
||||
}
|
||||
|
||||
return base.GetPreis(preisName, dt);
|
||||
}
|
||||
|
||||
private decimal GetGruppenPreis(CostBearer2SupportConcept c2s, DateTime dt)
|
||||
{
|
||||
String preisName = "Gruppenstunde Primärkasse";
|
||||
|
||||
if (c2s.CostBearer.Organisation.Function != null)
|
||||
{
|
||||
if (c2s.CostBearer.Organisation.Function.Value.Contains("Ersatzkasse"))
|
||||
{
|
||||
preisName = "Gruppenstunde Ersatzkasse";
|
||||
}
|
||||
}
|
||||
|
||||
return base.GetPreis(preisName, dt);
|
||||
}
|
||||
|
||||
private decimal GetEinzelPreis(CostBearer2SupportConcept c2s, DateTime dt)
|
||||
{
|
||||
String preisName = "Einzelstunde Primärkasse";
|
||||
|
||||
if (c2s.CostBearer.Organisation.Function != null)
|
||||
{
|
||||
if (c2s.CostBearer.Organisation.Function.Value.Contains("Ersatzkasse"))
|
||||
{
|
||||
preisName = "Einzelstunde Ersatzkasse";
|
||||
}
|
||||
}
|
||||
|
||||
return base.GetPreis(preisName, dt);
|
||||
}
|
||||
|
||||
public override IList<InvoiceItem> CreateSummaryInvoiceItems(IList<InvoiceItem> itemList, DateTimeSpan invoicePeriod, SupportConceptApprovalPeriod scap, Calculations calc, bool summaryPerMonth, bool addRateFactorToUnitCount)
|
||||
{
|
||||
return base.CreateSummaryInvoiceItems(itemList, invoicePeriod, scap, calc, true, true);
|
||||
}
|
||||
|
||||
public override string GetSummaryItemKey(SupportConceptApprovalPeriod scap, InvoiceItem iitem, bool summaryPerMonth)
|
||||
{
|
||||
String key = String.Format("{0}_{1}_{2}", iitem.AmountPerUnit, iitem.RateFactor, iitem.ItemDescription);
|
||||
if (summaryPerMonth)
|
||||
{
|
||||
key = String.Format("{0}_{1}_{2:yyyyMM}_{3}", iitem.AmountPerUnit, iitem.RateFactor, iitem.ItemPeriodStart, iitem.ItemDescription);
|
||||
}
|
||||
|
||||
return key;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,6 +30,7 @@ namespace ZukunftLeben
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LeistungsnachweisSoziotherapie));
|
||||
DevExpress.XtraReports.UI.XRWatermark xrWatermark1 = new DevExpress.XtraReports.UI.XRWatermark();
|
||||
this.Detail = new DevExpress.XtraReports.UI.DetailBand();
|
||||
this.xrTableServiceRecords1 = new DevExpress.XtraReports.UI.XRTable();
|
||||
@@ -109,6 +110,7 @@ namespace ZukunftLeben
|
||||
this.xrLabel1 = new DevExpress.XtraReports.UI.XRLabel();
|
||||
this.fieldArt = new DevExpress.XtraReports.UI.CalculatedField();
|
||||
this.fieldGroup = new DevExpress.XtraReports.UI.CalculatedField();
|
||||
this.xrPictureBox3 = new DevExpress.XtraReports.UI.XRPictureBox();
|
||||
((System.ComponentModel.ISupportInitialize)(this.xrTableServiceRecords1)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.xrTable3)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.bindingSource1)).BeginInit();
|
||||
@@ -755,6 +757,7 @@ namespace ZukunftLeben
|
||||
// ReportHeader
|
||||
//
|
||||
this.ReportHeader.Controls.AddRange(new DevExpress.XtraReports.UI.XRControl[] {
|
||||
this.xrPictureBox3,
|
||||
this.xrLabel5,
|
||||
this.xrLabel2,
|
||||
this.xrLabel9,
|
||||
@@ -854,7 +857,7 @@ namespace ZukunftLeben
|
||||
this.lblAdresse.LocationFloat = new DevExpress.Utils.PointFloat(233.9999F, 39.99999F);
|
||||
this.lblAdresse.Name = "lblAdresse";
|
||||
this.lblAdresse.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 0, 0, 100F);
|
||||
this.lblAdresse.SizeF = new System.Drawing.SizeF(749.2915F, 20F);
|
||||
this.lblAdresse.SizeF = new System.Drawing.SizeF(667.9385F, 20F);
|
||||
this.lblAdresse.StylePriority.UseFont = false;
|
||||
this.lblAdresse.Text = "Zukunft Leben, Binterimstr. 13, 40223 Düsseldorf";
|
||||
//
|
||||
@@ -882,6 +885,14 @@ namespace ZukunftLeben
|
||||
this.fieldGroup.FieldType = DevExpress.XtraReports.UI.FieldType.Decimal;
|
||||
this.fieldGroup.Name = "fieldGroup";
|
||||
//
|
||||
// xrPictureBox3
|
||||
//
|
||||
this.xrPictureBox3.ImageSource = new DevExpress.XtraPrinting.Drawing.ImageSource("img", resources.GetString("xrPictureBox3.ImageSource"));
|
||||
this.xrPictureBox3.LocationFloat = new DevExpress.Utils.PointFloat(921.5421F, 0F);
|
||||
this.xrPictureBox3.Name = "xrPictureBox3";
|
||||
this.xrPictureBox3.SizeF = new System.Drawing.SizeF(175.9159F, 60.00001F);
|
||||
this.xrPictureBox3.Sizing = DevExpress.XtraPrinting.ImageSizeMode.ZoomImage;
|
||||
//
|
||||
// LeistungsnachweisSoziotherapie
|
||||
//
|
||||
this.Bands.AddRange(new DevExpress.XtraReports.UI.Band[] {
|
||||
@@ -999,5 +1010,6 @@ namespace ZukunftLeben
|
||||
private DevExpress.XtraReports.UI.XRTableCell xrTableCell28;
|
||||
private DevExpress.XtraReports.UI.XRTableCell xrTableCell29;
|
||||
private DevExpress.XtraReports.UI.XRTableCell xrTableCell30;
|
||||
private DevExpress.XtraReports.UI.XRPictureBox xrPictureBox3;
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
1065
ReportImp/ZukunftLeben/SoziotherapieRechnung.Designer.cs
generated
Normal file
1065
ReportImp/ZukunftLeben/SoziotherapieRechnung.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
94
ReportImp/ZukunftLeben/SoziotherapieRechnung.cs
Normal file
94
ReportImp/ZukunftLeben/SoziotherapieRechnung.cs
Normal file
@@ -0,0 +1,94 @@
|
||||
using BeWo.Data.Access;
|
||||
using BeWo.Data.Entities;
|
||||
using BeWo.Report;
|
||||
using BeWo.Report.ReportObjects;
|
||||
using BS.Shared;
|
||||
using BS.Shared.Core;
|
||||
using DevExpress.XtraReports.UI;
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace ZukunftLeben
|
||||
{
|
||||
public partial class SoziotherapieRechnung : XtraReport, IBeWoReport<ServiceInvoiceRO>
|
||||
{
|
||||
public SoziotherapieRechnung()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
}
|
||||
|
||||
public void SetReportDataSource(ServiceInvoiceRO pRO)
|
||||
{
|
||||
string poBox = null;
|
||||
if (pRO.InvoiceBase.RecipientContactInformations.Count > 0)
|
||||
{
|
||||
foreach (var i in pRO.InvoiceBase.RecipientContactInformations)
|
||||
{
|
||||
if (i.ContactType == BS.Shared.ContactType.private_POBox)
|
||||
poBox = i.ContactValue;
|
||||
}
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
if (!String.IsNullOrEmpty(pRO.RecipientOrganisation))
|
||||
{
|
||||
sb.AppendLine(pRO.RecipientOrganisation);
|
||||
}
|
||||
if (!String.IsNullOrEmpty(pRO.RecipientAddressLine1))
|
||||
{
|
||||
sb.AppendLine(pRO.RecipientAddressLine1);
|
||||
}
|
||||
if (!String.IsNullOrEmpty(pRO.RecipientContactPerson))
|
||||
{
|
||||
sb.AppendLine(pRO.RecipientContactPerson);
|
||||
}
|
||||
if (!String.IsNullOrEmpty(pRO.RecipientDivision) && !String.IsNullOrEmpty(pRO.RecipientOrganisation))
|
||||
{
|
||||
sb.AppendLine(pRO.RecipientDivision);
|
||||
}
|
||||
if (!String.IsNullOrEmpty(poBox))
|
||||
{
|
||||
sb.AppendLine(poBox);
|
||||
}
|
||||
else if (!String.IsNullOrEmpty(pRO.RecipientPoBox))
|
||||
{
|
||||
sb.AppendLine(pRO.RecipientPoBox);
|
||||
}
|
||||
else if (!String.IsNullOrEmpty(pRO.RecipientStreet))
|
||||
{
|
||||
sb.AppendLine(pRO.RecipientStreet);
|
||||
}
|
||||
if (!String.IsNullOrEmpty(pRO.RecipientPostCodeAndTown))
|
||||
{
|
||||
sb.AppendLine("");
|
||||
sb.AppendLine(pRO.RecipientPostCodeAndTown);
|
||||
}
|
||||
lblAdresse.Text = sb.ToString();
|
||||
|
||||
decimal hours = 0;
|
||||
if (pRO.ServiceInvoicePeriods != null)
|
||||
{
|
||||
foreach (var sip in pRO.ServiceInvoicePeriods)
|
||||
{
|
||||
foreach (var ii in sip.ServiceInvoiceItems)
|
||||
{
|
||||
hours += ii.Hours ?? 0;
|
||||
if (ii.UnitDescription == null || !ii.UnitDescription.StartsWith("GPos"))
|
||||
{
|
||||
ii.UnitDescription = "";
|
||||
}
|
||||
|
||||
// Einheit setzen
|
||||
ii.HourlyRateString = "Stunden";
|
||||
if (ii.ServiceDescription != null && ii.ServiceDescription.ToLower().Contains("hausbesuchpauschale"))
|
||||
{
|
||||
ii.HourlyRateString = "Anzahl";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.bindingSource1.DataSource = pRO;
|
||||
}
|
||||
}
|
||||
}
|
||||
123
ReportImp/ZukunftLeben/SoziotherapieRechnung.resx
Normal file
123
ReportImp/ZukunftLeben/SoziotherapieRechnung.resx
Normal file
File diff suppressed because one or more lines are too long
@@ -59,7 +59,9 @@
|
||||
<Compile Include="CustomReportCreator.cs" />
|
||||
<Compile Include="Export\CustomDataExporter.cs" />
|
||||
<Compile Include="Export\DatevExporter.cs" />
|
||||
<Compile Include="Invoicing\CustomInvoiceFactory.cs" />
|
||||
<Compile Include="Invoicing\SettlementInvoiceCreation.cs" />
|
||||
<Compile Include="Invoicing\SoziotherapieInvoiceCreation.cs" />
|
||||
<Compile Include="LeistungsnachweisSoziotherapie.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
@@ -90,6 +92,12 @@
|
||||
<Compile Include="SettlementReport2.Designer.cs">
|
||||
<DependentUpon>SettlementReport2.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="SoziotherapieRechnung.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SoziotherapieRechnung.Designer.cs">
|
||||
<DependentUpon>SoziotherapieRechnung.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Translation\TranslationDictionary.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -131,6 +139,10 @@
|
||||
<DependentUpon>SettlementReport2.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="SoziotherapieRechnung.resx">
|
||||
<DependentUpon>SoziotherapieRechnung.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
Reference in New Issue
Block a user