feature_gesamtsicherheiten
This commit is contained in:
@@ -1,17 +1,15 @@
|
||||
Imports System.Reflection
|
||||
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
|
||||
|
||||
|
||||
'Dim openopened As cSicherheiten
|
||||
|
||||
'Dim closedopened As cSicherheiten
|
||||
|
||||
Dim currentSicherheit As cSicherheiten
|
||||
Property currentSicherheit As cSicherheiten
|
||||
Property currentSPos As cGesamtsicherheitsPositionen
|
||||
Property currentGesSichRef As cGesamtsicherheitsReferenz
|
||||
Public Property gessicherheitID As Integer
|
||||
@@ -30,58 +28,52 @@ Public Class frmGesamtsicherheitenNEU
|
||||
|
||||
Public Abfertigungsnummer As String
|
||||
|
||||
Public LKWID As String
|
||||
Public LKWKZ As String
|
||||
|
||||
Public warenortID As String
|
||||
|
||||
Dim indexGsId As Integer = 0
|
||||
Dim indexGsId As Integer
|
||||
|
||||
Dim indexGspPosId As Integer
|
||||
|
||||
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 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
|
||||
|
||||
|
||||
If setNullToZero(gessicherheitID) = 0 Or Neu = True Then
|
||||
'panOben.Enabled = False : panOben.Enabled = False
|
||||
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
|
||||
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)
|
||||
|
||||
cbx_Suche_Filiale.Items.AddRange(cboFiliale.Items.Cast(Of VERAG_PROG_ALLGEMEIN.MyListItem).ToArray())
|
||||
cbx_Suche_Warenort.Items.AddRange(cboWarenort.Items.Cast(Of VERAG_PROG_ALLGEMEIN.MyListItem).ToArray())
|
||||
|
||||
If datum = Nothing Then datum = Date.Now
|
||||
|
||||
Else
|
||||
LoadDGVSicherheiten()
|
||||
End If
|
||||
LoadStandort()
|
||||
cboATR.Enabled = currentGesSichRef.gsr_ATR
|
||||
cboSicherheitATR.Enabled = currentGesSichRef.gsr_ATR
|
||||
Zollsatz = currentGesSichRef.gsr_zollsatz
|
||||
|
||||
txtDatVon.Text = Date.Today.ToString("dd.MM.yyyy")
|
||||
txtDatBis.Text = Date.Today.ToString("dd.MM.yyyy")
|
||||
|
||||
btnMonat.Text = MONAT.ToString("MMMM")
|
||||
btnJahr.Text = JAHR.Year
|
||||
|
||||
Me.Text = "Gesamtsicherheit " & Standort
|
||||
frmHauptfenster.EnableDoubleBuffered(dgvSicherheitsPos)
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Public Sub LoadDGVSicherheiten()
|
||||
|
||||
lblSaldo.Text = "Saldo: € " & currentGesSichRef.gsr_Saldo.ToString()
|
||||
@@ -89,32 +81,33 @@ Public Class frmGesamtsicherheitenNEU
|
||||
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]"
|
||||
If txt_Suche.Text <> "" Or cbx_Suche_Warenort._value <> "" Then Dim sqlSearchSting As String = ""
|
||||
|
||||
|
||||
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_standort = '" & Standort & "'And gs_datum > '" & Date.Parse(txtDatVon.Text) & "' And gs_datum < '" & Date.Parse(txtDatBis.Text).AddDays(1).AddSeconds(-1) & "'" &
|
||||
"AND (gs_abfertigungsNr Like '%" & txt_Suche.Text & "%' OR" &
|
||||
" gs_ATBNr like '%" & txt_Suche.Text & "%' OR" &
|
||||
" gs_LKWID like '%" & txt_Suche.Text & "%' OR" &
|
||||
" gs_warenort like '%" & cbx_Suche_Warenort.Text & "%') order by [gs_datum]"
|
||||
'Dim SQLStringSicherheit As String = "select [gs_gsId], [gs_ATBNr], [gs_posNr], [gs_datum], [gs_warenwert], [gs_sicherheitsbetrag], [gs_saldo] " &
|
||||
' sqladd1 & " , [gs_freitext] from [tblGesamtsicherheit]
|
||||
' where gs_standort = '" & Standort & "'And gs_datum > '" & Date.Parse(txtDatVon.Text) & "' And gs_datum < '" & Date.Parse(txtDatBis.Text).AddDays(1).AddSeconds(-1) & "'" &
|
||||
' "AND (gs_abfertigungsNr Like '%" & txt_Suche.Text & "%' OR" &
|
||||
' " gs_ATBNr like '%" & txt_Suche.Text & "%' OR" &
|
||||
' " gs_LKWKZ like '%" & txt_Suche.Text & "%' OR" &
|
||||
' " gs_warenort like '%" & cbx_Suche_Warenort.Text & "%') order by [gs_datum]"
|
||||
|
||||
dgvGesamtsicherheit.SET_SQL(SQLStringMRN, "AVISO", ,)
|
||||
Dim SQLStringSicherheit As String = "select [gs_gsId], [gs_gsnr], [gs_ATBNr], [gs_posNr], [gs_datum], [gs_warenwert], [gs_sicherheitsbetrag], [gs_saldo] " & sqladd1 & " , [gs_freitext] from [tblGesamtsicherheit] where [gs_gsnr] = '" & gessicherheitID & "' order by [gs_datum]"
|
||||
|
||||
dgvGesamtsicherheit.SET_SQL(SQLStringSicherheit, "AVISO", ,)
|
||||
dgvGesamtsicherheit.LOAD()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
If dgvGesamtsicherheit.Columns.Count > 0 Then
|
||||
With dgvGesamtsicherheit
|
||||
.RowHeadersWidth = 10
|
||||
.Columns("gs_gsId").Visible = False
|
||||
.Columns("gs_gsId").Visible = True
|
||||
.Columns("gs_gsnr").Visible = True
|
||||
.Columns("gs_warenwert").DefaultCellStyle.Format = "c"
|
||||
.Columns("gs_sicherheitsbetrag").DefaultCellStyle.Format = "c"
|
||||
.Columns("gs_saldo").DefaultCellStyle.Format = "c"
|
||||
.Columns("gs_saldo").Visible = False
|
||||
.Columns("gs_saldo").Visible = True
|
||||
Select Case currentGesSichRef.gsr_ATR
|
||||
Case True
|
||||
.Columns("gs_ATBNr").HeaderText = "ATB"
|
||||
@@ -156,7 +149,9 @@ Public Class frmGesamtsicherheitenNEU
|
||||
currentSicherheit = New cSicherheiten(indexGsId)
|
||||
|
||||
LoadDGVSicherheitsPos(indexGsId)
|
||||
loadTitle(indexGsId)
|
||||
loadTitle()
|
||||
setSaldo()
|
||||
|
||||
|
||||
If dgvGesamtsicherheit.Enabled = False Then Exit Sub
|
||||
|
||||
@@ -167,14 +162,14 @@ Public Class frmGesamtsicherheitenNEU
|
||||
|
||||
If gsId = 0 Then Exit Sub
|
||||
|
||||
Dim SQLStringCRN As String = "select [gsp_gspPosId] ,[gsp_gsId],[gsp_warenwert],[gsp_sicherheitsbetrag],[gsp_freitext],[gsp_art] ,[gsp_avisoId] ,[gsp_ust] ,[gsp_filialenNr],[gsp_abfertigungsNr] ,[gsp_ATCNr] ,[gsp_MRNNr] from [tblGesamtsicherheitsPositionen] where [gsp_gsId] = '" & gsId & "' order by [gsp_gspPosId]"
|
||||
Dim SQLStringCRN As String = "select [gsp_gspPosId] ,[gsp_gsId],[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_gsId] = '" & gsId & "' order by [gsp_gspPosId]"
|
||||
dgvSicherheitsPos.SET_SQL(SQLStringCRN, "AVISO", ,)
|
||||
dgvSicherheitsPos.LOAD()
|
||||
|
||||
If dgvSicherheitsPos.Columns.Count > 0 Then
|
||||
With dgvSicherheitsPos
|
||||
.RowHeadersWidth = 10
|
||||
.Columns("gsp_gsId").Visible = False
|
||||
.Columns("gsp_gsId").Visible = True
|
||||
.Columns("gsp_warenwert").DefaultCellStyle.Format = "c"
|
||||
.Columns("gsp_sicherheitsbetrag").DefaultCellStyle.Format = "c"
|
||||
'.Columns("gs_saldo").DefaultCellStyle.Format = "c"
|
||||
@@ -186,7 +181,7 @@ Public Class frmGesamtsicherheitenNEU
|
||||
.Columns("gsp_ATCNr").HeaderText = "CRN"
|
||||
End Select
|
||||
.Columns("gsp_ATCNr").Width = 120
|
||||
'.Columns("gs_datum").Width = 140
|
||||
.Columns("gsp_erstellungsdatum").Width = 140
|
||||
.Columns("gsp_warenwert").Width = 100
|
||||
.Columns("gsp_sicherheitsbetrag").Width = 100
|
||||
.Columns("gsp_freitext").Width = 220
|
||||
@@ -196,7 +191,18 @@ Public Class frmGesamtsicherheitenNEU
|
||||
|
||||
End Sub
|
||||
|
||||
Sub loadTitle(indexGsId As Integer)
|
||||
'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 = ""
|
||||
@@ -208,16 +214,19 @@ Public Class frmGesamtsicherheitenNEU
|
||||
dt = SQL.loadDgvBySql(StandortSqlString, "AVISO", 100, True)
|
||||
|
||||
If dt.Rows.Count > 0 Then
|
||||
Me.LKWID = setNullToZero(dt.Rows(0).Item("gs_LKWID"))
|
||||
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"))
|
||||
|
||||
If Me.LKWID.ToString.Length > 0 Then lblGestellungNr.Text &= "LKW-ID: " & Me.LKWID & " "
|
||||
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 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 & " "
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
@@ -228,20 +237,20 @@ Public Class frmGesamtsicherheitenNEU
|
||||
ZollsatzMulti = currentGesSichRef.gsr_zollsatz / 100
|
||||
End Sub
|
||||
|
||||
Private Sub Warenwert_TextChanged(sender As Object, e As EventArgs) Handles txtMRNWarenwert.TextChanged, txtPosWarenwert.TextChanged
|
||||
Private Sub Warenwert_TextChanged(sender As Object, e As EventArgs) Handles txtSicherheitWarenwert.TextChanged, txtPosWarenwert.TextChanged
|
||||
Try
|
||||
Select Case sender.name
|
||||
Case "txtMRNWarenwert"
|
||||
txtMRNSicherheitsbetrag.Text = (txtMRNWarenwert.Text * ZollsatzMulti).ToString("N")
|
||||
If currentGesSichRef.gsr_ustEnabled Then txtEust.Text = (Double.Parse(txtMRNWarenwert.Text) + Double.Parse(txtMRNSicherheitsbetrag.Text)) * (currentGesSichRef.gsr_ust / 100)
|
||||
Case "txtCRNWarenwert"
|
||||
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 txtMRNWarenwert.KeyPress, txtPosWarenwert.KeyPress, txtPos.KeyPress
|
||||
Private Sub Warenwert_Keypresses(sender As Object, e As System.Windows.Forms.KeyPressEventArgs) Handles txtSicherheitWarenwert.KeyPress, txtPosWarenwert.KeyPress, txtAnzahlPos.KeyPress
|
||||
Select Case Asc(e.KeyChar)
|
||||
Case 48 To 57, 8, 44
|
||||
' Zahlen, Backspace und , zulassen
|
||||
@@ -252,7 +261,7 @@ Public Class frmGesamtsicherheitenNEU
|
||||
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
|
||||
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
|
||||
@@ -266,8 +275,8 @@ Public Class frmGesamtsicherheitenNEU
|
||||
|
||||
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 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)
|
||||
@@ -276,16 +285,16 @@ Public Class frmGesamtsicherheitenNEU
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub txtMRNDate_GotFocus(sender As Object, e As EventArgs) Handles txtMRNDate.GotFocus, txtCRNDate.GotFocus, txtMRNTime.GotFocus, txtCRNTime.GotFocus
|
||||
Private Sub txtMRNDate_GotFocus(sender As Object, e As EventArgs) Handles txtSicherheitDate.GotFocus, txtPosDate.GotFocus, txtSicherheitTime.GotFocus, txtPosTime.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")
|
||||
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
|
||||
|
||||
@@ -293,25 +302,41 @@ Public Class frmGesamtsicherheitenNEU
|
||||
Try
|
||||
|
||||
|
||||
Dim limit As Integer = Integer.Parse(setNullToZero(txtPos.Text))
|
||||
Dim limit As Integer = Integer.Parse(setNullToZero(txtAnzahlPos.Text))
|
||||
|
||||
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_gsNr = AddNewGesamtSichNr()
|
||||
.gs_ATBNr = txtSicherheitATBNr.Text
|
||||
.gs_posNr = Integer.Parse(setNullToZero(txtAnzahlPos.Text))
|
||||
.gs_datum = DateTimeString2DateTimeKonvertinator(txtSicherheitDate.Text, txtSicherheitTime.Text)
|
||||
.gs_warenwert = Double.Parse(txtSicherheitWarenwert.Text) '.Replace(".", "").Replace(",", ".")
|
||||
.gs_sicherheitsbetrag = Double.Parse(txtSicherheitSicherheitsbetrag.Text) '.Replace(".", "").Replace(",", ".")
|
||||
.gs_standort = Me.Standort
|
||||
.gs_art = "OPEN"
|
||||
.gs_gsNr = Me.gessicherheitID
|
||||
.gs_erstellungsdatum = Me.datum
|
||||
.gs_freitext = Me.txtFreitextOpen.Text
|
||||
.gs_freitext = Me.txtSicherheitFreitext.Text
|
||||
.gs_saldo = currentGesSichRef.gsr_Saldo
|
||||
.gs_atr = setNullToZero(cboATR.SelectedItem)
|
||||
.gs_atr = setNullToZero(cboSicherheitATR.SelectedItem)
|
||||
setEnviromentDataToObject(OPEN, 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
|
||||
|
||||
indexGsId = OPEN.SAVEOBJECT()
|
||||
|
||||
|
||||
@@ -328,8 +353,9 @@ Public Class frmGesamtsicherheitenNEU
|
||||
.gsp_freitext = ""
|
||||
.gsp_filialenNr = OPEN.gs_filialenNr
|
||||
.gsp_art = "OPEN"
|
||||
.gsp_abfertigungsNr = OPEN.gs_filialenNr
|
||||
.gsp_avisoId = OPEN.gs_ATBNr
|
||||
.gsp_abfertigungsNr = OPEN.gs_abfertigungsnr
|
||||
.gsp_erstellungsdatum = Me.datum
|
||||
.gsp_avisoId = ""
|
||||
.gsp_ust = ""
|
||||
.gsp_ATCNr = ""
|
||||
.gsp_MRNNr = ""
|
||||
@@ -337,26 +363,25 @@ Public Class frmGesamtsicherheitenNEU
|
||||
OPENPos.SAVE()
|
||||
|
||||
|
||||
'If Neu = True AndAlso count <= 1 Then OPEN.gs_gsNr = AddNewGesamtSichNr()
|
||||
If Neu = True AndAlso count <= 1 Then OPEN.gs_gsNr = AddNewGesamtSichNr()
|
||||
|
||||
'Select Case checkIfExist(OPEN.gs_ATBNr, gessicherheitID)
|
||||
' Case "Neu"
|
||||
' OPEN.SAVE()
|
||||
Select Case checkIfExist(OPEN.gs_ATBNr, gessicherheitID)
|
||||
Case "Neu"
|
||||
OPEN.SAVE()
|
||||
|
||||
' Case Else
|
||||
' If (count >= 1) Then
|
||||
' OPEN.SAVE()
|
||||
' OPENPos.SAVE()
|
||||
' Else
|
||||
' MsgBox("INFO: Dieser Eintrag wurde bereits bei GesamtsichNr " & checkIfExist(OPEN.gs_ATBNr, gessicherheitID) & "eingetragen") : OPEN.SAVE()
|
||||
' End If
|
||||
Case Else
|
||||
If (count >= 1) Then
|
||||
OPEN.SAVE()
|
||||
OPENPos.SAVE()
|
||||
Else
|
||||
MsgBox("INFO: Dieser Eintrag wurde bereits bei GesamtsichNr " & checkIfExist(OPEN.gs_ATBNr, gessicherheitID) & "eingetragen") : OPEN.SAVE()
|
||||
End If
|
||||
|
||||
'End Select
|
||||
End Select
|
||||
|
||||
Next
|
||||
|
||||
|
||||
|
||||
AfterButton()
|
||||
|
||||
|
||||
@@ -373,24 +398,32 @@ Public Class frmGesamtsicherheitenNEU
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If (checkWarenwert() = False) Then
|
||||
MsgBox("Der Warenwert der Positionen übersteigt den Warenwert der Gestellung!")
|
||||
txtPosWarenwert.Focus()
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Try
|
||||
|
||||
Dim SicherheitsPos As New cGesamtsicherheitsPositionen()
|
||||
With SicherheitsPos
|
||||
.gsp_gsId = currentSicherheit.gs_gsId
|
||||
.gsp_gspPosId = Me.getLatestPosNr(currentSicherheit.gs_gsId) + 1
|
||||
.gsp_warenwert = 0
|
||||
.gsp_sicherheitsbetrag = 0
|
||||
.gsp_freitext = ""
|
||||
.gsp_warenwert = Double.Parse(txtPosWarenwert.Text)
|
||||
.gsp_sicherheitsbetrag = Double.Parse(txtPosSicherheitsbetrag.Text)
|
||||
.gsp_freitext = txtPosFreitext.Text
|
||||
.gsp_filialenNr = currentSicherheit.gs_filialenNr
|
||||
.gsp_art = "OPEN"
|
||||
.gsp_abfertigungsNr = ""
|
||||
.gsp_avisoId = ""
|
||||
.gsp_abfertigungsNr = currentSicherheit.gs_abfertigungsnr
|
||||
.gsp_erstellungsdatum = DateTimeString2DateTimeKonvertinator(txtPosDate.Text, txtPosTime.Text)
|
||||
.gsp_ust = currentSicherheit.gs_ust
|
||||
.gsp_ATCNr = ""
|
||||
.gsp_MRNNr = ""
|
||||
.gsp_ATCNr = txtPositionenCRN.Text
|
||||
.gsp_MRNNr = txtPositionenCRN.Text
|
||||
End With
|
||||
|
||||
|
||||
|
||||
SicherheitsPos.SAVE()
|
||||
|
||||
'If Neu = True Then Close.gs_gsNr = AddNewGesamtSichNr()
|
||||
@@ -445,7 +478,7 @@ Public Class frmGesamtsicherheitenNEU
|
||||
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
|
||||
cboSicherheitATR.SelectedItem = Nothing
|
||||
End Sub
|
||||
|
||||
Public Function checkIfExist(KennnummerStr As String, Optional ByVal lkw As String = "") As String
|
||||
@@ -476,7 +509,7 @@ Public Class frmGesamtsicherheitenNEU
|
||||
|
||||
|
||||
|
||||
Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click, btnSaveOben.Click
|
||||
Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click ', btnSaveOben.Click
|
||||
|
||||
If checkMandatoryFieldsAreFilled() = False Then Exit Sub
|
||||
|
||||
@@ -494,13 +527,14 @@ Public Class frmGesamtsicherheitenNEU
|
||||
End Try
|
||||
|
||||
Me.Abfertigungsnummer = txtAbfertNum.Text
|
||||
Me.LKWID = txtLKWID.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_LKWID] = '" & Me.LKWID & "', [gs_warenort] = '" & Me.warenortID & "' WHERE [gs_gsNr] = '" & Me.gessicherheitID & "' "
|
||||
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")
|
||||
LoadDGVSicherheiten()
|
||||
End If
|
||||
loadTitle()
|
||||
|
||||
panOben.Enabled = True : panOben.Enabled = True
|
||||
panOverlay.Visible = False
|
||||
@@ -529,13 +563,13 @@ Public Class frmGesamtsicherheitenNEU
|
||||
|
||||
Dim Sicherh As New cSicherheiten(dgvGesamtsicherheit.CurrentRow.Cells("gs_gsId").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")
|
||||
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
|
||||
|
||||
@@ -546,19 +580,20 @@ Public Class frmGesamtsicherheitenNEU
|
||||
|
||||
Private Sub btnUpdateSicherheit_Click(sender As Object, e As EventArgs) Handles btnUpdateSicherheit.Click
|
||||
With currentSicherheit
|
||||
.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_ATBNr = txtSicherheitATBNr.Text
|
||||
.gs_posNr = Double.Parse(setNullToZero(txtAnzahlPos.Text))
|
||||
.gs_datum = DateTimeString2DateTimeKonvertinator(txtSicherheitDate.Text, txtSicherheitTime.Text)
|
||||
.gs_warenwert = Double.Parse(txtSicherheitWarenwert.Text) '.Replace(".", "").Replace(",", ".")
|
||||
.gs_sicherheitsbetrag = Double.Parse(txtSicherheitSicherheitsbetrag.Text) '.Replace(".", "").Replace(",", ".")
|
||||
.gs_standort = Me.Standort
|
||||
.gs_art = "OPEN"
|
||||
.gs_gsNr = Me.gessicherheitID
|
||||
'.MakeDate = Me.MakeDate
|
||||
.gs_freitext = Me.txtFreitextOpen.Text
|
||||
.gs_freitext = Me.txtSicherheitFreitext.Text
|
||||
'.saldo = currentGesSichRef.Saldo
|
||||
.gs_atr = setNullToZero(cboATR.SelectedItem)
|
||||
.gs_atr = setNullToZero(cboSicherheitATR.SelectedItem)
|
||||
End With
|
||||
checkWarenwert()
|
||||
currentSicherheit.SAVE()
|
||||
btnUpdateSicherheit.Visible = False
|
||||
btnAddSicherheit.Visible = True
|
||||
@@ -570,13 +605,13 @@ Public Class frmGesamtsicherheitenNEU
|
||||
With currentSPos
|
||||
|
||||
.gsp_art = "CLOSE"
|
||||
.gsp_gspPosId = txtPos.Text
|
||||
.gsp_freitext = txtPosFreitext.Text
|
||||
.gsp_sicherheitsbetrag = txtPosSicherheitsbetrag.Text
|
||||
.gsp_warenwert = txtPosWarenwert.Text
|
||||
.gsp_sicherheitsbetrag = Double.Parse(txtPosSicherheitsbetrag.Text)
|
||||
.gsp_warenwert = Double.Parse(txtPosWarenwert.Text)
|
||||
.gsp_ATCNr = txtPositionenCRN.Text
|
||||
|
||||
End With
|
||||
checkWarenwert()
|
||||
currentSPos.SAVE()
|
||||
btnAddPos.Visible = True
|
||||
btnUpdatePos.Visible = False
|
||||
@@ -584,15 +619,17 @@ Public Class frmGesamtsicherheitenNEU
|
||||
AfterButton()
|
||||
End Sub
|
||||
|
||||
Private Sub dgvGesamtsicherheitPositionen_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles dgvSicherheitsPos.CellContentClick
|
||||
Private Sub dgvGesamtsicherheitPositionen_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles dgvSicherheitsPos.CellDoubleClick
|
||||
|
||||
Dim sPos As New cGesamtsicherheitsPositionen(indexGsId, dgvSicherheitsPos.CurrentRow.Cells("gsp_gspPosId").Value)
|
||||
|
||||
txtPos.Text = sPos.gsp_gspPosId
|
||||
txtPosNr.Text = sPos.gsp_gspPosId
|
||||
txtPosFreitext.Text = sPos.gsp_freitext
|
||||
txtPosSicherheitsbetrag.Text = sPos.gsp_sicherheitsbetrag
|
||||
txtPosWarenwert.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
|
||||
|
||||
@@ -632,7 +669,7 @@ Public Class frmGesamtsicherheitenNEU
|
||||
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)
|
||||
cbx_Suche_Warenort.SelectedIndex = cbx_Suche_Warenort.FindString(Me.warenortID)
|
||||
txtAbfertNum.Text = Me.Abfertigungsnummer
|
||||
txtLKWID.Text = Me.LKWID
|
||||
txtLKWID.Text = Me.LKWKZ
|
||||
panOben.Enabled = False
|
||||
End Sub
|
||||
|
||||
@@ -657,7 +694,7 @@ Public Class frmGesamtsicherheitenNEU
|
||||
|
||||
sicherheiten.gs_filialenNr = gessich.FilialNummer
|
||||
sicherheiten.gs_abfertigungsnr = gessich.Abfertigungsnummer
|
||||
sicherheiten.gs_LKWID = gessich.LKWID
|
||||
sicherheiten.gs_LKWKZ = gessich.LKWKZ
|
||||
sicherheiten.gs_warenort = gessich.warenortID
|
||||
End Sub
|
||||
|
||||
@@ -680,106 +717,16 @@ Public Class frmGesamtsicherheitenNEU
|
||||
End Function
|
||||
|
||||
|
||||
'Kalenderhandling
|
||||
|
||||
|
||||
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"
|
||||
|
||||
DateTimePicker1.Value = JAHR
|
||||
DateTimePicker2.Value = JAHR.AddYears(1).AddDays(-1)
|
||||
'End If
|
||||
Case "Tag"
|
||||
|
||||
DateTimePicker1.Value = srcTAG
|
||||
DateTimePicker2.Value = srcTAG
|
||||
If srcTAG = Now.ToShortDateString Then
|
||||
btnTag.Text = "Heute"
|
||||
ElseIf srcTAG = Now.AddDays(-1).ToShortDateString Then
|
||||
btnTag.Text = "Gestern"
|
||||
ElseIf srcTAG = Now.AddDays(-2).ToShortDateString Then
|
||||
btnTag.Text = "Vorgestern"
|
||||
Else
|
||||
btnTag.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 btnBisJahr_Click(sender As Object, e As EventArgs) Handles btnBisJahr.Click
|
||||
JAHR = JAHR.AddYears(1)
|
||||
initBtns("Jahr")
|
||||
End Sub
|
||||
|
||||
Private Sub btnVonJahr_Click(sender As Object, e As EventArgs) Handles btnVonJahr.Click
|
||||
JAHR = JAHR.AddYears(-1)
|
||||
initBtns("Jahr")
|
||||
End Sub
|
||||
|
||||
Private Sub btnMonat_Click(sender As Object, e As EventArgs) Handles btnMonat.Click
|
||||
initBtns("Monat")
|
||||
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 Button5_Click(sender As Object, e As EventArgs) Handles btnTag.Click
|
||||
initBtns("Tag")
|
||||
End Sub
|
||||
|
||||
Private Sub Button6_Click(sender As Object, e As EventArgs) Handles btnVonTag.Click
|
||||
srcTAG = srcTAG.AddDays(-1)
|
||||
initBtns("Tag")
|
||||
End Sub
|
||||
|
||||
Private Sub Button7_Click(sender As Object, e As EventArgs) Handles btnBisTag.Click
|
||||
srcTAG = srcTAG.AddDays(1)
|
||||
initBtns("Tag")
|
||||
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
|
||||
|
||||
Private Sub btnSuche_Click(sender As Object, e As EventArgs) Handles btnSuche.Click
|
||||
Try
|
||||
Date.Parse(txtDatVon.Text)
|
||||
Date.Parse(txtDatBis.Text)
|
||||
If Me.Visible Then LoadDGVSicherheiten()
|
||||
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) Handles btnNeu.Click
|
||||
Private Sub btnNeu_Click(sender As Object, e As EventArgs)
|
||||
panOverlay.Visible = True
|
||||
End Sub
|
||||
|
||||
@@ -799,10 +746,64 @@ Public Class frmGesamtsicherheitenNEU
|
||||
|
||||
Private Sub clearSearchFields()
|
||||
cbx_Suche_Warenort.changeItem("")
|
||||
cbx_Suche_Filiale.changeItem("")
|
||||
txt_Suche.Clear()
|
||||
End Sub
|
||||
|
||||
Private Function checkWarenwert() As Boolean
|
||||
|
||||
Dim ok As Boolean = True
|
||||
|
||||
Dim offenerWarenwert As Double
|
||||
Try
|
||||
|
||||
offenerWarenwert = calcOffenenWarenwert()
|
||||
|
||||
If (offenerWarenwert < Double.Parse(txtPosWarenwert.Text)) Then
|
||||
ok = False
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message)
|
||||
End Try
|
||||
|
||||
|
||||
Return ok
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
Private Function calcOffenenWarenwert() As Double
|
||||
|
||||
Dim diff As Double = -10000
|
||||
If currentSicherheit Is Nothing Then Exit Function
|
||||
Try
|
||||
Dim warenwertSumPositionen = CDbl(SQL.DLookup("SUM(gsp_warenwert)", "[tblGesamtsicherheitsPositionen]", "gsp_gsId ='" & currentSicherheit.gs_gsId & "'", "AVISO"))
|
||||
diff = Double.Parse(currentSicherheit.gs_warenwert) - Double.Parse(warenwertSumPositionen)
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message)
|
||||
End Try
|
||||
|
||||
Return diff
|
||||
|
||||
End Function
|
||||
|
||||
Private Sub setSaldo()
|
||||
|
||||
lbloffenerSaldo.Text = "offener Saldo: "
|
||||
If Me.calcOffenenWarenwert > 0 Then
|
||||
lbloffenerSaldo.Text &= Me.calcOffenenWarenwert()
|
||||
Else
|
||||
lbloffenerSaldo.Text &= "0"
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub rearangePosNr()
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
End Class
|
||||
|
||||
|
||||
Reference in New Issue
Block a user