Compare commits
	
		
			5 Commits
		
	
	
		
			34d95eab9d
			...
			v1.0.1.5
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| e9722c790c | |||
| af98c32026 | |||
| 7300b30cf5 | |||
| 428cd6ddc2 | |||
| 2de8af878b | 
							
								
								
									
										28
									
								
								CHANGELOG.md
									
									
									
									
									
								
							
							
						
						
									
										28
									
								
								CHANGELOG.md
									
									
									
									
									
								
							@@ -2,6 +2,34 @@
 | 
				
			|||||||
Changelog
 | 
					Changelog
 | 
				
			||||||
=========
 | 
					=========
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[v1.0.1.5][v1.0.1.5] (2025-10-29) {#v1.0.1.5}
 | 
				
			||||||
 | 
					---------------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Behobene Fehler {#v1.0.1.5-bugfixes}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* Im Rundschreiben-Fenster (`MailWindow`) kam es zu einem Absturz, wenn man das Fenster über den "Anlieferungsbestätigung"-Knopf im Leseabschluss-Abschnitt geöffnet hat. (af98c32026)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[v1.0.1.5]: https://git.necronda.net/winzer/elwig/releases/tag/v1.0.1.5
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[v1.0.1.4][v1.0.1.4] (2025-10-28) {#v1.0.1.4}
 | 
				
			||||||
 | 
					---------------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Behobene Fehler {#v1.0.1.4-bugfixes}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* Im Rundschreiben-Fenster (`MailWindow`) kam es zu einem Absturz, wenn man die Zustelloptionen "Post zusenden an Mitglieder, die keine E-Mail erhalten würden" und "E-Mail zusenden an niemanden" kombiniert hat. (2de8af878b)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Sonstiges {#v1.0.1.4-misc}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* Im Auszahlungsvariante-Fenster (`ChartWindow`) gibt es keine Fehlermeldung mehr wenn nicht für alle Sorten ein Preis definiert ist, nur noch eine Warnung. (428cd6ddc2)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[v1.0.1.4]: https://git.necronda.net/winzer/elwig/releases/tag/v1.0.1.4
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[v1.0.1.3][v1.0.1.3] (2025-10-13) {#v1.0.1.3}
 | 
					[v1.0.1.3][v1.0.1.3] (2025-10-13) {#v1.0.1.3}
 | 
				
			||||||
---------------------------------------------
 | 
					---------------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,7 +7,7 @@
 | 
				
			|||||||
    <UseWPF>true</UseWPF>
 | 
					    <UseWPF>true</UseWPF>
 | 
				
			||||||
    <PreserveCompilationContext>true</PreserveCompilationContext>
 | 
					    <PreserveCompilationContext>true</PreserveCompilationContext>
 | 
				
			||||||
    <ApplicationIcon>Resources\Images\Elwig.ico</ApplicationIcon>
 | 
					    <ApplicationIcon>Resources\Images\Elwig.ico</ApplicationIcon>
 | 
				
			||||||
    <Version>1.0.1.3</Version>
 | 
					    <Version>1.0.1.5</Version>
 | 
				
			||||||
    <SatelliteResourceLanguages>de-AT</SatelliteResourceLanguages>
 | 
					    <SatelliteResourceLanguages>de-AT</SatelliteResourceLanguages>
 | 
				
			||||||
    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
 | 
					    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
 | 
				
			||||||
    <ApplicationManifest>app.manifest</ApplicationManifest>
 | 
					    <ApplicationManifest>app.manifest</ApplicationManifest>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -20,13 +20,19 @@ namespace Elwig.Helpers.Billing {
 | 
				
			|||||||
            Data = PaymentBillingData.FromJson(PaymentVariant.Data, Utils.GetVaributes(ctx, Year, onlyDelivered: false));
 | 
					            Data = PaymentBillingData.FromJson(PaymentVariant.Data, Utils.GetVaributes(ctx, Year, onlyDelivered: false));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public async Task Calculate(bool? honorGebunden = null, bool? allowAttrsIntoLower = null, bool? avoidUnderDeliveries = null) {
 | 
					        public async Task Calculate(bool strictPrices = true, bool? honorGebunden = null, bool? allowAttrsIntoLower = null, bool? avoidUnderDeliveries = null) {
 | 
				
			||||||
            using var cnx = await AppDbContext.ConnectAsync();
 | 
					            using var cnx = await AppDbContext.ConnectAsync();
 | 
				
			||||||
            using var tx = await cnx.BeginTransactionAsync();
 | 
					            using var tx = await cnx.BeginTransactionAsync();
 | 
				
			||||||
            await CalculateBuckets(honorGebunden, allowAttrsIntoLower, avoidUnderDeliveries, cnx);
 | 
					            await CalculateBuckets(honorGebunden, allowAttrsIntoLower, avoidUnderDeliveries, cnx);
 | 
				
			||||||
            await DeleteInDb(cnx);
 | 
					            await DeleteInDb(cnx);
 | 
				
			||||||
            await SetCalcTime(cnx);
 | 
					            await SetCalcTime(cnx);
 | 
				
			||||||
            await CalculatePrices(cnx);
 | 
					            KeyNotFoundException? exception = null;
 | 
				
			||||||
 | 
					            try {
 | 
				
			||||||
 | 
					                await CalculatePrices(cnx, strictPrices);
 | 
				
			||||||
 | 
					            } catch (KeyNotFoundException e) {
 | 
				
			||||||
 | 
					                if (strictPrices) throw;
 | 
				
			||||||
 | 
					                exception = e;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
            if (Data.ConsiderDelieryModifiers) {
 | 
					            if (Data.ConsiderDelieryModifiers) {
 | 
				
			||||||
                await CalculateDeliveryModifiers(cnx);
 | 
					                await CalculateDeliveryModifiers(cnx);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
@@ -34,6 +40,8 @@ namespace Elwig.Helpers.Billing {
 | 
				
			|||||||
                await CalculateMemberModifiers(cnx);
 | 
					                await CalculateMemberModifiers(cnx);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            await tx.CommitAsync();
 | 
					            await tx.CommitAsync();
 | 
				
			||||||
 | 
					            if (exception != null)
 | 
				
			||||||
 | 
					                throw exception;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public async Task Commit() {
 | 
					        public async Task Commit() {
 | 
				
			||||||
@@ -142,7 +150,8 @@ namespace Elwig.Helpers.Billing {
 | 
				
			|||||||
                """);
 | 
					                """);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        protected async Task CalculatePrices(SqliteConnection cnx) {
 | 
					        protected async Task CalculatePrices(SqliteConnection cnx, bool strict = true) {
 | 
				
			||||||
 | 
					            var invalid = new HashSet<string>();
 | 
				
			||||||
            var parts = new List<(int Year, int DId, int DPNr, int BktNr, string SortId, string? AttrId, string? CultId, string Discr, int Value, double Oe, double Kmw, string QualId, bool AttrAreaCom)>();
 | 
					            var parts = new List<(int Year, int DId, int DPNr, int BktNr, string SortId, string? AttrId, string? CultId, string Discr, int Value, double Oe, double Kmw, string QualId, bool AttrAreaCom)>();
 | 
				
			||||||
            using (var cmd = cnx.CreateCommand()) {
 | 
					            using (var cmd = cnx.CreateCommand()) {
 | 
				
			||||||
                cmd.CommandText = $"""
 | 
					                cmd.CommandText = $"""
 | 
				
			||||||
@@ -172,15 +181,25 @@ namespace Elwig.Helpers.Billing {
 | 
				
			|||||||
                var payAttrId = (part.Discr is "" or "_") ? null : part.Discr;
 | 
					                var payAttrId = (part.Discr is "" or "_") ? null : part.Discr;
 | 
				
			||||||
                var attrId = part.AttrAreaCom ? payAttrId : part.AttrId;
 | 
					                var attrId = part.AttrAreaCom ? payAttrId : part.AttrId;
 | 
				
			||||||
                var geb = !ungeb && (payAttrId == attrId || !part.AttrAreaCom);
 | 
					                var geb = !ungeb && (payAttrId == attrId || !part.AttrAreaCom);
 | 
				
			||||||
                var price = Data.CalculatePrice(part.SortId, attrId, part.CultId, part.QualId, geb, part.Oe, part.Kmw);
 | 
					                decimal price = 0;
 | 
				
			||||||
 | 
					                try {
 | 
				
			||||||
 | 
					                    price = Data.CalculatePrice(part.SortId, attrId, part.CultId, part.QualId, geb, part.Oe, part.Kmw);
 | 
				
			||||||
 | 
					                } catch (KeyNotFoundException e) {
 | 
				
			||||||
 | 
					                    invalid.Add(e.Message.Split('\'')[1]);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
                var priceL = PaymentVariant.Season.DecToDb(price);
 | 
					                var priceL = PaymentVariant.Season.DecToDb(price);
 | 
				
			||||||
                inserts.Add((part.Year, part.DId, part.DPNr, part.BktNr, priceL, priceL * part.Value));
 | 
					                inserts.Add((part.Year, part.DId, part.DPNr, part.BktNr, priceL, priceL * part.Value));
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            var msg = invalid.Count == 0 ? null : "Für folgende Sorten wurde noch keine Preiskurve festgelegt: " + string.Join(", ", invalid);
 | 
				
			||||||
 | 
					            if (msg != null && strict)
 | 
				
			||||||
 | 
					                throw new KeyNotFoundException(msg);
 | 
				
			||||||
            await AppDbContext.ExecuteBatch(cnx, $"""
 | 
					            await AppDbContext.ExecuteBatch(cnx, $"""
 | 
				
			||||||
                INSERT INTO payment_delivery_part_bucket (year, did, dpnr, bktnr, avnr, price, amount)
 | 
					                INSERT INTO payment_delivery_part_bucket (year, did, dpnr, bktnr, avnr, price, amount)
 | 
				
			||||||
                VALUES {string.Join(",\n       ", inserts.Select(i => $"({i.Year}, {i.DId}, {i.DPNr}, {i.BktNr}, {AvNr}, {i.Price}, {i.Amount})"))};
 | 
					                VALUES {string.Join(",\n       ", inserts.Select(i => $"({i.Year}, {i.DId}, {i.DPNr}, {i.BktNr}, {AvNr}, {i.Price}, {i.Amount})"))};
 | 
				
			||||||
                """);
 | 
					                """);
 | 
				
			||||||
 | 
					            if (msg != null)
 | 
				
			||||||
 | 
					                throw new KeyNotFoundException(msg);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        protected async Task CalculateDeliveryModifiers(SqliteConnection cnx) {
 | 
					        protected async Task CalculateDeliveryModifiers(SqliteConnection cnx) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -664,8 +664,10 @@ namespace Elwig.Windows {
 | 
				
			|||||||
            try {
 | 
					            try {
 | 
				
			||||||
                await Task.Run(async () => {
 | 
					                await Task.Run(async () => {
 | 
				
			||||||
                    var b = new BillingVariant(PaymentVar.Year, PaymentVar.AvNr);
 | 
					                    var b = new BillingVariant(PaymentVar.Year, PaymentVar.AvNr);
 | 
				
			||||||
                    await b.Calculate();
 | 
					                    await b.Calculate(false);
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
 | 
					            } catch (KeyNotFoundException exc) {
 | 
				
			||||||
 | 
					                MessageBox.Show(exc.Message, "Noch nicht alle Preise festgelegt", MessageBoxButton.OK, MessageBoxImage.Information);
 | 
				
			||||||
            } catch (Exception exc) {
 | 
					            } catch (Exception exc) {
 | 
				
			||||||
                MessageBox.Show(exc.Message, "Berechnungsfehler", MessageBoxButton.OK, MessageBoxImage.Error);
 | 
					                MessageBox.Show(exc.Message, "Berechnungsfehler", MessageBoxButton.OK, MessageBoxImage.Error);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -738,7 +738,7 @@ namespace Elwig.Windows {
 | 
				
			|||||||
                PostalNoEmailInput.IsChecked == true ? 1 : 0;
 | 
					                PostalNoEmailInput.IsChecked == true ? 1 : 0;
 | 
				
			||||||
            var emailMode = EmailAllInput.IsChecked == true ? 2 : EmailWishInput.IsChecked == true ? 1 : 0;
 | 
					            var emailMode = EmailAllInput.IsChecked == true ? 2 : EmailWishInput.IsChecked == true ? 1 : 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            double printNum = printMode == 3 ? PostalAllCount : printMode == 2 ? PostalWishCount : printMode == 2 ? PostalNoEmailCount : 0;
 | 
					            double printNum = printMode == 3 ? PostalAllCount : printMode == 2 ? PostalWishCount : printMode == 1 ? PostalNoEmailCount : 0;
 | 
				
			||||||
            double emailNum = emailMode == 2 ? EmailAllCount : emailMode == 1 ? EmailWishCount : 0;
 | 
					            double emailNum = emailMode == 2 ? EmailAllCount : emailMode == 1 ? EmailWishCount : 0;
 | 
				
			||||||
            double totalNum = printNum + emailNum;
 | 
					            double totalNum = printNum + emailNum;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -954,7 +954,7 @@ namespace Elwig.Windows {
 | 
				
			|||||||
            AvaiableDocumentsList.SelectedIndex = 1;
 | 
					            AvaiableDocumentsList.SelectedIndex = 1;
 | 
				
			||||||
            if (AvaiableDocumentsList.SelectedItem is not string s || SelectedDocs.Any(d => d.Type == DocType.DeliveryConfirmation))
 | 
					            if (AvaiableDocumentsList.SelectedItem is not string s || SelectedDocs.Any(d => d.Type == DocType.DeliveryConfirmation))
 | 
				
			||||||
                return;
 | 
					                return;
 | 
				
			||||||
            SelectedDocs.Add(new(DocType.DeliveryConfirmation, s, (Year, DocumentNonDeliverersInput.IsChecked == true)));
 | 
					            SelectedDocs.Add(new(DocType.DeliveryConfirmation, s, Year));
 | 
				
			||||||
            SelectedDocumentsList.SelectedIndex = SelectedDocs.Count - 1;
 | 
					            SelectedDocumentsList.SelectedIndex = SelectedDocs.Count - 1;
 | 
				
			||||||
            RecipientsDeliveryMembersInput.IsChecked = true;
 | 
					            RecipientsDeliveryMembersInput.IsChecked = true;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -13,7 +13,7 @@ About
 | 
				
			|||||||
**Product:** Elwig  
 | 
					**Product:** Elwig  
 | 
				
			||||||
**Description:** Electronic Management for Vintners' Cooperatives  
 | 
					**Description:** Electronic Management for Vintners' Cooperatives  
 | 
				
			||||||
**Type:** ERP system  
 | 
					**Type:** ERP system  
 | 
				
			||||||
**Version:** 1.0.1.3 ([Changelog](./CHANGELOG.md))  
 | 
					**Version:** 1.0.1.5 ([Changelog](./CHANGELOG.md))  
 | 
				
			||||||
**License:** [GNU General Public License 3.0 (GPLv3)](./LICENSE)  
 | 
					**License:** [GNU General Public License 3.0 (GPLv3)](./LICENSE)  
 | 
				
			||||||
**Website:** https://elwig.at/  
 | 
					**Website:** https://elwig.at/  
 | 
				
			||||||
**Source code:** https://git.necronda.net/winzer/elwig  
 | 
					**Source code:** https://git.necronda.net/winzer/elwig  
 | 
				
			||||||
@@ -33,7 +33,7 @@ Packaging: [WiX Toolset](https://www.firegiant.com/wixtoolset/)
 | 
				
			|||||||
**Produkt:** Elwig  
 | 
					**Produkt:** Elwig  
 | 
				
			||||||
**Beschreibung:** Elektronische Winzergenossenschaftsverwaltung  
 | 
					**Beschreibung:** Elektronische Winzergenossenschaftsverwaltung  
 | 
				
			||||||
**Typ:** Warenwirtschaftssystem (ERP-System)  
 | 
					**Typ:** Warenwirtschaftssystem (ERP-System)  
 | 
				
			||||||
**Version:** 1.0.1.2 ([Änderungsprotokoll](./CHANGELOG.md))  
 | 
					**Version:** 1.0.1.5 ([Änderungsprotokoll](./CHANGELOG.md))  
 | 
				
			||||||
**Lizenz:** [GNU General Public License 3.0 (GPLv3)](./LICENSE)  
 | 
					**Lizenz:** [GNU General Public License 3.0 (GPLv3)](./LICENSE)  
 | 
				
			||||||
**Website:** https://elwig.at/  
 | 
					**Website:** https://elwig.at/  
 | 
				
			||||||
**Quellcode:** https://git.necronda.net/winzer/elwig  
 | 
					**Quellcode:** https://git.necronda.net/winzer/elwig  
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -188,7 +188,7 @@ namespace Tests.UnitTests.HelperTests {
 | 
				
			|||||||
                Assert.That(payment["GV"],  Is.EqualTo(10_000));
 | 
					                Assert.That(payment["GV"],  Is.EqualTo(10_000));
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            await b.Calculate(false, false, false);
 | 
					            await b.Calculate(true, false, false, false);
 | 
				
			||||||
            var prices = await GetMemberDeliveryPrices(year, mgnr);
 | 
					            var prices = await GetMemberDeliveryPrices(year, mgnr);
 | 
				
			||||||
            Assert.Multiple(() => {
 | 
					            Assert.Multiple(() => {
 | 
				
			||||||
                Assert.That(prices, Has.Count.EqualTo(7));
 | 
					                Assert.That(prices, Has.Count.EqualTo(7));
 | 
				
			||||||
@@ -234,7 +234,7 @@ namespace Tests.UnitTests.HelperTests {
 | 
				
			|||||||
                Assert.That(payment["GV"],  Is.EqualTo(8_000));
 | 
					                Assert.That(payment["GV"],  Is.EqualTo(8_000));
 | 
				
			||||||
            });
 | 
					            });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            await b.Calculate(true, false, false);
 | 
					            await b.Calculate(true, true, false, false);
 | 
				
			||||||
            var prices = await GetMemberDeliveryPrices(year, mgnr);
 | 
					            var prices = await GetMemberDeliveryPrices(year, mgnr);
 | 
				
			||||||
            Assert.Multiple(() => {
 | 
					            Assert.Multiple(() => {
 | 
				
			||||||
                Assert.That(prices, Has.Count.EqualTo(6));
 | 
					                Assert.That(prices, Has.Count.EqualTo(6));
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user