Reload after export, Show and filter by Document Kind, Fix crash when reloading settings, change filename pattern for export files

This commit is contained in:
Jonathan Jenne
2022-01-28 16:17:15 +01:00
parent f224c73a2e
commit 9b3436686f
8 changed files with 111 additions and 114 deletions

View File

@@ -48,8 +48,7 @@ Public Class frmExportMain
Dim oViews As New List(Of GridView) From {
GridViewDocuments,
lookupMandator.Properties.View,
lookupAccount.Properties.View,
lookupDocumentKind.Properties.View
lookupAccount.Properties.View
}
GridBuilder = New GridBuilder(oViews)
GridBuilder.
@@ -78,9 +77,9 @@ Public Class frmExportMain
lookupAccount.ForceInitialize()
lookupAccount.Properties.View.BestFitColumns()
lookupDocumentKind.Properties.DataSource = Winline.DocumentKinds
lookupDocumentKind.ForceInitialize()
lookupDocumentKind.Properties.View.BestFitColumns()
comboDocumentKind.Properties.DataSource = Winline.DocumentKinds
comboDocumentKind.Properties.EditValueType = Repository.EditValueTypeCollection.List
comboDocumentKind.EditValue = New List(Of Object)
comboDocumentType.Properties.DisplayMember = "Key"
comboDocumentType.Properties.ValueMember = "Value"
@@ -91,6 +90,7 @@ Public Class frmExportMain
ToList()
If ConfigManager.Config.LastUsedMandator <> "" Then
lookupMandator.EditValue = Winline.Mandators.
Where(Function(mandator) mandator.Id = ConfigManager.Config.LastUsedMandator).
@@ -150,20 +150,27 @@ Public Class frmExportMain
Private Sub lookupMandator_EditValueChanged(sender As Object, e As EventArgs) Handles lookupMandator.EditValueChanged
Dim oMandator As Mandator = lookupMandator.EditValue
lookupAccount.Properties.DataSource = Winline.Accounts.Where(Function(acc) acc.Mandator.Equals(oMandator))
lookupDocumentKind.Properties.DataSource = Winline.DocumentKinds.Where(Function(kind) kind.Mandator.Equals(oMandator))
comboDocumentKind.Properties.DataSource = Winline.DocumentKinds.Where(Function(kind) kind.Mandator.Equals(oMandator))
ConfigManager.Config.LastUsedMandator = oMandator.Id
ConfigManager.Save()
End Sub
Private Sub lookup_Properties_ButtonClick(sender As Object, e As DevExpress.XtraEditors.Controls.ButtonPressedEventArgs) _
Handles lookupDocumentKind.Properties.ButtonClick, lookupAccount.Properties.ButtonClick, comboDocumentType.ButtonClick
Private Sub lookup_Properties_ButtonClick(sender As Object, e As DevExpress.XtraEditors.Controls.ButtonPressedEventArgs) Handles comboDocumentKind.Properties.ButtonClick, lookupAccount.Properties.ButtonClick, comboDocumentType.ButtonClick
Dim oLookup As GridLookUpEdit = sender
If e.Button.Kind = DevExpress.XtraEditors.Controls.ButtonPredefines.Clear Then
oLookup.EditValue = Nothing
End If
End Sub
Private Sub combo_Properties_ButtonClick(sender As Object, e As DevExpress.XtraEditors.Controls.ButtonPressedEventArgs) Handles comboDocumentKind.Properties.ButtonClick
Dim oLookup As CheckedComboBoxEdit = sender
If e.Button.Kind = DevExpress.XtraEditors.Controls.ButtonPredefines.Clear Then
oLookup.EditValue = New List(Of Object)
End If
End Sub
Private Sub SearchDocuments()
@@ -173,13 +180,16 @@ Public Class frmExportMain
Dim oMandator = lookupMandator.EditValue
Dim oAccount = lookupAccount.EditValue
Dim oKind = lookupDocumentKind.EditValue
Dim oKindsAsObjects As List(Of Object) = comboDocumentKind.EditValue
Dim oKinds As List(Of DocumentKind) = oKindsAsObjects.Cast(Of DocumentKind).ToList()
Dim oDateFrom = dateDocDateFrom.EditValue
Dim oDateTo = dateDocDateTo.EditValue
Dim oShowExported = chkShowExported.Checked
Dim oDocNumberFrom = Utils.NotNull(txtDocumentFrom.EditValue, String.Empty)
Dim oDocNumberTo = Utils.NotNull(txtDocumentTo.EditValue, String.Empty)
If oMandator Is Nothing Then
FormHelper.ShowWarning("Bitte einen Mandanten auswählen!")
Exit Sub
@@ -188,7 +198,7 @@ Public Class frmExportMain
'TODO: Make Document Type configurable
Dim oDocuments = Winline.GetDocuments(oMandator, CurrentTemplate, comboDocumentType.EditValue, New WinlineData.GetDocumentArgs With {
.Account = oAccount,
.Kind = oKind,
.Kinds = oKinds,
.DateFrom = oDateFrom,
.DateTo = oDateTo,
.ShowExported = oShowExported,
@@ -242,6 +252,7 @@ Public Class frmExportMain
Finally
SplashScreenManager.CloseWaitForm()
SearchDocuments()
End Try
End Sub