diff --git a/.gitignore b/.gitignore index fdb746bfd..c66999f80 100644 --- a/.gitignore +++ b/.gitignore @@ -622,6 +622,8 @@ obj /CustomerDlls /Dakota/bin /Dakota/obj +/DakotaSender/bin +/DakotaSender/obj /BeWoDatabaseTerminator/BeWoDatabaseTerminator/bin/Debug /BeWoDatabaseTerminator/BeWoDatabaseTerminator/bin/Release /ReportImp/TestLWV diff --git a/BeWo/AI/AiChatController.cs b/BeWo/AI/AiChatController.cs new file mode 100644 index 000000000..616133547 --- /dev/null +++ b/BeWo/AI/AiChatController.cs @@ -0,0 +1,45 @@ +using BeWo.AI.View; +using BeWo.View; +using BS.Shared; +using BS.Shared.Translation; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BeWo.AI +{ + class AiChatController + { + private static void CreateAiChatWindow(AiChatView view, double height, double width) + { + var beWoWindow = BeWoWindowBuilder.GetBeWoWindow(Translator.Translate("Frage unsere KI"), view, height, width); + + view.CloseButtonClicked += () => beWoWindow.Close(); + + beWoWindow.ShowDialog(); + } + + public static void ShowAiChatViewForServiceRecords(long c2sOid, DateTime start, DateTime end, double height, double width) + { + var ctrl = new AiChatView(); + ctrl.InitServiceRecordQuery(c2sOid, start, end); + CreateAiChatWindow(ctrl, height, width); + } + + public static void ShowAiChatViewForSingleCustomer(long customerOid, double height, double width) + { + var ctrl = new AiChatView(); + ctrl.InitSingleCustomerQuery(customerOid); + CreateAiChatWindow(ctrl, height, width); + } + + public static void ShowAiChatViewForObjects(TableID tableId, double height, double width) + { + var ctrl = new AiChatView(); + ctrl.InitObjectQuery(tableId); + CreateAiChatWindow(ctrl, height, width); + } + } +} diff --git a/BeWo/AI/View/AiChatView.xaml.cs b/BeWo/AI/View/AiChatView.xaml.cs index 344b919b3..535d21ed6 100644 --- a/BeWo/AI/View/AiChatView.xaml.cs +++ b/BeWo/AI/View/AiChatView.xaml.cs @@ -31,21 +31,41 @@ namespace BeWo.AI.View { public partial class AiChatView : BeWoView { - public event Action CloseButtonClicked; + + int type = 0; //0 = ServiceRecordQuery, 1 = SingleCustomerQuery, 2 = AllCustomerQuery + private long cb2scOid; + private long customerOid; + private TableID tableID; private DateTime startDate; private DateTime endDate; - public AiChatView(long c2sOid, DateTime start, DateTime end) + public AiChatView() { InitializeComponent(); + + } + + public void InitServiceRecordQuery(long c2sOid, DateTime start, DateTime end) + { + type = 0; this.cb2scOid = c2sOid; this.startDate = start; this.endDate = end; } - - + + public void InitSingleCustomerQuery(long customerOid) + { + type = 1; + this.customerOid = customerOid; + } + + public void InitObjectQuery(TableID tableId) + { + type = 2; + tableID = tableId; + } private void ReloadViewModel(AiChatDC dc) { @@ -57,14 +77,39 @@ namespace BeWo.AI.View var acdc = new AiChatDC(); acdc.Prompt = TextBoxAnfrage.Text; - ServiceFacade.DoOperationsServiceAsync(s => s.CreateAiQueryForServiceRecords(acdc, cb2scOid, startDate, endDate), - dc => - { - this.Dispatch(delegate + if (type == 1) + { + ServiceFacade.DoOperationsServiceAsync(s => s.CreateAiQueryForSingleCustomer(acdc, customerOid), + dc => { - ReloadViewModel(dc); + this.Dispatch(delegate + { + ReloadViewModel(dc); + }); }); - }); + } + else if (type == 2) + { + ServiceFacade.DoOperationsServiceAsync(s => s.CreateAiQueryForObjects(acdc, (int)tableID), + dc => + { + this.Dispatch(delegate + { + ReloadViewModel(dc); + }); + }); + } + else + { + ServiceFacade.DoOperationsServiceAsync(s => s.CreateAiQueryForServiceRecords(acdc, cb2scOid, startDate, endDate), + dc => + { + this.Dispatch(delegate + { + ReloadViewModel(dc); + }); + }); + } } private void btnClose_Click(object sender, RoutedEventArgs e) { diff --git a/BeWo/BeWo.csproj b/BeWo/BeWo.csproj index 79227a577..1da2cef25 100644 --- a/BeWo/BeWo.csproj +++ b/BeWo/BeWo.csproj @@ -39,16 +39,16 @@ false true false - https://app.ownsoft.de/ + https://app.ownsoft.de/test/ de-DE BeWoPlaner ownSoft GmbH - 2.0.1.240 + 2.0.1.247 true publish.htm false true - 241 + 248 2.0.1.%2a false true @@ -826,6 +826,7 @@ MSBuild:Compile Designer + AiChatView.xaml diff --git a/BeWo/BeWo.csproj.user b/BeWo/BeWo.csproj.user index 3eff8c8d2..5b9016668 100644 --- a/BeWo/BeWo.csproj.user +++ b/BeWo/BeWo.csproj.user @@ -2,7 +2,7 @@ D:\Projects\beyondsoft\BeWoPlaner\Publish\|publish\|D:\Projects\beyondsoft\BeWoPlaner\PublishTest\|D:\Projects\beyondsoft\BeWoPlaner\PublishDev\|D:\Projects\beyondsoft\BeWoPlaner\Publish45\ - https://app.ownsoft.de/|https://app.ownsoft.de/test/|https://app.ownsoft.de/dev/|http://app.ownsoft.de/dev/|http://app.beyondsoft.de/dev/ + https://app.ownsoft.de/test/|https://app.ownsoft.de/|https://app.ownsoft.de/dev/|http://app.ownsoft.de/dev/|http://app.beyondsoft.de/dev/ https://app.ownsoft.de/|https://app.ownsoft.de/bewoplaner.application/ diff --git a/BeWo/BeWoApp.xaml.cs b/BeWo/BeWoApp.xaml.cs index 072729246..59ab70e2e 100644 --- a/BeWo/BeWoApp.xaml.cs +++ b/BeWo/BeWoApp.xaml.cs @@ -50,7 +50,7 @@ namespace BeWo public static MainControl MainControl; public static string ShortVersion = "3.21"; - public static string Version = "Version 3.21"; + public static string Version = "Version 3.21.3 (GKV Test)"; public static int RenderTier = 0; @@ -368,10 +368,10 @@ namespace BeWo showDienstplanung = true; } - val = UserSettingsUtils.GetSettingValue(_Mandator.Settings, SettingsKeys.Arbeitszeiterfassung); + val = UserSettingsUtils.GetSettingValue(_Mandator.Settings, SettingsKeys.ShowWorktime); if (val != null && val.Equals("1")) { - AppSettings.Arbeitszeiterfassung = true; + AppSettings.ShowWorktime = true; } val = UserSettingsUtils.GetSettingValue(_Mandator.Settings, SettingsKeys.EnableArbeitszeiterfassung); if (val != null && val.Equals("1")) @@ -508,6 +508,9 @@ namespace BeWo val = UserSettingsUtils.GetSettingValue(_Mandator.Settings, SettingsKeys.ShowAI); AppSettings.ShowAI = val != null && val.Equals("1"); + val = UserSettingsUtils.GetSettingValue(_Mandator.Settings, SettingsKeys.ShowAIInternal); + AppSettings.ShowAIInternal = val != null && val.Equals("1"); + val = UserSettingsUtils.GetSettingValue(_Mandator.Settings, SettingsKeys.MoKSessionTimeout); if(int.TryParse(val, out var sessionTimeout)) { @@ -592,6 +595,8 @@ namespace BeWo showHilfeplanBezeichnung = true; AppSettings.AllowStorno = true; AppSettings.ShowAI = true; + AppSettings.ShowAIInternal = true; + AppSettings.ShowWorktime = true; //showInfoButtonInCalender = true; #endif @@ -642,7 +647,7 @@ namespace BeWo String url = ""; #if DEBUG url = String.Format("http://localhost:3777/Host"); - //return new Uri("https://app5.bewoplaner.de/service"); + //return new Uri("https://app4.bewoplaner.de/service"); //url = String.Format("app1.bewoplaner.de/service"); #endif @@ -851,9 +856,6 @@ namespace BeWo { if (MainControl != null) { - - - MainControl.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action) (() => { UserControl exControl = null; @@ -920,7 +922,7 @@ namespace BeWo base.OnStartup(e); //AppDomain.CurrentDomain.UnhandledException += (s, ex) => ShowError(null, ex.ExceptionObject as Exception, true); - + Dispatcher.UnhandledException += (s, ex) => { @@ -1154,7 +1156,11 @@ namespace BeWo { abc.Close(); } - } + else if (abc.Title.IndexOf("Popup") >= 0) + { + abc.Close(); + } + } MainControl.HideCurrentModalViewWindows(); diff --git a/BeWo/Core/Config/AppSettings.cs b/BeWo/Core/Config/AppSettings.cs index 8256fc352..3126d116d 100644 --- a/BeWo/Core/Config/AppSettings.cs +++ b/BeWo/Core/Config/AppSettings.cs @@ -425,7 +425,7 @@ namespace BeWo.Core.Config public bool DontShowSpitzabrechnung { get; set; } public bool ShowDienstplanung { get; set; } - public bool Arbeitszeiterfassung { get; set; } + public bool ShowWorktime { get; set; } public bool EnableArbeitszeiterfassung { get; set; } public bool EnableAutomaticPauses { get; set; } public bool EnableRestTimeWarning { get; set; } @@ -447,6 +447,8 @@ namespace BeWo.Core.Config public bool ShowAI { get; set; } + public bool ShowAIInternal { get; set; } + public bool AllowGkvAbrechnung { get; set; } public bool ShowImportAbschlagszahlungen { get; set; } diff --git a/BeWo/Core/Service/Cache.cs b/BeWo/Core/Service/Cache.cs index 837c44ef3..2b4b7c043 100644 --- a/BeWo/Core/Service/Cache.cs +++ b/BeWo/Core/Service/Cache.cs @@ -347,7 +347,8 @@ namespace BeWo.Core.Service } if (ve == null) { - return new ValueListEntryDC {TypeDescription = ""}; + return new ValueListEntryDC {TypeDescription = "", ValueListEntryOid = oid }; + //return new ValueListEntryDC { TypeDescription = "" }; } return ve; } diff --git a/BeWo/LoginControl.xaml.cs b/BeWo/LoginControl.xaml.cs index 39df78623..364287634 100644 --- a/BeWo/LoginControl.xaml.cs +++ b/BeWo/LoginControl.xaml.cs @@ -248,6 +248,10 @@ namespace BeWo private static String PUB_KEY_E1 = "04245C2DA22AFD1C4BA65D97732731ACB2A06962EF65E8A6B0F0AC4B9FFF1C0B700FD3982F4DFC0F009B37F074055732972E05EF2A4325A3FB6E342713F64F7E69D302995EEB244792C1249BE6B1218FC12481FC68CC1F69BA58F51922F774C616"; + private static String PUB_KEY_R11 = "3082010A0282010100BA87BC5C1B0039CBCA0ACDD46710F9013CA54EA561CB26CA52FB1501B7B928F5281EED27B324183967090C08ECE03AB03B770EBDF3E53954410C4EAE41D69974DE51DBEF7BFF58BDA8B713F6DE31D5F272C9726A0B8374959C4600641499F3B1D922D9CDA892AA1C267A3FFEEF58057B089581DB710F8EFBE33109BB09BE504D5F8F91763D5A9D9E83F2E9C466B3E106664348188065A037189A9B843297B1B2BDC4F815009D2788FBE26317966C9B27674BC4DB285E69C279F0495CE02450E1C4BCA105AC7B406D00B4C2413FA758B82FC55C9BA5BB099EF1FEEBB08539FDA80AEF45C478EB652AC2CF5F3CDEE35C4D1BF70B272BAA0B4277534F796A1D87D90203010001"; + + private static String PUB_KEY_R10 = "3082010A0282010100CF57E5E6C45412EDB447FEC92758764650288C1D3E88DF059DD5B51829BDDDB55ABFFAF6CEA3BEAF00214B625A5A3C012FC55803F689FF8E1143EBC1B5E01407968F6F1FD7E7BA8139097565B7C2AF185B372628E7A3F4072B6D1AFFAB58BC95AE40FFE9CB57C4B55B7F780D1861BC17E754C6BB4991CD6E18D18085EEA66536BC74EABC504CEAFC21F338169394BAB0D36B3806CD16127ACA5275C8AD76B2C29C5D98455C6F617BC62DEE3C13528601D957E6381CDF8DB51F92919AE74A1CCC45A87255F0B0E6A307ECFDA71B669E3F488B71847158C93AFAEF5EF25B442B3C74E78FB247C1076ACD9AB70D96F712812651540AEC61F6F7F5E2F28AC8950D8D0203010001"; + private bool PinPublicKey(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslpolicyerrors) { @@ -261,7 +265,11 @@ namespace BeWo foreach (var element in chain.ChainElements) { String pk = element.Certificate.GetPublicKeyString(); - if (pk == PUB_KEY_X3 || pk == PUB_KEY_R3 || pk == PUB_KEY_E1) + String testx3 = PUB_KEY_X3; + String testr3 = PUB_KEY_R3; + String teste1 = PUB_KEY_E1; + String r11 = PUB_KEY_R11; + if (pk == PUB_KEY_X3 || pk == PUB_KEY_R3 || pk == PUB_KEY_E1 || pk == PUB_KEY_R11 || pk == PUB_KEY_R10) { chainContainsPk = true; } @@ -286,6 +294,58 @@ namespace BeWo private bool CheckStatusMessage(String url) { + //try + //{ + // using (WebClient client = new WebClient()) + // { + // //MessageBox.Show(hostAddress); + // byte[] response = client.UploadValues(url, "POST", new NameValueCollection()); + + // String message = System.Text.Encoding.UTF8.GetString(response); + + // //zum testen: + // //using (var myFile = new StreamReader("C:\\temp\\testxaml.txt", Encoding.Default)) + // //{ + // // message = myFile.ReadToEnd(); + // // myFile.Close(); + // //} + + // if (!String.IsNullOrWhiteSpace(message) && message.Trim().Length > 2) + // { + // String ende = message.Substring(message.Length - 2); + + // message = message.Replace("\\n", "\n"); + // message = message.Substring(0, message.Length - 2); + // MessageDialog dlg = new MessageDialog(); + + // if (message.Contains("<") && message.Contains(">")) + // { + // dlg.SetXaml(message); + // } + // else + // { + // dlg.Message = message; + // } + + + + // dlg.ShowDialog(); + // if (ende.EndsWith(";0")) + // { + // return false; + // } + + // } + + // } + //} + //catch (Exception ex) + //{ + // //MessageBox.Show(String.Format("Fehler beim Prüfen der Kundennummer: {0}\n\n{1}", ex.Message, ex.StackTrace)); + + //} + + //return true; #if DEBUG //String message = @"Sehr geehrte Kundin, sehr geehrter Kunde, @@ -697,7 +757,7 @@ namespace BeWo } #if DEBUG - if (!CheckStatusMessage(String.Format(GETSTATUSMESSAGE_URL, profile.Tenant, BeWoApp.ShortVersion))) + if (!CheckStatusMessage(String.Format(GETSTATUSMESSAGE_URL + "&pre", profile.Tenant, BeWoApp.ShortVersion))) { return; } @@ -924,6 +984,8 @@ namespace BeWo { if (result == UserValidationResult.UserValidTwoFactorAuthenticationNeeded) { + Translator t = new Translator(new MultiLanguage.ServiceTranslator()); + grid_root.Children.Remove(lWaitLayer); var dlg = new TwoFactorAuthMessageDialog(lUserName, lPassword); var message = Translator.Translate("Zwei Faktor Authentifizierung erforderlich"); @@ -1237,9 +1299,9 @@ namespace BeWo #if DEBUG //CB ZUM TESTEN - //BeWoApp.Tenant = "9876543210"; - //BeWoApp.ServerName = "4"; - //BeWoApp.ServerAddress = "app4.bewoplaner.de"; + //BeWoApp.Tenant = "6000000000"; + //BeWoApp.ServerName = "6"; + //BeWoApp.ServerAddress = "app6.bewoplaner.de"; #endif SaveSelectedProfile(profile); //button_login.IsEnabled = true; @@ -1394,6 +1456,10 @@ namespace BeWo Tenant = ptenant; if (Name == null) Name = String.Empty; + if (!String.IsNullOrEmpty(Tenant)) + { + Tenant = Tenant.Trim(); + } } public override string ToString() diff --git a/BeWo/ServiceProxy/Generated.cs b/BeWo/ServiceProxy/Generated.cs index 00fc5a290..1a7b9c55a 100644 --- a/BeWo/ServiceProxy/Generated.cs +++ b/BeWo/ServiceProxy/Generated.cs @@ -5465,6 +5465,15 @@ namespace BeWo.ServiceProxy "t", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] BS.Shared.DataContracts.AiChatDC CreateAiQueryForServiceRecords(BS.Shared.DataContracts.AiChatDC acdc, long cb2scOid, System.DateTime startdate, System.DateTime enddate); + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsService/CreateAiQueryForSingleCustomer", ReplyAction="http://tempuri.org/IOperationsService/CreateAiQueryForSingleCustomerResponse")] + [System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsService/CreateAiQueryForSingleCustomerBeWoFaultFaul" + + "t", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] + BS.Shared.DataContracts.AiChatDC CreateAiQueryForSingleCustomer(BS.Shared.DataContracts.AiChatDC acdc, long customerOid); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsService/CreateAiQueryForObjects", ReplyAction="http://tempuri.org/IOperationsService/CreateAiQueryForObjectsResponse")] + [System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsService/CreateAiQueryForObjectsBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] + BS.Shared.DataContracts.AiChatDC CreateAiQueryForObjects(BS.Shared.DataContracts.AiChatDC acdc, long objectTid); + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsService/DeleteCertainDienstEintragOutOfTable", ReplyAction="http://tempuri.org/IOperationsService/DeleteCertainDienstEintragOutOfTableRespons" + "e")] [System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsService/DeleteCertainDienstEintragOutOfTableBeWoFau" + @@ -7475,6 +7484,16 @@ namespace BeWo.ServiceProxy return base.Channel.CreateAiQueryForServiceRecords(acdc, cb2scOid, startdate, enddate); } + public BS.Shared.DataContracts.AiChatDC CreateAiQueryForSingleCustomer(BS.Shared.DataContracts.AiChatDC acdc, long customerOid) + { + return base.Channel.CreateAiQueryForSingleCustomer(acdc, customerOid); + } + + public BS.Shared.DataContracts.AiChatDC CreateAiQueryForObjects(BS.Shared.DataContracts.AiChatDC acdc, long objectTid) + { + return base.Channel.CreateAiQueryForObjects(acdc, objectTid); + } + public void DeleteCertainDienstEintragOutOfTable(long dienstEintragOid) { base.Channel.DeleteCertainDienstEintragOutOfTable(dienstEintragOid); diff --git a/BeWo/View/BeWoWindowBuilder.cs b/BeWo/View/BeWoWindowBuilder.cs index c4f934be4..4ded5d01a 100644 --- a/BeWo/View/BeWoWindowBuilder.cs +++ b/BeWo/View/BeWoWindowBuilder.cs @@ -72,6 +72,7 @@ namespace BeWo.View beWoWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner; beWoWindow.Owner = BeWoApp.CurrentBeWo.MainWindow; + beWoWindow.Title = "Popup"; beWoWindow.rootGroupBox.Header = title; return beWoWindow; diff --git a/BeWo/View/Detail/Accounting/GkvAbrechnungOverview.xaml.cs b/BeWo/View/Detail/Accounting/GkvAbrechnungOverview.xaml.cs index 07c76b993..94441d6a5 100644 --- a/BeWo/View/Detail/Accounting/GkvAbrechnungOverview.xaml.cs +++ b/BeWo/View/Detail/Accounting/GkvAbrechnungOverview.xaml.cs @@ -106,6 +106,8 @@ namespace BeWo.View.Detail.Accounting CriteriaOperator.FromLambda(gkv => gkv.AbrechnungsZeitraumStart <= filter_start && filter_ende <= gkv.AbrechnungsZeitraumEnde)); } } + + gridView.BestFitColumns(); } private void UpdateGkvAbrechnungList(IList dcList) @@ -120,8 +122,6 @@ namespace BeWo.View.Detail.Accounting datagrid_gkvAbrechnungen.Visibility = Visibility.Visible; UpdateDataGridFilter(); - - gridView.BestFitColumns(); }); @@ -137,10 +137,13 @@ namespace BeWo.View.Detail.Accounting if (checked_invoice_bases.Count == 0) { +#if DEBUG if (MessageBox.Show("Sie haben keine Rechnung hinzugefügt. Wollen Sie fortfahren?", "GKV-Abrechnung erstellen", MessageBoxButton.YesNo, MessageBoxImage.Warning) != MessageBoxResult.Yes) - { return; - } +#else + MessageBox.Show("Sie haben keine Rechnung hinzugefügt.", "GKV-Abrechnung erstellen", MessageBoxButton.OK, MessageBoxImage.Warning); + return; +#endif } MainControl.CloseCurrentPopUp(); @@ -203,6 +206,11 @@ namespace BeWo.View.Detail.Accounting private void btn_force_send_Click(object sender, RoutedEventArgs e) { +#if DEBUG + +#else + return; +#endif var vm = datagrid_gkvAbrechnungen.GetCurrentValue(); @@ -225,7 +233,13 @@ namespace BeWo.View.Detail.Accounting var state = dc.GetState(); - var can_send = state == GkvState.NoSend || state == GkvState.Error; + var can_send = false; + + can_send |= state == GkvState.NoSend; + can_send |= state == GkvState.Error; +#if DEBUG + can_send |= state == GkvState.ErrorFatal; +#endif if (!can_send) { @@ -294,7 +308,7 @@ namespace BeWo.View.Detail.Accounting var ed = (CheckEdit)e.Editor; ed.Tag = e.Row; } - else if (int.TryParse(datagrid_gkvAbrechnungen.CurrentColumn.Tag.ToString(), out int tag) && gridView.ActiveEditor is TextEdit) + else if (int.TryParse(datagrid_gkvAbrechnungen.CurrentColumn.Tag?.ToString(), out int tag) && gridView.ActiveEditor is TextEdit) { ((TextEdit)gridView.ActiveEditor).SetPropertyValue("MaxLength", tag); } @@ -318,7 +332,7 @@ namespace BeWo.View.Detail.Accounting if (gkvAbrechnungVM is null) return; - if (!gkvAbrechnungVM.Bezahlt && DateTime.Now - gkvAbrechnungVM.ErstelltAm > TimeSpan.FromDays(28)) + if (GkvAbrechnungVM.GetState(gkvAbrechnungVM) == GkvState.OldAndNoFeedback) { e.Result = Brushes.Orange; e.Handled = true; diff --git a/BeWo/View/Detail/Accounting/NewGkvAbrechnungPopUpView.xaml.cs b/BeWo/View/Detail/Accounting/NewGkvAbrechnungPopUpView.xaml.cs index b058d74d6..a081564c1 100644 --- a/BeWo/View/Detail/Accounting/NewGkvAbrechnungPopUpView.xaml.cs +++ b/BeWo/View/Detail/Accounting/NewGkvAbrechnungPopUpView.xaml.cs @@ -60,6 +60,17 @@ namespace BeWo.View.Detail.Accounting } } + public DateTime FilterStart + { + get => ViewModel.AbrechnungsZeitraumStart.Value; + set => ViewModel.AbrechnungsZeitraumStart = value; + } + public DateTime FilterEnde + { + get => ViewModel.AbrechnungsZeitraumEnde.Value; + set => ViewModel.AbrechnungsZeitraumEnde = value; + } + public List InvoiceBaseDcs { set @@ -143,8 +154,8 @@ namespace BeWo.View.Detail.Accounting } private void RefreshInvoiceBases() => RefreshInvoiceBases(_LoadedInvoiceBaseOid); - private void RefreshInvoiceBases(DateTime? start, DateTime? ende) => RefreshInvoiceBases(_LoadedInvoiceBaseOid, start ?? ViewModel?.AbrechnungsZeitraumStart, ende ?? ViewModel?.AbrechnungsZeitraumEnde); - private void RefreshInvoiceBases(long? costOid) => RefreshInvoiceBases(costOid, ViewModel?.AbrechnungsZeitraumStart, ViewModel?.AbrechnungsZeitraumEnde); + private void RefreshInvoiceBases(DateTime? start, DateTime? ende) => RefreshInvoiceBases(_LoadedInvoiceBaseOid, start ?? FilterStart, ende ?? FilterEnde); + private void RefreshInvoiceBases(long? costOid) => RefreshInvoiceBases(costOid, FilterStart, FilterEnde); private void RefreshInvoiceBases(long? costOid, DateTime? start, DateTime? ende) { if (costOid != null && start != null && ende != null && ende >= start) @@ -223,12 +234,50 @@ namespace BeWo.View.Detail.Accounting private void DateEdit_EditValueChanged(object sender, DevExpress.Xpf.Editors.EditValueChangedEventArgs e) { - RefreshInvoiceBases((DateTime)e.NewValue, null); + if (_Viewmodel is null) + return; + + if (FilterStart == (DateTime)e.NewValue) + return; + + // Von + FilterStart = (DateTime)e.NewValue; + + if(FilterEnde < FilterStart) + { + FilterEnde = new DateTime(FilterStart.Year, FilterStart.Month, 1).AddMonths(1).AddTicks(-1); + } + + if(FilterEnde.Year != FilterStart.Year) + { + FilterEnde = new DateTime(FilterStart.Year, FilterStart.Month, 1).AddMonths(1).AddTicks(-1); + } + + RefreshInvoiceBases(); } private void DateEdit2_EditValueChanged(object sender, DevExpress.Xpf.Editors.EditValueChangedEventArgs e) { - RefreshInvoiceBases(null, (DateTime)e.NewValue); + if (_Viewmodel is null) + return; + + if (FilterEnde == (DateTime)e.NewValue) + return; + + // Bis + FilterEnde = (DateTime)e.NewValue; + + if (FilterEnde < FilterStart) + { + FilterStart = new DateTime(FilterEnde.Year, 1, 1); + } + + if (FilterEnde.Year != FilterStart.Year) + { + FilterStart = new DateTime(FilterEnde.Year, FilterEnde.Month, 1); + } + + RefreshInvoiceBases(); } } } \ No newline at end of file diff --git a/BeWo/View/Detail/Accounting/ServiceInvoiceCreatePopUpView.xaml b/BeWo/View/Detail/Accounting/ServiceInvoiceCreatePopUpView.xaml index 082070e1e..22c2af212 100644 --- a/BeWo/View/Detail/Accounting/ServiceInvoiceCreatePopUpView.xaml +++ b/BeWo/View/Detail/Accounting/ServiceInvoiceCreatePopUpView.xaml @@ -68,8 +68,11 @@ -