Fix DocumentTypes for Exports, Prepare Price calculation, load template parameters

This commit is contained in:
Jonathan Jenne
2022-02-28 11:58:01 +01:00
parent 2e7b0bef8a
commit 213bcef732
6 changed files with 188 additions and 81 deletions

View File

@@ -80,8 +80,8 @@ Partial Class frmExportMain
Me.LayoutControlItem6 = New DevExpress.XtraLayout.LayoutControlItem()
Me.LayoutControlItem7 = New DevExpress.XtraLayout.LayoutControlItem()
Me.LayoutControlItem8 = New DevExpress.XtraLayout.LayoutControlItem()
Me.LayoutControlItem9 = New DevExpress.XtraLayout.LayoutControlItem()
Me.LayoutControlItem10 = New DevExpress.XtraLayout.LayoutControlItem()
Me.LayoutControlItem9 = New DevExpress.XtraLayout.LayoutControlItem()
Me.LabelControl2 = New DevExpress.XtraEditors.LabelControl()
Me.colName2 = New DevExpress.XtraGrid.Columns.GridColumn()
Me.colId2 = New DevExpress.XtraGrid.Columns.GridColumn()
@@ -124,8 +124,8 @@ Partial Class frmExportMain
CType(Me.LayoutControlItem6, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.LayoutControlItem7, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.LayoutControlItem8, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.LayoutControlItem9, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.LayoutControlItem10, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.LayoutControlItem9, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'RibbonControl1
@@ -422,14 +422,14 @@ Partial Class frmExportMain
'
'lookupMandator
'
Me.lookupMandator.Location = New System.Drawing.Point(104, 15)
Me.lookupMandator.Location = New System.Drawing.Point(112, 15)
Me.lookupMandator.MenuManager = Me.RibbonControl1
Me.lookupMandator.Name = "lookupMandator"
Me.lookupMandator.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)})
Me.lookupMandator.Properties.NullText = ""
Me.lookupMandator.Properties.PopupSizeable = False
Me.lookupMandator.Properties.PopupView = Me.GridLookUpEdit1View
Me.lookupMandator.Size = New System.Drawing.Size(179, 20)
Me.lookupMandator.Size = New System.Drawing.Size(171, 20)
Me.lookupMandator.StyleController = Me.LayoutControl1
Me.lookupMandator.TabIndex = 4
'
@@ -460,27 +460,27 @@ Partial Class frmExportMain
'dateDocDateFrom
'
Me.dateDocDateFrom.EditValue = Nothing
Me.dateDocDateFrom.Location = New System.Drawing.Point(104, 195)
Me.dateDocDateFrom.Location = New System.Drawing.Point(112, 195)
Me.dateDocDateFrom.MenuManager = Me.RibbonControl1
Me.dateDocDateFrom.Name = "dateDocDateFrom"
Me.dateDocDateFrom.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)})
Me.dateDocDateFrom.Properties.CalendarTimeProperties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)})
Me.dateDocDateFrom.Properties.CharacterCasing = System.Windows.Forms.CharacterCasing.Lower
Me.dateDocDateFrom.Properties.SelectionMode = DevExpress.XtraEditors.Repository.CalendarSelectionMode.Multiple
Me.dateDocDateFrom.Size = New System.Drawing.Size(179, 20)
Me.dateDocDateFrom.Size = New System.Drawing.Size(171, 20)
Me.dateDocDateFrom.StyleController = Me.LayoutControl1
Me.dateDocDateFrom.TabIndex = 5
'
'lookupAccount
'
Me.lookupAccount.Location = New System.Drawing.Point(104, 105)
Me.lookupAccount.Location = New System.Drawing.Point(112, 105)
Me.lookupAccount.MenuManager = Me.RibbonControl1
Me.lookupAccount.Name = "lookupAccount"
Me.lookupAccount.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo), New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Clear)})
Me.lookupAccount.Properties.NullText = ""
Me.lookupAccount.Properties.PopupSizeable = False
Me.lookupAccount.Properties.PopupView = Me.GridView1
Me.lookupAccount.Size = New System.Drawing.Size(179, 20)
Me.lookupAccount.Size = New System.Drawing.Size(171, 20)
Me.lookupAccount.StyleController = Me.LayoutControl1
Me.lookupAccount.TabIndex = 7
'
@@ -520,44 +520,44 @@ Partial Class frmExportMain
'
'txtDocumentFrom
'
Me.txtDocumentFrom.Location = New System.Drawing.Point(104, 135)
Me.txtDocumentFrom.Location = New System.Drawing.Point(112, 135)
Me.txtDocumentFrom.MenuManager = Me.RibbonControl1
Me.txtDocumentFrom.Name = "txtDocumentFrom"
Me.txtDocumentFrom.Size = New System.Drawing.Size(179, 20)
Me.txtDocumentFrom.Size = New System.Drawing.Size(171, 20)
Me.txtDocumentFrom.StyleController = Me.LayoutControl1
Me.txtDocumentFrom.TabIndex = 10
'
'txtDocumentTo
'
Me.txtDocumentTo.Location = New System.Drawing.Point(104, 165)
Me.txtDocumentTo.Location = New System.Drawing.Point(112, 165)
Me.txtDocumentTo.MenuManager = Me.RibbonControl1
Me.txtDocumentTo.Name = "txtDocumentTo"
Me.txtDocumentTo.Size = New System.Drawing.Size(179, 20)
Me.txtDocumentTo.Size = New System.Drawing.Size(171, 20)
Me.txtDocumentTo.StyleController = Me.LayoutControl1
Me.txtDocumentTo.TabIndex = 11
'
'dateDocDateTo
'
Me.dateDocDateTo.EditValue = Nothing
Me.dateDocDateTo.Location = New System.Drawing.Point(104, 225)
Me.dateDocDateTo.Location = New System.Drawing.Point(112, 225)
Me.dateDocDateTo.MenuManager = Me.RibbonControl1
Me.dateDocDateTo.Name = "dateDocDateTo"
Me.dateDocDateTo.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)})
Me.dateDocDateTo.Properties.CalendarTimeProperties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)})
Me.dateDocDateTo.Size = New System.Drawing.Size(179, 20)
Me.dateDocDateTo.Size = New System.Drawing.Size(171, 20)
Me.dateDocDateTo.StyleController = Me.LayoutControl1
Me.dateDocDateTo.TabIndex = 12
'
'comboDocumentType
'
Me.comboDocumentType.Location = New System.Drawing.Point(104, 75)
Me.comboDocumentType.Location = New System.Drawing.Point(112, 45)
Me.comboDocumentType.MenuManager = Me.RibbonControl1
Me.comboDocumentType.Name = "comboDocumentType"
Me.comboDocumentType.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo), New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Clear)})
Me.comboDocumentType.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)})
Me.comboDocumentType.Properties.NullText = ""
Me.comboDocumentType.Properties.PopupSizeable = False
Me.comboDocumentType.Properties.PopupView = Me.GridView3
Me.comboDocumentType.Size = New System.Drawing.Size(179, 20)
Me.comboDocumentType.Size = New System.Drawing.Size(171, 20)
Me.comboDocumentType.StyleController = Me.LayoutControl1
Me.comboDocumentType.TabIndex = 13
'
@@ -570,12 +570,12 @@ Partial Class frmExportMain
'
'comboDocumentKind
'
Me.comboDocumentKind.Location = New System.Drawing.Point(104, 45)
Me.comboDocumentKind.Location = New System.Drawing.Point(112, 75)
Me.comboDocumentKind.MenuManager = Me.RibbonControl1
Me.comboDocumentKind.Name = "comboDocumentKind"
Me.comboDocumentKind.Properties.AllowMultiSelect = True
Me.comboDocumentKind.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo), New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Clear)})
Me.comboDocumentKind.Size = New System.Drawing.Size(179, 20)
Me.comboDocumentKind.Size = New System.Drawing.Size(171, 20)
Me.comboDocumentKind.StyleController = Me.LayoutControl1
Me.comboDocumentKind.TabIndex = 14
'
@@ -583,7 +583,7 @@ Partial Class frmExportMain
'
Me.Root.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.[True]
Me.Root.GroupBordersVisible = False
Me.Root.Items.AddRange(New DevExpress.XtraLayout.BaseLayoutItem() {Me.LayoutControlItem1, Me.EmptySpaceItem1, Me.LayoutControlItem3, Me.LayoutControlItem2, Me.LayoutControlItem5, Me.LayoutControlItem6, Me.LayoutControlItem7, Me.LayoutControlItem8, Me.LayoutControlItem9, Me.LayoutControlItem10})
Me.Root.Items.AddRange(New DevExpress.XtraLayout.BaseLayoutItem() {Me.LayoutControlItem1, Me.EmptySpaceItem1, Me.LayoutControlItem3, Me.LayoutControlItem2, Me.LayoutControlItem5, Me.LayoutControlItem6, Me.LayoutControlItem7, Me.LayoutControlItem8, Me.LayoutControlItem10, Me.LayoutControlItem9})
Me.Root.Name = "Root"
Me.Root.Size = New System.Drawing.Size(298, 538)
Me.Root.TextVisible = False
@@ -596,7 +596,7 @@ Partial Class frmExportMain
Me.LayoutControlItem1.Padding = New DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5)
Me.LayoutControlItem1.Size = New System.Drawing.Size(278, 30)
Me.LayoutControlItem1.Text = "Mandant"
Me.LayoutControlItem1.TextSize = New System.Drawing.Size(77, 13)
Me.LayoutControlItem1.TextSize = New System.Drawing.Size(85, 13)
'
'EmptySpaceItem1
'
@@ -614,7 +614,7 @@ Partial Class frmExportMain
Me.LayoutControlItem3.Padding = New DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5)
Me.LayoutControlItem3.Size = New System.Drawing.Size(278, 30)
Me.LayoutControlItem3.Text = "Konto"
Me.LayoutControlItem3.TextSize = New System.Drawing.Size(77, 13)
Me.LayoutControlItem3.TextSize = New System.Drawing.Size(85, 13)
'
'LayoutControlItem2
'
@@ -624,7 +624,7 @@ Partial Class frmExportMain
Me.LayoutControlItem2.Padding = New DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5)
Me.LayoutControlItem2.Size = New System.Drawing.Size(278, 30)
Me.LayoutControlItem2.Text = "Belegdatum Von"
Me.LayoutControlItem2.TextSize = New System.Drawing.Size(77, 13)
Me.LayoutControlItem2.TextSize = New System.Drawing.Size(85, 13)
'
'LayoutControlItem5
'
@@ -643,7 +643,7 @@ Partial Class frmExportMain
Me.LayoutControlItem6.Padding = New DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5)
Me.LayoutControlItem6.Size = New System.Drawing.Size(278, 30)
Me.LayoutControlItem6.Text = "BelegNr Von"
Me.LayoutControlItem6.TextSize = New System.Drawing.Size(77, 13)
Me.LayoutControlItem6.TextSize = New System.Drawing.Size(85, 13)
'
'LayoutControlItem7
'
@@ -653,7 +653,7 @@ Partial Class frmExportMain
Me.LayoutControlItem7.Padding = New DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5)
Me.LayoutControlItem7.Size = New System.Drawing.Size(278, 30)
Me.LayoutControlItem7.Text = "BelegNr Bis"
Me.LayoutControlItem7.TextSize = New System.Drawing.Size(77, 13)
Me.LayoutControlItem7.TextSize = New System.Drawing.Size(85, 13)
'
'LayoutControlItem8
'
@@ -663,31 +663,31 @@ Partial Class frmExportMain
Me.LayoutControlItem8.Padding = New DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5)
Me.LayoutControlItem8.Size = New System.Drawing.Size(278, 30)
Me.LayoutControlItem8.Text = "Belegdatum Bis"
Me.LayoutControlItem8.TextSize = New System.Drawing.Size(77, 13)
'
'LayoutControlItem9
'
Me.LayoutControlItem9.Control = Me.comboDocumentType
Me.LayoutControlItem9.Location = New System.Drawing.Point(0, 60)
Me.LayoutControlItem9.Name = "LayoutControlItem9"
Me.LayoutControlItem9.Padding = New DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5)
Me.LayoutControlItem9.Size = New System.Drawing.Size(278, 30)
Me.LayoutControlItem9.Text = "Belegtyp"
Me.LayoutControlItem9.TextSize = New System.Drawing.Size(77, 13)
Me.LayoutControlItem8.TextSize = New System.Drawing.Size(85, 13)
'
'LayoutControlItem10
'
Me.LayoutControlItem10.Control = Me.comboDocumentKind
Me.LayoutControlItem10.Location = New System.Drawing.Point(0, 30)
Me.LayoutControlItem10.Location = New System.Drawing.Point(0, 60)
Me.LayoutControlItem10.Name = "LayoutControlItem10"
Me.LayoutControlItem10.Padding = New DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5)
Me.LayoutControlItem10.Size = New System.Drawing.Size(278, 30)
Me.LayoutControlItem10.Text = "Belegart"
Me.LayoutControlItem10.TextSize = New System.Drawing.Size(77, 13)
Me.LayoutControlItem10.TextSize = New System.Drawing.Size(85, 13)
'
'LayoutControlItem9
'
Me.LayoutControlItem9.Control = Me.comboDocumentType
Me.LayoutControlItem9.Location = New System.Drawing.Point(0, 30)
Me.LayoutControlItem9.Name = "LayoutControlItem9"
Me.LayoutControlItem9.Padding = New DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5)
Me.LayoutControlItem9.Size = New System.Drawing.Size(278, 30)
Me.LayoutControlItem9.Text = "Belegtyp"
Me.LayoutControlItem9.TextSize = New System.Drawing.Size(85, 13)
'
'LabelControl2
'
Me.LabelControl2.Appearance.Font = New System.Drawing.Font("Tahoma", 48.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.LabelControl2.Appearance.Font = New System.Drawing.Font("Tahoma", 48.0!)
Me.LabelControl2.Appearance.ForeColor = System.Drawing.Color.Silver
Me.LabelControl2.Appearance.Options.UseFont = True
Me.LabelControl2.Appearance.Options.UseForeColor = True
@@ -770,8 +770,8 @@ Partial Class frmExportMain
CType(Me.LayoutControlItem6, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.LayoutControlItem7, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.LayoutControlItem8, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.LayoutControlItem9, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.LayoutControlItem10, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.LayoutControlItem9, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
Me.PerformLayout()

View File

@@ -89,7 +89,13 @@ Public Class frmExportMain
Select(AddressOf MapDocumentTypeFromEnum).
ToList()
Dim oDocType = CurrentTemplate.GetParameter("DOCTYPE")
Dim oPreselectedDocType As Integer = 0
If oDocType IsNot Nothing Then
Integer.TryParse(oDocType, oPreselectedDocType)
End If
comboDocumentType.EditValue = oPreselectedDocType
If ConfigManager.Config.LastUsedMandator <> "" Then
lookupMandator.EditValue = Winline.Mandators.
@@ -101,8 +107,15 @@ Public Class frmExportMain
End Try
End Sub
Private Function MapDocumentTypeToEnum(Of T)(pValue As Integer) As T
Return [Enum].Parse(GetType(T), pValue)
End Function
Private Function MapDocumentTypeFromEnum(pValue As WinlineData.DocumentType)
Select Case pValue
Case WinlineData.DocumentType.Undefined
Return New KeyValuePair(Of String, Integer)("Alle", pValue)
Case WinlineData.DocumentType.IncomingOffer
Return New KeyValuePair(Of String, Integer)("Angebot EK", pValue)
@@ -156,7 +169,7 @@ Public Class frmExportMain
ConfigManager.Save()
End Sub
Private Sub lookup_Properties_ButtonClick(sender As Object, e As DevExpress.XtraEditors.Controls.ButtonPressedEventArgs) Handles comboDocumentKind.Properties.ButtonClick, lookupAccount.Properties.ButtonClick, comboDocumentType.ButtonClick
Private Sub lookup_Properties_ButtonClick(sender As Object, e As DevExpress.XtraEditors.Controls.ButtonPressedEventArgs) Handles lookupAccount.Properties.ButtonClick
Dim oLookup As GridLookUpEdit = sender
If e.Button.Kind = DevExpress.XtraEditors.Controls.ButtonPredefines.Clear Then
oLookup.EditValue = Nothing
@@ -170,9 +183,6 @@ Public Class frmExportMain
End If
End Sub
Private Sub SearchDocuments()
Try
dateDocDateFrom.DoValidate()
@@ -189,6 +199,7 @@ Public Class frmExportMain
Dim oDocNumberFrom = Utils.NotNull(txtDocumentFrom.EditValue, String.Empty)
Dim oDocNumberTo = Utils.NotNull(txtDocumentTo.EditValue, String.Empty)
Dim oDocType As WinlineData.DocumentType = MapDocumentTypeToEnum(Of WinlineData.DocumentType)(comboDocumentType.EditValue)
If oMandator Is Nothing Then
FormHelper.ShowWarning("Bitte einen Mandanten auswählen!")
@@ -196,7 +207,7 @@ Public Class frmExportMain
End If
'TODO: Make Document Type configurable
Dim oDocuments = Winline.GetDocuments(oMandator, CurrentTemplate, comboDocumentType.EditValue, New WinlineData.GetDocumentArgs With {
Dim oDocuments = Winline.GetDocuments(oMandator, CurrentTemplate, oDocType, New WinlineData.GetDocumentArgs With {
.Account = oAccount,
.Kinds = oKinds,
.DateFrom = oDateFrom,