Compare commits

...

3 Commits

Author SHA1 Message Date
Jonathan Jenne
7f817ffce1 add button for Price calculation 2022-02-28 11:59:10 +01:00
Jonathan Jenne
f80ea96f8a Version 1.2.4.0 2022-02-28 11:58:13 +01:00
Jonathan Jenne
213bcef732 Fix DocumentTypes for Exports, Prepare Price calculation, load template parameters 2022-02-28 11:58:01 +01:00
10 changed files with 256 additions and 113 deletions

View File

@@ -13,7 +13,7 @@ Imports System.Runtime.InteropServices
<Assembly: AssemblyCompany("Digital Data")>
<Assembly: AssemblyProduct("WebService Multitool")>
<Assembly: AssemblyCopyright("Copyright © 2022")>
<Assembly: AssemblyTrademark("1.2.3.0")>
<Assembly: AssemblyTrademark("1.2.4.0")>
<Assembly: ComVisible(False)>
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' indem Sie "*" wie unten gezeigt eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.2.3.0")>
<Assembly: AssemblyVersion("1.2.4.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>

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,

View File

@@ -55,6 +55,7 @@ Partial Class frmImportMain
Me.BarButtonItem1 = New DevExpress.XtraBars.BarButtonItem()
Me.btnDebugExportReport = New DevExpress.XtraBars.BarButtonItem()
Me.btnEditRow = New DevExpress.XtraBars.BarButtonItem()
Me.btnCalculatePrices = New DevExpress.XtraBars.BarButtonItem()
Me.RibbonPage1 = New DevExpress.XtraBars.Ribbon.RibbonPage()
Me.RibbonPageGroup1 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup()
Me.RibbonPageGroup4 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup()
@@ -86,7 +87,6 @@ Partial Class frmImportMain
Me.WorkspaceManager1 = New DevExpress.Utils.WorkspaceManager(Me.components)
Me.BehaviorManager = New DevExpress.Utils.Behaviors.BehaviorManager(Me.components)
Me.SplashScreenManager = New DevExpress.XtraSplashScreen.SplashScreenManager(Me, GetType(Global.MultiTool.Form.frmWaitForm), True, True)
Me.btnCalculatePrices = New DevExpress.XtraBars.BarButtonItem()
CType(Me.SplitContainerMain, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.SplitContainerMain.Panel1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SplitContainerMain.Panel1.SuspendLayout()
@@ -373,6 +373,14 @@ Partial Class frmImportMain
Me.btnEditRow.ImageOptions.SvgImage = Global.MultiTool.Form.My.Resources.Resources.editquery
Me.btnEditRow.Name = "btnEditRow"
'
'btnCalculatePrices
'
resources.ApplyResources(Me.btnCalculatePrices, "btnCalculatePrices")
Me.btnCalculatePrices.Enabled = False
Me.btnCalculatePrices.Id = 36
Me.btnCalculatePrices.ImageOptions.SvgImage = Global.MultiTool.Form.My.Resources.Resources.bo_sale
Me.btnCalculatePrices.Name = "btnCalculatePrices"
'
'RibbonPage1
'
Me.RibbonPage1.Groups.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPageGroup() {Me.RibbonPageGroup1, Me.RibbonPageGroup4, Me.RibbonPageGroup3, Me.RibbonPageGroup7})
@@ -600,13 +608,6 @@ Partial Class frmImportMain
'
Me.SplashScreenManager.ClosingDelay = 500
'
'btnCalculatePrices
'
resources.ApplyResources(Me.btnCalculatePrices, "btnCalculatePrices")
Me.btnCalculatePrices.Id = 36
Me.btnCalculatePrices.ImageOptions.SvgImage = Global.MultiTool.Form.My.Resources.Resources.bo_sale
Me.btnCalculatePrices.Name = "btnCalculatePrices"
'
'frmImportMain
'
resources.ApplyResources(Me, "$this")

View File

@@ -935,6 +935,12 @@
<data name="&gt;&gt;btnEditRow.Type" xml:space="preserve">
<value>DevExpress.XtraBars.BarButtonItem, DevExpress.XtraBars.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="&gt;&gt;btnCalculatePrices.Name" xml:space="preserve">
<value>btnCalculatePrices</value>
</data>
<data name="&gt;&gt;btnCalculatePrices.Type" xml:space="preserve">
<value>DevExpress.XtraBars.BarButtonItem, DevExpress.XtraBars.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="&gt;&gt;RibbonPage1.Name" xml:space="preserve">
<value>RibbonPage1</value>
</data>
@@ -1055,12 +1061,6 @@
<data name="&gt;&gt;SplashScreenManager.Type" xml:space="preserve">
<value>DevExpress.XtraSplashScreen.SplashScreenManager, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="&gt;&gt;btnCalculatePrices.Name" xml:space="preserve">
<value>btnCalculatePrices</value>
</data>
<data name="&gt;&gt;btnCalculatePrices.Type" xml:space="preserve">
<value>DevExpress.XtraBars.BarButtonItem, DevExpress.XtraBars.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>frmImportMain</value>
</data>

View File

@@ -1,6 +1,5 @@
Imports System.IO
Imports System.Net.Http
Imports DevExpress.Utils.Behaviors.Common
Imports DevExpress.XtraGrid
Imports DevExpress.XtraGrid.Views.Grid
Imports DevExpress.XtraReports.UI
@@ -15,8 +14,7 @@ Imports MultiTool.Shared.Winline
Imports MultiTool.Shared.Winline.Entities
Imports MultiTool.Shared.Constants
Imports MultiTool.Shared.Exceptions
Imports Document = MultiTool.Shared.Documents.Document
Imports DevExpress.XtraGrid.Views.Grid.ViewInfo
Imports MultiTool.Shared.Documents.Document
Public Class frmImportMain
Public LogConfig As LogConfig
@@ -131,7 +129,10 @@ Public Class frmImportMain
Dim oRow As DataRow = oView.GetFocusedDataRow()
EditRow(oRow, oView)
Dim oModifiedRow = EditRow(oRow, oView)
If oModifiedRow IsNot Nothing Then
ReloadRow(oModifiedRow)
End If
End Sub
Private Sub btnEditRow_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnEditRow.ItemClick
@@ -143,10 +144,13 @@ Public Class frmImportMain
Exit Sub
End If
EditRow(oRow, oView)
Dim oModifiedRow = EditRow(oRow, oView)
If oModifiedRow IsNot Nothing Then
ReloadRow(oModifiedRow)
End If
End Sub
Private Sub EditRow(pRow As DataRow, pView As GridView)
Private Function EditRow(pRow As DataRow, pView As GridView) As DocumentRow
Try
Dim oColumns = pView.Columns.Select(Function(c) c.FieldName).ToList()
Dim oDocumentRow = CurrentDocument.Rows.
@@ -164,22 +168,19 @@ Public Class frmImportMain
Winline,
oTemplateTable
)
If oForm.ShowDialog() = DialogResult.OK Then
Dim oModifiedRow = oForm.DocumentRow
Dim oIndex = CurrentDocument.Rows.IndexOf(oModifiedRow)
CurrentDocument.Rows.Item(oIndex) = oModifiedRow
LoadDocument(CurrentDocument)
' Refresh Files to update Row color
GridViewFiles.RefreshData()
Return oForm.DocumentRow
Else
Return Nothing
End If
Catch ex As Exception
FormHelper.ShowError(ex, My.Resources.frmImportMainExtra.Laden_der_Detailzeilen)
Return Nothing
End Try
End Sub
End Function
Private Sub btnLoadFiles_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnLoadFiles.ItemClick
@@ -570,7 +571,15 @@ Public Class frmImportMain
txtCurrentFile.Caption = String.Format(My.Resources.frmImportMainExtra.Aktuelle_Datei___0_, pDocument.FileName)
CurrentDocument = pDocument
SetDocumentButtonsEnabled(True)
If CurrentDocument.HasErrors = True Then
btnCalculatePrices.Enabled = False
Else
btnCalculatePrices.Enabled = True
End If
Catch ex As Exception
SetDocumentButtonsEnabled(False)
Logger.Error(ex)
@@ -578,6 +587,17 @@ Public Class frmImportMain
End Try
End Sub
Private Sub ReloadRow(pRow As DocumentRow)
Dim oModifiedRow = pRow
Dim oIndex = CurrentDocument.Rows.IndexOf(oModifiedRow)
CurrentDocument.Rows.Item(oIndex) = oModifiedRow
LoadDocument(CurrentDocument)
' Refresh Files to update Row color
GridViewFiles.RefreshData()
End Sub
Private Sub LoadFiles()
Try
BeginLoadingUI()
@@ -604,6 +624,8 @@ Public Class frmImportMain
End Try
End Sub
Private Async Function TransferFile(pDocument As Document, Optional pIsTest As Boolean = False) As Task(Of Boolean)
' Check for errors and abort
If pDocument.HasErrors = True Then
@@ -699,7 +721,7 @@ Public Class frmImportMain
End Sub
Private Sub TryOpenFile(pPath As String, pDisplayName As String)
If File.Exists(pPath) Then
If IO.File.Exists(pPath) Then
Process.Start(pPath)
Else
Dim oMessage = String.Format(My.Resources.frmImportMainExtra._0__nicht_konfiguriert_oder_nicht_gefunden, pDisplayName)
@@ -733,5 +755,18 @@ Public Class frmImportMain
btnEditRow.Enabled = pEnabled
End Sub
Private Sub btnCalculatePrices_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnCalculatePrices.ItemClick
Dim oCurrentMandator As Mandator = TryCast(lookupMandator.EditValue, Mandator)
If oCurrentMandator Is Nothing Then
MsgBox(My.Resources.frmImportMainExtra.Bitte_wählen_Sie_einen_Mandanten_aus__bevor_Sie_fortfahren, MsgBoxStyle.Exclamation, Text)
Exit Sub
End If
Dim oNewDocument = DocumentLoader.MaybeApplyPriceFunctions(CurrentDocument, oCurrentMandator, CurrentTemplate)
DocumentLoader.ReplaceDocument(oNewDocument)
LoadDocument(oNewDocument)
End Sub
#End Region
End Class

View File

@@ -52,6 +52,21 @@ Namespace Documents
End Get
End Property
''' <summary>
''' Finds the first occurrence of Field and returns its value
''' </summary>
Public Function GetFieldValue(pField As String) As String
For Each oRow In Rows
For Each oField In oRow.Fields
If oField.Key = pField Then
Return oField.Value.Final
End If
Next
Next
Return Nothing
End Function
Public Overrides Function Equals(obj As Object) As Boolean
Return FullName = DirectCast(obj, Document).FullName
End Function

View File

@@ -86,6 +86,11 @@ Namespace Documents
End Try
End Function
Public Sub ReplaceDocument(pDocument As Document)
Dim oIndex = Files.IndexOf(pDocument)
Files.Item(oIndex) = pDocument
End Sub
Private Function IncludeSchema(pDocument As Document, pTemplate As Template) As Document
pDocument.Schema = pTemplate
@@ -243,7 +248,9 @@ Namespace Documents
Else
pDocument = ApplyDefinedItemFunctionsForImport(pDocument, oMandator, pTemplate)
pDocument = ApplyDynamicItemFunctionsForImport(pDocument, oMandator)
pDocument = ApplyPriceFunctions(pDocument, oMandator, pTemplate)
' These functions will only be applied if the document does not have errors
pDocument = MaybeApplyPriceFunctions(pDocument, oMandator, pTemplate)
End If
pDocument.Mandator = oMandator
@@ -256,7 +263,11 @@ Namespace Documents
''' This needs to be strictly seperated from `ApplyDefinedItemFunctionsForImport`
''' because prices can only be calculated if GLN and EAN functions were already (successfully) processed
''' </summary>
Private Function ApplyPriceFunctions(pDocument As Document, pMandator As Mandator, pTemplate As Template) As Document
Public Function MaybeApplyPriceFunctions(pDocument As Document, pMandator As Mandator, pTemplate As Template) As Document
If pDocument.HasErrors Then
Return pDocument
End If
For Each oRow As DocumentRow In pDocument.Rows
Dim oTable = pTemplate.Tables.Where(Function(table) table.Name = oRow.TableName).SingleOrDefault()
@@ -273,16 +284,20 @@ Namespace Documents
Dim oFunctionName = oColumn.Config?.Function?.Name
' TODO: Make more nice
Dim oParams = oColumn.Config?.Function.Params
Dim oParamList = oParams.Split("|").ToList()
Dim oParams = oColumn.Config?.Function?.Params
Dim oParamsDict As New Dictionary(Of String, String)
For Each oParam In oParamList
Dim oParamSplit = oParam.Split("=")
oParamsDict.Add(oParamSplit(0), oParamSplit(1))
Next
If oParams IsNot Nothing AndAlso oParams <> String.Empty Then
Dim oParamList = oParams.Split("|").ToList()
For Each oParam In oParamList
Dim oParamSplit = oParam.Split("=")
oParamsDict.Add(oParamSplit(0), oParamSplit(1))
Next
End If
If oFunctionName = "PRICE" Then
SetPrice(oRow, oField.Key, oParamsDict, pMandator, pTemplate)
SetPrice(oRow, oField.Key, oParamsDict, pDocument, pMandator, pTemplate)
End If
Next
Next
@@ -363,17 +378,23 @@ Namespace Documents
Return pDocument
End Function
Private Sub SetPrice(pRow As DocumentRow, pPriceField As String, oFieldMap As Dictionary(Of String, String), pMandator As Mandator, pTemplate As Template)
Private Sub SetPrice(pRow As DocumentRow, pPriceField As String, oFieldMap As Dictionary(Of String, String), pDocument As Document, pMandator As Mandator, pTemplate As Template)
Dim oPriceItem As DocumentRow.FieldValue = pRow.Fields.GetOrDefault(pPriceField)
Dim oArticleNumberField As String = oFieldMap.GetOrDefault("Article", Nothing)
Dim oAccountNumberField As String = oFieldMap.GetOrDefault("Account", Nothing)
Dim oDocumentDateField As String = oFieldMap.GetOrDefault("DocumentDate", Nothing)
' These fields are fetched from the current row
Dim oArticleNumberField As String = oFieldMap.GetOrDefault("Article", Nothing)
Dim oArticleNumber As String = pRow.Fields.Item(oArticleNumberField).Final
' These fields a fetched from the head row, ie. the first row
Dim oAccountNumberField As String = oFieldMap.GetOrDefault("Account", Nothing)
Dim oAccountNumber = pDocument.GetFieldValue(oAccountNumberField)
Dim oDocumentDateField As String = oFieldMap.GetOrDefault("DocumentDate", Nothing)
Dim oDocumentDate = pDocument.GetFieldValue(oDocumentDateField)
' TODO: Add Field Names as Constants
' TODO: Check for missing values
Dim oArticleNumber As String = pRow.Fields.Item(oArticleNumberField).Final
Dim oAccountNumber As String = pRow.Fields.Item(oAccountNumberField).Final
Dim oDocumentDate As Date = pRow.Fields.Item(oDocumentDateField).Final
Dim oQuantity As Integer = 1
Dim oArticlePrice As Double = Winline.TryGetArticlePrice(oArticleNumber, oAccountNumber, oQuantity, oDocumentDate, pMandator, pTemplate)

View File

@@ -1,4 +1,7 @@
Namespace Templates
Imports DigitalData.Modules.Language
Namespace Templates
Public Class Template
Public Property Guid As Integer
Public Property Name As String
@@ -33,6 +36,38 @@
End Get
End Property
Public Function GetParameter(pName As String) As String
Dim oParam1 As String = Utils.NotNull(Parameter1, String.Empty)
Dim oParam2 As String = Utils.NotNull(Parameter2, String.Empty)
Dim oParamValue1 = TryGetParameter(oParam1)
Dim oParamValue2 = TryGetParameter(oParam2)
If oParamValue1 IsNot Nothing AndAlso oParamValue1.Item1 = pName Then
Return oParamValue1.Item2
End If
If oParamValue2 IsNot Nothing AndAlso oParamValue2.Item1 = pName Then
Return oParamValue2.Item2
End If
Return Nothing
End Function
Private Function TryGetParameter(pParameterString As String) As Tuple(Of String, String)
If pParameterString <> String.Empty Then
Dim oSplit = pParameterString.Split("=").ToList()
If oSplit.Count = 2 Then
Return New Tuple(Of String, String)(oSplit.First, oSplit.Last)
Else
Return Nothing
End If
Else
Return Nothing
End If
End Function
Class Table
Public Property Name As String
Public Property Columns As New List(Of Column)

View File

@@ -10,7 +10,6 @@ Namespace Winline
Public Class WinlineData
Inherits BaseClass
Private ReadOnly Property Database As MSSQLServer
Private ReadOnly Property Config As GeneralConfig
Private ReadOnly Property MandatorConfig As MandatorConfig
Private ReadOnly Property MappingConfig As MappingConfig
@@ -24,23 +23,23 @@ Namespace Winline
Public Years As List(Of Integer)
Public Sub New(pLogConfig As LogConfig, pDatabase As MSSQLServer, pConfig As GeneralConfig, pMappingConfig As MappingConfig, pMandatorConfig As MandatorConfig)
MyBase.New(pLogConfig)
MyBase.New(pLogConfig, pDatabase)
Patterns = New Patterns(pLogConfig, pConfig)
Database = pDatabase
Config = pConfig
MandatorConfig = pMandatorConfig
MappingConfig = pMappingConfig
End Sub
Public Enum DocumentType
OutgoingOffer = 1
OutgoingOrder = 2
OutgoingDeliveryNote = 3
OutgoingInvoice = 4
IncomingOffer = -1
IncomingOrder = -2
IncomingDeliveryNote = -3
IncomingInvoice = -4
Undefined
OutgoingOffer
OutgoingOrder
OutgoingDeliveryNote
OutgoingInvoice
IncomingOffer
IncomingOrder
IncomingDeliveryNote
IncomingInvoice
End Enum
Public Class GetDocumentArgs
@@ -308,17 +307,18 @@ Namespace Winline
Try
Dim oYear As Integer = Config.GetWinLineYear()
Dim oSQL As String = $"
EXECUTE [PRCUST_GET_ACCOUNT_PRICE_CONDITION_VALUES]
EXECUTE [{pMandator.Database}].[dbo].[PRCUST_GET_ACCOUNT_PRICE_CONDITION_VALUES]
'{pAccountNumber}',
'*',
'{pArticle}',
'{pQuantity}',
{pDocumentDate:yyyy-MM-dd},
{pDocumentDate:yyyy-MM-dd},
'{pDocumentDate:dd.MM.yyyy}',
'{pDocumentDate:dd.MM.yyyy}',
'{pMandator.Id}',
{oYear},
1008,
NULL,
1,
'Multitool/{pTemplate.Name}',
'CalcPricing'
"
@@ -567,14 +567,39 @@ Namespace Winline
Return Nothing
End Function
Public Function GetDocuments(pMandator As Mandator, pTemplate As Template, pDocumentType As Integer, pOptions As GetDocumentArgs) As List(Of ExportDocument)
Public Function GetDocuments(pMandator As Mandator, pTemplate As Template, pDocumentType As DocumentType, pOptions As GetDocumentArgs) As List(Of ExportDocument)
Try
Dim oYear As Integer = Config.GetWinLineYear()
Dim oTypeConstraint = ""
If pDocumentType <> 0 Then
oTypeConstraint = $"T.c139 = {pDocumentType} AND "
End If
Dim oTypeConstraint
Select Case pDocumentType
Case DocumentType.OutgoingOffer
oTypeConstraint = $"T.c137 = 1 AND c139 = 1 AND "
Case DocumentType.OutgoingOffer
oTypeConstraint = $"T.c137 = 1 AND c139 = 2 AND "
Case DocumentType.OutgoingDeliveryNote
oTypeConstraint = $"T.c137 = 1 AND (c139 = 3 OR c139 = -3) AND "
Case DocumentType.OutgoingInvoice
oTypeConstraint = $"T.c137 = 1 AND c139 = 4 AND "
Case DocumentType.IncomingOffer
oTypeConstraint = $"T.c137 = 2 AND c139 = 1 AND "
Case DocumentType.IncomingOrder
oTypeConstraint = $"T.c137 = 2 AND c139 = 2 AND "
Case DocumentType.IncomingDeliveryNote
oTypeConstraint = $"T.c137 = 2 AND c139 = 3 AND "
Case DocumentType.IncomingInvoice
oTypeConstraint = $"T.c137 = 2 AND c139 = 4 AND "
Case Else
oTypeConstraint = ""
End Select
Dim oAccountConstraint = ""
If pOptions.Account IsNot Nothing Then