Feature Gesamtsicherheiten: Refactorting und Einbau der neuen Funktionen
This commit is contained in:
658
Aviso/frmGesamtsicherheiten.vb
Normal file
658
Aviso/frmGesamtsicherheiten.vb
Normal file
@@ -0,0 +1,658 @@
|
||||
Imports System.Reflection
|
||||
Imports VERAG_PROG_ALLGEMEIN
|
||||
|
||||
Public Class frmGesamtsicherheiten
|
||||
|
||||
Public Property gessicherheitID As Integer
|
||||
Public Property datum As DateTime = Nothing
|
||||
Property GesSichRef As cGesamtSicherheitsReferenz
|
||||
Property Standort As String = ""
|
||||
|
||||
Public ZollsatzMulti As Double = 0
|
||||
|
||||
Public Saldo As Integer = 0
|
||||
|
||||
Public Neu As Boolean = False
|
||||
|
||||
Public FilialNummer As Integer
|
||||
|
||||
Public Abfertigungsnummer As String
|
||||
|
||||
Public LKWID As String
|
||||
|
||||
Public warenortID As String
|
||||
|
||||
Dim openopened As cSicherheiten
|
||||
|
||||
Dim closedopened As cSicherheiten
|
||||
|
||||
Dim sicherheiten As cSicherheiten
|
||||
|
||||
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
|
||||
|
||||
Private Sub FlatButton1_Click(sender As Object, e As EventArgs) Handles FlatButton1.Click
|
||||
|
||||
Dim dgv As String = ""
|
||||
For Each c As DataGridViewColumn In dgvGesamtsicherheitMRN.Columns
|
||||
dgv &= c.Width & c.HeaderText & vbCrLf
|
||||
Next
|
||||
' MsgBox(dgv)
|
||||
LoadDGV()
|
||||
GesSichRef.LOAD()
|
||||
LoadStandort()
|
||||
End Sub
|
||||
|
||||
Private Sub frmGesamtsicherheit_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
||||
If setNullToZero(gessicherheitID) = 0 Or Neu = True Then
|
||||
panOben.Enabled = False : panOben.Enabled = False
|
||||
panOverlay.Visible = True
|
||||
cboFiliale.fillWithSQL("SELECT FilialenNr, cast(FilialenNr as varchar(4)) + ' ' + Grenzstelle FROM Filialen WHERE Fil_Status='A' ORDER BY FilialenNr ", True, "FMZOLL", True)
|
||||
cboWarenort.fillWithSQL("SELECT [grz_Grenzstelle], [grz_Bezeichnung] FROM [tblGrenzstelle] WHERE [grz_Aktiv] ='1' AND [grz_Warenort] ='1' ORDER BY [grz_Reihenfolge] ", True, "AVISO", True)
|
||||
If datum = Nothing Then datum = Date.Now
|
||||
Else
|
||||
LoadDGV()
|
||||
End If
|
||||
LoadStandort()
|
||||
cboATR.Enabled = GesSichRef.ATR
|
||||
|
||||
Me.Text = "Gesamtsicherheit " & Standort
|
||||
frmHauptfenster.EnableDoubleBuffered(dgvGesamtsicherheitCRN)
|
||||
End Sub
|
||||
|
||||
|
||||
Public Sub LoadDGV()
|
||||
lblSaldo.Text = "Saldo: € " & GesSichRef.Saldo.ToString("N")
|
||||
lblGestellungNr.Text = ""
|
||||
Dim sqladd1 As String = ""
|
||||
If GesSichRef.UstEnabled Then sqladd1 &= ", FORMAT(((Warenwert + Sicherheitsbetrag) * " & GesSichRef.Ust & "/100), 'C', 'de-DE') as Ust"
|
||||
If GesSichRef.ATR Then sqladd1 &= ", ATRJN"
|
||||
|
||||
|
||||
Dim addtosqlstring As String = ""
|
||||
Dim SQLStringMRN As String = "select GesamtSichID, Kennnummer, PosNr, DateTime, Warenwert, Sicherheitsbetrag, Saldo " & sqladd1 & " , Freitext from [tblGesamtsicherheit] where GesamtsichNr = '" & gessicherheitID & "' and Art = 'Open' order by DateTime"
|
||||
dgvGesamtsicherheitMRN.SET_SQL(SQLStringMRN, "AVISO", ,)
|
||||
dgvGesamtsicherheitMRN.LOAD()
|
||||
|
||||
Dim SQLStringCRN As String = "select GesamtSichID, Kennnummer, DateTime, Warenwert, Sicherheitsbetrag, Saldo, Freitext from [tblGesamtsicherheit] where GesamtsichNr = '" & gessicherheitID & "' and Art = 'Close' order by DateTime"
|
||||
dgvGesamtsicherheitCRN.SET_SQL(SQLStringCRN, "AVISO", ,)
|
||||
dgvGesamtsicherheitCRN.LOAD()
|
||||
|
||||
Dim StandortSqlString As String = "select * from [tblGesamtsicherheit] where GesamtsichNr = '" & gessicherheitID & "'"
|
||||
Dim dt As New DataTable
|
||||
dt = SQL.loadDgvBySql(StandortSqlString, "AVISO", 100, True)
|
||||
|
||||
If dt.Rows.Count > 0 Then
|
||||
'Me.GesamtsichNr = dt.Rows(0).Item("GesamtsichNr")
|
||||
Me.FilialNummer = dt.Rows(0).Item("FilialNummer")
|
||||
Me.Abfertigungsnummer = dt.Rows(0).Item("Abfertigungsnummer")
|
||||
|
||||
If Me.FilialNummer.ToString.Length > 0 Then lblGestellungNr.Text &= "FilialNr: " & Me.FilialNummer
|
||||
If Me.Abfertigungsnummer.Length > 0 Then lblGestellungNr.Text &= "Abfertigungsnummer: " & Me.Abfertigungsnummer
|
||||
End If
|
||||
|
||||
|
||||
If dgvGesamtsicherheitMRN.Columns.Count > 0 Then
|
||||
With dgvGesamtsicherheitMRN
|
||||
.RowHeadersWidth = 10
|
||||
.Columns("GesamtSichID").Visible = False
|
||||
.Columns("Warenwert").DefaultCellStyle.Format = "c"
|
||||
.Columns("Sicherheitsbetrag").DefaultCellStyle.Format = "c"
|
||||
.Columns("Saldo").DefaultCellStyle.Format = "c"
|
||||
.Columns("Saldo").Visible = False
|
||||
Select Case GesSichRef.ATR
|
||||
Case True
|
||||
.Columns("Kennnummer").HeaderText = "ATB"
|
||||
.Columns("AtrJN").HeaderText = "ATR"
|
||||
.Columns("AtrJN").Width = 33
|
||||
.Columns("Ust").Width = 69
|
||||
Case Else
|
||||
.Columns("Kennnummer").HeaderText = "CRN"
|
||||
End Select
|
||||
.Columns("Kennnummer").Width = 146
|
||||
|
||||
.Columns("PosNr").Width = 20
|
||||
.Columns("DateTime").Width = 95
|
||||
.Columns("Warenwert").Width = 100
|
||||
.Columns("Saldo").Width = 100
|
||||
|
||||
.Columns("Sicherheitsbetrag").Width = 100
|
||||
.Columns("Freitext").AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill
|
||||
End With
|
||||
' For Each col As DataGridViewColumn In dgvGesamtsicherheitMRN.Columns
|
||||
'col.Width = 120
|
||||
'Next
|
||||
End If
|
||||
|
||||
If dgvGesamtsicherheitCRN.Columns.Count > 0 Then
|
||||
With dgvGesamtsicherheitCRN
|
||||
.RowHeadersWidth = 10
|
||||
.Columns("GesamtSichID").Visible = False
|
||||
.Columns("Warenwert").DefaultCellStyle.Format = "c"
|
||||
.Columns("Sicherheitsbetrag").DefaultCellStyle.Format = "c"
|
||||
.Columns("Saldo").DefaultCellStyle.Format = "c"
|
||||
.Columns("Saldo").Visible = False
|
||||
Select Case GesSichRef.ATR
|
||||
Case True
|
||||
.Columns("Kennnummer").HeaderText = "ATC / MRN"
|
||||
Case Else
|
||||
.Columns("Kennnummer").HeaderText = "CRN"
|
||||
End Select
|
||||
.Columns("Kennnummer").Width = 120
|
||||
.Columns("DateTime").Width = 140
|
||||
.Columns("Warenwert").Width = 100
|
||||
.Columns("Sicherheitsbetrag").Width = 100
|
||||
.Columns("Freitext").Width = 220
|
||||
End With
|
||||
'For Each col As DataGridViewColumn In dgvGesamtsicherheitCRN.Columns
|
||||
' col.Width = 120
|
||||
'Next
|
||||
End If
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Public Sub LoadStandort()
|
||||
'Dim StandortSqlString As String = "select * from [tblGesamtsicherheitReferenz] where Standort = " & "'" & Standort & "'"
|
||||
'Dim dt As New DataTable
|
||||
'dt = SQL.loadDgvBySql(StandortSqlString, "AVISO", 100, True)
|
||||
'Zollsatz = dt.Rows(0).Item("Zollsatz")
|
||||
'Referenzwert = dt.Rows(0).Item("Referenzwert")
|
||||
|
||||
lblReferenzwert.Text = "Referenzwert: €" & GesSichRef.Referenzwert.ToString("N")
|
||||
lblZollsatz.Text = "Zollsatz: " & GesSichRef.Zollsatz & "%"
|
||||
ZollsatzMulti = GesSichRef.Zollsatz / 100
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
'Private Sub CalcSaldo()
|
||||
' Dim SaldoString As String = "select SUM([MRN_Sicherheitsbetrag]) as sumone, SUM([CRN_Sicherheitsbetrag]) As sumtwo from [tblGesamtsicherheit]"
|
||||
' Dim dt As New DataTable
|
||||
' dt = SQL.loadDgvBySql(SaldoString, "AVISO", 100, True)
|
||||
' Dim mrn As Integer = dt.Rows(0).Item(0)
|
||||
' Dim crn As Integer = dt.Rows(0).Item(1)
|
||||
|
||||
' Saldo = Referenzwert - mrn + crn
|
||||
|
||||
' lblSaldo.Text = "Saldo: €" & Saldo.ToString("N")
|
||||
'End Sub
|
||||
|
||||
|
||||
Private Sub Warenwert_TextChanged(sender As Object, e As EventArgs) Handles txtMRNWarenwert.TextChanged, txtCRNWarenwert.TextChanged
|
||||
Try
|
||||
Select Case sender.name
|
||||
Case "txtMRNWarenwert"
|
||||
txtMRNSicherheitsbetrag.Text = (txtMRNWarenwert.Text * ZollsatzMulti).ToString("N")
|
||||
If GesSichRef.UstEnabled Then txtEust.Text = (Double.Parse(txtMRNWarenwert.Text) + Double.Parse(txtMRNSicherheitsbetrag.Text)) * (GesSichRef.Ust / 100)
|
||||
Case "txtCRNWarenwert"
|
||||
txtCRNSicherheitsbetrag.Text = (txtCRNWarenwert.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 txtMRNWarenwert.KeyPress, txtCRNWarenwert.KeyPress, txtPos.KeyPress
|
||||
Select Case Asc(e.KeyChar)
|
||||
Case 48 To 57, 8, 44
|
||||
' Zahlen, Backspace und , zulassen
|
||||
|
||||
Case Else
|
||||
' alle anderen Eingaben unterdrücken
|
||||
e.Handled = True
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Private Sub DateTime_Keypresses(sender As Object, e As System.Windows.Forms.KeyPressEventArgs) Handles txtCRNDate.KeyPress, txtCRNTime.KeyPress, txtMRNDate.KeyPress, txtMRNTime.KeyPress
|
||||
Select Case Asc(e.KeyChar)
|
||||
Case 48 To 57, 8, 46, 58
|
||||
' Zahlen, Backspace, . und : zulassen
|
||||
|
||||
Case Else
|
||||
' alle anderen Eingaben unterdrücken
|
||||
e.Handled = True
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub btnSaveOben_Click(sender As Object, e As EventArgs) Handles btnSaveOben.Click
|
||||
Try
|
||||
Dim a As Date = Date.ParseExact(txtMRNDate.Text, "dd.MM.yyyy", System.Globalization.DateTimeFormatInfo.InvariantInfo)
|
||||
Dim b As Date = Date.ParseExact(txtMRNTime.Text, "HH:mm", System.Globalization.DateTimeFormatInfo.InvariantInfo)
|
||||
|
||||
Dim ab As Date = a.AddHours(b.Hour).AddMinutes(b.Minute)
|
||||
MsgBox(ab.ToString)
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub txtMRNDate_GotFocus(sender As Object, e As EventArgs) Handles txtMRNDate.GotFocus, txtCRNDate.GotFocus, txtMRNTime.GotFocus, txtCRNTime.GotFocus
|
||||
Select Case sender.name
|
||||
Case "txtMRNDate"
|
||||
If txtMRNDate.Text.Length < 1 Then txtMRNDate.Text = Date.Today.ToString("dd.MM.yyyy")
|
||||
Case "txtCRNDate"
|
||||
If txtCRNDate.Text.Length < 1 Then txtCRNDate.Text = Date.Today.ToString("dd.MM.yyyy")
|
||||
Case "txtMRNTime"
|
||||
If txtMRNTime.Text.Length < 1 Then txtMRNTime.Text = Date.Now.ToString("HH:mm")
|
||||
Case "txtCRNTime"
|
||||
If txtCRNTime.Text.Length < 1 Then txtCRNTime.Text = Date.Now.ToString("HH:mm")
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Private Sub btnAddMRN_Click(sender As Object, e As EventArgs) Handles btnAddOpen.Click
|
||||
Try
|
||||
|
||||
Dim OPEN As New cSicherheiten(Me)
|
||||
With OPEN
|
||||
.Kennnummer = txtMRN.Text
|
||||
.PosNr = Double.Parse(setNullToZero(txtPos.Text))
|
||||
.datum = DateTimeString2DateTimeKonvertinator(txtMRNDate.Text, txtMRNTime.Text)
|
||||
.Warenwert = Double.Parse(txtMRNWarenwert.Text) '.Replace(".", "").Replace(",", ".")
|
||||
.Sicherheitsbetrag = Double.Parse(txtMRNSicherheitsbetrag.Text) '.Replace(".", "").Replace(",", ".")
|
||||
.standort = Me.Standort
|
||||
.Art = "OPEN"
|
||||
.GesamtsichNr = Me.gessicherheitID
|
||||
.erstellungsdatum = Me.datum
|
||||
.Freitext = Me.txtFreitextOpen.Text
|
||||
.saldo = GesSichRef.Saldo
|
||||
.isATR = setNullToZero(cboATR.SelectedItem)
|
||||
End With
|
||||
|
||||
If Neu = True Then OPEN.GesamtsichNr = AddNewGesamtSichNr()
|
||||
|
||||
Select Case checkIfExist(OPEN.Kennnummer, gessicherheitID)
|
||||
Case "Neu"
|
||||
OPEN.Save()
|
||||
Case Else
|
||||
MsgBox("INFO: Dieser Eintrag wurde bereits bei GesamtsichNr " & checkIfExist(OPEN.Kennnummer, gessicherheitID) & "eingetragen") : OPEN.Save()
|
||||
End Select
|
||||
|
||||
AfterButton()
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub btnAddCRN_Click(sender As Object, e As EventArgs) Handles btnAddClose.Click
|
||||
Try
|
||||
Dim Close As New cSicherheiten(Me)
|
||||
With Close
|
||||
.Kennnummer = txtCRN.Text
|
||||
.datum = DateTimeString2DateTimeKonvertinator(txtCRNDate.Text, txtCRNTime.Text)
|
||||
.Warenwert = Double.Parse(txtCRNWarenwert.Text) '.Replace(".", "").Replace(",", ".")
|
||||
.Sicherheitsbetrag = Double.Parse(txtCRNSicherheitsbetrag.Text) '.Replace(".", "").Replace(",", ".")
|
||||
.standort = Me.Standort
|
||||
.Art = "Close"
|
||||
.GesamtsichNr = Me.gessicherheitID
|
||||
.erstellungsdatum = Me.datum
|
||||
.Freitext = Me.txtFreitextClose.Text
|
||||
.saldo = GesSichRef.Saldo
|
||||
End With
|
||||
|
||||
If Neu = True Then Close.GesamtsichNr = AddNewGesamtSichNr()
|
||||
|
||||
Select Case checkIfExist(Close.Kennnummer, gessicherheitID)
|
||||
Case "Neu"
|
||||
Close.Save()
|
||||
Case Else
|
||||
MsgBox("Dieser Eintrag wurde bereits bei GesamtsichNr " & checkIfExist(Close.Kennnummer, gessicherheitID) & "eingetragen") : Exit Sub
|
||||
End Select
|
||||
|
||||
AfterButton()
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Function setNullToZero(s As String, Optional type As String = "")
|
||||
|
||||
If s = "" Then
|
||||
Dim zero As Double = 0
|
||||
|
||||
Return zero
|
||||
Else
|
||||
Return s
|
||||
End If
|
||||
End Function
|
||||
Function AfterButton()
|
||||
GesSichRef.CalcSaldo()
|
||||
LoadDGV()
|
||||
EmptyTXT()
|
||||
End Function
|
||||
|
||||
Public Function AddNewGesamtSichNr() As Integer
|
||||
Dim sqlq As String = "select MAX([GesamtsichNr]) as MaxGesSich from tblGesamtsicherheit"
|
||||
Dim dt As New DataTable
|
||||
dt = SQL.loadDgvBySql(sqlq, "AVISO", 100, True)
|
||||
Dim LetzteGesSichNum As Integer = dt.Rows(0).Item(0)
|
||||
Me.gessicherheitID = LetzteGesSichNum + 1
|
||||
Me.Neu = False
|
||||
Return Me.gessicherheitID
|
||||
End Function
|
||||
|
||||
Public Sub EmptyTXT()
|
||||
Dim a As New List(Of Control)
|
||||
For Each contr As Control In panOben.Controls
|
||||
If contr.GetType.FullName = "System.Windows.Forms.TextBox" Then contr.Text = ""
|
||||
Next
|
||||
cboATR.SelectedItem = Nothing
|
||||
End Sub
|
||||
|
||||
Public Function checkIfExist(KennnummerStr As String, Optional ByVal lkw As String = "")
|
||||
If lkw = "" And Me.gessicherheitID > 0 Then lkw = gessicherheitID
|
||||
|
||||
Dim SQLString As String = "Select * from [tblGesamtsicherheit] where Kennnummer = '" & KennnummerStr & "'"
|
||||
Dim dt As New DataTable
|
||||
dt = SQL.loadDgvBySql(SQLString, "AVISO", 100, True)
|
||||
If dt.Rows.Count > 0 Then
|
||||
Return dt.Rows(0).Item("GesamtsichNr").ToString
|
||||
Else
|
||||
Return "Neu"
|
||||
End If
|
||||
End Function
|
||||
|
||||
Public Function DateTimeString2DateTimeKonvertinator(datum As String, uhrzeit As String) As DateTime
|
||||
Try
|
||||
Dim a As Date = Date.ParseExact(datum, "dd.MM.yyyy", System.Globalization.DateTimeFormatInfo.InvariantInfo)
|
||||
Dim b As Date = Date.ParseExact(uhrzeit, "HH:mm", System.Globalization.DateTimeFormatInfo.InvariantInfo)
|
||||
|
||||
Dim ab As Date = a.AddHours(b.Hour).AddMinutes(b.Minute)
|
||||
Return ab
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message)
|
||||
Return Date.Now
|
||||
End Try
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click, btnSaveOben.Click
|
||||
|
||||
Try
|
||||
Me.FilialNummer = checkNothingValue(cboFiliale.SelectedItem, "Integer")
|
||||
Catch
|
||||
Me.FilialNummer = "0"
|
||||
End Try
|
||||
|
||||
If checkNothingValue(cboWarenort.SelectedItem, "String") Then
|
||||
|
||||
Me.warenortID = cboWarenort.SelectedItem
|
||||
Else
|
||||
Me.warenortID = ""
|
||||
End If
|
||||
|
||||
Me.Abfertigungsnummer = txtAbfertNum.Text
|
||||
Me.LKWID = txtLKWID.Text
|
||||
|
||||
If setNullToZero(Me.gessicherheitID) > 0 Then
|
||||
Dim sqlstring = "Update [tblGesamtsicherheit] set FilialNummer = '" & Me.FilialNummer & "', Abfertigungsnummer = '" & Me.Abfertigungsnummer & "', LKWID = '" & Me.LKWID & "' WHERE GesamtSichNr = '" & Me.gessicherheitID & "' "
|
||||
SQL.doSQL(sqlstring, "AVISO")
|
||||
LoadDGV()
|
||||
End If
|
||||
|
||||
panOben.Enabled = True : panOben.Enabled = True
|
||||
panOverlay.Visible = False
|
||||
End Sub
|
||||
|
||||
Private Function checkNothingValue(obj As Object, Optional type As String = "String")
|
||||
Select Case type
|
||||
Case "String"
|
||||
If obj Is Nothing Then
|
||||
Return ""
|
||||
Else
|
||||
Return obj.value.ToString
|
||||
End If
|
||||
Case "Integer"
|
||||
If obj Is Nothing Then
|
||||
Return Nothing
|
||||
Else
|
||||
Return Integer.Parse(obj.value)
|
||||
End If
|
||||
End Select
|
||||
|
||||
|
||||
End Function
|
||||
|
||||
Private Sub dgvGesamtsicherheitMRN_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles dgvGesamtsicherheitMRN.CellDoubleClick
|
||||
|
||||
Dim Sicherh As New cSicherheiten(dgvGesamtsicherheitMRN.CurrentRow.Cells("GesamtSichID").Value)
|
||||
'Sicherh.Load(dgvGesamtsicherheitMRN.CurrentRow.Cells("GesamtSichID").Value)
|
||||
|
||||
txtMRN.Text = Sicherh.Kennnummer
|
||||
txtPos.Text = Sicherh.PosNr
|
||||
txtMRNWarenwert.Text = Sicherh.Warenwert
|
||||
txtFreitextOpen.Text = Sicherh.freitext
|
||||
cboATR.SelectedItem = Sicherh.isATR
|
||||
txtMRNDate.Text = Sicherh.datum.ToString("dd.MM.yyyy")
|
||||
txtMRNTime.Text = Sicherh.datum.ToString("HH:mm")
|
||||
|
||||
openopened = Sicherh
|
||||
|
||||
btnAddOpen.Visible = False
|
||||
btnUpdateOpen.Visible = True
|
||||
btnDeleteOpen.Visible = True
|
||||
End Sub
|
||||
|
||||
Private Sub btnUpdateOpen_Click(sender As Object, e As EventArgs) Handles btnUpdateOpen.Click
|
||||
With openopened
|
||||
.Kennnummer = txtMRN.Text
|
||||
.PosNr = Double.Parse(setNullToZero(txtPos.Text))
|
||||
.datum = DateTimeString2DateTimeKonvertinator(txtMRNDate.Text, txtMRNTime.Text)
|
||||
.Warenwert = Double.Parse(txtMRNWarenwert.Text) '.Replace(".", "").Replace(",", ".")
|
||||
.Sicherheitsbetrag = Double.Parse(txtMRNSicherheitsbetrag.Text) '.Replace(".", "").Replace(",", ".")
|
||||
.standort = Me.Standort
|
||||
.Art = "OPEN"
|
||||
.GesamtsichNr = Me.gessicherheitID
|
||||
'.MakeDate = Me.MakeDate
|
||||
.Freitext = Me.txtFreitextOpen.Text
|
||||
'.saldo = GesSichRef.Saldo
|
||||
.isATR = setNullToZero(cboATR.SelectedItem)
|
||||
End With
|
||||
openopened.Save()
|
||||
btnUpdateOpen.Visible = False
|
||||
btnAddOpen.Visible = True
|
||||
btnDeleteOpen.Visible = False
|
||||
AfterButton()
|
||||
End Sub
|
||||
|
||||
Private Sub btnDeleteClose_Click(sender As Object, e As EventArgs) Handles btnUpdateClose.Click
|
||||
With closedopened
|
||||
.Kennnummer = txtCRN.Text
|
||||
.datum = DateTimeString2DateTimeKonvertinator(txtCRNDate.Text, txtCRNTime.Text)
|
||||
.Warenwert = Double.Parse(txtCRNWarenwert.Text) '.Replace(".", "").Replace(",", ".")
|
||||
.Sicherheitsbetrag = Double.Parse(txtCRNSicherheitsbetrag.Text) '.Replace(".", "").Replace(",", ".")
|
||||
.standort = Me.Standort
|
||||
.Art = "Close"
|
||||
.Freitext = Me.txtFreitextClose.Text
|
||||
End With
|
||||
closedopened.Save()
|
||||
btnAddClose.Visible = True
|
||||
btnUpdateClose.Visible = False
|
||||
btnDeleteClose.Visible = False
|
||||
AfterButton()
|
||||
End Sub
|
||||
|
||||
Private Sub dgvGesamtsicherheitCRN_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles dgvGesamtsicherheitCRN.CellDoubleClick
|
||||
|
||||
Dim Sicherh As New cSicherheiten(dgvGesamtsicherheitCRN.CurrentRow.Cells("GesamtSichID").Value)
|
||||
'Sicherh.Load(dgvGesamtsicherheitCRN.CurrentRow.Cells("GesamtSichID").Value)
|
||||
|
||||
txtCRN.Text = Sicherh.Kennnummer
|
||||
txtCRNWarenwert.Text = Sicherh.Warenwert
|
||||
txtFreitextClose.Text = Sicherh.freitext
|
||||
txtCRNDate.Text = Sicherh.datum.ToString("dd.MM.yyyy")
|
||||
txtCRNTime.Text = Sicherh.datum.ToString("HH:mm")
|
||||
|
||||
closedopened = Sicherh
|
||||
|
||||
btnDeleteClose.Visible = True
|
||||
btnAddClose.Visible = False
|
||||
btnUpdateClose.Visible = True
|
||||
End Sub
|
||||
|
||||
Private Sub btnDeleteOpen_Click(sender As Object, e As EventArgs) Handles btnDeleteOpen.Click
|
||||
Try
|
||||
openopened.Delete()
|
||||
btnUpdateOpen.Visible = False
|
||||
btnAddOpen.Visible = True
|
||||
btnDeleteOpen.Visible = False
|
||||
AfterButton()
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub btnDeleteClose_Click_1(sender As Object, e As EventArgs) Handles btnDeleteClose.Click
|
||||
Try
|
||||
closedopened.Delete()
|
||||
btnUpdateClose.Visible = False
|
||||
btnAddClose.Visible = True
|
||||
btnDeleteClose.Visible = False
|
||||
AfterButton()
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub lblGestellungNr_Click(sender As Object, e As EventArgs) Handles lblGestellungNr.DoubleClick
|
||||
panOverlay.Visible = True
|
||||
cboFiliale.fillWithSQL("SELECT FilialenNr, cast(FilialenNr as varchar(4)) + ' ' + Grenzstelle FROM Filialen WHERE Fil_Status='A' ORDER BY FilialenNr ", True, "FMZOLL", True)
|
||||
cboFiliale.SelectedIndex = cboFiliale.FindString(Me.FilialNummer)
|
||||
txtAbfertNum.Text = Me.Abfertigungsnummer
|
||||
txtLKWID.Text = Me.LKWID
|
||||
panOben.Enabled = False
|
||||
End Sub
|
||||
|
||||
Private Sub btnClosePanOverlay_Click(sender As Object, e As EventArgs) Handles btnClosePanOverlay.Click
|
||||
Close()
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
'Public Class cSicherheit
|
||||
' Property GesamtSichID As Object
|
||||
' Property Kennnummer As String
|
||||
' Property PosNr As Integer
|
||||
' Property DateTime As DateTime
|
||||
' Property MakeDate As DateTime
|
||||
' Property Warenwert As Double
|
||||
' Property Sicherheitsbetrag As Double
|
||||
' Property saldo As Double
|
||||
' Property standort As String
|
||||
' Property Art As String
|
||||
' Property GesamtsichNr As Integer
|
||||
' Property Ust As Integer
|
||||
' Property Freitext As String
|
||||
' Property FilialNummer As Integer
|
||||
' Property Abfertigungsnummer As String
|
||||
' Property LKWID As String
|
||||
' Property ATRJN As String = ""
|
||||
' Property gs_warenort As String
|
||||
|
||||
' Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
|
||||
|
||||
' Public Sub New(Optional ByVal gessich As frmGesamtsicherheiten = Nothing)
|
||||
' If gessich IsNot Nothing Then
|
||||
' Me.FilialNummer = gessich.FilialNummer
|
||||
' Me.Abfertigungsnummer = gessich.Abfertigungsnummer
|
||||
' Me.LKWID = gessich.LKWID
|
||||
' Me.gs_warenort = gessich.warenortID
|
||||
' Me.GesamtSichID = GenerateID()
|
||||
' End If
|
||||
' End Sub
|
||||
|
||||
' Public Function Load(GsID As String)
|
||||
' Me.GesamtSichID = GsID
|
||||
' Load()
|
||||
' End Function
|
||||
|
||||
' Public Function Load()
|
||||
' Dim dt As New DataTable
|
||||
' Dim sqlstring As String = "SELECT * FROM [AVISO].[dbo].[tblGesamtsicherheit] where GesamtsichID = '" & Me.GesamtSichID & "'"
|
||||
' dt = SQL.loadDgvBySql(sqlstring, "AVISO", 100, True)
|
||||
' Dim test As cSicherheit = SQLEintraege.LoadEntities(Me, dt)
|
||||
' ' MsgBox("")
|
||||
' End Function
|
||||
|
||||
' Public Function GenerateID() As String
|
||||
' Return Date.Now.ToString.Replace(".", "").Replace("-", "").Replace(",", "").Replace(" ", "").Replace(":", "")
|
||||
' End Function
|
||||
|
||||
' Public Function Save()
|
||||
' 'MakeDate = frmGesSich.MakeDate
|
||||
' Dim entities As New List(Of SQLEintraege)
|
||||
' For Each prop As PropertyInfo In Me.GetType().GetProperties()
|
||||
' If prop.GetValue(Me, Nothing).GetType = GetType(Double) Then
|
||||
' ' MsgBox(prop.Name)
|
||||
' entities.Add(New SQLEintraege(prop.Name, prop.GetValue(Me, Nothing).ToString.Replace(",", ".")))
|
||||
' Else
|
||||
' entities.Add(New SQLEintraege(prop.Name, prop.GetValue(Me, Nothing)))
|
||||
' End If
|
||||
' ' entities.Add(New SQLEintraege(prop.Name, prop.GetValue(Me, Nothing)))
|
||||
' Next
|
||||
|
||||
' '''
|
||||
' Dim dt As DataTable = SQL.loadDgvBySql("Select * from [tblGesamtsicherheit] where GesamtSichID = '" & Me.GesamtSichID & "'", "AVISO")
|
||||
' If dt.Rows.Count > 0 Then
|
||||
' Dim UpdateString As String = ""
|
||||
' For Each i In entities
|
||||
' If Not i.Spalte = "GesamtSichID" Then
|
||||
' UpdateString &= "[" & i.Spalte & "]='" & i.Wert & "',"
|
||||
' End If
|
||||
' Next
|
||||
' UpdateString = UpdateString.Substring(0, UpdateString.Length - 1)
|
||||
|
||||
' Dim sqlquery As String
|
||||
' sqlquery = "update [tblGesamtsicherheit] set " & UpdateString & " where GesamtSichID = '" & Me.GesamtSichID & "'"
|
||||
' SQL.doSQL(sqlquery, "AVISO")
|
||||
' Else
|
||||
|
||||
' Dim text, value, insert As String
|
||||
' For Each i In entities
|
||||
' text &= i.Spalte & ", "
|
||||
' value &= "'" & i.Wert & "', "
|
||||
' Next
|
||||
' text = text.Substring(0, text.Length - 2)
|
||||
' value = value.Substring(0, value.Length - 2)
|
||||
|
||||
' insert = "(" & text & ") VALUES (" & value & ")"
|
||||
|
||||
' Dim sqlquery As String
|
||||
' sqlquery = "insert into [tblGesamtsicherheit] (" & text & ") VALUES (" & value & ")"
|
||||
' SQL.doSQL(sqlquery, "AVISO")
|
||||
' End If
|
||||
|
||||
' End Function
|
||||
|
||||
' Public Function Delete()
|
||||
' SQL.doSQL("delete from [tblGesamtsicherheit] where GesamtSichID = '" & Me.GesamtSichID & "'", "AVISO")
|
||||
' End Function
|
||||
|
||||
'End Class
|
||||
|
||||
'Public Class SQLEintraege
|
||||
' Property Spalte As String
|
||||
' Property Wert As String
|
||||
' Public Sub New(_Spalte As String, _Wert As String)
|
||||
' Spalte = _Spalte
|
||||
' Wert = _Wert
|
||||
' End Sub
|
||||
|
||||
' Public Shared Function LoadEntities(Obj As Object, dt As DataTable) As Object
|
||||
' Try
|
||||
' For Each prop As PropertyInfo In Obj.GetType().GetProperties()
|
||||
' If dt.Rows(0).Item(prop.Name) IsNot Nothing And dt.Rows(0).Item(prop.Name) IsNot DBNull.Value Then
|
||||
' If dt.Rows(0).Item(prop.Name).GetType Is GetType(Decimal) Then
|
||||
' prop.SetValue(Obj, Double.Parse(dt.Rows(0).Item(prop.Name)))
|
||||
' Else
|
||||
' prop.SetValue(Obj, dt.Rows(0).Item(prop.Name))
|
||||
' End If
|
||||
|
||||
' End If
|
||||
' Next
|
||||
' Return Obj
|
||||
' Catch ex As Exception
|
||||
' MsgBox(ex.Message)
|
||||
' End Try
|
||||
' End Function
|
||||
'End Class
|
||||
Reference in New Issue
Block a user