LyvieKupfer/Invoicing - Umstellung auf inkludierten Faktor pro Stunde -> Abrechnung in 45 Min Intervallen

This commit is contained in:
2026-03-20 12:53:10 +01:00
parent 5809b12d3d
commit b37b9ae9ce
5 changed files with 131 additions and 65 deletions

View File

@@ -30,6 +30,40 @@ namespace LyvieKupfer.Invoicing
}
return ii;
}
public override void BerechneSummaryItemsSummen(List<InvoiceItem> newlist, bool addRateFactorToUnitCount)
{
// Rundung nach Stundenzahl * Faktor plus die OriginalStunden ohne Faktor nachher wieder ausgewiesen!
foreach (InvoiceItem invoiceItem in newlist)
{
if (!invoiceItem.AmountPerUnit.HasValue)
{
invoiceItem.AmountPerUnit = 0;
}
invoiceItem.AmountPerUnit = Math.Round(invoiceItem.AmountPerUnit.Value, 2, MidpointRounding.AwayFromZero);
if (!invoiceItem.UnitCount.HasValue)
{
invoiceItem.UnitCount = 0;
}
var UnitOld = invoiceItem.UnitCount;
if (invoiceItem.RateFactor.HasValue)
{
invoiceItem.UnitCount = (invoiceItem.UnitCount ?? 0) * ((invoiceItem.RateFactor + 100) / 100);
}
invoiceItem.UnitCount = Math.Round(invoiceItem.UnitCount.Value, 2, MidpointRounding.AwayFromZero);
invoiceItem.AmountTotal = invoiceItem.AmountPerUnit * invoiceItem.UnitCount;
invoiceItem.AmountTotal = Math.Round(invoiceItem.AmountTotal.Value, 2, MidpointRounding.AwayFromZero);
invoiceItem.UnitCount = Math.Round(UnitOld.Value, 2, MidpointRounding.AwayFromZero);
invoiceItem.GrossAmountTotal = invoiceItem.AmountTotal;
}
}
public override string GetSummaryItemKey(SupportConceptApprovalPeriod scap, InvoiceItem iitem, bool summaryPerMonth)
{
String key = String.Format("{0:0.0000}_{1}_{2}", iitem.AmountPerUnit, iitem.RateFactor, iitem.ItemDescription);

View File

@@ -30,6 +30,7 @@ namespace LyvieKupfer
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
DevExpress.XtraReports.UI.XRSummary xrSummary2 = new DevExpress.XtraReports.UI.XRSummary();
DevExpress.XtraReports.UI.XRSummary xrSummary1 = new DevExpress.XtraReports.UI.XRSummary();
DevExpress.XtraReports.UI.XRWatermark xrWatermark1 = new DevExpress.XtraReports.UI.XRWatermark();
this.Detail = new DevExpress.XtraReports.UI.DetailBand();
@@ -54,6 +55,7 @@ namespace LyvieKupfer
this.xrTableCell7 = new DevExpress.XtraReports.UI.XRTableCell();
this.xrTableCell43 = new DevExpress.XtraReports.UI.XRTableCell();
this.xrTableCell49 = new DevExpress.XtraReports.UI.XRTableCell();
this.bindingSource1 = new System.Windows.Forms.BindingSource(this.components);
this.formattingRuleStartDate = new DevExpress.XtraReports.UI.FormattingRule();
this.ReportHeader = new DevExpress.XtraReports.UI.ReportHeaderBand();
this.xrLabel7 = new DevExpress.XtraReports.UI.XRLabel();
@@ -74,8 +76,10 @@ namespace LyvieKupfer
this.xrPictureBox1 = new DevExpress.XtraReports.UI.XRPictureBox();
this.xrLabel17 = new DevExpress.XtraReports.UI.XRLabel();
this.fieldKontaktArt = new DevExpress.XtraReports.UI.CalculatedField();
this.bindingSource1 = new System.Windows.Forms.BindingSource(this.components);
this.fieldHours = new DevExpress.XtraReports.UI.CalculatedField();
this.xrLabel3 = new DevExpress.XtraReports.UI.XRLabel();
this.xrLabel5 = new DevExpress.XtraReports.UI.XRLabel();
this.xrLabel9 = new DevExpress.XtraReports.UI.XRLabel();
((System.ComponentModel.ISupportInitialize)(this.xrTable3)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.xrTableServiceRecords1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.bindingSource1)).BeginInit();
@@ -353,6 +357,10 @@ namespace LyvieKupfer
this.xrTableCell49.TextAlignment = DevExpress.XtraPrinting.TextAlignment.TopCenter;
this.xrTableCell49.Weight = 0.44692737430167606D;
//
// bindingSource1
//
this.bindingSource1.DataSource = typeof(BeWo.Report.ReportObjects.ServicesOverviewRO);
//
// formattingRuleStartDate
//
this.formattingRuleStartDate.Condition = "[StartDate2] < [StartDate]";
@@ -512,6 +520,9 @@ namespace LyvieKupfer
// GroupFooter1
//
this.GroupFooter1.Controls.AddRange(new DevExpress.XtraReports.UI.XRControl[] {
this.xrLabel9,
this.xrLabel3,
this.xrLabel5,
this.lblUnterschriftMitarbeiter,
this.xrLabel12,
this.xrLabel1,
@@ -568,8 +579,8 @@ namespace LyvieKupfer
this.xrLabel1.StylePriority.UseFont = false;
this.xrLabel1.StylePriority.UsePadding = false;
this.xrLabel1.StylePriority.UseTextAlignment = false;
xrSummary1.FormatString = "{0:0.##}";
this.xrLabel1.Summary = xrSummary1;
xrSummary2.FormatString = "{0:0.##}";
this.xrLabel1.Summary = xrSummary2;
this.xrLabel1.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter;
//
// xrPictureBox1
@@ -604,16 +615,62 @@ namespace LyvieKupfer
this.fieldKontaktArt.FieldType = DevExpress.XtraReports.UI.FieldType.String;
this.fieldKontaktArt.Name = "fieldKontaktArt";
//
// bindingSource1
//
this.bindingSource1.DataSource = typeof(BeWo.Report.ReportObjects.ServicesOverviewRO);
//
// fieldHours
//
this.fieldHours.DataMember = "Services";
this.fieldHours.Expression = "Round([Minutes]/60,2)";
this.fieldHours.Name = "fieldHours";
//
// xrLabel3
//
this.xrLabel3.Font = new DevExpress.Drawing.DXFont("Calibri", 14F, DevExpress.Drawing.DXFontStyle.Bold);
this.xrLabel3.LocationFloat = new DevExpress.Utils.PointFloat(0F, 20.00001F);
this.xrLabel3.Name = "xrLabel3";
this.xrLabel3.Padding = new DevExpress.XtraPrinting.PaddingInfo(3, 2, 0, 0, 100F);
this.xrLabel3.SizeF = new System.Drawing.SizeF(109.1769F, 20F);
this.xrLabel3.StylePriority.UseBackColor = false;
this.xrLabel3.StylePriority.UseBorders = false;
this.xrLabel3.StylePriority.UseFont = false;
this.xrLabel3.StylePriority.UsePadding = false;
this.xrLabel3.StylePriority.UseTextAlignment = false;
this.xrLabel3.Text = "Insgesamt:";
this.xrLabel3.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft;
//
// xrLabel5
//
this.xrLabel5.BackColor = System.Drawing.Color.Transparent;
this.xrLabel5.Borders = DevExpress.XtraPrinting.BorderSide.None;
this.xrLabel5.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] {
new DevExpress.XtraReports.UI.XRBinding("Text", null, "TotalFLSString")});
this.xrLabel5.Font = new DevExpress.Drawing.DXFont("calibri", 14F);
this.xrLabel5.LocationFloat = new DevExpress.Utils.PointFloat(109.177F, 20.00001F);
this.xrLabel5.Name = "xrLabel5";
this.xrLabel5.Padding = new DevExpress.XtraPrinting.PaddingInfo(3, 2, 0, 0, 100F);
this.xrLabel5.SizeF = new System.Drawing.SizeF(126.4151F, 20F);
this.xrLabel5.StylePriority.UseBackColor = false;
this.xrLabel5.StylePriority.UseBorders = false;
this.xrLabel5.StylePriority.UseFont = false;
this.xrLabel5.StylePriority.UsePadding = false;
this.xrLabel5.StylePriority.UseTextAlignment = false;
xrSummary1.FormatString = "{0:0.##}";
this.xrLabel5.Summary = xrSummary1;
this.xrLabel5.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter;
//
// xrLabel9
//
this.xrLabel9.Font = new DevExpress.Drawing.DXFont("Calibri", 14F, DevExpress.Drawing.DXFontStyle.Bold);
this.xrLabel9.LocationFloat = new DevExpress.Utils.PointFloat(235.5921F, 20.00008F);
this.xrLabel9.Name = "xrLabel9";
this.xrLabel9.Padding = new DevExpress.XtraPrinting.PaddingInfo(3, 2, 0, 0, 100F);
this.xrLabel9.SizeF = new System.Drawing.SizeF(339.0233F, 20F);
this.xrLabel9.StylePriority.UseBackColor = false;
this.xrLabel9.StylePriority.UseBorders = false;
this.xrLabel9.StylePriority.UseFont = false;
this.xrLabel9.StylePriority.UsePadding = false;
this.xrLabel9.StylePriority.UseTextAlignment = false;
this.xrLabel9.Text = "Fördereinheiten à 45 Min";
this.xrLabel9.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft;
//
// Quittierungsbeleg
//
this.Bands.AddRange(new DevExpress.XtraReports.UI.Band[] {
@@ -693,5 +750,8 @@ namespace LyvieKupfer
private DevExpress.XtraReports.UI.XRLabel xrLabel17;
private DevExpress.XtraReports.UI.XRLabel xrLabel24;
private DevExpress.XtraReports.UI.CalculatedField fieldHours;
private DevExpress.XtraReports.UI.XRLabel xrLabel9;
private DevExpress.XtraReports.UI.XRLabel xrLabel3;
private DevExpress.XtraReports.UI.XRLabel xrLabel5;
}
}

View File

@@ -22,17 +22,23 @@ namespace LyvieKupfer
if (pRO.Services != null)
{
List<ServicesOverviewRO.ServiceDetail> servicesBillable = new List<ServicesOverviewRO.ServiceDetail>();
// die rechnen in Fördereinheiten aka 45 Minuten ab
decimal rateFactor = 1.3333m;
decimal einheiten = 0;
pRO.TotalFLSString = "0,00";
foreach (var sd in pRO.Services)
{
if (sd.IsBillable || sd.ServiceDescription.ToLower().Contains("fehlkontakt") || sd.ServiceCategory.ToLower().Contains("fehlkontakt"))
{
ServicesOverviewRO.CreateSignatureString(sd);
//einheiten += Math.Round(Math.Round((decimal)sd.Minutes / 60, 2, MidpointRounding.AwayFromZero) * rateFactor, 2, MidpointRounding.AwayFromZero);
servicesBillable.Add(sd);
}
}
pRO.Services = servicesBillable;
pRO.TotalFLSString = Math.Round((decimal)pRO.TotalFLS * rateFactor, 2, MidpointRounding.AwayFromZero).ToString();
pRO.TotalFLS = Math.Round(pRO.TotalFLS, 2, MidpointRounding.AwayFromZero);
}
bindingSource1.DataSource = pRO;
}

View File

@@ -61,6 +61,7 @@ namespace LyvieKupfer
this.xrTableCell44 = new DevExpress.XtraReports.UI.XRTableCell();
this.xrTableCell47 = new DevExpress.XtraReports.UI.XRTableCell();
this.GroupFooter1 = new DevExpress.XtraReports.UI.GroupFooterBand();
this.bindingSource1 = new System.Windows.Forms.BindingSource(this.components);
this.ReportFooter1 = new DevExpress.XtraReports.UI.ReportFooterBand();
this.xrLabel5 = new DevExpress.XtraReports.UI.XRLabel();
this.xrLabel3 = new DevExpress.XtraReports.UI.XRLabel();
@@ -77,15 +78,12 @@ namespace LyvieKupfer
this.xrTableCell12 = new DevExpress.XtraReports.UI.XRTableCell();
this.xrLabel14 = new DevExpress.XtraReports.UI.XRLabel();
this.xrLabel15 = new DevExpress.XtraReports.UI.XRLabel();
this.xrTableCell2 = new DevExpress.XtraReports.UI.XRTableCell();
this.xrTableCell3 = new DevExpress.XtraReports.UI.XRTableCell();
this.bindingSource1 = new System.Windows.Forms.BindingSource(this.components);
((System.ComponentModel.ISupportInitialize)(this.xrTable5)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.xrTable6)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.bindingSource1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.xrRichText1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.xrTable1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.xrTable4)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.bindingSource1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this)).BeginInit();
//
// Detail
@@ -166,7 +164,6 @@ namespace LyvieKupfer
this.xrTableRow23.Cells.AddRange(new DevExpress.XtraReports.UI.XRTableCell[] {
this.xrTableCell37,
this.xrTableCell35,
this.xrTableCell2,
this.xrTableCell33,
this.xrTableCell34});
this.xrTableRow23.Name = "xrTableRow23";
@@ -186,7 +183,7 @@ namespace LyvieKupfer
this.xrTableCell37.StylePriority.UseTextAlignment = false;
this.xrTableCell37.Text = "Bezeichnung";
this.xrTableCell37.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft;
this.xrTableCell37.Weight = 0.72819469145801552D;
this.xrTableCell37.Weight = 0.86319851515530477D;
//
// xrTableCell35
//
@@ -202,7 +199,7 @@ namespace LyvieKupfer
this.xrTableCell35.StylePriority.UseTextAlignment = false;
this.xrTableCell35.Text = "Menge";
this.xrTableCell35.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft;
this.xrTableCell35.Weight = 0.35507710147359051D;
this.xrTableCell35.Weight = 0.301115769776447D;
//
// xrTableCell33
//
@@ -218,7 +215,7 @@ namespace LyvieKupfer
this.xrTableCell33.StylePriority.UseTextAlignment = false;
this.xrTableCell33.Text = "Preis";
this.xrTableCell33.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleRight;
this.xrTableCell33.Weight = 0.4680052126781819D;
this.xrTableCell33.Weight = 0.38696272067803616D;
//
// xrTableCell34
//
@@ -361,7 +358,7 @@ namespace LyvieKupfer
this.xrTable6.Name = "xrTable6";
this.xrTable6.Rows.AddRange(new DevExpress.XtraReports.UI.XRTableRow[] {
this.xrTableRow25});
this.xrTable6.SizeF = new System.Drawing.SizeF(682F, 25F);
this.xrTable6.SizeF = new System.Drawing.SizeF(676.8331F, 25F);
this.xrTable6.StylePriority.UseFont = false;
//
// xrTableRow25
@@ -369,7 +366,6 @@ namespace LyvieKupfer
this.xrTableRow25.Cells.AddRange(new DevExpress.XtraReports.UI.XRTableCell[] {
this.xrTableCell42,
this.xrTableCell43,
this.xrTableCell3,
this.xrTableCell44,
this.xrTableCell47});
this.xrTableRow25.Name = "xrTableRow25";
@@ -388,14 +384,14 @@ namespace LyvieKupfer
this.xrTableCell42.StylePriority.UsePadding = false;
this.xrTableCell42.StylePriority.UseTextAlignment = false;
this.xrTableCell42.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft;
this.xrTableCell42.Weight = 0.72819464305594106D;
this.xrTableCell42.Weight = 1.0033335986556629D;
//
// xrTableCell43
//
this.xrTableCell43.BorderColor = System.Drawing.Color.DarkGray;
this.xrTableCell43.Borders = DevExpress.XtraPrinting.BorderSide.None;
this.xrTableCell43.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] {
new DevExpress.XtraReports.UI.XRBinding("Text", null, "ServiceInvoicePeriods.ServiceInvoiceItems.Hours")});
new DevExpress.XtraReports.UI.XRBinding("Text", null, "ServiceInvoicePeriods.ServiceInvoiceItems.UnitCountString")});
this.xrTableCell43.Name = "xrTableCell43";
this.xrTableCell43.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 2, 2, 100F);
this.xrTableCell43.StylePriority.UseBorderColor = false;
@@ -404,7 +400,7 @@ namespace LyvieKupfer
this.xrTableCell43.StylePriority.UseTextAlignment = false;
this.xrTableCell43.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft;
this.xrTableCell43.TextFormatString = "{0:0.##}";
this.xrTableCell43.Weight = 0.3550770822591699D;
this.xrTableCell43.Weight = 0.35000020044464281D;
//
// xrTableCell44
//
@@ -420,7 +416,7 @@ namespace LyvieKupfer
this.xrTableCell44.StylePriority.UseTextAlignment = false;
this.xrTableCell44.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleRight;
this.xrTableCell44.TextFormatString = "{0:0.00}";
this.xrTableCell44.Weight = 0.46800513529124477D;
this.xrTableCell44.Weight = 0.43612307970333575D;
//
// xrTableCell47
//
@@ -435,13 +431,17 @@ namespace LyvieKupfer
this.xrTableCell47.StylePriority.UsePadding = false;
this.xrTableCell47.StylePriority.UseTextAlignment = false;
this.xrTableCell47.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleRight;
this.xrTableCell47.Weight = 0.63978025562616325D;
this.xrTableCell47.Weight = 0.73738753967253867D;
//
// GroupFooter1
//
this.GroupFooter1.HeightF = 0F;
this.GroupFooter1.Name = "GroupFooter1";
//
// bindingSource1
//
this.bindingSource1.DataSource = typeof(BeWo.Report.ReportObjects.ServiceInvoiceRO);
//
// ReportFooter1
//
this.ReportFooter1.Controls.AddRange(new DevExpress.XtraReports.UI.XRControl[] {
@@ -614,43 +614,6 @@ namespace LyvieKupfer
this.xrLabel15.StylePriority.UseFont = false;
this.xrLabel15.Text = "Zahlbar nach Erhalt der Rechnung.\r\n\r\nIch bedanke mich für das Vertrauen und freue" +
" mich auf die weitere Zusammenarbeit.";
//
// xrTableCell2
//
this.xrTableCell2.BackColor = System.Drawing.Color.Transparent;
this.xrTableCell2.BorderColor = System.Drawing.Color.Black;
this.xrTableCell2.Borders = DevExpress.XtraPrinting.BorderSide.Bottom;
this.xrTableCell2.Multiline = true;
this.xrTableCell2.Name = "xrTableCell2";
this.xrTableCell2.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 2, 2, 100F);
this.xrTableCell2.StylePriority.UseBackColor = false;
this.xrTableCell2.StylePriority.UseBorderColor = false;
this.xrTableCell2.StylePriority.UseBorders = false;
this.xrTableCell2.StylePriority.UsePadding = false;
this.xrTableCell2.StylePriority.UseTextAlignment = false;
this.xrTableCell2.Text = "Faktor";
this.xrTableCell2.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft;
this.xrTableCell2.Weight = 0.35507710147359051D;
//
// xrTableCell3
//
this.xrTableCell3.BorderColor = System.Drawing.Color.DarkGray;
this.xrTableCell3.Borders = DevExpress.XtraPrinting.BorderSide.None;
this.xrTableCell3.DataBindings.AddRange(new DevExpress.XtraReports.UI.XRBinding[] {
new DevExpress.XtraReports.UI.XRBinding("Text", null, "ServiceInvoicePeriods.ServiceInvoiceItems.RateFactor")});
this.xrTableCell3.Multiline = true;
this.xrTableCell3.Name = "xrTableCell3";
this.xrTableCell3.Padding = new DevExpress.XtraPrinting.PaddingInfo(2, 2, 2, 2, 100F);
this.xrTableCell3.StylePriority.UseBorderColor = false;
this.xrTableCell3.StylePriority.UseBorders = false;
this.xrTableCell3.StylePriority.UsePadding = false;
this.xrTableCell3.StylePriority.UseTextAlignment = false;
this.xrTableCell3.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft;
this.xrTableCell3.Weight = 0.3550770822591699D;
//
// bindingSource1
//
this.bindingSource1.DataSource = typeof(BeWo.Report.ReportObjects.ServiceInvoiceRO);
//
// ServiceInvoiceReport
//
@@ -676,10 +639,10 @@ namespace LyvieKupfer
this.Watermarks.Add(xrWatermark1);
((System.ComponentModel.ISupportInitialize)(this.xrTable5)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.xrTable6)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.bindingSource1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.xrRichText1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.xrTable1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.xrTable4)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.bindingSource1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this)).EndInit();
}
@@ -732,7 +695,5 @@ namespace LyvieKupfer
private DevExpress.XtraReports.UI.XRTableCell xrTableCell12;
private DevExpress.XtraReports.UI.XRLabel xrLabel14;
private DevExpress.XtraReports.UI.XRLabel xrLabel15;
private DevExpress.XtraReports.UI.XRTableCell xrTableCell2;
private DevExpress.XtraReports.UI.XRTableCell xrTableCell3;
}
}

View File

@@ -16,9 +16,11 @@ namespace LyvieKupfer
public void SetReportDataSource(ServiceInvoiceRO pRO)
{
DateTime start = pRO.AccountingPeriodStart;
// die rechnen in Fördereinheiten aka 45 Minuten ab
DateTime start = pRO.AccountingPeriodStart;
DateTime end = pRO.AccountingPeriodEnd;
decimal hours = 0;
decimal rateFactor = 1.3333m;
if (pRO.ServiceInvoicePeriods != null)
{
@@ -28,7 +30,10 @@ namespace LyvieKupfer
{
foreach (var ii in sip.ServiceInvoiceItems)
{
hours += ii.Hours.Value;
var u = ii.Hours ?? 0;
u *= rateFactor;
ii.UnitCountString = Math.Round(u, 2, MidpointRounding.AwayFromZero).ToString();
hours += u;
}
}
}