705 lines
29 KiB
VB.net
705 lines
29 KiB
VB.net
Imports System.Reflection
|
|
Imports DocumentFormat.OpenXml.Bibliography
|
|
Imports DocumentFormat.OpenXml.Presentation
|
|
Imports DocumentFormat.OpenXml.Spreadsheet
|
|
Imports VERAG_PROG_ALLGEMEIN
|
|
|
|
Public Class frmGesamtsicherheitenNEU
|
|
|
|
Public Property gessicherheitID As Integer
|
|
Public Property datum As DateTime = Nothing
|
|
Property GesSichRef As cGesamtsicherheitsReferenz
|
|
Property GesSichPos As cGesamtssicherheitsPositionen
|
|
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
|
|
|
|
Dim MONAT As Date = CDate("01." & Now.Month & "." & Now.Year) '.AddMonths(-1)
|
|
Dim srcTAG As Date = CDate(Now.ToShortDateString)
|
|
|
|
Dim JAHR As Date = CDate("01.01." & Now.Year)
|
|
|
|
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
|
|
|
|
btnMonat.Text = MONAT.ToString("MMMM")
|
|
btnJahr.Text = JAHR.Year
|
|
|
|
If setNullToZero(gessicherheitID) = "" 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.gsr_ATR
|
|
|
|
Me.Text = "Gesamtsicherheit " & Standort
|
|
frmHauptfenster.EnableDoubleBuffered(dgvGesamtsicherheitCRN)
|
|
End Sub
|
|
|
|
|
|
Public Sub LoadDGV()
|
|
'lblSaldo.Text = "Saldo: € " & GesSichRef.gsr_Saldo.ToString("N")
|
|
lblSaldo.Text = "Saldo: € " & GesSichRef.gsr_Saldo.ToString()
|
|
lblGestellungNr.Text = ""
|
|
Dim sqladd1 As String = ""
|
|
If GesSichRef.gsr_ustEnabled Then sqladd1 &= ", FORMAT((([gs_warenwert] + [gs_sicherheitsbetrag]) * " & GesSichRef.gsr_ust & "/100), 'C', 'de-DE') as gs_ust"
|
|
If GesSichRef.gsr_ATR Then sqladd1 &= ", [gs_atr]"
|
|
|
|
|
|
Dim addtosqlstring As String = ""
|
|
Dim SQLStringMRN As String = "select [gs_gsId], [gs_ATBNr], [gs_posNr], [gs_datum], [gs_warenwert], [gs_sicherheitsbetrag], [gs_saldo] " & sqladd1 & " , [gs_freitext] from [tblGesamtsicherheit] where [gs_gsNr] = '" & gessicherheitID & "' and [gs_art] = 'Open' order by [gs_datum]"
|
|
dgvGesamtsicherheitMRN.SET_SQL(SQLStringMRN, "AVISO", ,)
|
|
dgvGesamtsicherheitMRN.LOAD()
|
|
|
|
Dim SQLStringCRN As String = "select [gs_gsId], [gs_ATBNr], [gs_datum], [gs_warenwert], [gs_sicherheitsbetrag], [gs_saldo], [gs_freitext] from [tblGesamtsicherheit] where [gs_gsNr] = '" & gessicherheitID & "' and [gs_art] = 'Close' order by [gs_datum]"
|
|
dgvGesamtsicherheitCRN.SET_SQL(SQLStringCRN, "AVISO", ,)
|
|
dgvGesamtsicherheitCRN.LOAD()
|
|
|
|
Dim StandortSqlString As String = "select * from [tblGesamtsicherheit] where [gs_gsNr] = '" & 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 = 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"))
|
|
|
|
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 & " "
|
|
End If
|
|
|
|
|
|
If dgvGesamtsicherheitMRN.Columns.Count > 0 Then
|
|
With dgvGesamtsicherheitMRN
|
|
.RowHeadersWidth = 10
|
|
.Columns("gs_gsId").Visible = False
|
|
.Columns("gs_warenwert").DefaultCellStyle.Format = "c"
|
|
.Columns("gs_sicherheitsbetrag").DefaultCellStyle.Format = "c"
|
|
.Columns("gs_saldo").DefaultCellStyle.Format = "c"
|
|
.Columns("gs_saldo").Visible = False
|
|
Select Case GesSichRef.gsr_ATR
|
|
Case True
|
|
.Columns("gs_ATBNr").HeaderText = "ATB"
|
|
.Columns("gs_atr").HeaderText = "ATR"
|
|
.Columns("gs_atr").Width = 33
|
|
.Columns("gs_ust").Width = 69
|
|
Case Else
|
|
.Columns("gs_ATBNr").HeaderText = "CRN"
|
|
End Select
|
|
.Columns("gs_ATBNr").Width = 146
|
|
|
|
.Columns("gs_posNr").Width = 20
|
|
.Columns("gs_datum").Width = 95
|
|
.Columns("gs_warenwert").Width = 100
|
|
.Columns("gs_saldo").Width = 100
|
|
|
|
.Columns("gs_sicherheitsbetrag").Width = 100
|
|
.Columns("gs_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("gs_gsId").Visible = False
|
|
.Columns("gs_warenwert").DefaultCellStyle.Format = "c"
|
|
.Columns("gs_sicherheitsbetrag").DefaultCellStyle.Format = "c"
|
|
.Columns("gs_saldo").DefaultCellStyle.Format = "c"
|
|
.Columns("gs_saldo").Visible = False
|
|
Select Case GesSichRef.gsr_ATR
|
|
Case True
|
|
.Columns("gs_ATBNr").HeaderText = "ATC / MRN"
|
|
Case Else
|
|
.Columns("gs_ATBNr").HeaderText = "CRN"
|
|
End Select
|
|
.Columns("gs_ATBNr").Width = 120
|
|
.Columns("gs_datum").Width = 140
|
|
.Columns("gs_warenwert").Width = 100
|
|
.Columns("gs_sicherheitsbetrag").Width = 100
|
|
.Columns("gs_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.gsr_referenzwert.ToString("N")
|
|
lblReferenzwert.Text = "Referenzwert: €" & GesSichRef.gsr_referenzwert.ToString()
|
|
lblZollsatz.Text = "Zollsatz: " & GesSichRef.gsr_zollsatz & "%"
|
|
ZollsatzMulti = GesSichRef.gsr_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.gsr_ustEnabled Then txtEust.Text = (Double.Parse(txtMRNWarenwert.Text) + Double.Parse(txtMRNSicherheitsbetrag.Text)) * (GesSichRef.gsr_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
|
|
|
|
If Integer.Parse(setNullToZero(txtPos.Text)) > 1 Then
|
|
|
|
Dim limit As Integer = Integer.Parse(setNullToZero(txtPos.Text))
|
|
|
|
For count As Integer = 1 To limit
|
|
If (count > 1) Then txtMRNWarenwert.Text = 0
|
|
Dim OPENWithMultiplePosNr As New cSicherheiten()
|
|
|
|
With OPENWithMultiplePosNr
|
|
.gs_ATBNr = txtMRN.Text
|
|
.gs_posNr = count
|
|
.gs_datum = DateTimeString2DateTimeKonvertinator(txtMRNDate.Text, txtMRNTime.Text)
|
|
.gs_warenwert = Double.Parse(txtMRNWarenwert.Text) '.Replace(".", "").Replace(",", ".")
|
|
.gs_sicherheitsbetrag = Double.Parse(txtMRNSicherheitsbetrag.Text) '.Replace(".", "").Replace(",", ".")
|
|
.gs_standort = Me.Standort
|
|
.gs_art = "OPEN"
|
|
.gs_gsNr = Me.gessicherheitID
|
|
.gs_erstellungsdatum = Me.datum
|
|
.gs_freitext = Me.txtFreitextOpen.Text
|
|
.gs_saldo = GesSichRef.gsr_Saldo
|
|
.gs_atr = setNullToZero(cboATR.SelectedItem)
|
|
setEnviromentDataToObject(OPENWithMultiplePosNr, Me)
|
|
End With
|
|
|
|
If Neu = True AndAlso count <= 1 Then OPENWithMultiplePosNr.gs_gsNr = AddNewGesamtSichNr()
|
|
|
|
Select Case checkIfExist(OPENWithMultiplePosNr.gs_ATBNr, gessicherheitID)
|
|
Case "Neu"
|
|
OPENWithMultiplePosNr.SAVE()
|
|
Case Else
|
|
If (count > 1) Then
|
|
OPENWithMultiplePosNr.SAVE()
|
|
Else
|
|
MsgBox("INFO: Dieser Eintrag wurde bereits bei GesamtsichNr " & checkIfExist(OPENWithMultiplePosNr.gs_ATBNr, gessicherheitID) & "eingetragen") : OPENWithMultiplePosNr.SAVE()
|
|
End If
|
|
|
|
End Select
|
|
|
|
Next
|
|
|
|
AfterButton()
|
|
|
|
Else
|
|
|
|
'Dim OPEN As New cSicherheiten(Me)
|
|
Dim OPEN As New cSicherheiten()
|
|
|
|
With OPEN
|
|
.gs_ATBNr = txtMRN.Text
|
|
.gs_posNr = Integer.Parse(setNullToZero(txtPos.Text))
|
|
.gs_datum = DateTimeString2DateTimeKonvertinator(txtMRNDate.Text, txtMRNTime.Text)
|
|
.gs_warenwert = Double.Parse(txtMRNWarenwert.Text) '.Replace(".", "").Replace(",", ".")
|
|
.gs_sicherheitsbetrag = Double.Parse(txtMRNSicherheitsbetrag.Text) '.Replace(".", "").Replace(",", ".")
|
|
.gs_standort = Me.Standort
|
|
.gs_art = "OPEN"
|
|
.gs_gsNr = Me.gessicherheitID
|
|
.gs_erstellungsdatum = Me.datum
|
|
.gs_freitext = Me.txtFreitextOpen.Text
|
|
.gs_saldo = GesSichRef.gsr_Saldo
|
|
.gs_atr = setNullToZero(cboATR.SelectedItem)
|
|
setEnviromentDataToObject(OPEN, Me)
|
|
End With
|
|
|
|
|
|
If Neu = True Then OPEN.gs_gsNr = AddNewGesamtSichNr()
|
|
|
|
Select Case checkIfExist(OPEN.gs_ATBNr, gessicherheitID)
|
|
Case "Neu"
|
|
OPEN.SAVE()
|
|
Case Else
|
|
MsgBox("INFO: Dieser Eintrag wurde bereits bei GesamtsichNr " & checkIfExist(OPEN.gs_ATBNr, gessicherheitID) & "eingetragen") : OPEN.SAVE()
|
|
End Select
|
|
|
|
|
|
AfterButton()
|
|
|
|
End If
|
|
Catch ex As Exception
|
|
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub btnAddCRN_Click(sender As Object, e As EventArgs) Handles btnAddClose.Click
|
|
Try
|
|
'Dim Close As New cSicherheiten(Me)
|
|
Dim Close As New cSicherheiten()
|
|
With Close
|
|
.gs_ATBNr = txtCRN.Text
|
|
.gs_datum = DateTimeString2DateTimeKonvertinator(txtCRNDate.Text, txtCRNTime.Text)
|
|
.gs_warenwert = Integer.Parse(txtCRNWarenwert.Text) '.Replace(".", "").Replace(",", ".")
|
|
.gs_sicherheitsbetrag = Double.Parse(txtCRNSicherheitsbetrag.Text) '.Replace(".", "").Replace(",", ".")
|
|
.gs_standort = Me.Standort
|
|
.gs_art = "CLOSE"
|
|
.gs_gsNr = Me.gessicherheitID
|
|
.gs_erstellungsdatum = Me.datum
|
|
.gs_freitext = Me.txtFreitextClose.Text
|
|
.gs_saldo = GesSichRef.gsr_Saldo
|
|
End With
|
|
|
|
If Neu = True Then Close.gs_gsNr = AddNewGesamtSichNr()
|
|
|
|
Select Case checkIfExist(Close.gs_ATBNr, gessicherheitID)
|
|
Case "Neu"
|
|
Close.SAVE()
|
|
Case Else
|
|
MsgBox("Dieser Eintrag wurde bereits bei GesamtsichNr " & checkIfExist(Close.gs_ATBNr, 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
|
|
Sub AfterButton()
|
|
GesSichRef.CalcSaldo()
|
|
LoadDGV()
|
|
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
|
|
cboATR.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.LKWID = txtLKWID.Text
|
|
|
|
If setNullToZero(Me.gessicherheitID) >= 0 Then
|
|
Dim sqlstring = "Update [tblGesamtsicherheit] set [gs_filialenNr] = '" & Me.FilialNummer & "', [gs_abfertigungsNr] = '" & Me.Abfertigungsnummer & "', [gs_LKWID] = '" & Me.LKWID & "', [gs_warenort] = '" & Me.warenortID & "' WHERE [gs_gsNr] = '" & 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") 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 dgvGesamtsicherheitMRN_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles dgvGesamtsicherheitMRN.CellDoubleClick
|
|
|
|
Dim Sicherh As New cSicherheiten(dgvGesamtsicherheitMRN.CurrentRow.Cells("gs_gsId").Value)
|
|
'Sicherh.Load(dgvGesamtsicherheitMRN.CurrentRow.Cells("GesamtSichID").Value)
|
|
|
|
txtMRN.Text = Sicherh.gs_ATBNr
|
|
txtPos.Text = Sicherh.gs_posNr
|
|
txtMRNWarenwert.Text = Sicherh.gs_warenwert
|
|
txtFreitextOpen.Text = Sicherh.gs_freitext
|
|
cboATR.SelectedItem = Sicherh.gs_atr
|
|
txtMRNDate.Text = Sicherh.gs_erstellungsdatum.ToString("dd.MM.yyyy")
|
|
txtMRNTime.Text = Sicherh.gs_erstellungsdatum.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
|
|
.gs_ATBNr = txtMRN.Text
|
|
.gs_posNr = Double.Parse(setNullToZero(txtPos.Text))
|
|
.gs_datum = DateTimeString2DateTimeKonvertinator(txtMRNDate.Text, txtMRNTime.Text)
|
|
.gs_warenwert = Double.Parse(txtMRNWarenwert.Text) '.Replace(".", "").Replace(",", ".")
|
|
.gs_sicherheitsbetrag = Double.Parse(txtMRNSicherheitsbetrag.Text) '.Replace(".", "").Replace(",", ".")
|
|
.gs_standort = Me.Standort
|
|
.gs_art = "OPEN"
|
|
.gs_gsNr = Me.gessicherheitID
|
|
'.MakeDate = Me.MakeDate
|
|
.gs_freitext = Me.txtFreitextOpen.Text
|
|
'.saldo = GesSichRef.Saldo
|
|
.gs_atr = 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
|
|
.gs_ATBNr = txtCRN.Text
|
|
.gs_datum = DateTimeString2DateTimeKonvertinator(txtCRNDate.Text, txtCRNTime.Text)
|
|
.gs_warenwert = Double.Parse(txtCRNWarenwert.Text) '.Replace(".", "").Replace(",", ".")
|
|
.gs_sicherheitsbetrag = Double.Parse(txtCRNSicherheitsbetrag.Text) '.Replace(".", "").Replace(",", ".")
|
|
.gs_standort = Me.Standort
|
|
.gs_art = "CLOSE"
|
|
.gs_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.gs_ATBNr
|
|
txtCRNWarenwert.Text = Sicherh.gs_warenwert
|
|
txtFreitextClose.Text = Sicherh.gs_freitext
|
|
txtCRNDate.Text = Sicherh.gs_erstellungsdatum.ToString("dd.MM.yyyy")
|
|
txtCRNTime.Text = Sicherh.gs_erstellungsdatum.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)
|
|
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 = cboWarenort.FindString(Me.warenortID)
|
|
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
|
|
|
|
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_LKWID = gessich.LKWID
|
|
sicherheiten.gs_warenort = gessich.warenortID
|
|
End Sub
|
|
|
|
Private Sub ClosedErzeugenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ClosedErzeugenToolStripMenuItem.Click
|
|
MsgBox("")
|
|
End Sub
|
|
Sub initBtns(MonatJahr)
|
|
btnMonat.Text = MONAT.ToString("MMMM")
|
|
btnJahr.Text = JAHR.Year
|
|
Select Case MonatJahr
|
|
Case "Monat"
|
|
DateTimePicker1.Value = MONAT
|
|
DateTimePicker2.Value = MONAT.AddMonths(1).AddDays(-1)
|
|
Case "Jahr"
|
|
' If cbxGeschaftsjahr.Checked Then
|
|
'DateTimePicker1.Value = JAHR.AddMonths(1)
|
|
' DateTimePicker2.Value = JAHR.AddYears(1).AddMonths(1).AddDays(-1)
|
|
' Else
|
|
DateTimePicker1.Value = JAHR
|
|
DateTimePicker2.Value = JAHR.AddYears(1).AddDays(-1)
|
|
'End If
|
|
Case "Tag"
|
|
' If cbxGeschaftsjahr.Checked Then
|
|
'DateTimePicker1.Value = JAHR.AddMonths(1)
|
|
' DateTimePicker2.Value = JAHR.AddYears(1).AddMonths(1).AddDays(-1)
|
|
' Else
|
|
DateTimePicker1.Value = srcTAG
|
|
DateTimePicker2.Value = srcTAG
|
|
If srcTAG = Now.ToShortDateString Then
|
|
Button5.Text = "Heute"
|
|
ElseIf srcTAG = Now.AddDays(-1).ToShortDateString Then
|
|
Button5.Text = "Gestern"
|
|
ElseIf srcTAG = Now.AddDays(-2).ToShortDateString Then
|
|
Button5.Text = "Vorgestern"
|
|
Else
|
|
Button5.Text = srcTAG.ToString("dd.MM")
|
|
End If
|
|
|
|
'End If
|
|
Case ""
|
|
DateTimePicker1.Value = ("01." & Now.Month & "." & Now.Year)
|
|
DateTimePicker2.Value = Now
|
|
End Select
|
|
|
|
End Sub
|
|
|
|
|
|
Private Sub btnJahr_Click(sender As Object, e As EventArgs) Handles btnJahr.Click
|
|
initBtns("Jahr")
|
|
End Sub
|
|
|
|
Private Sub btnBisMonat_Click(sender As Object, e As EventArgs) Handles btnBisMonat.Click
|
|
MONAT = MONAT.AddMonths(1)
|
|
initBtns("Monat")
|
|
End Sub
|
|
|
|
Private Sub btnVonMonat_Click(sender As Object, e As EventArgs) Handles btnVonMonat.Click
|
|
MONAT = MONAT.AddMonths(-1)
|
|
initBtns("Monat")
|
|
End Sub
|
|
|
|
Private Sub btnBisJahr_Click(sender As Object, e As EventArgs) Handles btnBisJahr.Click
|
|
JAHR = JAHR.AddYears(1)
|
|
initBtns("Jahr")
|
|
End Sub
|
|
|
|
Private Sub DateTimePicker1_ValueChanged(sender As Object, e As EventArgs) Handles DateTimePicker1.ValueChanged
|
|
txtDatVon._value = CDate(sender.value).ToShortDateString
|
|
End Sub
|
|
|
|
Private Sub DateTimePicker2_ValueChanged(sender As Object, e As EventArgs) Handles DateTimePicker2.ValueChanged
|
|
txtDatBis._value = CDate(sender.value).ToShortDateString
|
|
End Sub
|
|
|
|
|
|
End Class
|
|
|