1099 lines
41 KiB
VB.net
1099 lines
41 KiB
VB.net
Imports System.Reflection
|
|
Imports System.Web.UI.WebControls
|
|
Imports System.Web.UI.WebControls.Expressions
|
|
Imports DocumentFormat.OpenXml.Bibliography
|
|
Imports DocumentFormat.OpenXml.Presentation
|
|
Imports DocumentFormat.OpenXml.Spreadsheet
|
|
Imports Spire.Pdf.General.Render.Decode
|
|
Imports VERAG_PROG_ALLGEMEIN
|
|
|
|
Public Class frmGesamtsicherheitenNEU
|
|
|
|
|
|
Property currentSicherheit As cSicherheiten
|
|
Property currentSPos As cGesamtsicherheitsPositionen
|
|
Property currentGesSichRef As cGesamtsicherheitsReferenz
|
|
Public Property gessicherheitID As Integer
|
|
Public Property prevGessicherheitID As Integer = 0
|
|
Public Property nextGessicherheitID As Integer = 0
|
|
Public Property datum As DateTime = Nothing
|
|
Property Standort As String = ""
|
|
|
|
Public ZollsatzMulti As Double = 0
|
|
|
|
Public Zollsatz As Double
|
|
|
|
Public Saldo As Integer = 0
|
|
|
|
Public Neu As Boolean = False
|
|
|
|
Public FilialNummer As Integer
|
|
|
|
Public Abfertigungsnummer As String
|
|
|
|
Public LKWKZ As String
|
|
|
|
Public warenortID As String
|
|
|
|
Dim indexGsId As Integer
|
|
|
|
Dim indexGspPosId As Integer
|
|
|
|
Dim isOpen As Boolean = False
|
|
|
|
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
|
|
|
|
Public dt As New DataTable
|
|
|
|
|
|
Private Sub frmGesamtsicherheitNEU_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
|
|
|
currentGesSichRef = New VERAG_PROG_ALLGEMEIN.cGesamtsicherheitsReferenz(Standort)
|
|
lblSaldo.Text = "Saldo: €" & Decimal.Parse(currentGesSichRef.CalcSaldo()).ToString("N")
|
|
|
|
Me.Text = "Gesamtsicherheit " & Standort
|
|
|
|
|
|
cbx_Suche_Warenort.fillWithSQL("SELECT [grz_Grenzstelle], [grz_Bezeichnung] FROM [tblGrenzstelle] WHERE [grz_Aktiv] ='1' AND [grz_Warenort] ='1' ORDER BY [grz_Reihenfolge] ", True, "AVISO", True)
|
|
|
|
If setNullToZero(gessicherheitID) = "" Or Neu = True Then
|
|
|
|
panOben.Enabled = False : panOben.Enabled = False
|
|
Panel1.Enabled = True
|
|
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
|
|
nextGessicherheitID = -1
|
|
prevGessicherheitID = -1
|
|
|
|
Else
|
|
LoadDGVSicherheiten()
|
|
End If
|
|
LoadStandort()
|
|
cboSicherheitATR.Enabled = currentGesSichRef.gsr_ATR
|
|
|
|
cbx_offene.Checked = True
|
|
initPrevNextButtons()
|
|
|
|
|
|
Me.Text = "Gesamtsicherheit " & Standort
|
|
frmHauptfenster.EnableDoubleBuffered(dgvSicherheitsPos)
|
|
End Sub
|
|
|
|
|
|
|
|
Public Sub LoadDGVSicherheiten(Optional withFilterParam As Boolean = False)
|
|
|
|
lblSaldo.Text = "Saldo: € " & currentGesSichRef.gsr_Saldo.ToString()
|
|
lblGestellungNr.Text = ""
|
|
Dim sqladd1 As String = ""
|
|
If currentGesSichRef.gsr_ustEnabled Then sqladd1 &= ", FORMAT((([gs_warenwert] + [gs_sicherheitsbetrag]) * " & currentGesSichRef.gsr_ust & "/100), 'C', 'de-DE') as gs_ust"
|
|
If currentGesSichRef.gsr_ATR Then sqladd1 &= ", [gs_atr]"
|
|
Dim sqlSearchSting As String = ""
|
|
If withFilterParam = True Then
|
|
If txt_Suche.Text <> "" Then sqlSearchSting &= "AND ([gs_abfertigungsNr] Like '%" & txt_Suche.Text & "%' OR [gs_ATBNr] Like '%" & txt_Suche.Text & "%' OR [gs_LKWKZ] like '%" & txt_Suche.Text & "%' OR [gs_avisoId] like '%" & txt_Suche.Text & "%' OR [gs_freitext] like '%" & txt_Suche.Text & "%')"
|
|
If cbx_Suche_Warenort._value <> "" Then sqlSearchSting &= "AND gs_warenort like '%" & cbx_Suche_Warenort.Text & "%'"
|
|
End If
|
|
|
|
'Dim addtosqlstring As String = ""
|
|
|
|
Dim SQLStringSicherheit As String = "select [gs_gsId], [gs_gsnr], [gs_posNr], [gs_ATBNr], [gs_datum], [gs_warenwert], [gs_sicherheitsbetrag], [gs_saldo] " & sqladd1 & " , [gs_freitext] from [tblGesamtsicherheit] where [gs_gsnr] = '" & gessicherheitID & "'" & sqlSearchSting & "order by [gs_gsId]"
|
|
|
|
dgvGesamtsicherheit.SET_SQL(SQLStringSicherheit, "AVISO", ,)
|
|
dgvGesamtsicherheit.LOAD()
|
|
|
|
|
|
If dgvGesamtsicherheit.Columns.Count > 0 Then
|
|
With dgvGesamtsicherheit
|
|
.RowHeadersWidth = 10
|
|
.Columns("gs_gsId").Visible = False
|
|
.Columns("gs_gsnr").Visible = False
|
|
.Columns("gs_warenwert").DefaultCellStyle.Format = "c"
|
|
.Columns("gs_sicherheitsbetrag").DefaultCellStyle.Format = "c"
|
|
.Columns("gs_saldo").DefaultCellStyle.Format = "c"
|
|
.Columns("gs_saldo").Visible = True
|
|
Select Case currentGesSichRef.gsr_ATR
|
|
Case True
|
|
.Columns("gs_ATBNr").HeaderText = "ATB"
|
|
.Columns("gs_atr").HeaderText = "MRN"
|
|
.Columns("gs_atr").Visible = True
|
|
.Columns("gs_atr").Width = 33
|
|
.Columns("gs_ust").Width = 69
|
|
.Columns("gs_ust").HeaderText = "Ust"
|
|
Case Else
|
|
.Columns("gs_ATBNr").HeaderText = "ATB"
|
|
End Select
|
|
.Columns("gs_ATBNr").Width = 146
|
|
|
|
.Columns("gs_posNr").Width = 35
|
|
.Columns("gs_posNr").HeaderText = "Pos#"
|
|
.Columns("gs_datum").Width = 95
|
|
.Columns("gs_datum").HeaderText = "Datum"
|
|
.Columns("gs_warenwert").Width = 100
|
|
.Columns("gs_warenwert").HeaderText = "Warenwert"
|
|
.Columns("gs_saldo").Width = 100
|
|
.Columns("gs_saldo").HeaderText = "Saldo"
|
|
|
|
.Columns("gs_sicherheitsbetrag").Width = 85
|
|
.Columns("gs_sicherheitsbetrag").HeaderText = "S-Betrag"
|
|
.Columns("gs_freitext").AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill
|
|
End With
|
|
|
|
End If
|
|
|
|
calcGesamtsummen()
|
|
|
|
|
|
End Sub
|
|
|
|
Private Sub dgvGesamtsicherheit_SelectionChanged(sender As Object, e As EventArgs) Handles dgvGesamtsicherheit.SelectionChanged
|
|
If dgvGesamtsicherheit.SelectedRows.Count > 0 Then
|
|
|
|
indexGsId = CInt(dgvGesamtsicherheit.SelectedRows(0).Cells("gs_gsNr").Value)
|
|
currentSicherheit = New cSicherheiten(indexGsId)
|
|
LoadDGVSicherheitsPos(indexGsId, True)
|
|
loadTitle()
|
|
setSaldo()
|
|
|
|
|
|
If dgvGesamtsicherheit.Enabled = False Then Exit Sub
|
|
|
|
Else
|
|
LoadDGVSicherheitsPos(-1, True)
|
|
|
|
End If
|
|
End Sub
|
|
|
|
Public Sub LoadDGVSicherheitsPos(gsNr As Integer, Optional withFilterParam As Boolean = False)
|
|
|
|
'If gsNr = "" Then Exit Sub
|
|
|
|
Dim sqlSearchSting As String = ""
|
|
|
|
If withFilterParam = True Then
|
|
sqlSearchSting &= "AND gsp_gsid IN (select gs_gsId from [tblGesamtsicherheit] where [gs_gsnr] = '" & gessicherheitID & "'"
|
|
If txt_Suche.Text <> "" Then sqlSearchSting &= "AND ([gs_abfertigungsNr] Like '%" & txt_Suche.Text & "%' OR [gs_ATBNr] Like '%" & txt_Suche.Text & "%' OR [gs_LKWKZ] like '%" & txt_Suche.Text & "%' OR [gs_avisoId] like '%" & txt_Suche.Text & "%' OR [gs_freitext] like '%" & txt_Suche.Text & "%')"
|
|
If cbx_Suche_Warenort._value <> "" Then sqlSearchSting &= " AND gs_warenort like '%" & cbx_Suche_Warenort.Text & "%'"
|
|
sqlSearchSting &= ")"
|
|
End If
|
|
|
|
|
|
Dim SQLStringCRN As String = "select [gsp_gspPosId] ,[gsp_gsId],[gsp_gsnr],[gsp_warenwert],[gsp_sicherheitsbetrag],[gsp_freitext],[gsp_art] ,[gsp_avisoId] ,[gsp_ust] ,[gsp_filialenNr],[gsp_abfertigungsNr] ,[gsp_ATCNr] ,[gsp_MRNNr],[gsp_erstellungsdatum] from [tblGesamtsicherheitsPositionen] where [gsp_gsnr] = '" & gsNr & "'" & sqlSearchSting & " order by [gsp_gsId]"
|
|
dgvSicherheitsPos.SET_SQL(SQLStringCRN, "AVISO", ,)
|
|
dgvSicherheitsPos.LOAD()
|
|
|
|
If dgvSicherheitsPos.Columns.Count > 0 Then
|
|
With dgvSicherheitsPos
|
|
.RowHeadersWidth = 10
|
|
.Columns("gsp_gspPosId").Width = 35
|
|
.Columns("gsp_gspPosId").HeaderText = "Pos#"
|
|
.Columns("gsp_gsId").Visible = False
|
|
.Columns("gsp_gsnr").Visible = False
|
|
.Columns("gsp_warenwert").DefaultCellStyle.Format = "c"
|
|
.Columns("gsp_sicherheitsbetrag").DefaultCellStyle.Format = "c"
|
|
'.Columns("gs_saldo").DefaultCellStyle.Format = "c"
|
|
'.Columns("gs_saldo").Visible = False
|
|
Select Case currentGesSichRef.gsr_ATR
|
|
Case True
|
|
.Columns("gsp_ATCNr").HeaderText = "ATC / MRN"
|
|
Case Else
|
|
.Columns("gsp_ATCNr").HeaderText = "CRN / MRN"
|
|
End Select
|
|
.Columns("gsp_ATCNr").Width = 120
|
|
.Columns("gsp_erstellungsdatum").Width = 100
|
|
.Columns("gsp_erstellungsdatum").HeaderText = "Datum"
|
|
.Columns("gsp_warenwert").Width = 100
|
|
.Columns("gsp_warenwert").HeaderText = "Warenwert"
|
|
.Columns("gsp_sicherheitsbetrag").Width = 85
|
|
.Columns("gsp_sicherheitsbetrag").HeaderText = "S-Betrag"
|
|
.Columns("gsp_freitext").Width = 110
|
|
.Columns("gsp_freitext").HeaderText = "Freitext"
|
|
End With
|
|
|
|
End If
|
|
btnAddPos.Visible = True
|
|
|
|
End Sub
|
|
|
|
'Private Sub dgvSicherheitsPos_SelectionChanged(sender As Object, e As EventArgs) Handles dgvSicherheitsPos.SelectionChanged
|
|
' If dgvSicherheitsPos.SelectedRows.Count > 0 Then
|
|
|
|
' indexGspPosId = CInt(dgvSicherheitsPos.SelectedRows(0).Cells("gsp_gspPosId").Value)
|
|
' currentSPos = New cGesamtsicherheitsPositionen(indexGsId, indexGspPosId)
|
|
|
|
' If dgvSicherheitsPos.Enabled = False Then Exit Sub
|
|
|
|
' End If
|
|
'End Sub
|
|
|
|
Sub loadTitle()
|
|
'Dim StandortSqlString As String = "select * from [tblGesamtsicherheit] where [gs_gsNr] = '" & gessicherheitID & "'"
|
|
|
|
lblGestellungNr.Text = ""
|
|
lblId.Text = ""
|
|
Dim StandortSqlString As String = "select * from [tblGesamtsicherheit] where [gs_gsId] = '" & indexGsId & "'"
|
|
|
|
|
|
Dim dt As New DataTable
|
|
dt = SQL.loadDgvBySql(StandortSqlString, "AVISO", 100, True)
|
|
|
|
If dt.Rows.Count > 0 Then
|
|
Me.LKWKZ = setNullToZero(dt.Rows(0).Item("gs_LKWKZ"))
|
|
Me.FilialNummer = setNullToZero(dt.Rows(0).Item("gs_filialenNr"))
|
|
Me.Abfertigungsnummer = setNullToZero(dt.Rows(0).Item("gs_abfertigungsNr"))
|
|
Me.warenortID = setNullToZero(dt.Rows(0).Item("gs_warenort"))
|
|
End If
|
|
|
|
If Me.LKWKZ.ToString.Length > 0 Then lblGestellungNr.Text &= "LKW-ID: " & Me.LKWKZ & " "
|
|
If Me.FilialNummer.ToString.Length > 0 Then lblGestellungNr.Text &= "FilialNr: " & Me.FilialNummer & " "
|
|
If Me.Abfertigungsnummer.Length > 0 Then lblGestellungNr.Text &= "AbfNr: " & Me.Abfertigungsnummer & " "
|
|
If Me.warenortID.Length > 0 Then lblGestellungNr.Text &= "Warenort: " & Me.warenortID & " "
|
|
If gessicherheitID <> 0 Then lblId.Text &= "GS-Nr: " & gessicherheitID 'currentSicherheit.gs_gsNr
|
|
|
|
|
|
|
|
End Sub
|
|
|
|
|
|
Public Sub LoadStandort()
|
|
|
|
Zollsatz = currentGesSichRef.gsr_zollsatz
|
|
txtZollsatzueberschreiben.Text = Zollsatz
|
|
cbxZollsatzueberschreiben.Checked = False
|
|
lblReferenzwert.Text = "Referenzwert: €" & currentGesSichRef.gsr_referenzwert.ToString()
|
|
lblZollsatz.Text = "Zollsatz: " & currentGesSichRef.gsr_zollsatz & "%"
|
|
ZollsatzMulti = currentGesSichRef.gsr_zollsatz / 100
|
|
|
|
End Sub
|
|
|
|
Private Sub Warenwert_TextChanged(sender As Object, e As EventArgs) Handles txtSicherheitWarenwert.TextChanged, txtPosWarenwert.TextChanged
|
|
Try
|
|
Select Case sender.name
|
|
Case "txtSicherheitWarenwert"
|
|
txtSicherheitSicherheitsbetrag.Text = (txtSicherheitWarenwert.Text * ZollsatzMulti).ToString("N")
|
|
If currentGesSichRef.gsr_ustEnabled Then txtSicherheitEust.Text = (Double.Parse(txtSicherheitWarenwert.Text) + Double.Parse(txtSicherheitSicherheitsbetrag.Text)) * (currentGesSichRef.gsr_ust / 100)
|
|
Case "txtPosWarenwert"
|
|
txtPosSicherheitsbetrag.Text = (txtPosWarenwert.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
|
|
' 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 txtPosDate.KeyPress, txtPosTime.KeyPress, txtSicherheitDate.KeyPress, txtSicherheitTime.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 txtMRNDate_GotFocus(sender As Object, e As EventArgs) Handles txtSicherheitDate.GotFocus, txtPosDate.GotFocus, txtSicherheitTime.GotFocus, txtPosTime.GotFocus
|
|
Select Case sender.name
|
|
Case "txtSicherheitDate"
|
|
If txtSicherheitDate.Text.Length < 1 Then txtSicherheitDate.Text = Date.Today.ToString("dd.MM.yyyy")
|
|
Case "txtPosDate"
|
|
If txtPosDate.Text.Length < 1 Then txtPosDate.Text = Date.Today.ToString("dd.MM.yyyy")
|
|
Case "txtSicherheitTime"
|
|
If txtSicherheitTime.Text.Length < 1 Then txtSicherheitTime.Text = Date.Now.ToString("HH:mm")
|
|
Case "txtPosTime"
|
|
If txtPosTime.Text.Length < 1 Then txtPosTime.Text = Date.Now.ToString("HH:mm")
|
|
End Select
|
|
End Sub
|
|
|
|
Private Sub btnAddSicherheit_Click(sender As Object, e As EventArgs) Handles btnAddSicherheit.Click
|
|
|
|
Dim attachPosNrToExistingATB As Boolean = False
|
|
|
|
Try
|
|
|
|
If (txtAnzahlPos.Text = "") Then
|
|
txtAnzahlPos.Focus()
|
|
Exit Sub
|
|
End If
|
|
|
|
Dim limit As Integer = Integer.Parse(setNullToZero(txtAnzahlPos.Text))
|
|
|
|
|
|
For count As Integer = 1 To limit
|
|
attachPosNrToExistingATB = False
|
|
Dim warenwert As Double
|
|
Dim sicherheitsbetrag As Double
|
|
If count > 1 Then
|
|
warenwert = 0
|
|
sicherheitsbetrag = 0
|
|
Else
|
|
warenwert = Double.Parse(txtSicherheitWarenwert.Text)
|
|
sicherheitsbetrag = Double.Parse(txtSicherheitSicherheitsbetrag.Text)
|
|
End If
|
|
|
|
Dim OPEN As New cSicherheiten()
|
|
|
|
With OPEN
|
|
.gs_gsNr = gessicherheitID
|
|
.gs_ATBNr = txtSicherheitATBNr.Text
|
|
.gs_posNr = count
|
|
.gs_datum = DateTimeString2DateTimeKonvertinator(txtSicherheitDate.Text, txtSicherheitTime.Text)
|
|
.gs_warenwert = warenwert
|
|
.gs_sicherheitsbetrag = sicherheitsbetrag
|
|
.gs_standort = Me.Standort
|
|
.gs_art = "OPEN"
|
|
.gs_erstellungsdatum = Me.datum
|
|
.gs_freitext = Me.txtSicherheitFreitext.Text
|
|
.gs_saldo = currentGesSichRef.gsr_Saldo
|
|
.gs_atr = setNullToZero(cboSicherheitATR.SelectedItem)
|
|
.gs_zollsatz = Me.Zollsatz
|
|
setEnviromentDataToObject(OPEN, Me)
|
|
End With
|
|
|
|
|
|
|
|
|
|
If Neu = True AndAlso count <= 1 Then OPEN.gs_gsNr = AddNewGesamtSichNr()
|
|
|
|
Select Case checkIfExist(OPEN.gs_ATBNr, gessicherheitID)
|
|
|
|
Case "Neu"
|
|
|
|
indexGsId = OPEN.SAVEOBJECT()
|
|
|
|
Case Else
|
|
With OPEN
|
|
.gs_posNr = getLatestPosNr(gessicherheitID, txtSicherheitATBNr.Text) + 1
|
|
End With
|
|
attachPosNrToExistingATB = True
|
|
indexGsId = OPEN.SAVEOBJECT()
|
|
If count = 1 Then MsgBox("INFO: Dieser Eintrag wurde bei GesamtsichNr " & checkIfExist(OPEN.gs_ATBNr, gessicherheitID) & "eingetragen") ': indexGsId = OPEN.SAVEOBJECT()
|
|
|
|
End Select
|
|
|
|
Dim OPENPos As cGesamtsicherheitsPositionen
|
|
|
|
If attachPosNrToExistingATB Then
|
|
OPENPos = New cGesamtsicherheitsPositionen(indexGsId, OPEN.gs_posNr)
|
|
Else
|
|
OPENPos = New cGesamtsicherheitsPositionen(indexGsId, count)
|
|
End If
|
|
|
|
With OPENPos
|
|
|
|
.gsp_gsNr = OPEN.gs_gsNr
|
|
.gsp_warenwert = 0
|
|
.gsp_sicherheitsbetrag = 0
|
|
.gsp_freitext = ""
|
|
.gsp_filialenNr = OPEN.gs_filialenNr
|
|
.gsp_art = "OPEN"
|
|
.gsp_abfertigungsNr = OPEN.gs_abfertigungsnr
|
|
.gsp_erstellungsdatum = Me.datum
|
|
.gsp_avisoId = ""
|
|
.gsp_ust = ""
|
|
.gsp_ATCNr = ""
|
|
.gsp_MRNNr = ""
|
|
.gsp_gsNr = OPEN.gs_gsNr
|
|
End With
|
|
|
|
|
|
OPENPos.SAVE()
|
|
|
|
|
|
|
|
|
|
|
|
Next
|
|
|
|
AfterButton()
|
|
|
|
Catch ex As Exception
|
|
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub btnAddPos_Click(sender As Object, e As EventArgs) Handles btnAddPos.Click
|
|
|
|
If dgvGesamtsicherheit.SelectedRows.Count = 0 Then
|
|
|
|
MsgBox("Bitte eine Gestellung markieren, zu diese eine Pos hinzugefügt/entfernt/aktualisiert werden soll")
|
|
Exit Sub
|
|
End If
|
|
|
|
If (checkSicherheitsbetrag() = False) Then
|
|
MsgBox("Der Warenwert der Positionen übersteigt den Warenwert der Gestellung!")
|
|
txtPosWarenwert.Focus()
|
|
Exit Sub
|
|
End If
|
|
|
|
Try
|
|
|
|
Dim OPEN As New cSicherheiten()
|
|
|
|
With OPEN
|
|
.gs_gsNr = gessicherheitID
|
|
.gs_ATBNr = ""
|
|
.gs_posNr = Me.getLatestPosNr(currentSicherheit.gs_gsNr, currentSicherheit.gs_ATBNr) + 1
|
|
.gs_datum = DateTimeString2DateTimeKonvertinator(txtPosDate.Text, txtPosTime.Text)
|
|
.gs_warenwert = 0
|
|
.gs_sicherheitsbetrag = 0
|
|
.gs_standort = Me.Standort
|
|
.gs_art = "OPEN"
|
|
.gs_erstellungsdatum = Me.datum
|
|
.gs_freitext = Me.txtSicherheitFreitext.Text
|
|
.gs_saldo = currentGesSichRef.gsr_Saldo
|
|
.gs_atr = setNullToZero(cboSicherheitATR.SelectedItem)
|
|
.gs_zollsatz = Me.Zollsatz
|
|
setEnviromentDataToObject(OPEN, Me)
|
|
End With
|
|
|
|
Dim gs_gsId = OPEN.SAVEOBJECT()
|
|
|
|
Dim SicherheitsPos As New cGesamtsicherheitsPositionen()
|
|
With SicherheitsPos
|
|
.gsp_gsId = gs_gsId
|
|
'.gsp_gspPosId = Me.getLatestPosNr(currentSicherheit.gs_gsNr, ) + 1
|
|
.gsp_gspPosId = OPEN.gs_posNr
|
|
.gsp_warenwert = Double.Parse(txtPosWarenwert.Text)
|
|
.gsp_sicherheitsbetrag = Double.Parse(txtPosSicherheitsbetrag.Text)
|
|
.gsp_freitext = txtPosFreitext.Text
|
|
.gsp_filialenNr = currentSicherheit.gs_filialenNr
|
|
.gsp_art = "CLOSE"
|
|
.gsp_gsNr = gessicherheitID
|
|
.gsp_abfertigungsNr = currentSicherheit.gs_abfertigungsnr
|
|
.gsp_erstellungsdatum = DateTimeString2DateTimeKonvertinator(txtPosDate.Text, txtPosTime.Text)
|
|
.gsp_ust = currentSicherheit.gs_ust
|
|
.gsp_ATCNr = txtPositionenCRN.Text
|
|
.gsp_MRNNr = txtPositionenCRN.Text
|
|
End With
|
|
|
|
SicherheitsPos.SAVE()
|
|
|
|
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
|
|
Sub AfterButton()
|
|
currentGesSichRef.CalcSaldo()
|
|
LoadDGVSicherheiten()
|
|
EmptyTXT()
|
|
End Sub
|
|
|
|
Public Function AddNewGesamtSichNr() As Integer
|
|
Dim sqlq As String = "select MAX([gs_gsNr]) as MaxGesSich from tblGesamtsicherheit"
|
|
Dim dt As New DataTable
|
|
dt = SQL.loadDgvBySql(sqlq, "AVISO", 100, True)
|
|
Dim LetzteGesSichNum As Integer = -1
|
|
If (dt.Rows(0).Item(0) IsNot DBNull.Value) Then
|
|
|
|
LetzteGesSichNum = dt.Rows(0).Item(0)
|
|
Me.gessicherheitID = LetzteGesSichNum + 1
|
|
Me.Neu = False
|
|
|
|
End If
|
|
|
|
Return Me.gessicherheitID
|
|
End Function
|
|
|
|
Public Sub EmptyTXT()
|
|
Dim a As New List(Of Windows.Forms.Control)
|
|
For Each contr As Windows.Forms.Control In panOben.Controls
|
|
If contr.GetType.FullName = "System.Windows.Forms.TextBox" Then contr.Text = ""
|
|
Next
|
|
cboSicherheitATR.SelectedItem = Nothing
|
|
End Sub
|
|
|
|
Public Function checkIfExist(KennnummerStr As String, Optional ByVal lkw As String = "") As String
|
|
If lkw = "" And Me.gessicherheitID > 0 Then lkw = gessicherheitID
|
|
|
|
Dim SQLString As String = "Select * from [tblGesamtsicherheit] where [gs_ATBNr] = '" & KennnummerStr & "'"
|
|
Dim dt As New DataTable
|
|
dt = SQL.loadDgvBySql(SQLString, "AVISO", 100, True)
|
|
If dt.Rows.Count > 0 Then
|
|
Return dt.Rows(0).Item("gs_gsNr").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
|
|
|
|
If checkMandatoryFieldsAreFilled() = False Then Exit Sub
|
|
|
|
Try
|
|
Me.FilialNummer = checkNothingValue(cboFiliale.SelectedItem, "Integer")
|
|
Catch
|
|
Me.FilialNummer = "0"
|
|
End Try
|
|
|
|
Try
|
|
Me.warenortID = checkNothingValue(cboWarenort.SelectedItem, "String")
|
|
|
|
Catch
|
|
Me.warenortID = "-"
|
|
End Try
|
|
|
|
Me.Abfertigungsnummer = txtAbfertNum.Text
|
|
Me.LKWKZ = txtLKWID.Text
|
|
|
|
If setNullToZero(Me.gessicherheitID) > 0 Then
|
|
Dim sqlstring = "Update [tblGesamtsicherheit] set [gs_filialenNr] = '" & Me.FilialNummer & "', [gs_abfertigungsNr] = '" & Me.Abfertigungsnummer & "', [gs_LKWKZ] = '" & Me.LKWKZ & "', [gs_warenort] = '" & Me.warenortID & "' WHERE [gs_gsNr] = '" & Me.gessicherheitID & "' "
|
|
SQL.doSQL(sqlstring, "AVISO")
|
|
btnAddPos.Visible = True
|
|
LoadDGVSicherheiten()
|
|
End If
|
|
loadTitle()
|
|
btnAddPos.Visible = False
|
|
panOben.Enabled = True : panOben.Enabled = True
|
|
panOverlay.Visible = False
|
|
End Sub
|
|
|
|
Private Function checkNothingValue(obj As Object, Optional type As String = "String") As Object
|
|
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 dgvGesamtsicherheit_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles dgvGesamtsicherheit.CellDoubleClick
|
|
|
|
Dim Sicherh As New cSicherheiten(dgvGesamtsicherheit.CurrentRow.Cells("gs_gsId").Value, dgvGesamtsicherheit.CurrentRow.Cells("gs_posNr").Value)
|
|
|
|
txtSicherheitATBNr.Text = Sicherh.gs_ATBNr
|
|
txtAnzahlPos.Text = Sicherh.gs_posNr
|
|
txtSicherheitWarenwert.Text = Sicherh.gs_warenwert
|
|
txtSicherheitFreitext.Text = Sicherh.gs_freitext
|
|
cboSicherheitATR.SelectedItem = Sicherh.gs_atr
|
|
txtSicherheitDate.Text = Sicherh.gs_erstellungsdatum.ToString("dd.MM.yyyy")
|
|
txtSicherheitTime.Text = Sicherh.gs_erstellungsdatum.ToString("HH:mm")
|
|
|
|
currentSicherheit = Sicherh
|
|
txtAnzahlPos.Enabled = False
|
|
|
|
btnAddSicherheit.Visible = False
|
|
btnUpdateSicherheit.Visible = True
|
|
btnDeleteSicherheit.Visible = True
|
|
End Sub
|
|
|
|
Private Sub btnUpdateSicherheit_Click(sender As Object, e As EventArgs) Handles btnUpdateSicherheit.Click
|
|
With currentSicherheit
|
|
.gs_ATBNr = txtSicherheitATBNr.Text
|
|
.gs_posNr = Integer.Parse(setNullToZero(txtAnzahlPos.Text))
|
|
.gs_datum = DateTimeString2DateTimeKonvertinator(txtSicherheitDate.Text, txtSicherheitTime.Text)
|
|
.gs_warenwert = Double.Parse(txtSicherheitWarenwert.Text)
|
|
.gs_sicherheitsbetrag = Double.Parse(txtSicherheitSicherheitsbetrag.Text)
|
|
.gs_standort = Me.Standort
|
|
.gs_art = "OPEN"
|
|
.gs_gsNr = Me.gessicherheitID
|
|
'.MakeDate = Me.MakeDate
|
|
.gs_freitext = Me.txtSicherheitFreitext.Text
|
|
'.saldo = currentGesSichRef.Saldo
|
|
.gs_atr = setNullToZero(cboSicherheitATR.SelectedItem)
|
|
End With
|
|
checkSicherheitsbetrag()
|
|
currentSicherheit.SAVE()
|
|
txtAnzahlPos.Enabled = True
|
|
btnUpdateSicherheit.Visible = False
|
|
btnAddSicherheit.Visible = True
|
|
btnDeleteSicherheit.Visible = False
|
|
AfterButton()
|
|
End Sub
|
|
|
|
Private Sub btnUpdatePos_Click(sender As Object, e As EventArgs) Handles btnUpdatePos.Click
|
|
With currentSPos
|
|
|
|
.gsp_art = "CLOSE"
|
|
.gsp_freitext = txtPosFreitext.Text
|
|
.gsp_sicherheitsbetrag = Double.Parse(txtPosSicherheitsbetrag.Text)
|
|
.gsp_warenwert = Double.Parse(txtPosWarenwert.Text)
|
|
.gsp_ATCNr = txtPositionenCRN.Text
|
|
|
|
End With
|
|
checkSicherheitsbetrag()
|
|
currentSPos.SAVE()
|
|
btnAddPos.Visible = True
|
|
btnUpdatePos.Visible = False
|
|
btnDeletePos.Visible = False
|
|
AfterButton()
|
|
End Sub
|
|
|
|
Private Sub dgvGesamtsicherheitPositionen_CellCellDoubleClick(sender As Object, e As DataGridViewCellEventArgs) Handles dgvSicherheitsPos.CellDoubleClick
|
|
|
|
Dim sPos As New cGesamtsicherheitsPositionen(dgvSicherheitsPos.CurrentRow.Cells("gsp_gsId").Value, dgvSicherheitsPos.CurrentRow.Cells("gsp_gspPosId").Value)
|
|
|
|
txtPosNr.Text = sPos.gsp_gspPosId
|
|
txtPosFreitext.Text = sPos.gsp_freitext
|
|
txtPosSicherheitsbetrag.Text = sPos.gsp_sicherheitsbetrag
|
|
txtPosWarenwert.Text = sPos.gsp_warenwert
|
|
txtPositionenCRN.Text = sPos.gsp_ATCNr
|
|
txtPosDate.Text = sPos.gsp_erstellungsdatum.ToString("dd.MM.yyyy")
|
|
txtPosTime.Text = sPos.gsp_erstellungsdatum.ToString("HH:mm")
|
|
|
|
|
|
currentSPos = sPos
|
|
|
|
btnDeletePos.Visible = True
|
|
btnAddPos.Visible = False
|
|
btnUpdatePos.Visible = True
|
|
End Sub
|
|
|
|
Private Sub btnDeleteSicherheit_Click(sender As Object, e As EventArgs) Handles btnDeleteSicherheit.Click
|
|
Try
|
|
currentSicherheit.Delete()
|
|
btnUpdateSicherheit.Visible = False
|
|
btnAddSicherheit.Visible = True
|
|
btnDeleteSicherheit.Visible = False
|
|
txtAnzahlPos.Enabled = True
|
|
AfterButton()
|
|
Catch ex As Exception
|
|
MsgBox(ex.Message)
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub btnDeletePos_Click(sender As Object, e As EventArgs) Handles btnDeletePos.Click
|
|
Try
|
|
currentSPos.Delete()
|
|
btnUpdatePos.Visible = False
|
|
btnAddPos.Visible = True
|
|
btnDeletePos.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)
|
|
cboWarenort.fillWithSQL("SELECT [grz_Grenzstelle], [grz_Bezeichnung] FROM [tblGrenzstelle] WHERE [grz_Aktiv] ='1' AND [grz_Warenort] ='1' ORDER BY [grz_Reihenfolge] ", True, "AVISO", True)
|
|
cboWarenort.SelectedIndex = cbx_Suche_Warenort.FindString(Me.warenortID)
|
|
txtAbfertNum.Text = Me.Abfertigungsnummer
|
|
txtLKWID.Text = Me.LKWKZ
|
|
panOben.Enabled = False
|
|
End Sub
|
|
|
|
Private Sub btnClosePanOverlay_Click(sender As Object, e As EventArgs) Handles btnClosePanOverlay.Click
|
|
panOverlay.Visible = False
|
|
End Sub
|
|
|
|
Private Function checkMandatoryFieldsAreFilled() As Boolean
|
|
Dim isFilled = True
|
|
|
|
If cboWarenort._value = Nothing Or cboWarenort._value = "" Then
|
|
|
|
MsgBox("Bitte Warenort angeben!")
|
|
isFilled = False
|
|
|
|
End If
|
|
|
|
Return isFilled
|
|
|
|
End Function
|
|
|
|
Private Sub setEnviromentDataToObject(sicherheiten As cSicherheiten, Optional ByVal gessich As frmGesamtsicherheitenNEU = Nothing)
|
|
|
|
sicherheiten.gs_filialenNr = gessich.FilialNummer
|
|
sicherheiten.gs_abfertigungsnr = gessich.Abfertigungsnummer
|
|
sicherheiten.gs_LKWKZ = gessich.LKWKZ
|
|
sicherheiten.gs_warenort = gessich.warenortID
|
|
End Sub
|
|
|
|
|
|
Private Function getLatestPosNr(gs_gsnr As Integer, gs_ATBNr As String) As Integer
|
|
Dim posNr As Integer = 0
|
|
'Dim sqlq As String = "select MAX([gsp_gspPosId]) as MaxPosNr from tblGesamtsicherheitsPositionen where gsp_gsnr = " & gs_gsnr
|
|
Dim sqlq As String = "select MAX([gs_posNr]) as MaxPosNr from [tblGesamtsicherheit] where gs_gsnr = " & gs_gsnr & " AND gs_ATBNR = '" & gs_ATBNr & "'"
|
|
Dim dt As New DataTable
|
|
dt = SQL.loadDgvBySql(sqlq, "AVISO", 100, True)
|
|
|
|
If (dt.Rows(0).Item(0) IsNot DBNull.Value) Then
|
|
|
|
posNr = dt.Rows(0).Item(0)
|
|
|
|
End If
|
|
|
|
Return posNr
|
|
|
|
End Function
|
|
|
|
Private Sub btnSuche_Click(sender As Object, e As EventArgs) Handles btnSuche.Click
|
|
Try
|
|
If Me.Visible Then LoadDGVSicherheiten(True)
|
|
Catch ex As Exception
|
|
MsgBox("Datum VON und/oder BIS konnte nicht konvertiert werden.")
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub btnNeu_Click(sender As Object, e As EventArgs)
|
|
panOverlay.Visible = True
|
|
End Sub
|
|
|
|
Private Sub btn_resetSearch_Click(sender As Object, e As EventArgs) Handles btn_resetSearch.Click
|
|
|
|
Dim dgv As String = ""
|
|
For Each c As DataGridViewColumn In dgvGesamtsicherheit.Columns
|
|
dgv &= c.Width & c.HeaderText & vbCrLf
|
|
Next
|
|
|
|
clearSearchFields()
|
|
|
|
LoadDGVSicherheiten()
|
|
currentGesSichRef.LOAD()
|
|
LoadStandort()
|
|
End Sub
|
|
|
|
Private Sub clearSearchFields()
|
|
cbx_Suche_Warenort.changeItem("")
|
|
txt_Suche.Clear()
|
|
End Sub
|
|
|
|
Private Function checkSicherheitsbetrag() As Boolean
|
|
|
|
Dim ok As Boolean = True
|
|
|
|
Dim offenerSicherheitsbetrag As Double
|
|
Dim offenerSicherheitsbetragPos As Double
|
|
|
|
Try
|
|
|
|
offenerSicherheitsbetrag = calcOffenerSicherheitsbetrag()
|
|
|
|
If (offenerSicherheitsbetrag < 0) Then Return False
|
|
|
|
If (offenerSicherheitsbetrag < offenerSicherheitsbetragPos) Then Return False
|
|
|
|
Catch ex As Exception
|
|
MsgBox(ex.Message)
|
|
End Try
|
|
|
|
Return ok
|
|
|
|
End Function
|
|
Private Function calcSicherheitsbetragPos() As Double
|
|
|
|
Dim sicherheitsbetragSumPositionen As Double
|
|
If currentSicherheit Is Nothing Then Exit Function
|
|
sicherheitsbetragSumPositionen = CDbl(SQL.DLookup("SUM(gsp_sicherheitsbetrag)", "[tblGesamtsicherheitsPositionen]", "gsp_gsnr ='" & currentSicherheit.gs_gsNr & "'", "AVISO"))
|
|
|
|
If currentSPos IsNot Nothing Then
|
|
sicherheitsbetragSumPositionen = sicherheitsbetragSumPositionen + Double.Parse(setNullToZero(txtPosWarenwert.Text))
|
|
End If
|
|
|
|
Return sicherheitsbetragSumPositionen
|
|
|
|
End Function
|
|
|
|
|
|
Private Function calcSicherheitsbetragGestelle() As Double
|
|
|
|
Dim sicherheitsbetragSumGestelle As Double
|
|
If currentSicherheit Is Nothing Then Exit Function
|
|
sicherheitsbetragSumGestelle = CDbl(SQL.DLookup("SUM(gs_sicherheitsbetrag)", "[tblGesamtsicherheit]", "gs_gsnr ='" & currentSicherheit.gs_gsNr & "'", "AVISO"))
|
|
|
|
Return sicherheitsbetragSumGestelle
|
|
|
|
End Function
|
|
|
|
|
|
|
|
Private Function calcOffenerSicherheitsbetrag() As Double
|
|
|
|
Dim diff As Double = -10000
|
|
|
|
Try
|
|
Dim sicherheitsbetragSumPositionen = calcSicherheitsbetragPos()
|
|
Dim sicherheitsbetragSumGestelle = calcSicherheitsbetragGestelle()
|
|
|
|
diff = Double.Parse(sicherheitsbetragSumGestelle) - Double.Parse(sicherheitsbetragSumPositionen)
|
|
Catch ex As Exception
|
|
MsgBox(ex.Message)
|
|
End Try
|
|
|
|
Return diff
|
|
|
|
End Function
|
|
|
|
Private Sub setSaldo()
|
|
|
|
lbloffenerSaldo.Text = "offener S-Saldo: "
|
|
Dim offernerSB As Double = Me.calcOffenerSicherheitsbetrag()
|
|
If offernerSB <> 0 Then
|
|
lbloffenerSaldo.Text &= Math.Round(calcOffenerSicherheitsbetrag(), 2).ToString
|
|
isOpen = True
|
|
Else
|
|
lbloffenerSaldo.Text &= "0"
|
|
isOpen = False
|
|
End If
|
|
End Sub
|
|
|
|
|
|
Private Function setPrevAndNextGesIDAllOpen()
|
|
|
|
Dim isInList As Boolean = False
|
|
|
|
Dim onlyOpenDT As DataTable
|
|
|
|
onlyOpenDT = dt.Select("gs_isOpen = True").CopyToDataTable
|
|
|
|
|
|
For i As Integer = 0 To onlyOpenDT.Rows.Count - 1
|
|
If onlyOpenDT.Rows(i).Item("gs_gsnr") = Me.gessicherheitID Then
|
|
isInList = True
|
|
If i = 0 Then
|
|
prevGessicherheitID = -1 ' no prev Sicherheit
|
|
Else
|
|
prevGessicherheitID = onlyOpenDT.Rows(i - 1).Item("gs_gsnr")
|
|
|
|
End If
|
|
|
|
'MsgBox("prevOPENGessicherheitID " & prevGessicherheitID)
|
|
|
|
If i = onlyOpenDT.Rows.Count - 1 Then
|
|
nextGessicherheitID = -1 ' no next Sicherheit
|
|
Else
|
|
nextGessicherheitID = onlyOpenDT.Rows(i + 1).Item("gs_gsnr")
|
|
|
|
End If
|
|
|
|
'MsgBox("nextOPENGessicherheitID " & nextGessicherheitID)
|
|
|
|
End If
|
|
|
|
Next
|
|
|
|
If isInList = False AndAlso onlyOpenDT.Rows.Count - 1 <> 0 Then
|
|
|
|
For i As Integer = 0 To dt.Rows.Count - 1
|
|
If dt.Rows(i).Item("gs_gsnr") = Me.gessicherheitID Then
|
|
|
|
If i = 0 Then
|
|
prevGessicherheitID = -1 ' no prev Sicherheit
|
|
Else
|
|
|
|
For j As Integer = i To 0
|
|
If dt.Rows(j).Item("gs_isOpen") Then
|
|
prevGessicherheitID = dt.Rows(j).Item("gs_gsnr")
|
|
'MsgBox("prevGessicherheitID " & prevGessicherheitID)
|
|
Exit For
|
|
End If
|
|
Next
|
|
End If
|
|
|
|
|
|
If i = dt.Rows.Count - 1 Then
|
|
nextGessicherheitID = -1 ' ' no next Sicherheit
|
|
Else
|
|
For k As Integer = i To dt.Rows.Count - 1
|
|
If dt.Rows(k).Item("gs_isOpen") Then
|
|
nextGessicherheitID = dt.Rows(k).Item("gs_gsnr")
|
|
'MsgBox("nextGessicherheitID " & nextGessicherheitID)
|
|
Exit For
|
|
End If
|
|
Next
|
|
|
|
End If
|
|
|
|
|
|
End If
|
|
|
|
Next
|
|
End If
|
|
|
|
End Function
|
|
|
|
Private Function setPrevAndNextGesAll()
|
|
|
|
For i As Integer = 0 To dt.Rows.Count - 1
|
|
If dt.Rows(i).Item("gs_gsnr") = Me.gessicherheitID Then
|
|
|
|
prevGessicherheitID = dt.Rows(i).Item("gs_gsnr") - 1
|
|
|
|
nextGessicherheitID = dt.Rows(i).Item("gs_gsnr") + 1
|
|
|
|
|
|
If i = 0 Then prevGessicherheitID = -1 ' no prev Sicherheit
|
|
If i = dt.Rows.Count - 1 Then nextGessicherheitID = -1 ' ' no next Sicherheit
|
|
|
|
'MsgBox("prevGessicherheitID " & prevGessicherheitID)
|
|
'MsgBox("nextGessicherheitID " & nextGessicherheitID)
|
|
Return i
|
|
End If
|
|
|
|
Next
|
|
|
|
End Function
|
|
|
|
|
|
Private Sub btnPrev_Click(sender As Object, e As EventArgs) Handles btnPrev.Click
|
|
|
|
If (cbx_offene.Checked) Then
|
|
setPrevAndNextGesIDAllOpen()
|
|
Else
|
|
setPrevAndNextGesAll()
|
|
End If
|
|
|
|
If Me.prevGessicherheitID = -1 Then
|
|
initPrevNextButtons()
|
|
Exit Sub
|
|
End If
|
|
Me.gessicherheitID = Me.prevGessicherheitID
|
|
|
|
LoadDGVSicherheiten()
|
|
End Sub
|
|
|
|
Private Sub btnNext_Click(sender As Object, e As EventArgs) Handles btnNext.Click
|
|
|
|
If (cbx_offene.Checked) Then
|
|
setPrevAndNextGesIDAllOpen()
|
|
Else
|
|
setPrevAndNextGesAll()
|
|
End If
|
|
|
|
|
|
|
|
If Me.nextGessicherheitID = -1 Then
|
|
initPrevNextButtons()
|
|
Exit Sub
|
|
End If
|
|
Me.gessicherheitID = Me.nextGessicherheitID
|
|
|
|
LoadDGVSicherheiten()
|
|
End Sub
|
|
|
|
Private Sub initPrevNextButtons()
|
|
If nextGessicherheitID = -1 Then
|
|
btnNext.Enabled = True
|
|
Else
|
|
btnNext.Enabled = True
|
|
End If
|
|
|
|
|
|
If prevGessicherheitID = -1 Then
|
|
btnPrev.Enabled = True
|
|
Else
|
|
btnPrev.Enabled = True
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Sub cbxZollsatzueberschreiben_CheckedChanged(sender As Object, e As EventArgs) Handles cbxZollsatzueberschreiben.CheckedChanged
|
|
|
|
If cbxZollsatzueberschreiben.Checked Then
|
|
txtZollsatzueberschreiben.Enabled = True
|
|
Else
|
|
txtZollsatzueberschreiben.Enabled = False
|
|
txtZollsatzueberschreiben.Text = currentGesSichRef.gsr_zollsatz.ToString
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Sub txtZollsatzueberschreiben_TextChanged(sender As Object, e As EventArgs) Handles txtZollsatzueberschreiben.TextChanged
|
|
lblZollsatz.Text = "Zollsatz: " & txtZollsatzueberschreiben.Text & "%"
|
|
Zollsatz = CDbl(setNullToZero(txtZollsatzueberschreiben.Text))
|
|
ZollsatzMulti = CDbl(setNullToZero(txtZollsatzueberschreiben.Text)) / 100
|
|
End Sub
|
|
|
|
Private Sub btnSaveDatetime_Click(sender As Object, e As EventArgs) Handles btnSaveDatetime.Click
|
|
Try
|
|
Dim a As Date = Date.ParseExact(txtSicherheitDate.Text, "dd.MM.yyyy", System.Globalization.DateTimeFormatInfo.InvariantInfo)
|
|
Dim b As Date = Date.ParseExact(txtSicherheitTime.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 calcGesamtsummen()
|
|
|
|
txtAnzalPosGes.Text = DirectCast(dgvGesamtsicherheit.Rows.Count().ToString(), String)
|
|
|
|
txtPosAnzalPosGes.Text = DirectCast(dgvSicherheitsPos.Rows.Count().ToString(), String)
|
|
|
|
Dim countSicherheitsbetrag As Double = 0
|
|
Dim countWarenwert As Double = 0
|
|
|
|
For i As Integer = 0 To dgvGesamtsicherheit.Rows.Count - 1
|
|
countSicherheitsbetrag += CDbl(dgvGesamtsicherheit.Rows(i).Cells("gs_sicherheitsbetrag").Value)
|
|
countWarenwert += CDbl(dgvGesamtsicherheit.Rows(i).Cells("gs_warenwert").Value)
|
|
|
|
|
|
Next
|
|
|
|
txtSicherheitsbGes._value = countSicherheitsbetrag.ToString
|
|
txtWarenwertGes._value = countWarenwert.ToString
|
|
|
|
Dim countSicherheitsbetragPos As Double = 0
|
|
Dim countWarenwertPos As Double = 0
|
|
|
|
For i As Integer = 0 To dgvSicherheitsPos.Rows.Count - 1
|
|
|
|
countSicherheitsbetragPos += CDbl(dgvSicherheitsPos.Rows(i).Cells("gsp_sicherheitsbetrag").Value)
|
|
countWarenwertPos += CDbl(dgvSicherheitsPos.Rows(i).Cells("gsp_warenwert").Value)
|
|
|
|
Next
|
|
|
|
txtPosSicherheitsbGes._value = countSicherheitsbetragPos.ToString
|
|
txtPosWarenwertGes._value = countWarenwertPos.ToString
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
End Class
|
|
|