Compare commits
	
		
			10 Commits
		
	
	
		
			b4f1eeee84
			...
			v0.3.2
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 39279a5dda | |||
| 5271f357f5 | |||
| 13ba3f90f6 | |||
| 43be8bf391 | |||
| 826a76c56c | |||
| efaae5f490 | |||
| 3a73265a75 | |||
| a6fef7fd9b | |||
| a08df4c3ed | |||
| 9701af9e36 | 
							
								
								
									
										67
									
								
								Elwig/Documents/DeliveryJournal.cshtml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										67
									
								
								Elwig/Documents/DeliveryJournal.cshtml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,67 @@
 | 
				
			|||||||
 | 
					@using RazorLight
 | 
				
			||||||
 | 
					@inherits TemplatePage<Elwig.Documents.DeliveryJournal>
 | 
				
			||||||
 | 
					@model Elwig.Documents.DeliveryJournal
 | 
				
			||||||
 | 
					@{ Layout = "Document"; }
 | 
				
			||||||
 | 
					<link rel="stylesheet" href="file:///@Raw(Model.DataPath)\resources\style-deliveryjournal.css"/>
 | 
				
			||||||
 | 
					<main>
 | 
				
			||||||
 | 
					    <h1>Lieferjournal</h1>
 | 
				
			||||||
 | 
					    <h2>@Model.Filter</h2>
 | 
				
			||||||
 | 
					    <table class="journal">
 | 
				
			||||||
 | 
					        <colgroup>
 | 
				
			||||||
 | 
					            <col style="width: 25mm;"/>
 | 
				
			||||||
 | 
					            <col style="width: 5mm;"/>
 | 
				
			||||||
 | 
					            <col style="width: 17mm;"/>
 | 
				
			||||||
 | 
					            <col style="width: 10mm;"/>
 | 
				
			||||||
 | 
					            <col style="width: 8mm;"/>
 | 
				
			||||||
 | 
					            <col style="width: 38mm;"/>
 | 
				
			||||||
 | 
					            <col style="width: 28mm;"/>
 | 
				
			||||||
 | 
					            <col style="width: 10mm;"/>
 | 
				
			||||||
 | 
					            <col style="width: 10mm;"/>
 | 
				
			||||||
 | 
					            <col style="width: 14mm;"/>
 | 
				
			||||||
 | 
					        </colgroup>
 | 
				
			||||||
 | 
					        <thead>
 | 
				
			||||||
 | 
					            <tr>
 | 
				
			||||||
 | 
					                <th rowspan="2" style="text-align: left;">Lieferschein-Nr.</th>
 | 
				
			||||||
 | 
					                <th rowspan="2">Pos.</th>
 | 
				
			||||||
 | 
					                <th rowspan="2">Datum</th>
 | 
				
			||||||
 | 
					                <th rowspan="2">Zeit</th>
 | 
				
			||||||
 | 
					                <th colspan="2" rowspan="2" style="text-align: left;">Mitglied</th>
 | 
				
			||||||
 | 
					                <th rowspan="2" style="text-align: left;">Sorte</th>
 | 
				
			||||||
 | 
					                <th colspan="2">Gradation</th>
 | 
				
			||||||
 | 
					                <th>Gewicht</th>
 | 
				
			||||||
 | 
					            </tr>
 | 
				
			||||||
 | 
					            <tr>
 | 
				
			||||||
 | 
					                <th>[°Oe]</th>
 | 
				
			||||||
 | 
					                <th>[°KMW]</th>
 | 
				
			||||||
 | 
					                <th>[kg]</th>
 | 
				
			||||||
 | 
					            </tr>
 | 
				
			||||||
 | 
					        </thead>
 | 
				
			||||||
 | 
					        <tbody>
 | 
				
			||||||
 | 
					            @foreach (var p in Model.Deliveries) {
 | 
				
			||||||
 | 
					                <tr>
 | 
				
			||||||
 | 
					                    <td>@p.Delivery.LsNr</td>
 | 
				
			||||||
 | 
					                    <td>@p.DPNr</td>
 | 
				
			||||||
 | 
					                    <td>@($"{p.Delivery.Date:dd.MM.yyyy}")</td>
 | 
				
			||||||
 | 
					                    <td>@($"{p.Delivery.Time:HH:mm}")</td>
 | 
				
			||||||
 | 
					                    <td class="mgnr">@p.Delivery.Member.MgNr</td>
 | 
				
			||||||
 | 
					                    <td>@p.Delivery.Member.AdministrativeName</td>
 | 
				
			||||||
 | 
					                    <td>@p.Variant.Name</td>
 | 
				
			||||||
 | 
					                    <td class="grad">@($"{p.Oe:N0}")</td>
 | 
				
			||||||
 | 
					                    <td class="grad">@($"{p.Kmw:N1}")</td>
 | 
				
			||||||
 | 
					                    <td class="weight">@($"{p.Weight:N0}")</td>
 | 
				
			||||||
 | 
					                </tr>
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            <tr class="sum">
 | 
				
			||||||
 | 
					                @{
 | 
				
			||||||
 | 
					                    var kmw = Elwig.Helpers.Utils.AggregateDeliveryPartsKmw(Model.Deliveries);
 | 
				
			||||||
 | 
					                    var oe = Elwig.Helpers.Utils.KmwToOe(kmw);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                <td colspan="2">Gesamt:</td>
 | 
				
			||||||
 | 
					                <td colspan="5">(Teil-)Lieferungen: @($"{Model.Deliveries.DistinctBy(p => p.Delivery).Count():N0}") (@($"{Model.Deliveries.Count():N0}"))</td>
 | 
				
			||||||
 | 
					                <td class="grad">@($"{oe:N0}")</td>
 | 
				
			||||||
 | 
					                <td class="grad">@($"{kmw:N1}")</td>
 | 
				
			||||||
 | 
					                <td class="weight">@($"{Model.Deliveries.Sum(p => p.Weight):N0}")</td>
 | 
				
			||||||
 | 
					            </tr>
 | 
				
			||||||
 | 
					        </tbody>
 | 
				
			||||||
 | 
					    </table>
 | 
				
			||||||
 | 
					</main>
 | 
				
			||||||
							
								
								
									
										25
									
								
								Elwig/Documents/DeliveryJournal.cshtml.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								Elwig/Documents/DeliveryJournal.cshtml.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
				
			|||||||
 | 
					using Elwig.Helpers;
 | 
				
			||||||
 | 
					using Elwig.Models;
 | 
				
			||||||
 | 
					using System;
 | 
				
			||||||
 | 
					using System.Collections.Generic;
 | 
				
			||||||
 | 
					using System.Linq;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace Elwig.Documents {
 | 
				
			||||||
 | 
					    public class DeliveryJournal : Document {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public string Filter;
 | 
				
			||||||
 | 
					        public IEnumerable<DeliveryPart> Deliveries;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public DeliveryJournal(string filter, IEnumerable<DeliveryPart> deliveries) : base($"Lieferjournal {filter}") {
 | 
				
			||||||
 | 
					            Filter = filter;
 | 
				
			||||||
 | 
					            Deliveries = deliveries;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public DeliveryJournal(AppDbContext ctx, DateOnly date) :
 | 
				
			||||||
 | 
					            this(date.ToString("dd.MM.yyyy"), ctx.DeliveryParts
 | 
				
			||||||
 | 
					                .Where(p => p.Delivery.DateString == date.ToString("yyy-MM-dd"))
 | 
				
			||||||
 | 
					                .OrderBy(p => p.Delivery.LsNr)
 | 
				
			||||||
 | 
					                .ThenBy(p => p.DPNr)
 | 
				
			||||||
 | 
					                .ToList()) { }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -53,6 +53,8 @@ namespace Elwig.Documents {
 | 
				
			|||||||
                name = "DeliveryNote";
 | 
					                name = "DeliveryNote";
 | 
				
			||||||
            } else if (this is CreditNote) {
 | 
					            } else if (this is CreditNote) {
 | 
				
			||||||
                name = "CreditNote";
 | 
					                name = "CreditNote";
 | 
				
			||||||
 | 
					            } else if (this is DeliveryJournal) {
 | 
				
			||||||
 | 
					                name = "DeliveryJournal";
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
                throw new InvalidOperationException("Invalid document object");
 | 
					                throw new InvalidOperationException("Invalid document object");
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -19,6 +19,7 @@ namespace Elwig.Documents {
 | 
				
			|||||||
            await e.CompileTemplateAsync("BusinessLetter");
 | 
					            await e.CompileTemplateAsync("BusinessLetter");
 | 
				
			||||||
            await e.CompileTemplateAsync("DeliveryNote");
 | 
					            await e.CompileTemplateAsync("DeliveryNote");
 | 
				
			||||||
            await e.CompileTemplateAsync("CreditNote");
 | 
					            await e.CompileTemplateAsync("CreditNote");
 | 
				
			||||||
 | 
					            await e.CompileTemplateAsync("DeliveryJournal");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            Engine = e;
 | 
					            Engine = e;
 | 
				
			||||||
            evtHandler();
 | 
					            evtHandler();
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										47
									
								
								Elwig/Documents/style-deliveryjournal.css
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								Elwig/Documents/style-deliveryjournal.css
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,47 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					h1 {
 | 
				
			||||||
 | 
					    text-align: center;
 | 
				
			||||||
 | 
					    font-size: 24pt;
 | 
				
			||||||
 | 
					    margin-bottom: 2mm;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					h2 {
 | 
				
			||||||
 | 
					    text-align: center;
 | 
				
			||||||
 | 
					    font-size: 14pt;
 | 
				
			||||||
 | 
					    margin-top: 2mm;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					table.journal {
 | 
				
			||||||
 | 
					    font-size: 10pt;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					table.journal thead {
 | 
				
			||||||
 | 
					    font-size: 8pt;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					table.journal th {
 | 
				
			||||||
 | 
					    font-weight: normal;
 | 
				
			||||||
 | 
					    font-style: italic;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					table.journal td {
 | 
				
			||||||
 | 
					    overflow: hidden;
 | 
				
			||||||
 | 
					    white-space: nowrap;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					table.journal .mgnr,
 | 
				
			||||||
 | 
					table.journal .weight {
 | 
				
			||||||
 | 
					    text-align: right;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					table.journal .grad {
 | 
				
			||||||
 | 
					    text-align: center;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					table.journal tr.sum {
 | 
				
			||||||
 | 
					    font-weight: bold;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					table.journal tr.sum td {
 | 
				
			||||||
 | 
					    border-top: 0.5pt solid black;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -7,7 +7,7 @@
 | 
				
			|||||||
    <UseWPF>true</UseWPF>
 | 
					    <UseWPF>true</UseWPF>
 | 
				
			||||||
    <PreserveCompilationContext>true</PreserveCompilationContext>
 | 
					    <PreserveCompilationContext>true</PreserveCompilationContext>
 | 
				
			||||||
    <ApplicationIcon>elwig.ico</ApplicationIcon>
 | 
					    <ApplicationIcon>elwig.ico</ApplicationIcon>
 | 
				
			||||||
    <Version>0.3.1</Version>
 | 
					    <Version>0.3.2</Version>
 | 
				
			||||||
    <SatelliteResourceLanguages>de-AT</SatelliteResourceLanguages>
 | 
					    <SatelliteResourceLanguages>de-AT</SatelliteResourceLanguages>
 | 
				
			||||||
  </PropertyGroup>
 | 
					  </PropertyGroup>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,7 +4,7 @@ using System;
 | 
				
			|||||||
namespace Elwig.Helpers {
 | 
					namespace Elwig.Helpers {
 | 
				
			||||||
    public static class AppDbUpdater {
 | 
					    public static class AppDbUpdater {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public static readonly int RequiredSchemaVersion = 1;
 | 
					        public static readonly int RequiredSchemaVersion = 2;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        private static int _versionOffset = 0;
 | 
					        private static int _versionOffset = 0;
 | 
				
			||||||
        private static readonly Action<SqliteConnection>[] _updaters = new[] {
 | 
					        private static readonly Action<SqliteConnection>[] _updaters = new[] {
 | 
				
			||||||
@@ -42,7 +42,10 @@ namespace Elwig.Helpers {
 | 
				
			|||||||
            var minor = (userVers >> 16) & 0xFF;
 | 
					            var minor = (userVers >> 16) & 0xFF;
 | 
				
			||||||
            var patch = userVers & 0xFFFF;
 | 
					            var patch = userVers & 0xFFFF;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (App.VersionMajor > major || App.VersionMinor > minor || App.VersionPatch > patch) {
 | 
					            if (App.VersionMajor > major ||
 | 
				
			||||||
 | 
					                (App.VersionMajor == major && App.VersionMinor > minor) ||
 | 
				
			||||||
 | 
					                (App.VersionMajor == major && App.VersionMinor == minor && App.VersionPatch > patch))
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
                long vers = (App.VersionMajor << 24) | (App.VersionMinor << 16) | App.VersionPatch;
 | 
					                long vers = (App.VersionMajor << 24) | (App.VersionMinor << 16) | App.VersionPatch;
 | 
				
			||||||
                ExecuteNonQuery(cnx, $"PRAGMA user_version = {vers}");
 | 
					                ExecuteNonQuery(cnx, $"PRAGMA user_version = {vers}");
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
@@ -71,7 +74,11 @@ namespace Elwig.Helpers {
 | 
				
			|||||||
            ExecuteNonQuery(cnx, $"PRAGMA schema_version = {toVersion * 100 + _versionOffset}");
 | 
					            ExecuteNonQuery(cnx, $"PRAGMA schema_version = {toVersion * 100 + _versionOffset}");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        private static void UpdateDbSchema_1_To_2(SqliteConnection cnx) { }
 | 
					        private static void UpdateDbSchema_1_To_2(SqliteConnection cnx) {
 | 
				
			||||||
 | 
					            ExecuteNonQuery(cnx, "DROP VIEW v_area_commitment");
 | 
				
			||||||
 | 
					            ExecuteNonQuery(cnx, "ALTER TABLE delivery_part DROP COLUMN weighing_reason");
 | 
				
			||||||
 | 
					            ExecuteNonQuery(cnx, "ALTER TABLE delivery_part ADD COLUMN weighing_reason TEXT CHECK(NOT (manual_weighing = FALSE AND weighing_reason IS NOT NULL))");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        private static void UpdateDbSchema_2_To_3(SqliteConnection cnx) { }
 | 
					        private static void UpdateDbSchema_2_To_3(SqliteConnection cnx) { }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -193,28 +193,27 @@ namespace Elwig.Helpers {
 | 
				
			|||||||
            if (!searchKeywords.Any())
 | 
					            if (!searchKeywords.Any())
 | 
				
			||||||
                return 0;
 | 
					                return 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return words
 | 
					            return searchKeywords
 | 
				
			||||||
                .Select(w => {
 | 
					                .Select(k => {
 | 
				
			||||||
                    w = w?.ToLower();
 | 
					                    k = k.ToLower();
 | 
				
			||||||
                    var p = w?.ToLower()?.Split(" ");
 | 
					                    var scores = words.Select(w => {
 | 
				
			||||||
                    if (w == null || p == null)
 | 
					                        w = w?.ToLower();
 | 
				
			||||||
                        return 0;
 | 
					                        var p = w?.ToLower()?.Split(" ");
 | 
				
			||||||
 | 
					                        if (w == null || p == null) {
 | 
				
			||||||
                    var t1 = searchKeywords.Where(f => w == f).Select(f => f.Length).OrderDescending().FirstOrDefault(0);
 | 
					                            return 0;
 | 
				
			||||||
                    var t2 = searchKeywords.Where(f => p.Any(a => a == f)).Select(f => f.Length).OrderDescending().FirstOrDefault(0);
 | 
					                        } else if (k == w) {
 | 
				
			||||||
                    var t3 = searchKeywords.Where(f => p.Any(a => a.StartsWith(f))).Select(f => f.Length).OrderDescending().FirstOrDefault(0);
 | 
					                            return 4 + k.Length;
 | 
				
			||||||
                    var t4 = searchKeywords.Where(f => w.Contains(f)).Select(f => f.Length).OrderDescending().FirstOrDefault(0);
 | 
					                        } else if (p.Any(a => a == k)) {
 | 
				
			||||||
                    if (t1 > 0) {
 | 
					                            return 3 + k.Length;
 | 
				
			||||||
                        return 4 + t1;
 | 
					                        } else if (p.Any(a => a.StartsWith(k))) {
 | 
				
			||||||
                    } else if (t2 > 0) {
 | 
					                            return 2 + k.Length;
 | 
				
			||||||
                        return 3 + t2;
 | 
					                        } else if (w.Contains(k)) {
 | 
				
			||||||
                    } else if (t3 > 0) {
 | 
					                            return 1 + k.Length;
 | 
				
			||||||
                        return 2 + t3;
 | 
					                        } else {
 | 
				
			||||||
                    } else if (t4 > 0) {
 | 
					                            return 0;
 | 
				
			||||||
                        return 1 + t4;
 | 
					                        }
 | 
				
			||||||
                    } else {
 | 
					                    });
 | 
				
			||||||
                        return 0;
 | 
					                    return scores.Max() + scores.Count(s => s > 0);
 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
                })
 | 
					                })
 | 
				
			||||||
                .Sum();
 | 
					                .Sum();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -16,20 +16,20 @@ namespace Elwig.Windows {
 | 
				
			|||||||
        protected Control[] ExemptInputs { private get; set; }
 | 
					        protected Control[] ExemptInputs { private get; set; }
 | 
				
			||||||
        protected Control[] RequiredInputs { private get; set; }
 | 
					        protected Control[] RequiredInputs { private get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        private bool _IsEditing;
 | 
					        private bool _isEditing;
 | 
				
			||||||
        private bool _IsCreating;
 | 
					        private bool _isCreating;
 | 
				
			||||||
        protected bool IsEditing {
 | 
					        protected bool IsEditing {
 | 
				
			||||||
            get { return _IsEditing; }
 | 
					            get { return _isEditing; }
 | 
				
			||||||
            set {
 | 
					            set {
 | 
				
			||||||
                _IsEditing = value;
 | 
					                _isEditing = value;
 | 
				
			||||||
                LockContext = IsEditing;
 | 
					                LockContext = IsEditing || IsCreating;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        protected bool IsCreating {
 | 
					        protected bool IsCreating {
 | 
				
			||||||
            get { return _IsCreating; }
 | 
					            get { return _isCreating; }
 | 
				
			||||||
            set {
 | 
					            set {
 | 
				
			||||||
                _IsCreating = value;
 | 
					                _isCreating = value;
 | 
				
			||||||
                LockContext = IsEditing;
 | 
					                LockContext = IsEditing || IsCreating;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        protected bool DoShowWarningWindows = true;
 | 
					        protected bool DoShowWarningWindows = true;
 | 
				
			||||||
@@ -99,7 +99,7 @@ namespace Elwig.Windows {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        abstract protected void UpdateButtons();
 | 
					        abstract protected void UpdateButtons();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        protected override async Task RenewContext() {
 | 
					        protected override async Task OnRenewContext() {
 | 
				
			||||||
            for (int i = 0; i < PlzInputs.Length; i++)
 | 
					            for (int i = 0; i < PlzInputs.Length; i++)
 | 
				
			||||||
                UpdatePlz(PlzInputs[i], PlzOrtInputs[i]);
 | 
					                UpdatePlz(PlzInputs[i], PlzOrtInputs[i]);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -95,8 +95,8 @@ namespace Elwig.Windows {
 | 
				
			|||||||
            ValidateRequiredInputs();
 | 
					            ValidateRequiredInputs();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        protected override async Task RenewContext() {
 | 
					        protected override async Task OnRenewContext() {
 | 
				
			||||||
            await base.RenewContext();
 | 
					            await base.OnRenewContext();
 | 
				
			||||||
            ControlUtils.RenewItemsSource(KgInput, await Context.WbKgs.Select(k => k.AtKg).OrderBy(k => k.Name).ToListAsync(), i => (i as AT_Kg)?.KgNr);
 | 
					            ControlUtils.RenewItemsSource(KgInput, await Context.WbKgs.Select(k => k.AtKg).OrderBy(k => k.Name).ToListAsync(), i => (i as AT_Kg)?.KgNr);
 | 
				
			||||||
            ControlUtils.RenewItemsSource(AreaComTypeInput, await Context.AreaCommitmentTypes.OrderBy(v => v.VtrgId).ToListAsync(), i => (i as AreaComType)?.VtrgId);
 | 
					            ControlUtils.RenewItemsSource(AreaComTypeInput, await Context.AreaCommitmentTypes.OrderBy(v => v.VtrgId).ToListAsync(), i => (i as AreaComType)?.VtrgId);
 | 
				
			||||||
            ControlUtils.RenewItemsSource(WineCultivationInput, await Context.WineCultivations.OrderBy(c => c.Name).ToListAsync(), i => (i as WineCult)?.CultId);
 | 
					            ControlUtils.RenewItemsSource(WineCultivationInput, await Context.WineCultivations.OrderBy(c => c.Name).ToListAsync(), i => (i as WineCult)?.CultId);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -52,8 +52,8 @@ namespace Elwig.Windows {
 | 
				
			|||||||
            FillInputs(App.Client);
 | 
					            FillInputs(App.Client);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        protected override async Task RenewContext() {
 | 
					        protected override async Task OnRenewContext() {
 | 
				
			||||||
            await base.RenewContext();
 | 
					            await base.OnRenewContext();
 | 
				
			||||||
            ControlUtils.RenewItemsSource(SeasonList, await Context.Seasons.OrderByDescending(s => s.Year).ToListAsync(), s => (s as Season)?.Year, null, ControlUtils.RenewSourceDefault.First);
 | 
					            ControlUtils.RenewItemsSource(SeasonList, await Context.Seasons.OrderByDescending(s => s.Year).ToListAsync(), s => (s as Season)?.Year, null, ControlUtils.RenewSourceDefault.First);
 | 
				
			||||||
            var year = (SeasonList.SelectedItem as Season)?.Year;
 | 
					            var year = (SeasonList.SelectedItem as Season)?.Year;
 | 
				
			||||||
            ControlUtils.RenewItemsSource(SeasonModifierList, await Context.Modifiers.Where(m => m.Year == year).OrderBy(m => m.Ordering).ToListAsync(), m => (m as Modifier)?.ModId);
 | 
					            ControlUtils.RenewItemsSource(SeasonModifierList, await Context.Modifiers.Where(m => m.Year == year).OrderBy(m => m.Ordering).ToListAsync(), m => (m as Modifier)?.ModId);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -214,8 +214,8 @@ namespace Elwig.Windows {
 | 
				
			|||||||
            FinishInputFilling();
 | 
					            FinishInputFilling();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        protected override async Task RenewContext() {
 | 
					        protected override async Task OnRenewContext() {
 | 
				
			||||||
            await base.RenewContext();
 | 
					            await base.OnRenewContext();
 | 
				
			||||||
            await RefreshGraphList();
 | 
					            await RefreshGraphList();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,30 +7,32 @@ using System.Windows.Threading;
 | 
				
			|||||||
namespace Elwig.Windows {
 | 
					namespace Elwig.Windows {
 | 
				
			||||||
    public abstract class ContextWindow : Window {
 | 
					    public abstract class ContextWindow : Window {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public static readonly int RenewSec = 10;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        protected AppDbContext Context { get; private set; }
 | 
					        protected AppDbContext Context { get; private set; }
 | 
				
			||||||
        protected bool LockContext { get; set; } = false;
 | 
					        protected bool LockContext { get; set; } = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        private readonly DispatcherTimer ContextRenewTimer;
 | 
					        private readonly DispatcherTimer _timer;
 | 
				
			||||||
        private static readonly int ContextRenewSec = 10;
 | 
					        private bool _renewPending = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public ContextWindow() : base() {
 | 
					        public ContextWindow() : base() {
 | 
				
			||||||
            ContextRenewTimer = new DispatcherTimer();
 | 
					            _timer = new DispatcherTimer();
 | 
				
			||||||
            ContextRenewTimer.Tick += new EventHandler(OnRenewContext);
 | 
					            _timer.Tick += new EventHandler(OnShouldRenewContext);
 | 
				
			||||||
            ContextRenewTimer.Interval = new TimeSpan(0, 0, ContextRenewSec);
 | 
					            _timer.Interval = new TimeSpan(0, 0, RenewSec);
 | 
				
			||||||
            ContextRenewTimer.Start();
 | 
					            _timer.Start();
 | 
				
			||||||
            Context = new();
 | 
					            Context = new();
 | 
				
			||||||
            Loaded += OnLoaded;
 | 
					            Loaded += OnLoaded;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        private void OnRenewContext(object? sender, EventArgs evt) {
 | 
					        private async void OnShouldRenewContext(object? sender, EventArgs evt) {
 | 
				
			||||||
            if (LockContext || !Context.HasBackendChanged) return;
 | 
					            if (!Context.HasBackendChanged) return;
 | 
				
			||||||
            Context.Dispose();
 | 
					            _renewPending = true;
 | 
				
			||||||
            Context = new();
 | 
					            if (LockContext) return;
 | 
				
			||||||
            RenewContext().GetAwaiter().GetResult();
 | 
					            await RenewContext();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        private void OnLoaded(object sender, RoutedEventArgs evt) {
 | 
					        private void OnLoaded(object sender, RoutedEventArgs evt) {
 | 
				
			||||||
            RenewContext().GetAwaiter().GetResult();
 | 
					            OnRenewContext().GetAwaiter().GetResult();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        protected override void OnClosed(EventArgs evt) {
 | 
					        protected override void OnClosed(EventArgs evt) {
 | 
				
			||||||
@@ -38,6 +40,14 @@ namespace Elwig.Windows {
 | 
				
			|||||||
            Context.Dispose();
 | 
					            Context.Dispose();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        abstract protected Task RenewContext();
 | 
					        protected async Task RenewContext() {
 | 
				
			||||||
 | 
					            if (!_renewPending) return;
 | 
				
			||||||
 | 
					            Context.Dispose();
 | 
				
			||||||
 | 
					            Context = new();
 | 
				
			||||||
 | 
					            await OnRenewContext();
 | 
				
			||||||
 | 
					            _renewPending = false;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        abstract protected Task OnRenewContext();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -63,6 +63,10 @@
 | 
				
			|||||||
                          Click="Menu_Print_ShowDeliveryNote_Click"/>
 | 
					                          Click="Menu_Print_ShowDeliveryNote_Click"/>
 | 
				
			||||||
                <MenuItem x:Name="Menu_Print_PrintDeliveryNote" Header="Lieferschein drucken" IsEnabled="False"
 | 
					                <MenuItem x:Name="Menu_Print_PrintDeliveryNote" Header="Lieferschein drucken" IsEnabled="False"
 | 
				
			||||||
                          Click="Menu_Print_PrintDeliveryNote_Click"/>
 | 
					                          Click="Menu_Print_PrintDeliveryNote_Click"/>
 | 
				
			||||||
 | 
					                <MenuItem x:Name="Menu_Print_ShowDeliveryJournalToday" Header="Lieferjournal anzeigen (heute)"
 | 
				
			||||||
 | 
					                          Click="Menu_Print_ShowDeliveryJournalToday_Click"/>
 | 
				
			||||||
 | 
					                <MenuItem x:Name="Menu_Print_ShowDeliveryJournalYesterday" Header="Lieferjournal anzeigen (gestern)"
 | 
				
			||||||
 | 
					                          Click="Menu_Print_ShowDeliveryJournalYesterday_Click"/>
 | 
				
			||||||
            </MenuItem>
 | 
					            </MenuItem>
 | 
				
			||||||
            <MenuItem Header="Exportieren">
 | 
					            <MenuItem Header="Exportieren">
 | 
				
			||||||
                <MenuItem x:Name="Menu_Export_Bki" Header="Traubentransportscheinliste (BKI)"/>
 | 
					                <MenuItem x:Name="Menu_Export_Bki" Header="Traubentransportscheinliste (BKI)"/>
 | 
				
			||||||
@@ -209,7 +213,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                <Label Content="Sorte:" Margin="10,10,0,0" Grid.Column="0"/>
 | 
					                <Label Content="Sorte:" Margin="10,10,0,0" Grid.Column="0"/>
 | 
				
			||||||
                <TextBox x:Name="SortIdInput" Width="36" Grid.Row="1" Grid.Column="1" Margin="0,10,0,0" HorizontalAlignment="Left"
 | 
					                <TextBox x:Name="SortIdInput" Width="36" Grid.Row="1" Grid.Column="1" Margin="0,10,0,0" HorizontalAlignment="Left"
 | 
				
			||||||
                         TextChanged="SortIdInput_TextChanged" LostFocus="SortIdInput_LostFocus"  KeyUp="Input_KeyUp"/>
 | 
					                         TextChanged="SortIdInput_TextChanged" LostFocus="SortIdInput_LostFocus" KeyUp="Input_KeyUp"/>
 | 
				
			||||||
                <ComboBox x:Name="WineVarietyInput" Grid.Row="1" Grid.Column="1" Margin="41,10,10,10"
 | 
					                <ComboBox x:Name="WineVarietyInput" Grid.Row="1" Grid.Column="1" Margin="41,10,10,10"
 | 
				
			||||||
                          ItemTemplate="{StaticResource WineVarietyTemplate}" TextSearch.TextPath="Name" 
 | 
					                          ItemTemplate="{StaticResource WineVarietyTemplate}" TextSearch.TextPath="Name" 
 | 
				
			||||||
                          SelectionChanged="WineVarietyInput_SelectionChanged" KeyUp="Input_KeyUp"/>
 | 
					                          SelectionChanged="WineVarietyInput_SelectionChanged" KeyUp="Input_KeyUp"/>
 | 
				
			||||||
@@ -230,20 +234,20 @@
 | 
				
			|||||||
                <Label Content="Gradation:" Margin="10,10,10,10"/>
 | 
					                <Label Content="Gradation:" Margin="10,10,10,10"/>
 | 
				
			||||||
                <Grid Grid.Column="1" Width="54" Height="25" Margin="0,10,10,10" HorizontalAlignment="Left" VerticalAlignment="Top">
 | 
					                <Grid Grid.Column="1" Width="54" Height="25" Margin="0,10,10,10" HorizontalAlignment="Left" VerticalAlignment="Top">
 | 
				
			||||||
                    <TextBox x:Name="GradationOeInput"  TextAlignment="Right" Padding="2,2,23,2"
 | 
					                    <TextBox x:Name="GradationOeInput"  TextAlignment="Right" Padding="2,2,23,2"
 | 
				
			||||||
                             TextChanged="GradationOeInput_TextChanged" LostFocus="GradationOeInput_LostFocus"/>
 | 
					                             TextChanged="GradationOeInput_TextChanged" LostFocus="GradationOeInput_LostFocus" KeyUp="Input_KeyUp"/>
 | 
				
			||||||
                    <Label Content="°Oe" Margin="0,4,3,0" HorizontalAlignment="Right" FontSize="10"/>
 | 
					                    <Label Content="°Oe" Margin="0,4,3,0" HorizontalAlignment="Right" FontSize="10"/>
 | 
				
			||||||
                </Grid>
 | 
					                </Grid>
 | 
				
			||||||
                <Label Content="=" Margin="60,10,10,10" Grid.Column="1"/>
 | 
					                <Label Content="=" Margin="60,10,10,10" Grid.Column="1"/>
 | 
				
			||||||
                <Grid Grid.Column="1" Width="68" Height="25" Margin="78,10,10,10" HorizontalAlignment="Left" VerticalAlignment="Top">
 | 
					                <Grid Grid.Column="1" Width="68" Height="25" Margin="78,10,10,10" HorizontalAlignment="Left" VerticalAlignment="Top">
 | 
				
			||||||
                    <TextBox x:Name="GradationKmwInput" TextAlignment="Right" Padding="2,2,34,2" SnapsToDevicePixels="True"
 | 
					                    <TextBox x:Name="GradationKmwInput" TextAlignment="Right" Padding="2,2,34,2" SnapsToDevicePixels="True"
 | 
				
			||||||
                             TextChanged="GradationKmwInput_TextChanged" LostFocus="GradationKmwInput_LostFocus"/>
 | 
					                             TextChanged="GradationKmwInput_TextChanged" LostFocus="GradationKmwInput_LostFocus" KeyUp="Input_KeyUp"/>
 | 
				
			||||||
                    <Label Content="°KMW" Margin="0,4,3,0" HorizontalAlignment="Right" FontSize="10"/>
 | 
					                    <Label Content="°KMW" Margin="0,4,3,0" HorizontalAlignment="Right" FontSize="10"/>
 | 
				
			||||||
                </Grid>
 | 
					                </Grid>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                <Label Content="Qualitätsstufe:" Margin="10,40,10,10"/>
 | 
					                <Label Content="Qualitätsstufe:" Margin="10,40,10,10"/>
 | 
				
			||||||
                <ComboBox x:Name="WineQualityLevelInput" Width="146" Margin="0,40,10,10" Grid.Column="1" HorizontalAlignment="Left"
 | 
					                <ComboBox x:Name="WineQualityLevelInput" Width="146" Margin="0,40,10,10" Grid.Column="1" HorizontalAlignment="Left"
 | 
				
			||||||
                          ItemTemplate="{StaticResource WineQualityLevelTemplate}"
 | 
					                          ItemTemplate="{StaticResource WineQualityLevelTemplate}"
 | 
				
			||||||
                          SelectionChanged="WineQualityLevelInput_SelectionChanged"/>
 | 
					                          SelectionChanged="WineQualityLevelInput_SelectionChanged" KeyUp="Input_KeyUp"/>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                <CheckBox x:Name="AbgewertetInput" Content="Abgewertet" IsEnabled="False"
 | 
					                <CheckBox x:Name="AbgewertetInput" Content="Abgewertet" IsEnabled="False"
 | 
				
			||||||
                          VerticalAlignment="Top" HorizontalAlignment="Left" Margin="10,75,10,10" Grid.Column="0" Grid.ColumnSpan="2"/>
 | 
					                          VerticalAlignment="Top" HorizontalAlignment="Left" Margin="10,75,10,10" Grid.Column="0" Grid.ColumnSpan="2"/>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -128,8 +128,9 @@ namespace Elwig.Windows {
 | 
				
			|||||||
            if (sender is not MenuItem m) return;
 | 
					            if (sender is not MenuItem m) return;
 | 
				
			||||||
            var year = int.Parse(m.Header.ToString()?.Split(" ")[^1] ?? Utils.CurrentLastSeason.ToString());
 | 
					            var year = int.Parse(m.Header.ToString()?.Split(" ")[^1] ?? Utils.CurrentLastSeason.ToString());
 | 
				
			||||||
            var d = new SaveFileDialog() {
 | 
					            var d = new SaveFileDialog() {
 | 
				
			||||||
                FileName = $"{App.Client.NameToken}-Traubentransportscheinliste-{year}",
 | 
					                FileName = $"{App.Client.NameToken}-Traubentransportscheinliste-{year}.{Bki.FileExtension}",
 | 
				
			||||||
                DefaultExt = Bki.FileExtension,
 | 
					                DefaultExt = Bki.FileExtension,
 | 
				
			||||||
 | 
					                Filter = "CSV-Datei (*.csv)|*.csv",
 | 
				
			||||||
                Title = $"Traubentransportscheinliste (BKI) speichern unter - Elwig"
 | 
					                Title = $"Traubentransportscheinliste (BKI) speichern unter - Elwig"
 | 
				
			||||||
            };
 | 
					            };
 | 
				
			||||||
            if (d.ShowDialog() == true) {
 | 
					            if (d.ShowDialog() == true) {
 | 
				
			||||||
@@ -140,6 +141,22 @@ namespace Elwig.Windows {
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        private async void Menu_Print_ShowDeliveryJournalToday_Click(object sender, RoutedEventArgs evt) {
 | 
				
			||||||
 | 
					            Mouse.OverrideCursor = Cursors.Wait;
 | 
				
			||||||
 | 
					            var doc = new DeliveryJournal(Context, DateOnly.FromDateTime(Utils.Today));
 | 
				
			||||||
 | 
					            await doc.Generate();
 | 
				
			||||||
 | 
					            Mouse.OverrideCursor = null;
 | 
				
			||||||
 | 
					            doc.Show();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        private async void Menu_Print_ShowDeliveryJournalYesterday_Click(object sender, RoutedEventArgs evt) {
 | 
				
			||||||
 | 
					            Mouse.OverrideCursor = Cursors.Wait;
 | 
				
			||||||
 | 
					            var doc = new DeliveryJournal(Context, DateOnly.FromDateTime(Utils.Today.AddDays(-1)));
 | 
				
			||||||
 | 
					            await doc.Generate();
 | 
				
			||||||
 | 
					            Mouse.OverrideCursor = null;
 | 
				
			||||||
 | 
					            doc.Show();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        private void OnSecondPassed(object? sender, EventArgs? evt) {
 | 
					        private void OnSecondPassed(object? sender, EventArgs? evt) {
 | 
				
			||||||
            if (IsReceipt && IsCreating) {
 | 
					            if (IsReceipt && IsCreating) {
 | 
				
			||||||
                var now = DateTime.Now;
 | 
					                var now = DateTime.Now;
 | 
				
			||||||
@@ -195,9 +212,14 @@ namespace Elwig.Windows {
 | 
				
			|||||||
            if (sender is not Control ctrl) return;
 | 
					            if (sender is not Control ctrl) return;
 | 
				
			||||||
            if (evt.Key != Key.Enter) return;
 | 
					            if (evt.Key != Key.Enter) return;
 | 
				
			||||||
            if (ctrl == MgNrInput || ctrl == MemberInput) {
 | 
					            if (ctrl == MgNrInput || ctrl == MemberInput) {
 | 
				
			||||||
                SortIdInput.Focus(); SortIdInput.SelectAll();
 | 
					                SortIdInput.Focus();
 | 
				
			||||||
 | 
					                SortIdInput.SelectAll();
 | 
				
			||||||
            } else if (ctrl == SortIdInput || ctrl == WineVarietyInput || ctrl == AttributesInput) {
 | 
					            } else if (ctrl == SortIdInput || ctrl == WineVarietyInput || ctrl == AttributesInput) {
 | 
				
			||||||
                GradationOeInput.Focus(); GradationOeInput.SelectAll();
 | 
					                GradationOeInput.Focus();
 | 
				
			||||||
 | 
					                GradationOeInput.SelectAll();
 | 
				
			||||||
 | 
					            } else if (ctrl == GradationKmwInput || ctrl == GradationOeInput || ctrl == WineQualityLevelInput) {
 | 
				
			||||||
 | 
					                if (WeighingAButton.IsVisible) WeighingAButton.Focus();
 | 
				
			||||||
 | 
					                else WeighingManualButton.Focus();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -410,8 +432,8 @@ namespace Elwig.Windows {
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        protected override async Task RenewContext() {
 | 
					        protected override async Task OnRenewContext() {
 | 
				
			||||||
            await base.RenewContext();
 | 
					            await base.OnRenewContext();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (Member != null) {
 | 
					            if (Member != null) {
 | 
				
			||||||
                if (Context.Members.Find(Member.MgNr) is not Member m) {
 | 
					                if (Context.Members.Find(Member.MgNr) is not Member m) {
 | 
				
			||||||
@@ -651,7 +673,6 @@ namespace Elwig.Windows {
 | 
				
			|||||||
                    WeightInput.Text = $"{res.Weight:N0}";
 | 
					                    WeightInput.Text = $"{res.Weight:N0}";
 | 
				
			||||||
                    ScaleId = s.ScaleId;
 | 
					                    ScaleId = s.ScaleId;
 | 
				
			||||||
                    WeighingId = res.FullWeighingId;
 | 
					                    WeighingId = res.FullWeighingId;
 | 
				
			||||||
                    s.Empty();
 | 
					 | 
				
			||||||
                } else {
 | 
					                } else {
 | 
				
			||||||
                    WeightInput.Text = "";
 | 
					                    WeightInput.Text = "";
 | 
				
			||||||
                    ScaleId = null;
 | 
					                    ScaleId = null;
 | 
				
			||||||
@@ -757,12 +778,19 @@ namespace Elwig.Windows {
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        private void EmptyScale() {
 | 
				
			||||||
 | 
					            var scale = App.Scales.Where(s => s.ScaleId == ScaleId).FirstOrDefault();
 | 
				
			||||||
 | 
					            if (scale == null) return;
 | 
				
			||||||
 | 
					            scale.Empty();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        private async void NewDeliveryPartButton_Click(object sender, RoutedEventArgs evt) {
 | 
					        private async void NewDeliveryPartButton_Click(object sender, RoutedEventArgs evt) {
 | 
				
			||||||
            FinishButton.IsEnabled = false;
 | 
					            FinishButton.IsEnabled = false;
 | 
				
			||||||
            NewDeliveryPartButton.IsEnabled = false;
 | 
					            NewDeliveryPartButton.IsEnabled = false;
 | 
				
			||||||
            NewDeliveryPartButton.Cursor = Cursors.Wait;
 | 
					            NewDeliveryPartButton.Cursor = Cursors.Wait;
 | 
				
			||||||
            DeliveryPartList.IsEnabled = false;
 | 
					            DeliveryPartList.IsEnabled = false;
 | 
				
			||||||
            var p = await UpdateDeliveryPart(DeliveryList.SelectedItem as Delivery, DeliveryPartList.SelectedItem as DeliveryPart);
 | 
					            var p = await UpdateDeliveryPart(DeliveryList.SelectedItem as Delivery, DeliveryPartList.SelectedItem as DeliveryPart);
 | 
				
			||||||
 | 
								EmptyScale();
 | 
				
			||||||
            await RefreshDeliveryList();
 | 
					            await RefreshDeliveryList();
 | 
				
			||||||
            await RefreshDeliveryParts();
 | 
					            await RefreshDeliveryParts();
 | 
				
			||||||
            NewDeliveryPartButton.Cursor = null;
 | 
					            NewDeliveryPartButton.Cursor = null;
 | 
				
			||||||
@@ -778,7 +806,8 @@ namespace Elwig.Windows {
 | 
				
			|||||||
            FinishButton.Cursor = Cursors.Wait;
 | 
					            FinishButton.Cursor = Cursors.Wait;
 | 
				
			||||||
            DeliveryPartList.IsEnabled = false;
 | 
					            DeliveryPartList.IsEnabled = false;
 | 
				
			||||||
            var p = await UpdateDeliveryPart(DeliveryList.SelectedItem as Delivery, DeliveryPartList.SelectedItem as DeliveryPart);
 | 
					            var p = await UpdateDeliveryPart(DeliveryList.SelectedItem as Delivery, DeliveryPartList.SelectedItem as DeliveryPart);
 | 
				
			||||||
            await RefreshDeliveryList();
 | 
								EmptyScale();
 | 
				
			||||||
 | 
								await RefreshDeliveryList();
 | 
				
			||||||
            await RefreshDeliveryParts();
 | 
					            await RefreshDeliveryParts();
 | 
				
			||||||
            if (p?.Delivery != null) {
 | 
					            if (p?.Delivery != null) {
 | 
				
			||||||
                Mouse.OverrideCursor = Cursors.Wait;
 | 
					                Mouse.OverrideCursor = Cursors.Wait;
 | 
				
			||||||
@@ -789,10 +818,12 @@ namespace Elwig.Windows {
 | 
				
			|||||||
                    doc.Show();
 | 
					                    doc.Show();
 | 
				
			||||||
                } else {
 | 
					                } else {
 | 
				
			||||||
                    await doc.Print(2);
 | 
					                    await doc.Print(2);
 | 
				
			||||||
 | 
					                    Activate();
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            FinishButton.Cursor = null;
 | 
					            FinishButton.Cursor = null;
 | 
				
			||||||
            DeliveryList.SelectedItem = null;
 | 
					            DeliveryList.SelectedItem = null;
 | 
				
			||||||
 | 
					            await RenewContext();
 | 
				
			||||||
            RefreshInputs();
 | 
					            RefreshInputs();
 | 
				
			||||||
            InitInputs();
 | 
					            InitInputs();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@@ -815,6 +846,7 @@ namespace Elwig.Windows {
 | 
				
			|||||||
                DisableWeighingButtons();
 | 
					                DisableWeighingButtons();
 | 
				
			||||||
                HideFinishNewPartDeliveryCancelButtons();
 | 
					                HideFinishNewPartDeliveryCancelButtons();
 | 
				
			||||||
                ShowNewEditDeleteButtons();
 | 
					                ShowNewEditDeleteButtons();
 | 
				
			||||||
 | 
					                await RenewContext();
 | 
				
			||||||
                RefreshInputs();
 | 
					                RefreshInputs();
 | 
				
			||||||
                ClearInputStates();
 | 
					                ClearInputStates();
 | 
				
			||||||
                LockInputs();
 | 
					                LockInputs();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -131,8 +131,8 @@ namespace Elwig.Windows {
 | 
				
			|||||||
            ValidateRequiredInputs();
 | 
					            ValidateRequiredInputs();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        protected override async Task RenewContext() {
 | 
					        protected override async Task OnRenewContext() {
 | 
				
			||||||
            await base.RenewContext();
 | 
					            await base.OnRenewContext();
 | 
				
			||||||
            ControlUtils.RenewItemsSource(BranchInput, await Context.Branches.OrderBy(b => b.Name).ToListAsync(), i => (i as Branch)?.ZwstId);
 | 
					            ControlUtils.RenewItemsSource(BranchInput, await Context.Branches.OrderBy(b => b.Name).ToListAsync(), i => (i as Branch)?.ZwstId);
 | 
				
			||||||
            ControlUtils.RenewItemsSource(DefaultKgInput, await Context.WbKgs.Select(k => k.AtKg).OrderBy(k => k.Name).ToListAsync(), i => (i as AT_Kg)?.KgNr);
 | 
					            ControlUtils.RenewItemsSource(DefaultKgInput, await Context.WbKgs.Select(k => k.AtKg).OrderBy(k => k.Name).ToListAsync(), i => (i as AT_Kg)?.KgNr);
 | 
				
			||||||
            await RefreshMemberList();
 | 
					            await RefreshMemberList();
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user