Kundensuche erweitert

This commit is contained in:
ms
2019-08-21 17:01:47 +02:00
parent 41a24b77fc
commit 8cbc8c3728
4 changed files with 157 additions and 10 deletions

View File

@@ -22,9 +22,11 @@ Partial Class usrcntlFirmen
'Das Bearbeiten mit dem Code-Editor ist nicht möglich.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Dim DataGridViewCellStyle1 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
Me.PanTop = New System.Windows.Forms.Panel()
Me.PanOben = New System.Windows.Forms.Panel()
Me.btnDetailSuche = New System.Windows.Forms.Button()
Me.btnReset = New System.Windows.Forms.Button()
Me.Label4 = New System.Windows.Forms.Label()
Me.txtSuche = New System.Windows.Forms.TextBox()
@@ -36,10 +38,20 @@ Partial Class usrcntlFirmen
Me.lblMs = New System.Windows.Forms.Label()
Me.lblAnzahl = New System.Windows.Forms.Label()
Me.dgvKunden = New System.Windows.Forms.DataGridView()
Me.SplitContainer1 = New System.Windows.Forms.SplitContainer()
Me.Label1 = New System.Windows.Forms.Label()
Me.cboLand = New System.Windows.Forms.ComboBox()
Me.cboRolle = New DISPO.MyComboBox(Me.components)
' Me.cboRolle.BackColor = Color.White
Me.Label14 = New System.Windows.Forms.Label()
Me.PanTop.SuspendLayout()
Me.PanOben.SuspendLayout()
Me.Panel2.SuspendLayout()
CType(Me.dgvKunden, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.SplitContainer1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SplitContainer1.Panel1.SuspendLayout()
Me.SplitContainer1.Panel2.SuspendLayout()
Me.SplitContainer1.SuspendLayout()
Me.SuspendLayout()
'
'PanTop
@@ -56,6 +68,7 @@ Partial Class usrcntlFirmen
'
'PanOben
'
Me.PanOben.Controls.Add(Me.btnDetailSuche)
Me.PanOben.Controls.Add(Me.btnReset)
Me.PanOben.Controls.Add(Me.Label4)
Me.PanOben.Controls.Add(Me.txtSuche)
@@ -65,11 +78,22 @@ Partial Class usrcntlFirmen
Me.PanOben.Size = New System.Drawing.Size(666, 84)
Me.PanOben.TabIndex = 1
'
'btnDetailSuche
'
Me.btnDetailSuche.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.btnDetailSuche.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.btnDetailSuche.Location = New System.Drawing.Point(458, 45)
Me.btnDetailSuche.Name = "btnDetailSuche"
Me.btnDetailSuche.Size = New System.Drawing.Size(162, 23)
Me.btnDetailSuche.TabIndex = 45
Me.btnDetailSuche.Text = "Detailsuche"
Me.btnDetailSuche.UseVisualStyleBackColor = True
'
'btnReset
'
Me.btnReset.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.btnReset.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.btnReset.Location = New System.Drawing.Point(456, 32)
Me.btnReset.Location = New System.Drawing.Point(458, 15)
Me.btnReset.Name = "btnReset"
Me.btnReset.Size = New System.Drawing.Size(162, 23)
Me.btnReset.TabIndex = 33
@@ -186,17 +210,79 @@ Partial Class usrcntlFirmen
Me.dgvKunden.BackgroundColor = System.Drawing.Color.White
Me.dgvKunden.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize
Me.dgvKunden.Dock = System.Windows.Forms.DockStyle.Fill
Me.dgvKunden.Location = New System.Drawing.Point(0, 84)
Me.dgvKunden.Location = New System.Drawing.Point(0, 0)
Me.dgvKunden.Name = "dgvKunden"
Me.dgvKunden.RowHeadersVisible = False
Me.dgvKunden.Size = New System.Drawing.Size(914, 694)
Me.dgvKunden.Size = New System.Drawing.Size(914, 642)
Me.dgvKunden.TabIndex = 6
'
'SplitContainer1
'
Me.SplitContainer1.Dock = System.Windows.Forms.DockStyle.Fill
Me.SplitContainer1.Location = New System.Drawing.Point(0, 84)
Me.SplitContainer1.Name = "SplitContainer1"
Me.SplitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal
'
'SplitContainer1.Panel1
'
Me.SplitContainer1.Panel1.BackColor = System.Drawing.SystemColors.GradientInactiveCaption
Me.SplitContainer1.Panel1.Controls.Add(Me.Label1)
Me.SplitContainer1.Panel1.Controls.Add(Me.cboLand)
Me.SplitContainer1.Panel1.Controls.Add(Me.cboRolle)
Me.SplitContainer1.Panel1.Controls.Add(Me.Label14)
'
'SplitContainer1.Panel2
'
Me.SplitContainer1.Panel2.Controls.Add(Me.dgvKunden)
Me.SplitContainer1.Size = New System.Drawing.Size(914, 694)
Me.SplitContainer1.SplitterDistance = 48
Me.SplitContainer1.TabIndex = 7
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Bold)
Me.Label1.Location = New System.Drawing.Point(455, 15)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(39, 14)
Me.Label1.TabIndex = 515
Me.Label1.Text = "LAND:"
'
'cboLand
'
Me.cboLand.FormattingEnabled = True
Me.cboLand.Items.AddRange(New Object() {"AT", "DE", "HR", "IT", "RO", "SRB", "TR", "-"})
Me.cboLand.Location = New System.Drawing.Point(500, 11)
Me.cboLand.Name = "cboLand"
Me.cboLand.Size = New System.Drawing.Size(55, 21)
Me.cboLand.TabIndex = 514
'
'cboRolle
'
Me.cboRolle._value = ""
Me.cboRolle.BackColor = System.Drawing.SystemColors.Window
Me.cboRolle.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.cboRolle.FormattingEnabled = True
Me.cboRolle.Location = New System.Drawing.Point(86, 11)
Me.cboRolle.Name = "cboRolle"
Me.cboRolle.Size = New System.Drawing.Size(295, 21)
Me.cboRolle.TabIndex = 513
'
'Label14
'
Me.Label14.AutoSize = True
Me.Label14.Font = New System.Drawing.Font("Arial", 8.25!, System.Drawing.FontStyle.Bold)
Me.Label14.Location = New System.Drawing.Point(32, 15)
Me.Label14.Name = "Label14"
Me.Label14.Size = New System.Drawing.Size(45, 14)
Me.Label14.TabIndex = 512
Me.Label14.Text = "ROLLE:"
'
'usrcntlFirmen
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.Controls.Add(Me.dgvKunden)
Me.Controls.Add(Me.SplitContainer1)
Me.Controls.Add(Me.Panel2)
Me.Controls.Add(Me.PanTop)
Me.Name = "usrcntlFirmen"
@@ -207,6 +293,11 @@ Partial Class usrcntlFirmen
Me.Panel2.ResumeLayout(False)
Me.Panel2.PerformLayout()
CType(Me.dgvKunden, System.ComponentModel.ISupportInitialize).EndInit()
Me.SplitContainer1.Panel1.ResumeLayout(False)
Me.SplitContainer1.Panel1.PerformLayout()
Me.SplitContainer1.Panel2.ResumeLayout(False)
CType(Me.SplitContainer1, System.ComponentModel.ISupportInitialize).EndInit()
Me.SplitContainer1.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
@@ -224,4 +315,10 @@ Partial Class usrcntlFirmen
Friend WithEvents lblAnzahl As Label
Friend WithEvents dgvKunden As DataGridView
Friend WithEvents btnReset As Button
Friend WithEvents SplitContainer1 As SplitContainer
Friend WithEvents btnDetailSuche As Button
Friend WithEvents cboRolle As MyComboBox
Friend WithEvents Label14 As Label
Friend WithEvents cboLand As ComboBox
Friend WithEvents Label1 As Label
End Class

View File

@@ -13,6 +13,17 @@ Public Class usrcntlFirmen
Private Sub usrcntlFirmen_Load(sender As Object, e As EventArgs) Handles Me.Load
EnableDoubleBuffered(dgvKunden)
SplitContainer1.Panel1Collapsed = True
btnDetailSuche.Text = ChrW(9660) & ChrW(9660) & ChrW(9660) & "Detailsuche" & ChrW(9660) & ChrW(9660) & ChrW(9660)
cboRolle.Items.Clear()
cboRolle.Items.Add(New MyListItem("nicht filtern", "-1"))
cboRolle.Items.Add(New MyListItem("ohne (-)", "0"))
cboRolle.Items.Add(New MyListItem("Auftraggeber", "1"))
cboRolle.Items.Add(New MyListItem("Ladestelle", "2"))
cboRolle.Items.Add(New MyListItem("Entladestelle", "3"))
cboRolle.Items.Add(New MyListItem("Frachtführer", "4"))
cboRolle.Items.Add(New MyListItem("Transportunternehmen", "5"))
showDGVKunden()
End Sub
@@ -31,10 +42,8 @@ Public Class usrcntlFirmen
Dim search As String = ""
Dim start As Long = (DateTime.Now - New DateTime(1970, 1, 1)).TotalMilliseconds
If txtSuche.Text <> "" Then
search = txtSuche.Text.Replace("'", "")
where &= " WHERE kd_firma LIKE '%" & search & "%' OR (kd_str + ' ' + kd_strnr) LIKE '%" & search & "%' OR (kd_plz + ' - ' + kd_ort) LIKE '%" & search & "%' OR kd_land LIKE '%" & search & "%'"
End If
Whereinator3000(search, where)
With dgvKunden
Dim top As String = ""
@@ -111,6 +120,8 @@ Public Class usrcntlFirmen
Private Sub btnReset_Click(sender As Object, e As EventArgs) Handles btnReset.Click
txtSuche.Text = ""
cboLand.SelectedItem = "-"
cboRolle._value = "-1"
showDGVKunden()
End Sub
@@ -170,4 +181,43 @@ Public Class usrcntlFirmen
Me.Enabled = True
End Try
End Sub
Private Sub btnDetailSuche_Click(sender As Object, e As EventArgs) Handles btnDetailSuche.Click
SplitContainer1.Panel1Collapsed = Not SplitContainer1.Panel1Collapsed
If SplitContainer1.Panel1Collapsed Then
btnDetailSuche.BackColor = Color.White
btnDetailSuche.Text = ChrW(9660) & ChrW(9660) & ChrW(9660) & "Detailsuche" & ChrW(9660) & ChrW(9660) & ChrW(9660)
Else
btnDetailSuche.BackColor = Color.RoyalBlue
btnDetailSuche.Text = ChrW(9650) & ChrW(9650) & ChrW(9650) & "Detailsuche" & ChrW(9650) & ChrW(9650) & ChrW(9650)
End If
End Sub
Function Whereinator3000(ByRef search As String, ByRef where As String)
If txtSuche.Text <> "" Then
search = txtSuche.Text.Replace("'", "")
Else
search = "%"
End If
where &= " WHERE (kd_firma LIKE '%" & search & "%' OR (kd_str + ' ' + kd_strnr) LIKE '%" & search & "%' OR (kd_plz + ' - ' + kd_ort) LIKE '%" & search & "%' OR kd_land LIKE '%" & search & "%')"
If cboRolle._value IsNot "-1" And cboRolle._value IsNot "" Then
where &= " AND kd_rolle = '" & cboRolle._value & "'"
End If
If cboLand.SelectedItem IsNot "" And cboLand.SelectedItem IsNot "-" And cboLand.SelectedItem IsNot Nothing Then
where &= " AND kd_land = '" & cboLand.SelectedItem & "'"
End If
'Else
' If cboRolle._value IsNot "-1" And cboRolle._value IsNot "" Then
' where &= " WHERE kd_rolle = '" & cboRolle._value & "'"
' End If
'End If
End Function
Private Sub cboRolle_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboRolle.SelectedIndexChanged, cboLand.SelectedIndexChanged
showDGVKunden()
End Sub
End Class