FeidPartnerReports/Statistics/CustomServiceRecordStatisticFactory und Invoicing - Umstellung auf Minuten und Einrichtung Abrechnung LWV

This commit is contained in:
2025-06-27 14:09:18 +02:00
parent 9f5d052fac
commit ee660c2c26
4 changed files with 100 additions and 37 deletions

View File

@@ -53,8 +53,8 @@ namespace FeidPartnerReports
this.xrTableCell42 = new DevExpress.XtraReports.UI.XRTableCell();
this.xrTableCell45 = new DevExpress.XtraReports.UI.XRTableCell();
this.xrTableCell51 = new DevExpress.XtraReports.UI.XRTableCell();
this.xrTableCell52 = new DevExpress.XtraReports.UI.XRTableCell();
this.xrTableCell53 = new DevExpress.XtraReports.UI.XRTableCell();
this.lblEPreis = new DevExpress.XtraReports.UI.XRTableCell();
this.lblAnzahl = new DevExpress.XtraReports.UI.XRTableCell();
this.xrTableCell54 = new DevExpress.XtraReports.UI.XRTableCell();
this.xrTableCell55 = new DevExpress.XtraReports.UI.XRTableCell();
this.ruleRateFactorNull = new DevExpress.XtraReports.UI.FormattingRule();
@@ -83,6 +83,7 @@ namespace FeidPartnerReports
this.xrTableCell29 = new DevExpress.XtraReports.UI.XRTableCell();
this.xrTableCell3 = new DevExpress.XtraReports.UI.XRTableCell();
this.xrTableCell31 = new DevExpress.XtraReports.UI.XRTableCell();
this.bindingSource1 = new System.Windows.Forms.BindingSource(this.components);
this.GroupHeader2 = new DevExpress.XtraReports.UI.GroupHeaderBand();
this.GroupFooter1 = new DevExpress.XtraReports.UI.GroupFooterBand();
this.xrTable5 = new DevExpress.XtraReports.UI.XRTable();
@@ -96,12 +97,11 @@ namespace FeidPartnerReports
this.xrPictureBox1 = new DevExpress.XtraReports.UI.XRPictureBox();
this.xrLabel8 = new DevExpress.XtraReports.UI.XRLabel();
this.xrLabel9 = new DevExpress.XtraReports.UI.XRLabel();
this.bindingSource1 = new System.Windows.Forms.BindingSource(this.components);
((System.ComponentModel.ISupportInitialize)(this.xrTable4)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.xrTable1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.xrTable2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.xrTable5)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.bindingSource1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.xrTable5)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this)).BeginInit();
//
// Detail
@@ -259,8 +259,8 @@ namespace FeidPartnerReports
this.xrTableCell42,
this.xrTableCell45,
this.xrTableCell51,
this.xrTableCell52,
this.xrTableCell53,
this.lblEPreis,
this.lblAnzahl,
this.xrTableCell54,
this.xrTableCell55});
this.xrTableRow7.Name = "xrTableRow7";
@@ -325,25 +325,25 @@ namespace FeidPartnerReports
this.xrTableCell51.Text = " pro Woche";
this.xrTableCell51.Weight = 0.23459246033900408D;
//
// xrTableCell52
// lblEPreis
//
this.xrTableCell52.Borders = ((DevExpress.XtraPrinting.BorderSide)((DevExpress.XtraPrinting.BorderSide.Left | DevExpress.XtraPrinting.BorderSide.Bottom)));
this.xrTableCell52.Font = new DevExpress.Drawing.DXFont("Calibri", 9F, DevExpress.Drawing.DXFontStyle.Bold);
this.xrTableCell52.Name = "xrTableCell52";
this.xrTableCell52.StylePriority.UseBorders = false;
this.xrTableCell52.StylePriority.UseFont = false;
this.xrTableCell52.Text = "Tage";
this.xrTableCell52.Weight = 0.22079291172385726D;
this.lblEPreis.Borders = ((DevExpress.XtraPrinting.BorderSide)((DevExpress.XtraPrinting.BorderSide.Left | DevExpress.XtraPrinting.BorderSide.Bottom)));
this.lblEPreis.Font = new DevExpress.Drawing.DXFont("Calibri", 9F, DevExpress.Drawing.DXFontStyle.Bold);
this.lblEPreis.Name = "lblEPreis";
this.lblEPreis.StylePriority.UseBorders = false;
this.lblEPreis.StylePriority.UseFont = false;
this.lblEPreis.Text = "Tage";
this.lblEPreis.Weight = 0.22079291172385726D;
//
// xrTableCell53
// lblAnzahl
//
this.xrTableCell53.Borders = ((DevExpress.XtraPrinting.BorderSide)((DevExpress.XtraPrinting.BorderSide.Left | DevExpress.XtraPrinting.BorderSide.Bottom)));
this.xrTableCell53.Font = new DevExpress.Drawing.DXFont("Calibri", 9F, DevExpress.Drawing.DXFontStyle.Bold);
this.xrTableCell53.Name = "xrTableCell53";
this.xrTableCell53.StylePriority.UseBorders = false;
this.xrTableCell53.StylePriority.UseFont = false;
this.xrTableCell53.Text = "Tage";
this.xrTableCell53.Weight = 0.22079290420700248D;
this.lblAnzahl.Borders = ((DevExpress.XtraPrinting.BorderSide)((DevExpress.XtraPrinting.BorderSide.Left | DevExpress.XtraPrinting.BorderSide.Bottom)));
this.lblAnzahl.Font = new DevExpress.Drawing.DXFont("Calibri", 9F, DevExpress.Drawing.DXFontStyle.Bold);
this.lblAnzahl.Name = "lblAnzahl";
this.lblAnzahl.StylePriority.UseBorders = false;
this.lblAnzahl.StylePriority.UseFont = false;
this.lblAnzahl.Text = "Tage";
this.lblAnzahl.Weight = 0.22079290420700248D;
//
// xrTableCell54
//
@@ -668,6 +668,10 @@ namespace FeidPartnerReports
this.xrTableCell31.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleRight;
this.xrTableCell31.Weight = 0.29773565063758856D;
//
// bindingSource1
//
this.bindingSource1.DataSource = typeof(BeWo.Report.ReportObjects.ServiceInvoiceRO);
//
// GroupHeader2
//
this.GroupHeader2.GroupFields.AddRange(new DevExpress.XtraReports.UI.GroupField[] {
@@ -813,10 +817,6 @@ namespace FeidPartnerReports
this.xrLabel9.StylePriority.UseFont = false;
this.xrLabel9.Text = "[InvoiceBase.InvoiceNumber]\r\n\r\n";
//
// bindingSource1
//
this.bindingSource1.DataSource = typeof(BeWo.Report.ReportObjects.ServiceInvoiceRO);
//
// SammelrechnungTab
//
this.Bands.AddRange(new DevExpress.XtraReports.UI.Band[] {
@@ -845,8 +845,8 @@ namespace FeidPartnerReports
((System.ComponentModel.ISupportInitialize)(this.xrTable4)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.xrTable1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.xrTable2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.xrTable5)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.bindingSource1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.xrTable5)).EndInit();
((System.ComponentModel.ISupportInitialize)(this)).EndInit();
}
@@ -912,8 +912,8 @@ namespace FeidPartnerReports
private DevExpress.XtraReports.UI.XRTableCell xrTableCell42;
private DevExpress.XtraReports.UI.XRTableCell xrTableCell45;
private DevExpress.XtraReports.UI.XRTableCell xrTableCell51;
private DevExpress.XtraReports.UI.XRTableCell xrTableCell52;
private DevExpress.XtraReports.UI.XRTableCell xrTableCell53;
private DevExpress.XtraReports.UI.XRTableCell lblEPreis;
private DevExpress.XtraReports.UI.XRTableCell lblAnzahl;
private DevExpress.XtraReports.UI.XRTableCell xrTableCell54;
private DevExpress.XtraReports.UI.XRTableCell xrTableCell55;
}

View File

@@ -17,17 +17,15 @@ namespace FeidPartnerReports
public void SetReportDataSource(ServiceInvoiceRO pRO)
{
pRO.RecipientOrganisation = "LWV Hessen";
if (pRO.RecipientOrganisation.Contains("67"))
{
lblAnzahl.Text = "Monat";
lblEPreis.Text = "Monat";
}
pRO.ServiceInvoicePeriods.Sort((a, b) => a.Customer.LastNameFirstName.CompareTo(b.Customer.LastNameFirstName));
foreach (var sip in pRO.ServiceInvoicePeriods)
{
if (sip.Customer.FirstName.ToLower().Contains("(ka)"))
{
sip.Customer.FirstName = sip.Customer.FirstName.Replace("(ka)", "").Trim();
sip.Customer.FirstName = sip.Customer.FirstName.Replace("(KA)", "").Trim();
}
sip.Customer.LastName = sip.Customer.LastName + ", " + sip.Customer.FirstName;
if (sip.Notice != null)
{

View File

@@ -63,13 +63,16 @@ namespace FeidPartnerReports.Invoicing
DateTime start = accountingPeriodStart.Value;
DateTime end = accountingPeriodEnd.Value;
bool teilmonat = false;
if (supportConceptApprovalPeriod.StartDate > start)
{
start = supportConceptApprovalPeriod.StartDate.Value;
teilmonat = true;
}
if (supportConceptApprovalPeriod.EndDate < end)
{
end = supportConceptApprovalPeriod.EndDate.Value;
teilmonat = true;
}
if (supportConceptApprovalPeriod.ServiceCategory != null)
@@ -83,6 +86,23 @@ namespace FeidPartnerReports.Invoicing
UnitCount = (decimal)(end - start).TotalDays + 1,
Notice = "keine Minuten"
};
if (supportConceptApprovalPeriod.ServiceCategory.Name.Contains("Bedarfsgruppe"))
{
ii.AccountingInterval = AccountingIntervalType.Monthly;
ii.ItemDescription = supportConceptApprovalPeriod.ServiceCategory.Name;
ii.UnitCount = 1;
ii.AmountPerUnit = (decimal)Math.Round((double)data[0].AmountTotal, 2, MidpointRounding.AwayFromZero);
if (teilmonat)
{
var days = (double)(end - start).TotalDays + 1;
ii.AmountPerUnit = (decimal)Math.Round((double)data[0].AmountTotal / 30.42 * days, 2, MidpointRounding.AwayFromZero);
}
ii.AmountTotal = ii.AmountPerUnit;
ii.GrossAmountTotal = ii.AmountTotal;
ii.Notice = "";
serviceInvoicePeriod.InvoiceItemList.Add(ii);
return;
}
if (supportConceptApprovalPeriod.ApprovedBEPerInterval.HasValue)
{
ii.Notice = String.Format("{0:n0}", supportConceptApprovalPeriod.ApprovedBEPerInterval.Value);

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using BeWo.Data.Access;
using BeWo.Data.Entities;
using BeWo.Service.DCEntityMapper;
using BeWo.Service.Plugins;
@@ -17,8 +18,13 @@ namespace FeidPartnerReports.Statistics
public override SupportConceptStatisticsDC CreateSupportConceptStatisticsImpl(long costBearer2SupportConceptOid, DateTime statisticsDate, long? ignoreServiceRecordOid)
{
var stat = base.CreateSupportConceptStatisticsImpl(costBearer2SupportConceptOid, statisticsDate, null);
// Fahrtzeiten nicht in Ministatistik nur für Abrechnung
stat.PeriodStatistics = stat.PeriodStatistics.Where(p => p.SupportConceptApprovalPeriod.ServiceCategory == null || String.IsNullOrEmpty(p.SupportConceptApprovalPeriod.ServiceCategory.Abbreviation) ||
!p.SupportConceptApprovalPeriod.ServiceCategory.Abbreviation.Contains("FZQA")).ToList();
foreach (var item in stat.PeriodStatistics)
var cb2sc = DAOFactory.GenericDAO.LoadByID<CostBearer2SupportConcept>(costBearer2SupportConceptOid);
foreach (var item in stat.PeriodStatistics)
{
DateTime start = item.SupportConceptApprovalPeriod.StartDate ?? DateTime.MinValue;
DateTime end = item.SupportConceptApprovalPeriod.EndDate ?? DateTime.MaxValue;
@@ -70,10 +76,49 @@ namespace FeidPartnerReports.Statistics
}
start = start.AddDays(7);
}
if (!cb2sc.CostBearer.Organisation.Name.ToLower().Contains("alt"))
{
item.MinutesApprovedTotal /= 60;
}
SetMinutesFreePerWeek(stat, item);
}
return stat;
}
private void SetMinutesFreePerWeek(SupportConceptStatisticsDC stat, SupportConceptPeriodStatisticsDC ps)
{
DateTime dtPeriod = stat.DateOfCreation.Date;
if (ps.SupportConceptApprovalPeriod.StartDate.HasValue && ps.SupportConceptApprovalPeriod.EndDate.HasValue)
{
if (ps.SupportConceptApprovalPeriod.StartDate.HasValue && ps.SupportConceptApprovalPeriod.StartDate > dtPeriod)
{
dtPeriod = ps.SupportConceptApprovalPeriod.StartDate.Value;
}
TimeSpan tsPeriod = ps.SupportConceptApprovalPeriod.EndDate.Value.Subtract(dtPeriod);
int daysPeriod = tsPeriod.Days + 1;
if (daysPeriod < 0)
{
daysPeriod = 0;
}
if (daysPeriod != 0)
{
ps.MinutesFreePerWeek = (ps.MinutesApprovedTotal - ps.MinutesProvidedTotalRounded) / (daysPeriod / 7m);
ps.MinutesFreePerWeekStatisticDate = (ps.MinutesApprovedTotal - ps.IstTotalUntilThisMonth - ps.MinutesProvidedThisMonth) / (daysPeriod / 7m);
ps.MinutesFreePerMonth = (ps.MinutesApprovedTotal - ps.MinutesProvidedTotalRounded) / (daysPeriod / 7m) * (365m / 84m);
ps.MinutesFreePerMonthStatisticDate = (ps.MinutesApprovedTotal - ps.IstTotalUntilThisMonth - ps.MinutesProvidedThisMonth) / (daysPeriod / 7m) * (365m / 84m);
}
else // Bewilligung ist abgelaufen
{
ps.MinutesFreePerWeek = ps.MinutesApprovedTotal - ps.MinutesProvidedTotalRounded;
ps.MinutesFreePerWeekStatisticDate = ps.MinutesApprovedTotal - ps.MinutesProvidedTotalRounded;
ps.MinutesFreePerMonth = ps.MinutesApprovedTotal - ps.MinutesProvidedTotalRounded;
ps.MinutesFreePerMonthStatisticDate = ps.MinutesApprovedTotal - ps.MinutesProvidedTotalRounded;
}
}
}
protected override IEnumerable<ServiceRecord> GetServiceRecordsForStatistic(long costBearer2SupportConceptOid)
{
var allServiceRecords = base.GetServiceRecordsForStatistic(costBearer2SupportConceptOid);