From ad8ea75db4bd21de436bd09d5c8250d01bd68f74 Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Thu, 27 Jan 2022 14:28:40 +0100 Subject: [PATCH] Constraints for search export documents --- MultiTool.Form/MyApplication.vb | 2 - MultiTool.Form/frmExportMain.Designer.vb | 215 +++++++++++++------- MultiTool.Form/frmExportMain.vb | 75 +++++-- MultiTool.Form/frmMain.Designer.vb | 4 +- MultiTool.Form/frmMain.vb | 116 +++++++---- MultiTool.Shared/My Project/AssemblyInfo.vb | 4 +- MultiTool.Shared/Patterns.vb | 2 +- MultiTool.Shared/Winline/WinlineData.vb | 116 +++++++---- 8 files changed, 351 insertions(+), 183 deletions(-) diff --git a/MultiTool.Form/MyApplication.vb b/MultiTool.Form/MyApplication.vb index 30c1163..c98120b 100644 --- a/MultiTool.Form/MyApplication.vb +++ b/MultiTool.Form/MyApplication.vb @@ -10,7 +10,5 @@ Namespace My Friend Property MandatorConfiguration As MandatorConfig Friend Property GeneralConfiguration As GeneralConfig Friend Property Winline As WinlineData - - Public Property Helpers As Helpers End Module End Namespace diff --git a/MultiTool.Form/frmExportMain.Designer.vb b/MultiTool.Form/frmExportMain.Designer.vb index 0005311..c1c1391 100644 --- a/MultiTool.Form/frmExportMain.Designer.vb +++ b/MultiTool.Form/frmExportMain.Designer.vb @@ -58,7 +58,7 @@ Partial Class frmExportMain Me.GridLookUpEdit1View = New DevExpress.XtraGrid.Views.Grid.GridView() Me.colName = New DevExpress.XtraGrid.Columns.GridColumn() Me.colId = New DevExpress.XtraGrid.Columns.GridColumn() - Me.dateDocDate = New DevExpress.XtraEditors.DateEdit() + Me.dateDocDateFrom = New DevExpress.XtraEditors.DateEdit() Me.lookupAccount = New DevExpress.XtraEditors.GridLookUpEdit() Me.GridView1 = New DevExpress.XtraGrid.Views.Grid.GridView() Me.GridColumn1 = New DevExpress.XtraGrid.Columns.GridColumn() @@ -68,8 +68,9 @@ Partial Class frmExportMain Me.GridColumn3 = New DevExpress.XtraGrid.Columns.GridColumn() Me.GridColumn4 = New DevExpress.XtraGrid.Columns.GridColumn() Me.chkShowExported = New DevExpress.XtraEditors.CheckEdit() - Me.TextEdit1 = New DevExpress.XtraEditors.TextEdit() - Me.TextEdit2 = New DevExpress.XtraEditors.TextEdit() + Me.txtDocumentFrom = New DevExpress.XtraEditors.TextEdit() + Me.txtDocumentTo = New DevExpress.XtraEditors.TextEdit() + Me.dateDocDateTo = New DevExpress.XtraEditors.DateEdit() Me.Root = New DevExpress.XtraLayout.LayoutControlGroup() Me.LayoutControlItem1 = New DevExpress.XtraLayout.LayoutControlItem() Me.EmptySpaceItem1 = New DevExpress.XtraLayout.EmptySpaceItem() @@ -79,10 +80,14 @@ Partial Class frmExportMain Me.LayoutControlItem5 = New DevExpress.XtraLayout.LayoutControlItem() 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.LabelControl2 = New DevExpress.XtraEditors.LabelControl() Me.colName2 = New DevExpress.XtraGrid.Columns.GridColumn() Me.colId2 = New DevExpress.XtraGrid.Columns.GridColumn() Me.SplashScreenManager = New DevExpress.XtraSplashScreen.SplashScreenManager(Me, GetType(Global.MultiTool.Form.frmWaitForm), True, True) + Me.comboDocumentType = New DevExpress.XtraEditors.GridLookUpEdit() + Me.GridView3 = New DevExpress.XtraGrid.Views.Grid.GridView() CType(Me.RibbonControl1, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.GridControlDocuments, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.GridViewDocuments, System.ComponentModel.ISupportInitialize).BeginInit() @@ -100,15 +105,17 @@ Partial Class frmExportMain Me.LayoutControl1.SuspendLayout() CType(Me.lookupMandator.Properties, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.GridLookUpEdit1View, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.dateDocDate.Properties.CalendarTimeProperties, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.dateDocDate.Properties, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.dateDocDateFrom.Properties.CalendarTimeProperties, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.dateDocDateFrom.Properties, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.lookupAccount.Properties, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.GridView1, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.lookupDocumentKind.Properties, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.GridView2, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.chkShowExported.Properties, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.TextEdit1.Properties, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.TextEdit2.Properties, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.txtDocumentFrom.Properties, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.txtDocumentTo.Properties, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.dateDocDateTo.Properties.CalendarTimeProperties, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.dateDocDateTo.Properties, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.Root, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.LayoutControlItem1, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.EmptySpaceItem1, System.ComponentModel.ISupportInitialize).BeginInit() @@ -118,6 +125,10 @@ Partial Class frmExportMain CType(Me.LayoutControlItem5, System.ComponentModel.ISupportInitialize).BeginInit() 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.comboDocumentType.Properties, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.GridView3, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' 'RibbonControl1 @@ -388,12 +399,14 @@ Partial Class frmExportMain 'LayoutControl1 ' Me.LayoutControl1.Controls.Add(Me.lookupMandator) - Me.LayoutControl1.Controls.Add(Me.dateDocDate) + Me.LayoutControl1.Controls.Add(Me.dateDocDateFrom) Me.LayoutControl1.Controls.Add(Me.lookupAccount) Me.LayoutControl1.Controls.Add(Me.lookupDocumentKind) Me.LayoutControl1.Controls.Add(Me.chkShowExported) - Me.LayoutControl1.Controls.Add(Me.TextEdit1) - Me.LayoutControl1.Controls.Add(Me.TextEdit2) + Me.LayoutControl1.Controls.Add(Me.txtDocumentFrom) + Me.LayoutControl1.Controls.Add(Me.txtDocumentTo) + Me.LayoutControl1.Controls.Add(Me.dateDocDateTo) + Me.LayoutControl1.Controls.Add(Me.comboDocumentType) Me.LayoutControl1.Dock = System.Windows.Forms.DockStyle.Fill Me.LayoutControl1.Location = New System.Drawing.Point(0, 0) Me.LayoutControl1.Name = "LayoutControl1" @@ -404,14 +417,14 @@ Partial Class frmExportMain ' 'lookupMandator ' - Me.lookupMandator.Location = New System.Drawing.Point(85, 15) + Me.lookupMandator.Location = New System.Drawing.Point(104, 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(198, 20) + Me.lookupMandator.Size = New System.Drawing.Size(179, 20) Me.lookupMandator.StyleController = Me.LayoutControl1 Me.lookupMandator.TabIndex = 4 ' @@ -439,30 +452,30 @@ Partial Class frmExportMain Me.colId.Visible = True Me.colId.VisibleIndex = 1 ' - 'dateDocDate + 'dateDocDateFrom ' - Me.dateDocDate.EditValue = Nothing - Me.dateDocDate.Location = New System.Drawing.Point(85, 165) - Me.dateDocDate.MenuManager = Me.RibbonControl1 - Me.dateDocDate.Name = "dateDocDate" - Me.dateDocDate.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}) - Me.dateDocDate.Properties.CalendarTimeProperties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}) - Me.dateDocDate.Properties.CharacterCasing = System.Windows.Forms.CharacterCasing.Lower - Me.dateDocDate.Properties.SelectionMode = DevExpress.XtraEditors.Repository.CalendarSelectionMode.Multiple - Me.dateDocDate.Size = New System.Drawing.Size(198, 20) - Me.dateDocDate.StyleController = Me.LayoutControl1 - Me.dateDocDate.TabIndex = 5 + Me.dateDocDateFrom.EditValue = Nothing + Me.dateDocDateFrom.Location = New System.Drawing.Point(104, 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.StyleController = Me.LayoutControl1 + Me.dateDocDateFrom.TabIndex = 5 ' 'lookupAccount ' - Me.lookupAccount.Location = New System.Drawing.Point(85, 75) + Me.lookupAccount.Location = New System.Drawing.Point(104, 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(198, 20) + Me.lookupAccount.Size = New System.Drawing.Size(179, 20) Me.lookupAccount.StyleController = Me.LayoutControl1 Me.lookupAccount.TabIndex = 7 ' @@ -492,14 +505,14 @@ Partial Class frmExportMain ' 'lookupDocumentKind ' - Me.lookupDocumentKind.Location = New System.Drawing.Point(85, 45) + Me.lookupDocumentKind.Location = New System.Drawing.Point(104, 45) Me.lookupDocumentKind.MenuManager = Me.RibbonControl1 Me.lookupDocumentKind.Name = "lookupDocumentKind" Me.lookupDocumentKind.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.lookupDocumentKind.Properties.NullText = "" Me.lookupDocumentKind.Properties.PopupSizeable = False Me.lookupDocumentKind.Properties.PopupView = Me.GridView2 - Me.lookupDocumentKind.Size = New System.Drawing.Size(198, 20) + Me.lookupDocumentKind.Size = New System.Drawing.Size(179, 20) Me.lookupDocumentKind.StyleController = Me.LayoutControl1 Me.lookupDocumentKind.TabIndex = 8 ' @@ -529,7 +542,7 @@ Partial Class frmExportMain ' 'chkShowExported ' - Me.chkShowExported.Location = New System.Drawing.Point(12, 192) + Me.chkShowExported.Location = New System.Drawing.Point(12, 252) Me.chkShowExported.MenuManager = Me.RibbonControl1 Me.chkShowExported.Name = "chkShowExported" Me.chkShowExported.Properties.Caption = "Bereits exportierte Belege anzeigen" @@ -537,29 +550,41 @@ Partial Class frmExportMain Me.chkShowExported.StyleController = Me.LayoutControl1 Me.chkShowExported.TabIndex = 9 ' - 'TextEdit1 + 'txtDocumentFrom ' - Me.TextEdit1.Location = New System.Drawing.Point(85, 105) - Me.TextEdit1.MenuManager = Me.RibbonControl1 - Me.TextEdit1.Name = "TextEdit1" - Me.TextEdit1.Size = New System.Drawing.Size(198, 20) - Me.TextEdit1.StyleController = Me.LayoutControl1 - Me.TextEdit1.TabIndex = 10 + Me.txtDocumentFrom.Location = New System.Drawing.Point(104, 135) + Me.txtDocumentFrom.MenuManager = Me.RibbonControl1 + Me.txtDocumentFrom.Name = "txtDocumentFrom" + Me.txtDocumentFrom.Size = New System.Drawing.Size(179, 20) + Me.txtDocumentFrom.StyleController = Me.LayoutControl1 + Me.txtDocumentFrom.TabIndex = 10 ' - 'TextEdit2 + 'txtDocumentTo ' - Me.TextEdit2.Location = New System.Drawing.Point(85, 135) - Me.TextEdit2.MenuManager = Me.RibbonControl1 - Me.TextEdit2.Name = "TextEdit2" - Me.TextEdit2.Size = New System.Drawing.Size(198, 20) - Me.TextEdit2.StyleController = Me.LayoutControl1 - Me.TextEdit2.TabIndex = 11 + Me.txtDocumentTo.Location = New System.Drawing.Point(104, 165) + Me.txtDocumentTo.MenuManager = Me.RibbonControl1 + Me.txtDocumentTo.Name = "txtDocumentTo" + Me.txtDocumentTo.Size = New System.Drawing.Size(179, 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.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.StyleController = Me.LayoutControl1 + Me.dateDocDateTo.TabIndex = 12 ' 'Root ' 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.LayoutControlItem4, Me.LayoutControlItem5, Me.LayoutControlItem6, Me.LayoutControlItem7}) + Me.Root.Items.AddRange(New DevExpress.XtraLayout.BaseLayoutItem() {Me.LayoutControlItem1, Me.EmptySpaceItem1, Me.LayoutControlItem3, Me.LayoutControlItem2, Me.LayoutControlItem4, Me.LayoutControlItem5, Me.LayoutControlItem6, Me.LayoutControlItem7, Me.LayoutControlItem8, Me.LayoutControlItem9}) Me.Root.Name = "Root" Me.Root.Size = New System.Drawing.Size(298, 538) Me.Root.TextVisible = False @@ -572,36 +597,35 @@ 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(58, 13) + Me.LayoutControlItem1.TextSize = New System.Drawing.Size(77, 13) ' 'EmptySpaceItem1 ' Me.EmptySpaceItem1.AllowHotTrack = False - Me.EmptySpaceItem1.Location = New System.Drawing.Point(0, 204) + Me.EmptySpaceItem1.Location = New System.Drawing.Point(0, 264) Me.EmptySpaceItem1.Name = "EmptySpaceItem1" - Me.EmptySpaceItem1.Size = New System.Drawing.Size(278, 314) + Me.EmptySpaceItem1.Size = New System.Drawing.Size(278, 254) Me.EmptySpaceItem1.TextSize = New System.Drawing.Size(0, 0) ' 'LayoutControlItem3 ' Me.LayoutControlItem3.Control = Me.lookupAccount - Me.LayoutControlItem3.Location = New System.Drawing.Point(0, 60) + Me.LayoutControlItem3.Location = New System.Drawing.Point(0, 90) Me.LayoutControlItem3.Name = "LayoutControlItem3" 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(58, 13) + Me.LayoutControlItem3.TextSize = New System.Drawing.Size(77, 13) ' 'LayoutControlItem2 ' - Me.LayoutControlItem2.Control = Me.dateDocDate - Me.LayoutControlItem2.Enabled = False - Me.LayoutControlItem2.Location = New System.Drawing.Point(0, 150) + Me.LayoutControlItem2.Control = Me.dateDocDateFrom + Me.LayoutControlItem2.Location = New System.Drawing.Point(0, 180) Me.LayoutControlItem2.Name = "LayoutControlItem2" 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" - Me.LayoutControlItem2.TextSize = New System.Drawing.Size(58, 13) + Me.LayoutControlItem2.Text = "Belegdatum Von" + Me.LayoutControlItem2.TextSize = New System.Drawing.Size(77, 13) ' 'LayoutControlItem4 ' @@ -611,12 +635,12 @@ Partial Class frmExportMain Me.LayoutControlItem4.Padding = New DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5) Me.LayoutControlItem4.Size = New System.Drawing.Size(278, 30) Me.LayoutControlItem4.Text = "Belegart" - Me.LayoutControlItem4.TextSize = New System.Drawing.Size(58, 13) + Me.LayoutControlItem4.TextSize = New System.Drawing.Size(77, 13) ' 'LayoutControlItem5 ' Me.LayoutControlItem5.Control = Me.chkShowExported - Me.LayoutControlItem5.Location = New System.Drawing.Point(0, 180) + Me.LayoutControlItem5.Location = New System.Drawing.Point(0, 240) Me.LayoutControlItem5.Name = "LayoutControlItem5" Me.LayoutControlItem5.Size = New System.Drawing.Size(278, 24) Me.LayoutControlItem5.TextSize = New System.Drawing.Size(0, 0) @@ -624,25 +648,43 @@ Partial Class frmExportMain ' 'LayoutControlItem6 ' - Me.LayoutControlItem6.Control = Me.TextEdit1 - Me.LayoutControlItem6.Enabled = False - Me.LayoutControlItem6.Location = New System.Drawing.Point(0, 90) + Me.LayoutControlItem6.Control = Me.txtDocumentFrom + Me.LayoutControlItem6.Location = New System.Drawing.Point(0, 120) Me.LayoutControlItem6.Name = "LayoutControlItem6" 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(58, 13) + Me.LayoutControlItem6.TextSize = New System.Drawing.Size(77, 13) ' 'LayoutControlItem7 ' - Me.LayoutControlItem7.Control = Me.TextEdit2 - Me.LayoutControlItem7.Enabled = False - Me.LayoutControlItem7.Location = New System.Drawing.Point(0, 120) + Me.LayoutControlItem7.Control = Me.txtDocumentTo + Me.LayoutControlItem7.Location = New System.Drawing.Point(0, 150) Me.LayoutControlItem7.Name = "LayoutControlItem7" 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(58, 13) + Me.LayoutControlItem7.TextSize = New System.Drawing.Size(77, 13) + ' + 'LayoutControlItem8 + ' + Me.LayoutControlItem8.Control = Me.dateDocDateTo + Me.LayoutControlItem8.Location = New System.Drawing.Point(0, 210) + Me.LayoutControlItem8.Name = "LayoutControlItem8" + 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) ' 'LabelControl2 ' @@ -676,6 +718,26 @@ Partial Class frmExportMain ' Me.SplashScreenManager.ClosingDelay = 500 ' + 'comboDocumentType + ' + Me.comboDocumentType.Location = New System.Drawing.Point(104, 75) + 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.NullText = "" + Me.comboDocumentType.Properties.PopupSizeable = False + Me.comboDocumentType.Properties.PopupView = Me.GridView3 + Me.comboDocumentType.Size = New System.Drawing.Size(179, 20) + Me.comboDocumentType.StyleController = Me.LayoutControl1 + Me.comboDocumentType.TabIndex = 13 + ' + 'GridView3 + ' + Me.GridView3.FocusRectStyle = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFocus + Me.GridView3.Name = "GridView3" + Me.GridView3.OptionsSelection.EnableAppearanceFocusedCell = False + Me.GridView3.OptionsView.ShowGroupPanel = False + ' 'frmExportMain ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) @@ -708,15 +770,17 @@ Partial Class frmExportMain Me.LayoutControl1.ResumeLayout(False) CType(Me.lookupMandator.Properties, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.GridLookUpEdit1View, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.dateDocDate.Properties.CalendarTimeProperties, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.dateDocDate.Properties, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.dateDocDateFrom.Properties.CalendarTimeProperties, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.dateDocDateFrom.Properties, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.lookupAccount.Properties, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.GridView1, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.lookupDocumentKind.Properties, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.GridView2, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.chkShowExported.Properties, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.TextEdit1.Properties, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.TextEdit2.Properties, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.txtDocumentFrom.Properties, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.txtDocumentTo.Properties, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.dateDocDateTo.Properties.CalendarTimeProperties, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.dateDocDateTo.Properties, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.Root, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.LayoutControlItem1, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.EmptySpaceItem1, System.ComponentModel.ISupportInitialize).EndInit() @@ -726,6 +790,10 @@ Partial Class frmExportMain CType(Me.LayoutControlItem5, System.ComponentModel.ISupportInitialize).EndInit() 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.comboDocumentType.Properties, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.GridView3, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) Me.PerformLayout() @@ -751,7 +819,7 @@ Partial Class frmExportMain Friend WithEvents GridLookUpEdit1View As DevExpress.XtraGrid.Views.Grid.GridView Friend WithEvents colName As DevExpress.XtraGrid.Columns.GridColumn Friend WithEvents colId As DevExpress.XtraGrid.Columns.GridColumn - Friend WithEvents dateDocDate As DevExpress.XtraEditors.DateEdit + Friend WithEvents dateDocDateFrom As DevExpress.XtraEditors.DateEdit Friend WithEvents LayoutControlItem2 As DevExpress.XtraLayout.LayoutControlItem Friend WithEvents EmptySpaceItem1 As DevExpress.XtraLayout.EmptySpaceItem Friend WithEvents lookupAccount As DevExpress.XtraEditors.GridLookUpEdit @@ -771,8 +839,8 @@ Partial Class frmExportMain Friend WithEvents colImported As DevExpress.XtraGrid.Columns.GridColumn Friend WithEvents chkShowExported As DevExpress.XtraEditors.CheckEdit Friend WithEvents LayoutControlItem5 As DevExpress.XtraLayout.LayoutControlItem - Friend WithEvents TextEdit1 As DevExpress.XtraEditors.TextEdit - Friend WithEvents TextEdit2 As DevExpress.XtraEditors.TextEdit + Friend WithEvents txtDocumentFrom As DevExpress.XtraEditors.TextEdit + Friend WithEvents txtDocumentTo As DevExpress.XtraEditors.TextEdit Friend WithEvents LayoutControlItem6 As DevExpress.XtraLayout.LayoutControlItem Friend WithEvents LayoutControlItem7 As DevExpress.XtraLayout.LayoutControlItem Friend WithEvents GridColumn7 As DevExpress.XtraGrid.Columns.GridColumn @@ -791,4 +859,9 @@ Partial Class frmExportMain Friend WithEvents GridColumn9 As DevExpress.XtraGrid.Columns.GridColumn Friend WithEvents GridColumn10 As DevExpress.XtraGrid.Columns.GridColumn Friend WithEvents RepositoryItemDateEdit1 As DevExpress.XtraEditors.Repository.RepositoryItemDateEdit + Friend WithEvents dateDocDateTo As DevExpress.XtraEditors.DateEdit + Friend WithEvents LayoutControlItem8 As DevExpress.XtraLayout.LayoutControlItem + Friend WithEvents LayoutControlItem9 As DevExpress.XtraLayout.LayoutControlItem + Friend WithEvents comboDocumentType As DevExpress.XtraEditors.GridLookUpEdit + Friend WithEvents GridView3 As DevExpress.XtraGrid.Views.Grid.GridView End Class diff --git a/MultiTool.Form/frmExportMain.vb b/MultiTool.Form/frmExportMain.vb index 336cf0b..4a13e09 100644 --- a/MultiTool.Form/frmExportMain.vb +++ b/MultiTool.Form/frmExportMain.vb @@ -4,6 +4,7 @@ Imports DigitalData.GUIs.Common Imports DigitalData.Modules.Config Imports DigitalData.Modules.Database Imports DigitalData.Modules.Logging +Imports DigitalData.Modules.Language Imports MultiTool.Shared Imports MultiTool.Shared.Templates Imports MultiTool.Shared.Exceptions @@ -81,6 +82,15 @@ Public Class frmExportMain lookupDocumentKind.ForceInitialize() lookupDocumentKind.Properties.View.BestFitColumns() + comboDocumentType.Properties.DisplayMember = "Key" + comboDocumentType.Properties.ValueMember = "Value" + comboDocumentType.Properties.DataSource = [Enum]. + GetValues(GetType(WinlineData.DocumentType)). + Cast(Of WinlineData.DocumentType)(). + Select(AddressOf MapDocumentTypeFromEnum). + ToList() + + If ConfigManager.Config.LastUsedMandator <> "" Then lookupMandator.EditValue = Winline.Mandators. Where(Function(mandator) mandator.Id = ConfigManager.Config.LastUsedMandator). @@ -91,6 +101,38 @@ Public Class frmExportMain End Try End Sub + Private Function MapDocumentTypeFromEnum(pValue As WinlineData.DocumentType) + Select Case pValue + Case WinlineData.DocumentType.IncomingOffer + Return New KeyValuePair(Of String, Integer)("Angebot EK", pValue) + + Case WinlineData.DocumentType.IncomingOrder + Return New KeyValuePair(Of String, Integer)("Auftrag EK", pValue) + + Case WinlineData.DocumentType.IncomingDeliveryNote + Return New KeyValuePair(Of String, Integer)("Lieferschein EK", pValue) + + Case WinlineData.DocumentType.IncomingInvoice + Return New KeyValuePair(Of String, Integer)("Rechnung EK", pValue) + + Case WinlineData.DocumentType.OutgoingOffer + Return New KeyValuePair(Of String, Integer)("Angebot VK", pValue) + + Case WinlineData.DocumentType.OutgoingOrder + Return New KeyValuePair(Of String, Integer)("Auftrag VK", pValue) + + Case WinlineData.DocumentType.OutgoingDeliveryNote + Return New KeyValuePair(Of String, Integer)("Lieferschein VK", pValue) + + Case WinlineData.DocumentType.OutgoingInvoice + Return New KeyValuePair(Of String, Integer)("Rechnung VK", pValue) + + Case Else + Return Nothing + + End Select + End Function + Private Sub BarButtonItem1_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem1.ItemClick SearchDocuments() End Sub @@ -109,7 +151,7 @@ Public Class frmExportMain End Sub Private Sub lookup_Properties_ButtonClick(sender As Object, e As DevExpress.XtraEditors.Controls.ButtonPressedEventArgs) _ - Handles lookupDocumentKind.Properties.ButtonClick, lookupAccount.Properties.ButtonClick + Handles lookupDocumentKind.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 @@ -120,37 +162,32 @@ Public Class frmExportMain Private Sub SearchDocuments() Try + dateDocDateFrom.DoValidate() + dateDocDateTo.DoValidate() + Dim oMandator = lookupMandator.EditValue Dim oAccount = lookupAccount.EditValue Dim oKind = lookupDocumentKind.EditValue - Dim oDateRanges = dateDocDate.SelectedRanges + 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 End If - If oDateRanges.Count > 1 Then - FormHelper.ShowWarning("Bitte nur einen Datumsbereich auswählen!") - Exit Sub - End If - - Dim oStartDate As Date = Nothing - Dim oEndDate As Date = Nothing - If oDateRanges.Count > 0 Then - Dim oRange = oDateRanges.First() - oStartDate = oRange.StartDate - oEndDate = oRange.EndDate - End If - 'TODO: Make Document Type configurable - Dim oDocuments = Winline.GetDocuments(oMandator, CurrentTemplate, WinlineData.DocumentType.Order, New WinlineData.GetDocumentArgs With { + Dim oDocuments = Winline.GetDocuments(oMandator, CurrentTemplate, comboDocumentType.EditValue, New WinlineData.GetDocumentArgs With { .Account = oAccount, .Kind = oKind, - .DateFrom = oStartDate, - .DateTo = oEndDate, - .ShowExported = oShowExported + .DateFrom = oDateFrom, + .DateTo = oDateTo, + .ShowExported = oShowExported, + .DocNumberFrom = oDocNumberFrom, + .DocNumberTo = oDocNumberTo }) GridControlDocuments.DataSource = oDocuments diff --git a/MultiTool.Form/frmMain.Designer.vb b/MultiTool.Form/frmMain.Designer.vb index 8db1448..5e7cab4 100644 --- a/MultiTool.Form/frmMain.Designer.vb +++ b/MultiTool.Form/frmMain.Designer.vb @@ -75,7 +75,7 @@ Partial Class frmMain ' 'BarButtonItem1 ' - Me.BarButtonItem1.Caption = "Vorlagen laden" + Me.BarButtonItem1.Caption = "Daten neuladen" Me.BarButtonItem1.Id = 2 Me.BarButtonItem1.ImageOptions.SvgImage = Global.MultiTool.Form.My.Resources.Resources.actions_reload Me.BarButtonItem1.Name = "BarButtonItem1" @@ -155,7 +155,7 @@ Partial Class frmMain Me.RibbonPageGroup3.Alignment = DevExpress.XtraBars.Ribbon.RibbonPageGroupAlignment.Far Me.RibbonPageGroup3.ItemLinks.Add(Me.BarButtonItem1) Me.RibbonPageGroup3.Name = "RibbonPageGroup3" - Me.RibbonPageGroup3.Text = "RibbonPageGroup3" + Me.RibbonPageGroup3.Text = "Daten" ' 'RibbonPage3 ' diff --git a/MultiTool.Form/frmMain.vb b/MultiTool.Form/frmMain.vb index 56f1107..82a801e 100644 --- a/MultiTool.Form/frmMain.vb +++ b/MultiTool.Form/frmMain.vb @@ -1,5 +1,6 @@ Imports System.ComponentModel Imports System.IO +Imports DevExpress.Utils Imports DigitalData.Controls.SQLConfig Imports DigitalData.GUIs.Common Imports DigitalData.Modules.Config @@ -17,7 +18,6 @@ Public Class frmMain Private TemplateLoader As TemplateLoader Private GridBuilder As GridBuilder Private FormHelper As FormHelper - Private WinLine As WinlineData Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load Try @@ -64,53 +64,20 @@ Public Class frmMain End If End If - SplashScreenManager.SetWaitFormDescription("Initialisierung der Datenbankverbindung") - ' Initialize Database + SplashScreenManager.SetWaitFormDescription("Initialisierung der Datenbankverbindung") Dim oConnectionString = MSSQLServer.DecryptConnectionString(ConfigManager.Config.ConnectionString) Database = New MSSQLServer(LogConfig, oConnectionString) - SplashScreenManager.SetWaitFormDescription("Initialisierung der Vorlagen") - - ' Initialize Schemas - TemplateLoader = New TemplateLoader(LogConfig, Database) - Await TemplateLoader.LoadTemplates() - Await TemplateLoader.LoadTemplateConfiguration() - Await TemplateLoader.LoadGeneralConfiguration() - Await TemplateLoader.LoadMappingConfiguration() - Await TemplateLoader.LoadMandatorConfiguration() - - ' Save Schema data in 'My' Namespace - My.MappingConfiguration = TemplateLoader.MappingConfiguration - My.TemplateConfiguration = TemplateLoader.TemplateConfiguration - My.MandatorConfiguration = TemplateLoader.MandatorConfiguration - My.GeneralConfiguration = TemplateLoader.GeneralConfiguration - My.Helpers = New [Shared].Helpers(LogConfig) - - Dim oBindingSource = New BindingList(Of Template) - For Each oTemplate As Template In TemplateLoader.TemplateList - oBindingSource.Add(oTemplate) - Next + SplashScreenManager.SetWaitFormDescription("Lade Vorlagen") + Await LoadTemplateData() SplashScreenManager.SetWaitFormDescription("Lade Winline Stammdaten") - WinLine = New WinlineData(LogConfig, Database, My.GeneralConfiguration, My.MappingConfiguration, My.MandatorConfiguration) - WinLine.Mandators.Clear() - WinLine.LoadEconomicYears() - Await WinLine.LoadMandators() - - For Each oMandator As Mandator In WinLine.Mandators - SplashScreenManager.SetWaitFormDescription(String.Format(My.Resources.frmImportMainExtra.Lade__0__Konten, oMandator.Id)) - Await WinLine.LoadAccounts(oMandator) - SplashScreenManager.SetWaitFormDescription(String.Format(My.Resources.frmImportMainExtra.Lade__0__Artikel, oMandator.Id)) - Await WinLine.LoadArticles(oMandator) - SplashScreenManager.SetWaitFormDescription(String.Format(My.Resources.frmImportMainExtra.Lade__0__Belegarten, oMandator.Id)) - Await WinLine.LoadDocumentKinds(oMandator) - Next - - My.Winline = WinLine - + My.Winline = New WinlineData(LogConfig, Database, My.GeneralConfiguration, My.MappingConfiguration, My.MandatorConfiguration) + Dim oBindingSource As BindingList(Of Template) = Await LoadWinlineData(My.Winline) GridControl1.DataSource = oBindingSource + txtVersion.Caption = String.Format(My.Resources.frmMainExtra.Version___0_, My.Application.Info.Version.ToString) txtCulture.Caption = String.Format(My.Resources.frmMainExtra.Sprache___0_, My.Application.UICulture.ToString) Catch ex As Exception @@ -122,6 +89,45 @@ Public Class frmMain End Try End Sub + Private Async Function LoadWinlineData(Winline As WinlineData) As Task(Of BindingList(Of Template)) + Winline.Mandators.Clear() + Winline.LoadEconomicYears() + Await Winline.LoadMandators() + + For Each oMandator As Mandator In Winline.Mandators + SplashScreenManager.SetWaitFormDescription(String.Format(My.Resources.frmImportMainExtra.Lade__0__Konten, oMandator.Id)) + Await Winline.LoadAccounts(oMandator) + SplashScreenManager.SetWaitFormDescription(String.Format(My.Resources.frmImportMainExtra.Lade__0__Artikel, oMandator.Id)) + Await Winline.LoadArticles(oMandator) + SplashScreenManager.SetWaitFormDescription(String.Format(My.Resources.frmImportMainExtra.Lade__0__Belegarten, oMandator.Id)) + Await Winline.LoadDocumentKinds(oMandator) + Next + + My.Winline = Winline + + Dim oBindingSource = New BindingList(Of Template) + For Each oTemplate As Template In TemplateLoader.TemplateList + oBindingSource.Add(oTemplate) + Next + Return oBindingSource + End Function + + Private Async Function LoadTemplateData() As Task + ' Initialize Schemas + TemplateLoader = New TemplateLoader(LogConfig, Database) + Await TemplateLoader.LoadTemplates() + Await TemplateLoader.LoadTemplateConfiguration() + Await TemplateLoader.LoadGeneralConfiguration() + Await TemplateLoader.LoadMappingConfiguration() + Await TemplateLoader.LoadMandatorConfiguration() + + ' Save Schema data in 'My' Namespace + My.MappingConfiguration = TemplateLoader.MappingConfiguration + My.TemplateConfiguration = TemplateLoader.TemplateConfiguration + My.MandatorConfiguration = TemplateLoader.MandatorConfiguration + My.GeneralConfiguration = TemplateLoader.GeneralConfiguration + End Function + Private Sub btnOpenImportExportForm_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnOpenImportExportForm.ItemClick Dim oTemplate As Template = GridViewTemplates.GetRow(GridViewTemplates.FocusedRowHandle) OpenImportExportForm(oTemplate) @@ -168,14 +174,16 @@ Public Class frmMain End Sub Private Sub GridViewTemplates_DoubleClick(sender As Object, e As EventArgs) Handles GridViewTemplates.DoubleClick - Dim oTemplate As Template = GridViewTemplates.GetRow(GridViewTemplates.FocusedRowHandle) - OpenImportExportForm(oTemplate) + Dim oArgs As DXMouseEventArgs = TryCast(e, DXMouseEventArgs) + Dim oHitInfo = GridViewTemplates.CalcHitInfo(oArgs.Location) + If oHitInfo.InRow Then + Dim oTemplate As Template = GridViewTemplates.GetRow(oHitInfo.RowHandle) + OpenImportExportForm(oTemplate) + End If End Sub Private Sub OpenImportExportForm(pTemplate As Template) Try - - If pTemplate Is Nothing Then MsgBox("Keine Vorlage ausgewählt! Bitte wählen Sie eine Vorlage aus!", MsgBoxStyle.Exclamation, Text) Exit Sub @@ -217,4 +225,24 @@ Public Class frmMain End Try End Sub + + Private Async Sub BarButtonItem1_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem1.ItemClick + SplashScreenManager.ShowWaitForm() + + Try + SplashScreenManager.SetWaitFormDescription("Lade Vorlagen") + Await LoadTemplateData() + + SplashScreenManager.SetWaitFormDescription("Lade Winline Stammdaten") + Dim oBindingSource As BindingList(Of Template) = Await LoadWinlineData(My.Winline) + GridControl1.DataSource = oBindingSource + + Catch ex As Exception + FormHelper.ShowError(ex, My.Resources.frmImportMainExtra.Laden_der_Winline_Daten) + + Finally + SplashScreenManager.CloseWaitForm() + + End Try + End Sub End Class \ No newline at end of file diff --git a/MultiTool.Shared/My Project/AssemblyInfo.vb b/MultiTool.Shared/My Project/AssemblyInfo.vb index cf48350..2879e5c 100644 --- a/MultiTool.Shared/My Project/AssemblyInfo.vb +++ b/MultiTool.Shared/My Project/AssemblyInfo.vb @@ -12,7 +12,7 @@ Imports System.Runtime.InteropServices - + @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' indem Sie "*" wie unten gezeigt eingeben: ' - + diff --git a/MultiTool.Shared/Patterns.vb b/MultiTool.Shared/Patterns.vb index ae16993..4a7576e 100644 --- a/MultiTool.Shared/Patterns.vb +++ b/MultiTool.Shared/Patterns.vb @@ -7,7 +7,7 @@ Imports MultiTool.Shared.Winline.Entities Public Class Patterns Inherits BaseClass - Private GeneralConfig As GeneralConfig + Private ReadOnly GeneralConfig As GeneralConfig Public Sub New(pLogConfig As LogConfig, pGeneralConfig As GeneralConfig) MyBase.New(pLogConfig) diff --git a/MultiTool.Shared/Winline/WinlineData.vb b/MultiTool.Shared/Winline/WinlineData.vb index 9989896..72f8c7b 100644 --- a/MultiTool.Shared/Winline/WinlineData.vb +++ b/MultiTool.Shared/Winline/WinlineData.vb @@ -33,10 +33,14 @@ Namespace Winline End Sub Public Enum DocumentType - Offer = 1 - Order = 2 - DeliverySlip = 3 - Invoice = 4 + OutgoingOffer = 1 + OutgoingOrder = 2 + OutgoingDeliveryNote = 3 + OutgoingInvoice = 4 + IncomingOffer = -1 + IncomingOrder = -2 + IncomingDeliveryNote = -3 + IncomingInvoice = -4 End Enum Public Class GetDocumentArgs @@ -44,6 +48,8 @@ Namespace Winline Public Property Kind As DocumentKind Public Property DateFrom As Date Public Property DateTo As Date + Public Property DocNumberFrom As String + Public Property DocNumberTo As String Public Property ShowExported As Boolean End Class @@ -522,66 +528,92 @@ Namespace Winline Return Nothing End Function - Public Function GetDocuments(pMandator As Mandator, pTemplate As Template, pDocumentType As DocumentType, pOptions As GetDocumentArgs) As List(Of Document) + Public Function GetDocuments(pMandator As Mandator, pTemplate As Template, pDocumentType As Integer, pOptions As GetDocumentArgs) As List(Of Document) Try Dim oYear As Integer = Config.GetWinLineYear() + Dim oTypeConstraint = "" + If pDocumentType <> 0 Then + oTypeConstraint = $"T.c139 = {pDocumentType} AND " + End If + Dim oAccountConstraint = "" If pOptions.Account IsNot Nothing Then - oAccountConstraint = $"c021 = '{pOptions.Account.Id}' AND " + oAccountConstraint = $"T.c021 = '{pOptions.Account.Id}' AND " End If Dim oKindConstraint = "" If pOptions.Kind IsNot Nothing Then - oKindConstraint = $"c035 = {pOptions.Kind.Id} AND " + oKindConstraint = $"T.c035 = {pOptions.Kind.Id} AND " + End If + + Dim oDateFromConstraint = "" + If pOptions.DateFrom <> Date.MinValue Then + oDateFromConstraint = $"T2.DATE >= CAST('{pOptions.DateFrom.ToString("yyyy-MM-dd")}' as date) AND " End If - Dim oDateConstraint = "" - If pOptions.DateFrom <> Date.MinValue And pOptions.DateTo <> Date.MinValue Then - oDateConstraint = $"" + Dim oDateToConstraint = "" + If pOptions.DateTo <> Date.MinValue Then + oDateToConstraint = $"T2.DATE <= CAST('{pOptions.DateTo.ToString("yyyy-MM-dd")}' as date) AND " End If - Dim oExportedConstraint = "U010 = 0 AND" + Dim oDocNumberConstraint = "" + If pOptions.DocNumberFrom <> String.Empty Then + oDocNumberConstraint &= $"T.c044 >= '{pOptions.DocNumberFrom}' AND " + End If + If pOptions.DocNumberTo <> String.Empty Then + oDocNumberConstraint &= $"T.c044 <= '{pOptions.DocNumberTo}' AND " + End If + + Dim oExportedConstraint = "(T.U010 = 0 OR T.U010 IS NULL) AND" If pOptions.ShowExported Then oExportedConstraint = "" End If - Dim oDocumentType As Integer = pDocumentType Dim oSql = $" - SELECT - c139 DOCUMENT_TYPE, - c035 DOCUMENT_KIND, - - c021 ACCOUNT_NUMBER, - c022 RUNNING_NUMBER, - - c043 OFFER_NUMBER, - c027 OFFER_DATE, - - c044 ORDER_NUMBER, - c028 ORDER_DATE, - - c045 DELIVERY_NUMBER, - c029 DELIVERY_DATE, - - c055 INVOICE_NUMBER, - c032 INVOICE_DATE, - - c100 GROSS_AMOUNT, - c114 NET_AMOUNT, - - U010 ALREADY_EXPORTED, - U011 EXPORTED_WHO, - U012 EXPORTED_WHEN, - U013 EXPORTED_FILE - - FROM [{pMandator.Database}].[dbo].[T025] + SELECT + T2.DATE, + T.c139 DOCUMENT_TYPE, + T.c035 DOCUMENT_KIND, + T.c021 ACCOUNT_NUMBER, + T.c022 RUNNING_NUMBER, + T.c043 OFFER_NUMBER, + T.c027 OFFER_DATE, + T.c044 ORDER_NUMBER, + T.c028 ORDER_DATE, + T.c045 DELIVERY_NUMBER, + T.c029 DELIVERY_DATE, + T.c055 INVOICE_NUMBER, + T.c032 INVOICE_DATE, + T.c100 GROSS_AMOUNT, + T.c114 NET_AMOUNT, + T.U010 ALREADY_EXPORTED, + T.U011 EXPORTED_WHO, + T.U012 EXPORTED_WHEN, + T.U013 EXPORTED_FILE + FROM [{pMandator.Database}].[dbo].[T025] T + INNER JOIN (SELECT * FROM ( + SELECT c021, c022, mesoyear, mesocomp, c027 [DATE] FROM [{pMandator.Database}].[dbo].[T025] + WHERE c139 = 1 OR c139 = -1 + UNION + SELECT c021, c022, mesoyear, mesocomp, c028 [DATE] FROM [{pMandator.Database}].[dbo].[T025] + WHERE c139 = 2 OR c139 = -2 + UNION + SELECT c021, c022, mesoyear, mesocomp, c029 [DATE] FROM [{pMandator.Database}].[dbo].[T025] + WHERE c139 = 3 OR c139 = -3 + UNION + SELECT c021, c022, mesoyear, mesocomp, c032 [DATE] FROM [{pMandator.Database}].[dbo].[T025] + WHERE c139 = 4 OR c139 = -4 + ) QUERY) T2 ON T.c021 = T2.c021 AND T.c022 = T2.c022 AND T.mesoyear = T2.mesoyear AND T.mesocomp = T2.mesocomp WHERE - c139 = {oDocumentType} AND + {oTypeConstraint} {oAccountConstraint} {oKindConstraint} {oExportedConstraint} - [mesocomp] = '{pMandator.Id}' AND [mesoyear] = {oYear}" + {oDocNumberConstraint} + {oDateFromConstraint} + {oDateToConstraint} + T.[mesocomp] = '{pMandator.Id}' AND T.[mesoyear] = {oYear}" Dim oTable As DataTable = Database.GetDatatable(oSql) Dim oDocuments As New List(Of Document)