From 03ece0cd5025285cc6189072560fbfc4cdc00762 Mon Sep 17 00:00:00 2001 From: Christian Date: Wed, 21 Feb 2024 16:53:55 +0100 Subject: [PATCH] Button Import Abschlagszahlungen. Bugfix Kette Bericht --- BeWo/BeWoApp.xaml.cs | 4 + BeWo/Core/Config/AppSettings.cs | 2 + .../AccountingTransactionBookingView.xaml | 11 ++- .../AccountingTransactionBookingView.xaml.cs | 96 +++++++++++++++++++ .../BeWoDatabaseTerminator/Program.cs | 31 +++--- .../Kette2/AuswertungSozialpsychiatrie.cs | 4 +- ReportImp/Kette2/QueryListReport.cs | 6 +- Shared/Core/SettingsKeys.cs | 3 + 8 files changed, 136 insertions(+), 21 deletions(-) diff --git a/BeWo/BeWoApp.xaml.cs b/BeWo/BeWoApp.xaml.cs index b315475da..f9c92707c 100644 --- a/BeWo/BeWoApp.xaml.cs +++ b/BeWo/BeWoApp.xaml.cs @@ -491,6 +491,10 @@ namespace BeWo val = UserSettingsUtils.GetSettingValue(_Mandator.Settings, SettingsKeys.AllowGkvAbrechnung); AppSettings.AllowGkvAbrechnung = val != null && val.Equals("1"); + val = UserSettingsUtils.GetSettingValue(_Mandator.Settings, SettingsKeys.ShowImportAbschlagszahlungen); + AppSettings.ShowImportAbschlagszahlungen = val != null && val.Equals("1"); + + switch (_Mandator.BeWoClientType) { case 1: diff --git a/BeWo/Core/Config/AppSettings.cs b/BeWo/Core/Config/AppSettings.cs index ad6889342..5f2a7a94a 100644 --- a/BeWo/Core/Config/AppSettings.cs +++ b/BeWo/Core/Config/AppSettings.cs @@ -422,6 +422,8 @@ namespace BeWo.Core.Config public bool AllowGkvAbrechnung { get; set; } + public bool ShowImportAbschlagszahlungen { get; set; } + private SchedulerViewType _SchedulerViewType; public SchedulerViewType SchedulerViewType { diff --git a/BeWo/View/Detail/AccountingTransactionBookingView.xaml b/BeWo/View/Detail/AccountingTransactionBookingView.xaml index 576d7a89e..8715af857 100644 --- a/BeWo/View/Detail/AccountingTransactionBookingView.xaml +++ b/BeWo/View/Detail/AccountingTransactionBookingView.xaml @@ -57,6 +57,11 @@ + + + + + @@ -64,7 +69,9 @@ - + + + @@ -88,7 +95,7 @@ - + diff --git a/BeWo/View/Detail/AccountingTransactionBookingView.xaml.cs b/BeWo/View/Detail/AccountingTransactionBookingView.xaml.cs index bb11a377c..b06270eab 100644 --- a/BeWo/View/Detail/AccountingTransactionBookingView.xaml.cs +++ b/BeWo/View/Detail/AccountingTransactionBookingView.xaml.cs @@ -23,12 +23,15 @@ using BS.Shared.Services; using BS.Shared.Core; using BS.Shared.Translation; using Microsoft.Win32; +using BS.Shared.Extensions; namespace BeWo.View.Detail { public partial class AccountingTransactionBookingView { private bool saveInProgress = false; + + private String _UploadFileName; public static Visibility InsertedOnAndByVisibility { get @@ -56,6 +59,12 @@ namespace BeWo.View.Detail DownloadLinkEngine = new DownloadLinkEngine(); linkExcelExport.NavigateUri = DownloadLinkEngine.GenerateNewExcelLink(); + if (!BeWoApp.AppSettings.ShowImportAbschlagszahlungen) + { + popupedit_file.Visibility = Visibility.Collapsed; + ButtonImport.Visibility = Visibility.Collapsed; + } + Loaded += AccountingTransactionBookingView_Loaded; } @@ -650,5 +659,92 @@ namespace BeWo.View.Detail } } + private void popupedit_file_PopUpClick(object sender, RoutedEventArgs ev) + { + var dlg = new OpenFileDialog(); + + if (dlg.ShowDialog() == true) + { + try + { + + _UploadFileName = dlg.FileName; + + popupedit_file.Text = dlg.SafeFileName; + ButtonImport.IsEnabled = true; + + + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Fehler", MessageBoxButton.OK, MessageBoxImage.Exclamation); + } + } + } + private void ButtonImport_Click(object sender, RoutedEventArgs pe) + { + if (!String.IsNullOrEmpty(popupedit_file.Text)) + { + + try + { + var upload = new ProgressStream(File.OpenRead(_UploadFileName)); + //upload.ProgressChanged += (s, e) => Dispatcher.BeginInvoke( + // DispatcherPriority.Normal, + // (Action)(() => + // { + // progressbar_upload.Value = e.Data; + // text_progress.Content = string.Format("Bitte warten... {0:00}%", e.Data * 100); + // })); + long oid = 0; + + var lUlPackage = new UploadPackage(null, 0, _UploadFileName, null, 0, 0, upload); + + ServiceFacade.DoStreamingServiceAsync( + s => s.UploadImportFile(lUlPackage), + r => this.Dispatch( + delegate + { + + + //_UploadFileName = null; + //button_uploadDocument.IsEnabled = false; + //popupedit_file.Text = string.Empty; + + upload.Dispose(); + if (r != null && !String.IsNullOrEmpty(r.ResultMessage)) + { + if (r.Success) + { + MessageBox.Show(r.ResultMessage, "Import", MessageBoxButton.OK, + MessageBoxImage.Information); + + ViewModel.RefreshAccountingTransactionsForSelectedTreeNode(); + } + else + { + MessageBox.Show(r.ResultMessage, "Import", MessageBoxButton.OK, + MessageBoxImage.Exclamation); + } + + } + + }), + () => this.Dispatch( + delegate + { + + upload.Dispose(); + })); + } + catch (Exception ex) + { + MessageBox.Show(ex.Message, "Fehler", MessageBoxButton.OK, MessageBoxImage.Exclamation); + } + + + } + } + } } \ No newline at end of file diff --git a/BeWoDatabaseTerminator/BeWoDatabaseTerminator/Program.cs b/BeWoDatabaseTerminator/BeWoDatabaseTerminator/Program.cs index a42ea6ce8..6388fb688 100644 --- a/BeWoDatabaseTerminator/BeWoDatabaseTerminator/Program.cs +++ b/BeWoDatabaseTerminator/BeWoDatabaseTerminator/Program.cs @@ -145,14 +145,14 @@ namespace BeWoDatabaseTerminator { var contractStatus = contractStatusKeyValuePair.Value; - if (contractStatus.Tenant == "5564670353") - { + //if (contractStatus.Tenant == "5564670353") + //{ - } - else - { - continue; - } + //} + //else + //{ + // continue; + //} if (contractStatus.Activate == 1) { @@ -163,8 +163,8 @@ namespace BeWoDatabaseTerminator if(contractStatus.Deactivate == 1) { FileUtils.WriteLog($"Deaktiviere Datenbank `{contractStatus.Tenant}`.", _LogFilePath); - ToggleConfigActivation(contractStatus, false); - ToggleBackupConfigActivation(contractStatus, false); + //ToggleConfigActivation(contractStatus, false); + //ToggleBackupConfigActivation(contractStatus, false); } @@ -284,7 +284,7 @@ namespace BeWoDatabaseTerminator //} } // Config-Datei ist deaktiviert - else if(File.Exists(Path.Combine(_MultitenancyPath, $"{tenant}.config.deactivated"))) + else if (File.Exists(Path.Combine(_MultitenancyPath, $"{tenant}.config.deactivated"))) { FileUtils.WriteLog($"Die Config-Datei '{tenant}.config.deactivated' existiert.", _LogFilePath); //connectionString = isExisting ? ExtractConnectionString(configFilePath) : connectionString; @@ -300,10 +300,11 @@ namespace BeWoDatabaseTerminator else { FileUtils.WriteLog($"Die Config-Datei '{configFilePath}' existiert nicht.", _LogFilePath); - - RunCreateScripts(tenant, connectionString); - - await SendInitialPasswordToTool(contractStatus); + if (!isExisting) + { + RunCreateScripts(tenant, connectionString); + await SendInitialPasswordToTool(contractStatus); + } } } @@ -415,7 +416,7 @@ namespace BeWoDatabaseTerminator if (Directory.Exists(_CreateScriptsFolderPath) && Directory.Exists(_MultitenancyPath) && Directory.Exists(_BackupConfigFolderPath)) { FileUtils.GenerateNewConfigFile(Path.Combine(_MultitenancyPath, $"{tenant}.config"), connectionString, tenant); - FileUtils.GenerateNewDBAdminFile(Path.Combine(_CreateAdminFolderPath, $"{tenant}.db2mail"), connectionString, tenant); + FileUtils.GenerateNewDBAdminFile(Path.Combine(_BackupConfigFolderPath, $"{tenant}.db2mail"), tenant, _ConnectionStringPort, _ConnectionStringUserID, _ConnectionStringPassword); var createScriptPath = Path.Combine(_CreateScriptsFolderPath, _CreateScriptName); var changesScriptPath = Path.Combine(_CreateScriptsFolderPath, _ChangesScriptName); diff --git a/ReportImp/Kette2/AuswertungSozialpsychiatrie.cs b/ReportImp/Kette2/AuswertungSozialpsychiatrie.cs index 14ce7abbd..37bd958d8 100644 --- a/ReportImp/Kette2/AuswertungSozialpsychiatrie.cs +++ b/ReportImp/Kette2/AuswertungSozialpsychiatrie.cs @@ -453,7 +453,7 @@ namespace KetteReports ro.GeleisteteFlsGesamt += serviceRecord.RoundedDuration / 60; - result.GeleisteteFlsGesamtCount += ro.GeleisteteFlsGesamt; + result.GeleisteteFlsGesamtCount += serviceRecord.RoundedDuration / 60; } } //else @@ -463,7 +463,7 @@ namespace KetteReports } - ro.GeleisteteFlsOhneKlient /= 60; + //ro.GeleisteteFlsOhneKlient /= 60; diff --git a/ReportImp/Kette2/QueryListReport.cs b/ReportImp/Kette2/QueryListReport.cs index 45eacf6eb..021d452ae 100644 --- a/ReportImp/Kette2/QueryListReport.cs +++ b/ReportImp/Kette2/QueryListReport.cs @@ -453,6 +453,8 @@ namespace KetteReports ro.GeleisteteFlsKlient += serviceRecord.RoundedDuration / 60; ro.GeleisteteFlsGesamt += serviceRecord.RoundedDuration / 60; + + result.GeleisteteFlsGesamtCount += serviceRecord.RoundedDuration / 60; } } //else @@ -462,9 +464,9 @@ namespace KetteReports } - ro.GeleisteteFlsOhneKlient /= 60; + //ro.GeleisteteFlsOhneKlient /= 60; - result.GeleisteteFlsGesamtCount += ro.GeleisteteFlsGesamt; + var calc = PluginLoader.FindClass(); diff --git a/Shared/Core/SettingsKeys.cs b/Shared/Core/SettingsKeys.cs index 3b1713645..e2a87dec7 100644 --- a/Shared/Core/SettingsKeys.cs +++ b/Shared/Core/SettingsKeys.cs @@ -85,5 +85,8 @@ public static string FilterGroupServiceCategories => "FilterGroupServiceCategories"; public static string AllowGkvAbrechnung => "AllowGkvAbrechnung"; + + public static string ShowImportAbschlagszahlungen => "ShowImportAbschlagszahlungen"; + } }