From dec7d82479a3455927d4bdb9705ca3c9ff4312ba Mon Sep 17 00:00:00 2001 From: Alexandra Date: Mon, 27 Oct 2025 10:34:42 +0100 Subject: [PATCH 1/5] TwgJonathan/Export/ConturaExporter - Mehr Spalten u Mietzahlungsexport --- .../TwgJonathan/Export/ConturaExporter.cs | 169 +++++++++++++----- 1 file changed, 128 insertions(+), 41 deletions(-) diff --git a/ReportImp/TwgJonathan/Export/ConturaExporter.cs b/ReportImp/TwgJonathan/Export/ConturaExporter.cs index 039bf8588..14bfa7c9b 100644 --- a/ReportImp/TwgJonathan/Export/ConturaExporter.cs +++ b/ReportImp/TwgJonathan/Export/ConturaExporter.cs @@ -11,7 +11,7 @@ namespace TwgJonathan.Export { public class ConturaExporter { - + public static int count = 1; public static QueryDC CreateQuery(QueryDC query) { DateTime dt = DateTime.Now; @@ -35,15 +35,20 @@ namespace TwgJonathan.Export public static String GetAbrechnungenString(DateTime date) { StringBuilder sb = new StringBuilder(); - sb.AppendLine("AnwenderNr;TeilnNr;Wirtschaftsjahr;Wirtschaftsmonat;Buchungssatz;ErfaBuchhnr;ErfaBetrag;FibuBelegNr;BelegDatum;FKontoNr;FGKontoNr;KstKtr;Buchungstext"); - + sb.AppendLine("AnwenderNr;TeilnNr;Wirtschaftsjahr;Wirtschaftsmonat;WirtJahrBeginn;Benutzer;ErfaQuelle;Bezeichnung;Buchungssatz;Umsatzart;ErfaBuchhnr;VerrBuchhNr;ErfaBetrag;ErfaWaehrung;Steuerschl;" + + "FibuBelegNr;BelegDatum;Faelligkeit;OPBelegNr;OPBelegNr2;LieferBelegNr;FKontoNr;UKontoNr;FGKontoNr;GUKontoNr;KstKtr;LeistKst;Buchungstext;VerteilGruppeK;VerteilGruppeG;Mischfall;AufteilProz;" + + "Umkehrung;Zahlungsart;Bankleitzahl;BankkontoNr;SkontoTage;AusnahmeSkonto;FKontoNrRechnEmpf;UKontoNrRechnEmpf;FKontoNrBetreuter;UKontoNrBetreuter;Aktenzeichen;Unterbringung;Leistungdatum;Geburtsdatum;" + + "Ungesichert;VersichertenNr;Lieferscheinnr;Projektnr1;ProjektNrA;Projektnr2;ProjektNrB;Projektnr3;ProjektNrC;Verwzweck1;BankNr;WMonatVonAbgr;WMonatBisAbgr;OPBelegNrK;OPBelegNrG;LieferKundenNr;" + + "Skontofaelligkeit;Name1;Name2;Name3;Strasse;PLZ;Ort;ScanID"); var s = GetMonatlicheRechnungenString(date); if (!String.IsNullOrWhiteSpace(s)) { sb.Append(s); } - //if (sb.Length > 0) - // sb.AppendLine(); + if (sb.Length > 0) + { + sb.AppendLine(); + } //s = GetAbschlagszahlungenString(date); //if (!String.IsNullOrWhiteSpace(s)) @@ -53,11 +58,11 @@ namespace TwgJonathan.Export //if (sb.Length > 0) // sb.AppendLine(); - //s = GetSelbstzahlerString(date); - //if (!String.IsNullOrWhiteSpace(s)) - //{ - // sb.Append(s); - //} + s = GetMietzahlungenString(date); + if (!String.IsNullOrWhiteSpace(s)) + { + sb.Append(s); + } return sb.ToString(); } @@ -65,21 +70,6 @@ namespace TwgJonathan.Export public static String GetMonatlicheRechnungenString(DateTime date) { var dt = ExecuteQuery(GetMonatlicheRechnungenSql(date), date); - - //int idx = Int32.MaxValue; - //foreach (DataRow row in dt.Rows) - //{ - // var item = row[2]; - // if ((int)item < idx) - // { - // idx = (int)item; - // } - //} - - //if (idx == Int32.MaxValue) - //{ - // idx = 1; - //} int idx = 1; StringBuilder sb = new StringBuilder(); foreach (DataRow row in dt.Rows) @@ -93,34 +83,91 @@ namespace TwgJonathan.Export sb.Append(String.Format("{0:yyyy}", date)); // Wirtschaftsjahr sb.Append(";"); sb.Append(String.Format("{0:0}", date.Month)); // Wirtschaftsmonat - sb.Append(";1;"); //Buchungssatz - sb.Append(String.Format("{0:0}", idx++)); //ErfaBuchhnr - sb.Append(";"); + sb.Append(";;;;;1;;"); //Buchungssatz + _ = sb.Append(String.Format("{0:0}", idx++)); //ErfaBuchhnr + sb.Append(";;"); sb.Append(String.Format("{0:0.00}", row[0])); // ErfaBetrag - sb.Append(";"); + sb.Append(";;;"); sb.Append(String.Format("{0}", row[2])); // FibuBelegNr sb.Append(";"); sb.Append(String.Format("{0:dd.MM.yyyy}", row[3])); // Belegdatum - sb.Append(";"); + sb.Append(";;;;;"); sb.Append(String.Format("{0}", row[4])); // FKontoNr (Debitor) - sb.Append(";"); + sb.Append(";;"); sb.Append(String.Format("{0}", row[1])); // FGKontoNr - sb.Append(";6300;"); // Kostenstelle + sb.Append(";;6300;;"); // Kostenstelle String buchungstext = ""; - long? c2sOid = (long?)row[6]; - - if (c2sOid.HasValue) + if (row[8] != null && row[8].ToString() == "Allgemeine Rechnung") { - var c2s = DAOFactory.GenericDAO.LoadByID(c2sOid.Value); - var c = c2s.SupportConcept.Customer; - buchungstext = String.Format("{0} {1} {2:0.00}/{3}", c.Person.LastName, c.Person.FirstName, date.Month, date.Year); - buchungstext = buchungstext.Replace(";", ","); + buchungstext = row[8].ToString(); + } + else + { + long? c2sOid = (long?)row[6]; + + if (c2sOid.HasValue) + { + var c2s = DAOFactory.GenericDAO.LoadByID(c2sOid.Value); + var c = c2s.SupportConcept.Customer; + buchungstext = String.Format("{0} {1} {2:MM}/{3}", c.Person.LastName, c.Person.FirstName, date, date.Year); + buchungstext = buchungstext.Replace(";", ","); + } } sb.Append(buchungstext); + sb.Append(";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"); // Leerspalten + } + count = idx; + + return sb.ToString(); + } + + private static string GetMietzahlungenString(DateTime date) + { + /* Round(scap.ApprovedFixedAmount, 2) AS 'Miete', + '40126' AS 'Gegenkonto', + '123456' AS InvoiceNumber, + cust.CostCenter, + cust.DebitorNumber, + CONCAT(p.LastName, ', ', p.FirstName) AS KlientName */ + var dt = ExecuteQuery(GetMonatlicheMietenSql(date), date); + int idx = count; + StringBuilder sb = new StringBuilder(); + foreach (DataRow row in dt.Rows) + { + if (sb.Length > 0) + { + sb.AppendLine(); + } + sb.Append("172265000;172265;"); // Anwender Nr.;TeilNr + sb.Append(String.Format("{0:yyyy}", date)); // Wirtschaftsjahr + sb.Append(";"); + sb.Append(String.Format("{0:0}", date.Month)); // Wirtschaftsmonat + sb.Append(";;;;;1;;"); //Buchungssatz + sb.Append(String.Format("{0:0}", idx)); //ErfaBuchhnr + sb.Append(";;"); + sb.Append(String.Format("{0:0.00}", row[0])); // ErfaBetrag + sb.Append(";;;"); + sb.Append(String.Format("{0}", idx++)); // FibuBelegNr + sb.Append(";"); + sb.Append(String.Format("{0:dd.MM.yyyy}", date)); // Belegdatum + sb.Append(";;;;;"); + sb.Append(String.Format("{0}", row[3])); // FKontoNr (Debitor) Debitor für Miete ist in Kostenstelle, da abweicht + sb.Append(";;"); + sb.Append(String.Format("{0}", row[1])); // FGKontoNr + sb.Append(";;6300;;"); // Kostenstelle + String buchungstext = ""; + if (row[5] != null) + { + buchungstext = row[5].ToString(); + buchungstext = String.Format("{0} {1:MM}/{2}", row[5], date, date.Year); + //buchungstext = buchungstext.Replace(";", ","); + } + sb.Append(buchungstext); + sb.Append(";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"); // Leerspalten } return sb.ToString(); - } + } private static String GetMonatlicheRechnungenSql(DateTime date) { @@ -148,8 +195,48 @@ namespace TwgJonathan.Export inner join invoicebase ib on ib.costbearer2supportconceptoid = c2s.oid inner join serviceinvoice si on si.invoicebaseoid = ib.oid inner join serviceinvoiceperiod sip on sip.serviceinvoiceoid = si.oid + WHERE ib.`AccountingPeriodEnd` >= ':Monat_Start' AND ib.`AccountingPeriodEnd` < ':Monat_End' and ib.IsActive = 1 AND ib.`IsExported` = 0 + UNION + SELECT DISTINCT + (select sum(ii.AmountTotal) from invoiceitem ii where ii.invoicebaseoid = ib.oid), + '40125' as 'Gegenkonto', + ib.invoicenumber, + ib.InvoiceDate, + '113999', + '6300', + ib.Oid, + ib.InvoiceId, + 'Allgemeine Rechnung' + from invoicebase ib + inner join organisation org on org.costbeareroid = ib.RecipientOrganisationOid WHERE ib.`AccountingPeriodEnd` >= ':Monat_Start' AND ib.`AccountingPeriodEnd` < ':Monat_End' and ib.IsActive = 1 - order by ib.invoicenumber + and ib.Type = 2 AND ib.`IsExported` = 0 + -- order by ib.invoicenumber + "; + + return sql; + } + + private static String GetMonatlicheMietenSql(DateTime date) + { + //40125 Betreuung + //40126 Mietkostenerstattung + + String sql = @" + SELECT + Round(IFNULL(scap.ApprovedFixedAmount, 0), 2) as 'Miete', + '40126' AS 'Gegenkonto', + '123456' AS InvoiceNumber, + cust.CostCenter, + cust.DebitorNumber, + CONCAT(p.LastName, ', ', p.FirstName, ', Miete ') AS KlientName + FROM `person` p join `customer` cust on p.Oid = cust.PersonOid join `supportconcept` sc on cust.Oid = sc.CustomerOid + join `costbearer2supportconcept` cb2sc on sc.Oid = cb2sc.SupportConceptOid join `costbearer` cb on cb2sc.`CostBearerOid` = cb.`Oid` + join `supportconceptapprovalperiod` scap on cb2sc.`Oid` = scap.`CostBearer2SupportConceptOid` + join `organisation` o on cb.`Oid` = o.`CostBearerOid` + WHERE cust.IsActive = 1 AND sc.IsActive = 1 AND (scap.ServicecategoryOid) = 6 + AND scap.Start < ':Monat_End' && scap.EndDate > ':Monat_Start' + Order by KlientName "; return sql; From 752e9e13b5d86c7849130b5a0a5525378ce38759 Mon Sep 17 00:00:00 2001 From: Alexandra Date: Mon, 27 Oct 2025 10:35:01 +0100 Subject: [PATCH 2/5] TwgJonathan/Rechnung - Adresszusatz mit aufgenommen --- ReportImp/TwgJonathan/Rechnung.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ReportImp/TwgJonathan/Rechnung.cs b/ReportImp/TwgJonathan/Rechnung.cs index 1937e477f..5ae6cdff9 100644 --- a/ReportImp/TwgJonathan/Rechnung.cs +++ b/ReportImp/TwgJonathan/Rechnung.cs @@ -28,7 +28,11 @@ namespace TwgJonathan sb.AppendLine(pRO.RecipientOrganisation); sb.AppendLine(""); } - if (!String.IsNullOrEmpty(pRO.RecipientContactPerson)) + if (!String.IsNullOrEmpty(pRO.RecipientAddressLine1)) + { + sb.AppendLine(pRO.RecipientAddressLine1); + } + if (!String.IsNullOrEmpty(pRO.RecipientContactPerson)) { sb.AppendLine(pRO.RecipientContactPerson); } From 891aa96c767b60f773b192a253d164cc5a07a01c Mon Sep 17 00:00:00 2001 From: Alexandra Date: Mon, 27 Oct 2025 10:35:23 +0100 Subject: [PATCH 3/5] LebenshilfeBadKreuznachFUD/Invoicing/CustomInvoiceCreation - Kein CheckMaxApprovedAmount --- .../Invoicing/CustomInvoiceCreation.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ReportImp/LebenshilfeBadKreuznachFUD/Invoicing/CustomInvoiceCreation.cs b/ReportImp/LebenshilfeBadKreuznachFUD/Invoicing/CustomInvoiceCreation.cs index f295fd360..22faa13d7 100644 --- a/ReportImp/LebenshilfeBadKreuznachFUD/Invoicing/CustomInvoiceCreation.cs +++ b/ReportImp/LebenshilfeBadKreuznachFUD/Invoicing/CustomInvoiceCreation.cs @@ -335,5 +335,10 @@ namespace LebenshilfeBadKreuznachFUD.Invoicing } return 0; } + + public override void CheckMaxApprovedAmount(ServiceInvoice invoice, ServiceInvoicePeriod sip, SupportConceptApprovalPeriodDC scap, CostBearer2SupportConcept costBearer2SupportConcept, DateTimeSpan invoicePeriod, List serviceRecords) + { + // Do nothing + } } } \ No newline at end of file From c4dc357d399b0172e2ac2560687ef990ccf0956b Mon Sep 17 00:00:00 2001 From: Alexandra Date: Tue, 28 Oct 2025 11:54:43 +0100 Subject: [PATCH 4/5] ArcheTecklenburg/Service/CustomAccountingService.cs - nacherstellen Einzelne Abrechnung nach Differenzabrechnung alle --- .../Service/CustomAccountingService.cs | 264 +++++++++++------- 1 file changed, 156 insertions(+), 108 deletions(-) diff --git a/ReportImp/ArcheTecklenburg/Service/CustomAccountingService.cs b/ReportImp/ArcheTecklenburg/Service/CustomAccountingService.cs index 58e7977af..4c38cc8ef 100644 --- a/ReportImp/ArcheTecklenburg/Service/CustomAccountingService.cs +++ b/ReportImp/ArcheTecklenburg/Service/CustomAccountingService.cs @@ -13,119 +13,167 @@ namespace ArcheTecklenburg.Service { public class CustomAccountingService : AccountingService { - //protected override ServiceInvoiceDC ErstelleDifferenzRechnung(DifferenzRechnungCheck item) - //{ - // ServiceInvoiceDC diffRechnung = null; - // //var alterBetrag = item.VorhandeneRechungen.Sum(i => i.ClaimSum ?? 0); - // var letzteRg = item.VorhandeneRechungen.OrderByDescending(r => r.ServiceInvoiceOid).FirstOrDefault(); + protected override ServiceInvoiceDC ErstelleDifferenzRechnung(DifferenzRechnungCheck item) + { + ServiceInvoiceDC diffRechnung = null; + //var alterBetrag = item.VorhandeneRechungen.Sum(i => i.ClaimSum ?? 0); + var letzteRg = item.VorhandeneRechungen.OrderByDescending(r => r.ServiceInvoiceOid).FirstOrDefault(); - // letzteRg = item.VorhandeneRechungen.FirstOrDefault(r => item.NeueRechnung.InvoiceBase.CustomerOid == r.InvoiceBase.CustomerOid); - // if (letzteRg != null) - // { - // if (item.NeueRechnung.ClaimSum == letzteRg.ClaimSum) - // { - // diffRechnung = item.NeueRechnung; - // diffRechnung.InvoiceBase.NeuErstellen = false; - // diffRechnung.InvoiceBase.Hinweise = String.Format("Rechnung wurde bereits erstellt"); - // } - // else - // { - // diffRechnung = new ServiceInvoiceDC(); - // diffRechnung.OriginalZurDifferenz = item.NeueRechnung; - // diffRechnung.InvoiceBase = new InvoiceBaseDC(); - // CopyInvoiceBaseDC(item.NeueRechnung.InvoiceBase, diffRechnung); + letzteRg = item.VorhandeneRechungen.FirstOrDefault(r => item.NeueRechnung.InvoiceBase.CustomerOid == r.InvoiceBase.CustomerOid); + if (letzteRg != null) + { + if (item.NeueRechnung.ClaimSum == letzteRg.ClaimSum) + { + diffRechnung = item.NeueRechnung; + diffRechnung.InvoiceBase.NeuErstellen = false; + diffRechnung.InvoiceBase.Hinweise = String.Format("Rechnung wurde bereits erstellt"); + } + else + { + diffRechnung = new ServiceInvoiceDC(); + diffRechnung.OriginalZurDifferenz = item.NeueRechnung; + diffRechnung.InvoiceBase = new InvoiceBaseDC(); + CopyInvoiceBaseDC(item.NeueRechnung.InvoiceBase, diffRechnung); - // ServiceInvoice counterInvoice = new ServiceInvoice(); - // var serviceInvoice = DAOFactory.SearchDAO.GetServiceInvoiceByInvoiceBaseOid(letzteRg.InvoiceBase.InvoiceBaseOid.Value); + ServiceInvoice counterInvoice = new ServiceInvoice(); + var serviceInvoice = DAOFactory.SearchDAO.GetServiceInvoiceByInvoiceBaseOid(letzteRg.InvoiceBase.InvoiceBaseOid.Value); - // CopyServiceInvoice(serviceInvoice, counterInvoice); - // SetzeStornoInfos(counterInvoice); - // SetzeRechnungspositionenServiceInvoice(diffRechnung, counterInvoice, item); + CopyServiceInvoice(serviceInvoice, counterInvoice); + SetzeStornoInfos(counterInvoice); + SetzeRechnungspositionenServiceInvoice(diffRechnung, counterInvoice, item); - // if (item.VorhandeneRechungen.Count > 1) - // { - // var restRgen = new List(item.VorhandeneRechungen); - // restRgen.Remove(letzteRg); - // if (restRgen.All(rg => rg.ServiceInvoicePeriods != null && rg.ServiceInvoicePeriods.Any() - // && rg.ServiceInvoicePeriods.Select(p => p.Customer.CustomerOid).Distinct().Count() == 1)) - // { - // foreach (var oldRg in restRgen) - // { - // var sips = diffRechnung.ServiceInvoicePeriods.Where(s => s.Customer != null && s.Customer.CustomerOid == oldRg.ServiceInvoicePeriods[0].Customer.CustomerOid).ToList(); - // //var sip = sips.Where(s => s.SupportConceptApprovalPeriod != null && s.SupportConceptApprovalPeriod.ServiceCategory != null && rg.ServiceInvoicePeriods[0].SupportConceptApprovalPeriod.ServiceCategory.ServiceCategoryOid == 6).First(); - // foreach (var sip in sips) - // { - // if (sip.InvoiceItems != null && sip.InvoiceItems.Count > 0) - // { - // sip.Claim -= oldRg.ServiceInvoicePeriods[0].Claim; - // foreach (var iiDC in oldRg.ServiceInvoicePeriods[0].InvoiceItems) - // { - - // if (sip.InvoiceItems.Any(newII => newII.AmountTotal == iiDC.AmountTotal - // && iiDC.SupportConceptApprovalPeriodOid != null && newII.SupportConceptApprovalPeriodOid == iiDC.SupportConceptApprovalPeriodOid)) - // { - // break; // Wenn das InvoiceItem schon storniert enthalten ist, überspring das - // } - // var copyItemDC = new InvoiceItemDC(); - // var copyItem = new InvoiceItem(); - // CopyInvoiceItem(MapperFactory.InvoiceItemDC_InvoiceItem.MapToNewEntity(iiDC), copyItem); - // copyItemDC = MapperFactory.InvoiceItemDC_InvoiceItem.MapToNewDC(copyItem); - // sip.InvoiceItems.Add(copyItemDC); - // } - // } - // } - // } - // } - // } + if (item.VorhandeneRechungen.Count > 1) + { + var restRgen = new List(item.VorhandeneRechungen); + restRgen.Remove(letzteRg); + if (restRgen.All(rg => rg.ServiceInvoicePeriods != null && rg.ServiceInvoicePeriods.Any() + && rg.ServiceInvoicePeriods.Select(p => p.Customer.CustomerOid).Distinct().Count() == 1)) + { + //foreach (var oldRg in restRgen) + //{ + // var sips = diffRechnung.ServiceInvoicePeriods.Where(s => s.Customer != null && s.Customer.CustomerOid == oldRg.ServiceInvoicePeriods[0].Customer.CustomerOid).ToList(); + // //var sip = sips.Where(s => s.SupportConceptApprovalPeriod != null && s.SupportConceptApprovalPeriod.ServiceCategory != null && rg.ServiceInvoicePeriods[0].SupportConceptApprovalPeriod.ServiceCategory.ServiceCategoryOid == 6).First(); + // foreach (var sip in sips) + // { + // if (sip.InvoiceItems != null && sip.InvoiceItems.Count > 0) + // { + // sip.Claim -= oldRg.ServiceInvoicePeriods[0].Claim; + // foreach (var iiDC in oldRg.ServiceInvoicePeriods[0].InvoiceItems) + // { - // diffRechnung.InvoiceBase.NeuErstellen = true; - // diffRechnung.InvoiceBase.Hinweise = String.Format("Rechnungsdifferenz zu Rechnung {0} in Höhe von {1:c}", letzteRg.InvoiceBase.InvoiceNumber, letzteRg.InvoiceBase.TotalAmount.Value); - // } - // } + // if (sip.InvoiceItems.Any(newII => newII.AmountTotal == iiDC.AmountTotal + // && iiDC.SupportConceptApprovalPeriodOid != null && newII.SupportConceptApprovalPeriodOid == iiDC.SupportConceptApprovalPeriodOid)) + // { + // break; // Wenn das InvoiceItem schon storniert enthalten ist, überspring das + // } + // var copyItemDC = new InvoiceItemDC(); + // var copyItem = new InvoiceItem(); + // CopyInvoiceItem(MapperFactory.InvoiceItemDC_InvoiceItem.MapToNewEntity(iiDC), copyItem); + // copyItemDC = MapperFactory.InvoiceItemDC_InvoiceItem.MapToNewDC(copyItem); + // sip.InvoiceItems.Add(copyItemDC); + // } + // } + // } + //} + } + else + { + ServiceInvoice counterInvoice2 = new ServiceInvoice(); + if (diffRechnung.ServiceInvoicePeriods.Select(p => p.Customer.CustomerOid).Distinct().Count() == 1) + { + var cOid = diffRechnung.ServiceInvoicePeriods[0].Customer.CustomerOid; + if (restRgen.All(rg => rg.ServiceInvoicePeriods != null && rg.ServiceInvoicePeriods.Any() && rg.ServiceInvoicePeriods.Any(p => p.Customer.CustomerOid == cOid))) + { + foreach (var oldRg in restRgen) + { + var sips = oldRg.ServiceInvoicePeriods.Where(s => s.Customer.CustomerOid == cOid).ToList(); + foreach (var sip in sips) + { + if (sip.InvoiceItems != null && sip.InvoiceItems.Count > 0) + { + if (sip.SupportConceptApprovalPeriod != null && sip.SupportConceptApprovalPeriod.SupportConceptApprovalPeriodOid != null + && diffRechnung.ServiceInvoicePeriods.Any(sipDif => sipDif.SupportConceptApprovalPeriod.SupportConceptApprovalPeriodOid == sip.SupportConceptApprovalPeriod.SupportConceptApprovalPeriodOid)) + { + var sipDif = diffRechnung.ServiceInvoicePeriods.Where(si => si.SupportConceptApprovalPeriod.SupportConceptApprovalPeriodOid == sip.SupportConceptApprovalPeriod.SupportConceptApprovalPeriodOid).First(); + foreach (var iiDC in sip.InvoiceItems) + { - // return diffRechnung; - //} + if (sipDif.InvoiceItems.Any(newII => newII.AmountTotal == iiDC.AmountTotal && newII.UnitCount == iiDC.UnitCount && newII.AmountPerUnit == iiDC.AmountPerUnit)) + { + var doubleII = sipDif.InvoiceItems.Where(newII => newII.AmountTotal == iiDC.AmountTotal && newII.UnitCount == iiDC.UnitCount && newII.AmountPerUnit == iiDC.AmountPerUnit).First(); + if (sipDif.InvoiceItems.Count > 1) + { + sipDif.InvoiceItems.Remove(doubleII); + } + else + { + doubleII.AmountPerUnit = 0; + doubleII.UnitCount = 0; + doubleII.AmountTotal = 0; + doubleII.GrossAmountTotal = 0; + doubleII.UnitDescription += " - bereits abgerechnet"; + sipDif.Claim = 0; + } + } + } + } + } + } + } + } + } + } - //public override void SetzeRechnungspositionenServiceInvoice(ServiceInvoiceDC diffRechnung, ServiceInvoice counterInvoice, DifferenzRechnungCheck item) - //{ - // var siDCAlt = MapperFactory.ServiceInvoiceDC_ServiceInvoice.MapToNewDC(counterInvoice); - // if (siDCAlt.ServiceInvoicePeriods != null && siDCAlt.ServiceInvoicePeriods.Count > 0) - // { - // if (siDCAlt.ServiceInvoicePeriods.Select(p => p.Customer.CustomerOid).Distinct().Count() > 1 - // && item.NeueRechnung.ServiceInvoicePeriods != null && item.NeueRechnung.ServiceInvoicePeriods.Count > 0 - // && item.NeueRechnung.ServiceInvoicePeriods.Select(p => p.Customer.CustomerOid).Distinct().Count() == 1) - // { - // if (diffRechnung.ServiceInvoicePeriods == null) - // { - // diffRechnung.ServiceInvoicePeriods = item.NeueRechnung.ServiceInvoicePeriods; - // foreach (var sip in siDCAlt.ServiceInvoicePeriods) - // { - // if (sip.Customer.CustomerOid == diffRechnung.ServiceInvoicePeriods[0].Customer.CustomerOid && - // sip.SupportConceptApprovalPeriod != null && sip.SupportConceptApprovalPeriod.SupportConceptApprovalPeriodOid.HasValue) - // { - // var newSip = diffRechnung.ServiceInvoicePeriods.Where(s => s.SupportConceptApprovalPeriod != null && s.SupportConceptApprovalPeriod.SupportConceptApprovalPeriodOid.HasValue - // && s.SupportConceptApprovalPeriod.SupportConceptApprovalPeriodOid == sip.SupportConceptApprovalPeriod.SupportConceptApprovalPeriodOid).First(); - // if (newSip.InvoiceItems != null && newSip.InvoiceItems.Count > 0) - // { - // newSip.Claim += sip.Claim; - // foreach (var ii in sip.InvoiceItems) - // { - // newSip.InvoiceItems.Add(ii); - // } - // } - // } - // } - // } - // } - // else - // { - // base.SetzeRechnungspositionenServiceInvoice(diffRechnung, counterInvoice, item); - // } - // } - // else - // { - // base.SetzeRechnungspositionenServiceInvoice(diffRechnung, counterInvoice, item); - // } - //} - } + diffRechnung.InvoiceBase.NeuErstellen = true; + diffRechnung.InvoiceBase.Hinweise = String.Format("Rechnungsdifferenz zu Rechnung {0} in Höhe von {1:c}", letzteRg.InvoiceBase.InvoiceNumber, letzteRg.InvoiceBase.TotalAmount.Value); + } + } + } + + return diffRechnung; + } + + + public override void SetzeRechnungspositionenServiceInvoice(ServiceInvoiceDC diffRechnung, ServiceInvoice counterInvoice, DifferenzRechnungCheck item) + { + var siDCAlt = MapperFactory.ServiceInvoiceDC_ServiceInvoice.MapToNewDC(counterInvoice); + if (siDCAlt.ServiceInvoicePeriods != null && siDCAlt.ServiceInvoicePeriods.Count > 0) + { + if (siDCAlt.ServiceInvoicePeriods.Select(p => p.Customer.CustomerOid).Distinct().Count() > 1 + && item.NeueRechnung.ServiceInvoicePeriods != null && item.NeueRechnung.ServiceInvoicePeriods.Count > 0 + && item.NeueRechnung.ServiceInvoicePeriods.Select(p => p.Customer.CustomerOid).Distinct().Count() == 1) + { + if (diffRechnung.ServiceInvoicePeriods == null) + { + diffRechnung.ServiceInvoicePeriods = item.NeueRechnung.ServiceInvoicePeriods; + foreach (var sip in siDCAlt.ServiceInvoicePeriods) + { + if (sip.Customer.CustomerOid == diffRechnung.ServiceInvoicePeriods[0].Customer.CustomerOid && + sip.SupportConceptApprovalPeriod != null && sip.SupportConceptApprovalPeriod.SupportConceptApprovalPeriodOid.HasValue) + { + var newSip = diffRechnung.ServiceInvoicePeriods.Where(s => s.SupportConceptApprovalPeriod != null && s.SupportConceptApprovalPeriod.SupportConceptApprovalPeriodOid.HasValue + && s.SupportConceptApprovalPeriod.SupportConceptApprovalPeriodOid == sip.SupportConceptApprovalPeriod.SupportConceptApprovalPeriodOid).First(); + if (newSip.InvoiceItems != null && newSip.InvoiceItems.Count > 0) + { + newSip.Claim += sip.Claim; + foreach (var ii in sip.InvoiceItems) + { + newSip.InvoiceItems.Add(ii); + } + } + } + } + } + } + else + { + base.SetzeRechnungspositionenServiceInvoice(diffRechnung, counterInvoice, item); + } + } + else + { + base.SetzeRechnungspositionenServiceInvoice(diffRechnung, counterInvoice, item); + } + } + } } From 555dc488ceccc241039a202816b9b2e02689135f Mon Sep 17 00:00:00 2001 From: Christian Date: Mon, 27 Oct 2025 11:39:42 +0100 Subject: [PATCH 5/5] Neue Version erstellt --- BeWo/BeWo.csproj | 160 +++++++++--------- BeWo/BeWoApp.xaml.cs | 7 +- .../Detail/Accounting/InvoiceOverview.xaml.cs | 7 +- Host/Host.csproj.user | 7 +- 4 files changed, 93 insertions(+), 88 deletions(-) diff --git a/BeWo/BeWo.csproj b/BeWo/BeWo.csproj index bc3475ad1..06c21387d 100644 --- a/BeWo/BeWo.csproj +++ b/BeWo/BeWo.csproj @@ -43,12 +43,12 @@ de-DE BeWoPlaner ownSoft GmbH - 2.0.1.279 + 2.0.1.281 true publish.htm false true - 279 + 282 2.0.1.%2a false true @@ -3029,392 +3029,392 @@ False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly False + Include + True - Include - True Assembly diff --git a/BeWo/BeWoApp.xaml.cs b/BeWo/BeWoApp.xaml.cs index bdf3417d2..ed9de3dd6 100644 --- a/BeWo/BeWoApp.xaml.cs +++ b/BeWo/BeWoApp.xaml.cs @@ -56,9 +56,9 @@ namespace BeWo public static LoginControl LoginControl; public static MainControl MainControl; - public static string ShortVersion = "3.27"; + public static string ShortVersion = "3.28"; - public static string Version = "Version 3.27.3"; + public static string Version = "Version 3.28"; public static int RenderTier = 0; public static bool IsInDesignMode = DesignerProperties.GetIsInDesignMode(new DependencyObject()); @@ -536,6 +536,9 @@ namespace BeWo val = UserSettingsUtils.GetSettingValue(_Mandator.Settings, SettingsKeys.AllowXRechnung); AppSettings.AllowXRechnung = val != null && val.Equals("1"); + val = UserSettingsUtils.GetSettingValue(_Mandator.Settings, SettingsKeys.HidePrintQBPopup); + AppSettings.HidePrintQBPopup = val != null && val.Equals("1"); + val = UserSettingsUtils.GetSettingValue(_Mandator.Settings, SettingsKeys.UseDistanceApi); AppSettings.UseDistanceApi = val != null && val.Equals("1"); diff --git a/BeWo/View/Detail/Accounting/InvoiceOverview.xaml.cs b/BeWo/View/Detail/Accounting/InvoiceOverview.xaml.cs index 3a836214a..813140b34 100644 --- a/BeWo/View/Detail/Accounting/InvoiceOverview.xaml.cs +++ b/BeWo/View/Detail/Accounting/InvoiceOverview.xaml.cs @@ -353,12 +353,13 @@ namespace BeWo.View.Detail.Accounting if (BeWoApp.AppSettings.HidePrintQBPopup) { - popup_PrintQB.IsOpen = true; - popup_PrintQB.Tag = ((Hyperlink)sender).NavigateUri.ToString(); + BeWoUtils.NavigateToReportUri(((Hyperlink)sender).NavigateUri.ToString(), "Druckvorschau"); + } else { - BeWoUtils.NavigateToReportUri(((Hyperlink)sender).NavigateUri.ToString(), "Druckvorschau"); + popup_PrintQB.IsOpen = true; + popup_PrintQB.Tag = ((Hyperlink)sender).NavigateUri.ToString(); } } diff --git a/Host/Host.csproj.user b/Host/Host.csproj.user index d73513eff..e24f21a47 100644 --- a/Host/Host.csproj.user +++ b/Host/Host.csproj.user @@ -1,10 +1,11 @@ - + C:\Projects\Bewo\BeWo - Main\Host\Properties\PublishProfiles\FolderProfile.pubxml true Debug|Any CPU - true + + @@ -32,7 +33,7 @@ True - False + True