Bugfix Gesamtsicherheiten (über Kontextmenü -> Warenwert).
This commit is contained in:
@@ -381,6 +381,32 @@ Public Class frmGesamtsicherheitenNEU
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub WarenwertContext_TextChanged(sender As Object, e As EventArgs) Handles txtWarenwertContext.TextChanged
|
||||
|
||||
|
||||
If Not IsNumeric(txtWarenwertContext.Text) And sender.name = "txtWarenwertContext" Then
|
||||
txtWarenwertContext.ForeColor = Color.Red
|
||||
Exit Sub
|
||||
Else
|
||||
txtWarenwertContext.ForeColor = Color.Black
|
||||
|
||||
End If
|
||||
|
||||
txtWarenwertContext.Text = Replace(txtWarenwertContext.Text, ".", "")
|
||||
txtWarenwertContext.Text = Replace(txtWarenwertContext.Text, "€", "")
|
||||
|
||||
Try
|
||||
Select Case sender.name
|
||||
|
||||
Case "txtWarenwertContext"
|
||||
txtSicherheitsbetragContext.Text = (txtWarenwertContext.Text * ZollsatzMulti).ToString("N")
|
||||
End Select
|
||||
Catch
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub Warenwert_Keypresses(sender As Object, e As System.Windows.Forms.KeyPressEventArgs) Handles txtSicherheitWarenwert.KeyPress, txtPosWarenwert.KeyPress, txtAnzahlPos.KeyPress, txtZollsatzueberschreiben.KeyPress
|
||||
Select Case Asc(e.KeyChar)
|
||||
Case 48 To 57, 8, 44, 22
|
||||
@@ -1098,7 +1124,8 @@ Public Class frmGesamtsicherheitenNEU
|
||||
Dim isInList As Boolean = False
|
||||
|
||||
Dim onlyOpenDT As DataTable
|
||||
|
||||
dataTable.DefaultView.Sort = "gs_gsnr ASC"
|
||||
dataTable = dataTable.DefaultView.ToTable
|
||||
onlyOpenDT = dataTable.Select("gs_isOpen = True").CopyToDataTable
|
||||
|
||||
|
||||
@@ -1112,8 +1139,6 @@ Public Class frmGesamtsicherheitenNEU
|
||||
|
||||
End If
|
||||
|
||||
'MsgBox("prevOPENGessicherheitID " & prevGessicherheitID)
|
||||
|
||||
If i = onlyOpenDT.Rows.Count - 1 Then
|
||||
nextGessicherheitID = -1 ' no next Sicherheit
|
||||
Else
|
||||
@@ -1121,52 +1146,65 @@ Public Class frmGesamtsicherheitenNEU
|
||||
|
||||
End If
|
||||
|
||||
'MsgBox("nextOPENGessicherheitID " & nextGessicherheitID)
|
||||
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
If isInList = False AndAlso onlyOpenDT.Rows.Count - 1 <> 0 Then
|
||||
|
||||
For i As Integer = 0 To dataTable.Rows.Count - 1
|
||||
If dataTable.Rows(i).Item("gs_gsnr") = Me.gessicherheitID Then
|
||||
setPrevAndNextGesIDAllOpenIfNotInList(isInList) 'wenn Me.gessicherheitID selbst nicht mehr offen ist!!!
|
||||
|
||||
If i = 0 Then
|
||||
prevGessicherheitID = -1 ' no prev Sicherheit
|
||||
Else
|
||||
If isInList = False Then
|
||||
dataTable.Rows.Add(Me.gessicherheitID, True) ' wenn Me.gessicherheitsID neu angelegt wurde!!!
|
||||
setPrevAndNextGesIDAllOpenIfNotInList(isInList)
|
||||
|
||||
For j As Integer = i To 0
|
||||
If dataTable.Rows(j).Item("gs_isOpen") Then
|
||||
prevGessicherheitID = dataTable.Rows(j).Item("gs_gsnr")
|
||||
'MsgBox("prevGessicherheitID " & prevGessicherheitID)
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
If i = dataTable.Rows.Count - 1 Then
|
||||
nextGessicherheitID = -1 ' ' no next Sicherheit
|
||||
Else
|
||||
For k As Integer = i To dataTable.Rows.Count - 1
|
||||
If dataTable.Rows(k).Item("gs_isOpen") Then
|
||||
nextGessicherheitID = dataTable.Rows(k).Item("gs_gsnr")
|
||||
'MsgBox("nextGessicherheitID " & nextGessicherheitID)
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
|
||||
Next
|
||||
End If
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
Private Function setPrevAndNextGesIDAllOpenIfNotInList(ByRef isInList As Boolean)
|
||||
|
||||
For i As Integer = 0 To dataTable.Rows.Count - 1
|
||||
If dataTable.Rows(i).Item("gs_gsnr") = Me.gessicherheitID Then
|
||||
isInList = True
|
||||
If i = 0 Then
|
||||
prevGessicherheitID = -1 ' no prev Sicherheit
|
||||
Else
|
||||
|
||||
For j As Integer = i - 1 To 0 Step -1
|
||||
If dataTable.Rows(j).Item("gs_isOpen") Then
|
||||
prevGessicherheitID = dataTable.Rows(j).Item("gs_gsnr")
|
||||
'MsgBox("prevGessicherheitID " & prevGessicherheitID)
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
|
||||
If i = dataTable.Rows.Count - 1 Then
|
||||
nextGessicherheitID = -1 ' ' no next Sicherheit
|
||||
Else
|
||||
For k As Integer = i To dataTable.Rows.Count - 1
|
||||
If dataTable.Rows(k).Item("gs_isOpen") Then
|
||||
nextGessicherheitID = dataTable.Rows(k).Item("gs_gsnr")
|
||||
'MsgBox("nextGessicherheitID " & nextGessicherheitID)
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
Private Function setPrevAndNextGesAll()
|
||||
|
||||
For i As Integer = 0 To dataTable.Rows.Count - 1
|
||||
@@ -1452,7 +1490,7 @@ Public Class frmGesamtsicherheitenNEU
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If txtWarenwertContext.Text = "" Or Not IsNumeric(txtWarenwertContext().Text) Then
|
||||
If txtWarenwertContext.Text = "" Then
|
||||
MsgBox("Bitte Warenwert angeben!")
|
||||
Exit Sub
|
||||
End If
|
||||
@@ -1460,16 +1498,34 @@ Public Class frmGesamtsicherheitenNEU
|
||||
|
||||
If dgvSicherheitsPos.SelectedRows.Count > 0 Then
|
||||
|
||||
Dim firstIndex As Integer = 10000
|
||||
|
||||
If dgvSicherheitsPos.SelectedRows.Count = 1 Then firstIndex = dgvSicherheitsPos.SelectedRows(0).Index
|
||||
|
||||
If dgvSicherheitsPos.SelectedRows.Count > 1 Then
|
||||
For Each row As DataGridViewRow In dgvSicherheitsPos.SelectedRows
|
||||
If row.Index < firstIndex Then
|
||||
firstIndex = row.Index
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
End If
|
||||
|
||||
|
||||
For Each row As DataGridViewRow In dgvSicherheitsPos.SelectedRows
|
||||
|
||||
Dim SicherhPos As New cGesamtsicherheitsPositionen(row.Cells("gsp_gsId").Value, row.Cells("gsp_gspPosId").Value)
|
||||
|
||||
If row.Index = 0 Then
|
||||
SicherhPos.gsp_warenwert = txtWarenwertContext
|
||||
If row.Index = firstIndex Then
|
||||
Dim warenwert = Double.Parse(txtWarenwertContext.Text)
|
||||
SicherhPos.gsp_warenwert = warenwert
|
||||
SicherhPos.gsp_sicherheitsbetrag = Double.Parse(txtSicherheitsbetragContext.Text)
|
||||
If warenwert > 0 Then
|
||||
SicherhPos.gsp_art = "CLOSE"
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
SicherhPos.gsp_ATCNr = txtATCaendern.Text
|
||||
SicherhPos.gsp_datum = DateTimeString2DateTimeKonvertinator(txtDatumaendern.Text, txtUhrzeitaendern.Text)
|
||||
SicherhPos.SAVE()
|
||||
@@ -1503,6 +1559,7 @@ Public Class frmGesamtsicherheitenNEU
|
||||
|
||||
If Not System.Windows.Forms.Application.OpenForms.Item("frmGesamtsicherheitenMenuNEU") Is Nothing Then
|
||||
Dim p = System.Windows.Forms.Application.OpenForms.Item("frmGesamtsicherheitenMenuNEU")
|
||||
|
||||
DirectCast(p, frmGesamtsicherheitenMenuNEU).btnNeu.PerformClick()
|
||||
Me.Close()
|
||||
Me.Cursor = Cursors.Default : Exit Sub
|
||||
|
||||
Reference in New Issue
Block a user