diff --git a/Aviso/AktenErfassung/frmEintragAviso.vb b/Aviso/AktenErfassung/frmEintragAviso.vb index af57315..e4d228f 100644 --- a/Aviso/AktenErfassung/frmEintragAviso.vb +++ b/Aviso/AktenErfassung/frmEintragAviso.vb @@ -757,27 +757,52 @@ Public Class frmEintragAviso For Each LKWNr In ListOfLKWNr - - Dim hLKWCheck2 As String = AvisoDAL.Suche_LKWStatus(LKWNr) + Dim temp_avisoID As Integer = -1 + Dim hLKWCheck2 As String = AvisoDAL.Suche_LKWStatus(LKWNr, temp_avisoID) If hLKWCheck2 <> "" Then - Dim antwort As MsgBoxResult = MsgBox(hLKWCheck2 & vbCrLf & vbCrLf & "Wollen Sie den Eintrag trotzdem speichern?", CType(MsgBoxStyle.YesNo + MsgBoxStyle.Exclamation, MsgBoxStyle), + Dim antwort As MsgBoxResult = MsgBox(hLKWCheck2 & vbCrLf & vbCrLf & "Wollen Sie den Eintrag trotzdem speichern?" & vbNewLine & "NEIN -> Springe zu existierendem Eintrag!", CType(MsgBoxStyle.YesNoCancel + MsgBoxStyle.Exclamation, MsgBoxStyle), "Aviso-Eintrag") If antwort = vbNo Then - Exit Sub - Else - EintragMehrfach = True + If temp_avisoID > 0 Then + Dim frmGrayOut = VERAG_PROG_ALLGEMEIN.cMeineFunktionenAVISO.grayoutForm() + Dim FRM As New frmSendungsdetailsNEU(temp_avisoID, -1) + FRM.ShowDialog(frmGrayOut) + frmGrayOut.Close() + + Exit Sub + Else + MsgBox("AVISO-ID konnte nicht ermittelt werden") + Exit Sub + End If + + ElseIf antwort = vbCancel Then + Exit Sub + Else + EintragMehrfach = True End If End If If hLKWCheck2 = "" Then 'jetzt eine Prüfung, ob dieser LKW bereits vor kurzem erfasst wurde - Dim hLKWCheck As String = AvisoDAL.Suche_LKW(LKWNr) + Dim hLKWCheck As String = AvisoDAL.Suche_LKW(LKWNr, temp_avisoID) If hLKWCheck <> "" Then - Dim antwort As MsgBoxResult = MsgBox(hLKWCheck & vbCrLf & vbCrLf & "Wollen Sie den Eintrag trotzdem speichern?", CType(MsgBoxStyle.YesNo + MsgBoxStyle.Exclamation, MsgBoxStyle), + Dim antwort As MsgBoxResult = MsgBox(hLKWCheck & vbCrLf & vbCrLf & "Wollen Sie den Eintrag trotzdem speichern?" & vbNewLine & "NEIN -> Springe zu existierendem Eintrag!", CType(MsgBoxStyle.YesNoCancel + MsgBoxStyle.Exclamation, MsgBoxStyle), "Aviso-Eintrag") If antwort = vbNo Then + If temp_avisoID > 0 Then + Dim frmGrayOut = VERAG_PROG_ALLGEMEIN.cMeineFunktionenAVISO.grayoutForm() + Dim FRM As New frmSendungsdetailsNEU(temp_avisoID, -1) + FRM.ShowDialog(frmGrayOut) + frmGrayOut.Close() + Exit Sub + Else + MsgBox("AVISO-ID konnte nicht ermittelt werden") + Exit Sub + End If + ElseIf antwort = vbCancel Then Exit Sub Else + EintragMehrfach = True End If End If diff --git a/Aviso/My Project/AssemblyInfo.vb b/Aviso/My Project/AssemblyInfo.vb index e76f75f..9280b24 100644 --- a/Aviso/My Project/AssemblyInfo.vb +++ b/Aviso/My Project/AssemblyInfo.vb @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' übernehmen, indem Sie "*" eingeben: ' - - + + diff --git a/Aviso/frmGesamtsicherheitenMenuNEU.vb b/Aviso/frmGesamtsicherheitenMenuNEU.vb index d7d2561..ee4c95a 100644 --- a/Aviso/frmGesamtsicherheitenMenuNEU.vb +++ b/Aviso/frmGesamtsicherheitenMenuNEU.vb @@ -218,28 +218,35 @@ Public Class frmGesamtsicherheitenMenuNEU Private Sub OpenFRM(sender As Object, e As DataGridViewCellEventArgs) Handles dgvListe.CellDoubleClick - Dim frm As New frmGesamtsicherheitenNEU - With frm - .currentGesSichRef = GesSichRef - .gessicherheitID = dgvListe.CurrentRow.Cells("gs_gsnr").Value - .Standort = Me.Standort - .datum = dgvListe.CurrentRow.Cells("gs_datum").Value - .LKWKZ = dgvListe.CurrentRow.Cells("gs_LKWKZ").Value - .FilialNummer = dgvListe.CurrentRow.Cells("gs_filialenNr").Value - .Abfertigungsnummer = dgvListe.CurrentRow.Cells("gs_abfertigungsNr").Value - .warenortID = dgvListe.CurrentRow.Cells("gs_warenort").Value - .avisoID = dgvListe.CurrentRow.Cells("gs_avisoId").Value - .dataTable = Me.dataTable - .firmaId = Me.firmaId - End With + Try - AddHandler frm.FormClosing, Function() - GesSichRef.CalcSaldo() - ShowStandort() - LoadDGV() - Me.BringToFront() - End Function - frm.Show() + + Dim frm As New frmGesamtsicherheitenNEU + With frm + .currentGesSichRef = GesSichRef + .gessicherheitID = dgvListe.CurrentRow.Cells("gs_gsnr").Value + .Standort = Me.Standort + .datum = dgvListe.CurrentRow.Cells("gs_datum").Value + .LKWKZ = dgvListe.CurrentRow.Cells("gs_LKWKZ").Value + .FilialNummer = dgvListe.CurrentRow.Cells("gs_filialenNr").Value + .Abfertigungsnummer = dgvListe.CurrentRow.Cells("gs_abfertigungsNr").Value + .warenortID = dgvListe.CurrentRow.Cells("gs_warenort").Value + .avisoID = dgvListe.CurrentRow.Cells("gs_avisoId").Value + .dataTable = Me.dataTable + .firmaId = Me.firmaId + End With + + AddHandler frm.FormClosing, Function() + GesSichRef.CalcSaldo() + ShowStandort() + LoadDGV() + Me.BringToFront() + End Function + frm.Show() + + Catch ex As Exception + + End Try End Sub Private Sub btnNeu_Click(sender As Object, e As EventArgs) Handles btnNeu.Click diff --git a/Aviso/frmGesamtsicherheitenNEU.vb b/Aviso/frmGesamtsicherheitenNEU.vb index f77b577..0d15e0d 100644 --- a/Aviso/frmGesamtsicherheitenNEU.vb +++ b/Aviso/frmGesamtsicherheitenNEU.vb @@ -603,30 +603,35 @@ Public Class frmGesamtsicherheitenNEU Sub loadTitle() - txtGestellInfo.Text = "" - lblId.Text = "" - Dim StandortSqlString As String = "select * from [tblGesamtsicherheit] where [gs_gsNr] = '" & indexGsNr & "'" + Try - Dim dt As New DataTable - dt = SQL.loadDgvBySql(StandortSqlString, "AVISO", 100, True) - - If dt.Rows.Count > 0 Then - Me.avisoID = setNullToZero(dt.Rows(0).Item("gs_avisoId")) - Me.LKWKZ = setNullToZero(dt.Rows(0).Item("gs_LKWKZ")) - Me.FilialNummer = setNullToZero(dt.Rows(0).Item("gs_filialenNr")) - Me.Abfertigungsnummer = dt.Rows(0).Item("gs_abfertigungsNr") - Me.warenortID = setNullToZero(dt.Rows(0).Item("gs_warenort")) - End If - - If Me.avisoID.ToString.Length > 0 Then txtGestellInfo.Text &= "LKW-ID: " & Me.avisoID & " " - If Me.LKWKZ.ToString.Length > 0 Then txtGestellInfo.Text &= "LKW-KZ: " & Me.LKWKZ & " " - If Me.FilialNummer.ToString.Length > 0 Then txtGestellInfo.Text &= "FilialNr: " & Me.FilialNummer & " " - If Me.Abfertigungsnummer.Length > 0 Then txtGestellInfo.Text &= "AbfNr: " & Me.Abfertigungsnummer & " " - If Me.warenortID.Length > 0 Then txtGestellInfo.Text &= "Warenort: " & Me.warenortID & " " - If gessicherheitID <> 0 Then lblId.Text &= "GS-Nr: " & gessicherheitID 'currentSicherheit.gs_gsNr + txtGestellInfo.Text = "" + lblId.Text = "" + Dim StandortSqlString As String = "select * from [tblGesamtsicherheit] where [gs_gsNr] = '" & indexGsNr & "'" + Dim dt As New DataTable + dt = SQL.loadDgvBySql(StandortSqlString, "AVISO", 100, True) + + If dt.Rows.Count > 0 Then + Me.avisoID = setNullToZero(dt.Rows(0).Item("gs_avisoId")) + Me.LKWKZ = dt.Rows(0).Item("gs_LKWKZ") + Me.FilialNummer = setNullToZero(dt.Rows(0).Item("gs_filialenNr")) + Me.Abfertigungsnummer = dt.Rows(0).Item("gs_abfertigungsNr") + Me.warenortID = setNullToZero(dt.Rows(0).Item("gs_warenort")) + End If + + If Me.avisoID.ToString.Length > 0 Then txtGestellInfo.Text &= "LKW-ID: " & Me.avisoID & " " + If Me.LKWKZ.ToString.Length > 0 Then txtGestellInfo.Text &= "LKW-KZ: " & Me.LKWKZ & " " + If Me.FilialNummer.ToString.Length > 0 Then txtGestellInfo.Text &= "FilialNr: " & Me.FilialNummer & " " + If Me.Abfertigungsnummer.Length > 0 Then txtGestellInfo.Text &= "AbfNr: " & Me.Abfertigungsnummer & " " + If Me.warenortID.Length > 0 Then txtGestellInfo.Text &= "Warenort: " & Me.warenortID & " " + If gessicherheitID <> 0 Then lblId.Text &= "GS-Nr: " & gessicherheitID 'currentSicherheit.gs_gsNr + + Catch ex As Exception + VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name) + End Try End Sub diff --git a/Aviso/frmSendungsdetailsNEU.vb b/Aviso/frmSendungsdetailsNEU.vb index 64d49d2..2e0ee0b 100644 --- a/Aviso/frmSendungsdetailsNEU.vb +++ b/Aviso/frmSendungsdetailsNEU.vb @@ -1654,6 +1654,7 @@ Public Class frmSendungsdetailsNEU Case 44 usrcntl_ATB.txtATBT1.Text = loadValue(SENDUNG_LIST(CURRENT_INDEX).tblSnd_ATB_T1, "") usrcntl_ATB.txtATBNr.Text = loadValue(SENDUNG_LIST(CURRENT_INDEX).tblSnd_ATB_Nr, "") + usrcntl_ATB.txtT1Datum.Text = loadValue(SENDUNG_LIST(CURRENT_INDEX).tblSnd_T1_Frist, "") If SENDUNG_LIST(CURRENT_INDEX).tblSnd_ATBFakturieren Is Nothing Then usrcntl_ATB.cbxATBFakturieren.CheckState = CheckState.Indeterminate @@ -2099,6 +2100,7 @@ Public Class frmSendungsdetailsNEU If pnlT1.Controls.Count > 0 AndAlso pnlT1.Controls(0).GetType Is GetType(usrCntlSND_ATBGestellung) Then SENDUNG_LIST(CURRENT_INDEX).tblSnd_ATB_T1 = usrcntl_ATB.txtATBT1.Text SENDUNG_LIST(CURRENT_INDEX).tblSnd_ATB_Nr = usrcntl_ATB.txtATBNr.Text + SENDUNG_LIST(CURRENT_INDEX).tblSnd_T1_Frist = usrcntl_ATB.txtT1Datum.Text Select Case usrcntl_ATB.cbxATBFakturieren.CheckState Case CheckState.Indeterminate : SENDUNG_LIST(CURRENT_INDEX).tblSnd_ATBFakturieren = Nothing diff --git a/Aviso/usrCntlSND_ATBGestellung.Designer.vb b/Aviso/usrCntlSND_ATBGestellung.Designer.vb index bedeb1d..343052d 100644 --- a/Aviso/usrCntlSND_ATBGestellung.Designer.vb +++ b/Aviso/usrCntlSND_ATBGestellung.Designer.vb @@ -32,11 +32,17 @@ Partial Class usrCntlSND_ATBGestellung Me.Label3 = New System.Windows.Forms.Label() Me.txtT1VerzollungsadresseBestimmungszollstelle = New VERAG_PROG_ALLGEMEIN.MySearchBox() Me.Label33 = New System.Windows.Forms.Label() + Me.Label1 = New System.Windows.Forms.Label() + Me.txtT1Datum = New VERAG_PROG_ALLGEMEIN.MyTextBox() + Me.DateTimePicker1 = New System.Windows.Forms.DateTimePicker() Me.pnlT1.SuspendLayout() Me.SuspendLayout() ' 'pnlT1 ' + Me.pnlT1.Controls.Add(Me.txtT1Datum) + Me.pnlT1.Controls.Add(Me.DateTimePicker1) + Me.pnlT1.Controls.Add(Me.Label1) Me.pnlT1.Controls.Add(Me.btnGesSicherheit) Me.pnlT1.Controls.Add(Me.Button1) Me.pnlT1.Controls.Add(Me.cbxATBFakturieren) @@ -48,7 +54,7 @@ Partial Class usrCntlSND_ATBGestellung Me.pnlT1.Controls.Add(Me.Label33) Me.pnlT1.Location = New System.Drawing.Point(0, 0) Me.pnlT1.Name = "pnlT1" - Me.pnlT1.Size = New System.Drawing.Size(549, 101) + Me.pnlT1.Size = New System.Drawing.Size(549, 125) Me.pnlT1.TabIndex = 0 ' 'btnGesSicherheit @@ -77,7 +83,7 @@ Partial Class usrCntlSND_ATBGestellung Me.cbxATBFakturieren.AutoSize = True Me.cbxATBFakturieren.Checked = True Me.cbxATBFakturieren.CheckState = System.Windows.Forms.CheckState.Indeterminate - Me.cbxATBFakturieren.Location = New System.Drawing.Point(121, 80) + Me.cbxATBFakturieren.Location = New System.Drawing.Point(121, 102) Me.cbxATBFakturieren.Name = "cbxATBFakturieren" Me.cbxATBFakturieren.Size = New System.Drawing.Size(153, 17) Me.cbxATBFakturieren.TabIndex = 24 @@ -100,7 +106,7 @@ Partial Class usrCntlSND_ATBGestellung Me.txtATBNr._Waehrung = False Me.txtATBNr._WaehrungZeichen = True Me.txtATBNr.ForeColor = System.Drawing.Color.Black - Me.txtATBNr.Location = New System.Drawing.Point(121, 30) + Me.txtATBNr.Location = New System.Drawing.Point(121, 56) Me.txtATBNr.MaxLineLength = -1 Me.txtATBNr.MaxLines_Warning = "" Me.txtATBNr.MaxLines_Warning_Label = Nothing @@ -135,7 +141,7 @@ Partial Class usrCntlSND_ATBGestellung ' Me.Label4.AutoSize = True Me.Label4.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.Label4.Location = New System.Drawing.Point(23, 33) + Me.Label4.Location = New System.Drawing.Point(23, 59) Me.Label4.Name = "Label4" Me.Label4.Size = New System.Drawing.Size(92, 13) Me.Label4.TabIndex = 20 @@ -144,7 +150,7 @@ Partial Class usrCntlSND_ATBGestellung 'Label3 ' Me.Label3.AutoSize = True - Me.Label3.Location = New System.Drawing.Point(23, 59) + Me.Label3.Location = New System.Drawing.Point(23, 81) Me.Label3.Name = "Label3" Me.Label3.Size = New System.Drawing.Size(51, 13) Me.Label3.TabIndex = 15 @@ -164,7 +170,7 @@ Partial Class usrCntlSND_ATBGestellung Me.txtT1VerzollungsadresseBestimmungszollstelle.INVISIBLE_COLUMNS = Nothing Me.txtT1VerzollungsadresseBestimmungszollstelle.key_visible = False Me.txtT1VerzollungsadresseBestimmungszollstelle.KEYPARAM = Nothing - Me.txtT1VerzollungsadresseBestimmungszollstelle.Location = New System.Drawing.Point(121, 56) + Me.txtT1VerzollungsadresseBestimmungszollstelle.Location = New System.Drawing.Point(121, 78) Me.txtT1VerzollungsadresseBestimmungszollstelle.MaxLength = 8 Me.txtT1VerzollungsadresseBestimmungszollstelle.Name = "txtT1VerzollungsadresseBestimmungszollstelle" Me.txtT1VerzollungsadresseBestimmungszollstelle.searchActive = True @@ -186,11 +192,57 @@ Partial Class usrCntlSND_ATBGestellung Me.Label33.TabIndex = 3 Me.Label33.Text = "Vorpapier / T1:" ' + 'Label1 + ' + Me.Label1.AutoSize = True + Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Label1.Location = New System.Drawing.Point(158, 36) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(101, 13) + Me.Label1.TabIndex = 26 + Me.Label1.Text = "Vorpapier / T1 Frist:" + ' + 'txtT1Datum + ' + Me.txtT1Datum._DateTimeOnly = False + Me.txtT1Datum._numbersOnly = False + Me.txtT1Datum._numbersOnlyKommastellen = "" + Me.txtT1Datum._numbersOnlyTrennzeichen = True + Me.txtT1Datum._Prozent = False + Me.txtT1Datum._ShortDateNew = True + Me.txtT1Datum._ShortDateOnly = False + Me.txtT1Datum._TimeOnly = False + Me.txtT1Datum._TimeOnly_Seconds = False + Me.txtT1Datum._value = "" + Me.txtT1Datum._Waehrung = False + Me.txtT1Datum._WaehrungZeichen = True + Me.txtT1Datum.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.txtT1Datum.ForeColor = System.Drawing.Color.Black + Me.txtT1Datum.Location = New System.Drawing.Point(272, 33) + Me.txtT1Datum.MaxLength = 10 + Me.txtT1Datum.MaxLineLength = -1 + Me.txtT1Datum.MaxLines_Warning = "" + Me.txtT1Datum.MaxLines_Warning_Label = Nothing + Me.txtT1Datum.Name = "txtT1Datum" + Me.txtT1Datum.Size = New System.Drawing.Size(83, 20) + Me.txtT1Datum.TabIndex = 38 + ' + 'DateTimePicker1 + ' + Me.DateTimePicker1.CustomFormat = "''" + Me.DateTimePicker1.Format = System.Windows.Forms.DateTimePickerFormat.Custom + Me.DateTimePicker1.Location = New System.Drawing.Point(272, 33) + Me.DateTimePicker1.Margin = New System.Windows.Forms.Padding(0) + Me.DateTimePicker1.Name = "DateTimePicker1" + Me.DateTimePicker1.RightToLeft = System.Windows.Forms.RightToLeft.No + Me.DateTimePicker1.Size = New System.Drawing.Size(115, 20) + Me.DateTimePicker1.TabIndex = 39 + ' 'usrCntlSND_ATBGestellung ' Me.Controls.Add(Me.pnlT1) Me.Name = "usrCntlSND_ATBGestellung" - Me.Size = New System.Drawing.Size(553, 106) + Me.Size = New System.Drawing.Size(553, 129) Me.pnlT1.ResumeLayout(False) Me.pnlT1.PerformLayout() Me.ResumeLayout(False) @@ -206,4 +258,7 @@ Partial Class usrCntlSND_ATBGestellung Friend WithEvents cbxATBFakturieren As CheckBox Friend WithEvents btnGesSicherheit As Button Friend WithEvents Button1 As Button + Friend WithEvents Label1 As Label + Friend WithEvents txtT1Datum As VERAG_PROG_ALLGEMEIN.MyTextBox + Friend WithEvents DateTimePicker1 As DateTimePicker End Class diff --git a/Aviso/usrCntlSND_ATBGestellung.vb b/Aviso/usrCntlSND_ATBGestellung.vb index bbc57d3..619edfe 100644 --- a/Aviso/usrCntlSND_ATBGestellung.vb +++ b/Aviso/usrCntlSND_ATBGestellung.vb @@ -13,6 +13,7 @@ Public Class usrCntlSND_ATBGestellung Dim AVISO As VERAG_PROG_ALLGEMEIN.cAviso = Nothing Dim SND As VERAG_PROG_ALLGEMEIN.cSendungen = Nothing + Dim gsnr_global As Integer = -1 Sub New(AVISO, SND) @@ -34,11 +35,25 @@ Public Class usrCntlSND_ATBGestellung Dim f As frmSendungsdetailsNEU = Me.FindForm If f.SAVE_ME() Then + SND = f.SENDUNG_LIST(f.CURRENT_INDEX) If Not IsNumeric(SND.AbfertigungsNr) OrElse CInt(SND.AbfertigungsNr) < 100000 Then MsgBox("Abfertigungsnummer angeben!") : Exit Sub If If(SND.tblSnd_ATB_T1, "") = "" Then MsgBox("MRN (Gestellung) angeben!") : Exit Sub + If SND.tblSnd_T1_Frist IsNot Nothing AndAlso IsDate(SND.tblSnd_T1_Frist) Then + If CDate(SND.tblSnd_T1_Frist) <= Today() Then + '-> OK + Else + MsgBox("T1 Frist ist abgelaufen!") + Exit Sub + End If + Else + MsgBox("T1 Frist muss befüllt werden") + Exit Sub + + End If + Dim Standort As String = "" Select Case SND.FilialenNr @@ -81,13 +96,20 @@ Public Class usrCntlSND_ATBGestellung If GesSichRef Is Nothing Then MsgBox("Verwahrungsreferenz kann nicht ermittelt werden!") : Exit Sub Dim saldo = CDbl(GesSichRef.CalcSaldo()) - If SND.tblSnd_Warenwert > saldo Then - If MsgBox("Gestellung kann NICHT durchgeführt werden!" & vbNewLine & "Eingetragener Warenwert: " & SND.tblSnd_Warenwert & " übersteigt den vorhandenen Sicherheitssaldo von: " & saldo & vbNewLine & "Trotzdem fortfahren", vbYesNoCancel) <> vbYes Then Exit Sub + + Dim sicherheitsbertrag As Double = SND.tblSnd_Warenwert * (GesSichRef.gsr_zollsatz / 100) + + If sicherheitsbertrag > saldo Then + If MsgBox("Gestellung kann NICHT durchgeführt werden!" & vbNewLine & "Eingetragener Warenwert: " & SND.tblSnd_Warenwert & " (Sicherheitsbetrag: " & sicherheitsbertrag & ") übersteigt den vorhandenen Sicherheitssaldo von: " & saldo & vbNewLine & "Trotzdem fortfahren", vbYesNoCancel) <> vbYes Then Exit Sub End If - Dim frMZA As New SDL.frmZollanmeldung("AA", Nothing, AVISO, SND, Now.ToString("yy")) + Dim frMZA As New SDL.frmZollanmeldung("AA", Nothing, AVISO, SND, Now.ToString("yy"), GesSichRef, Standort) + frMZA.Show() + + AddHandler frMZA.FormClosed, Sub() + initGesamtsicherheiten() ' initdgvZollAnmeldungen() End Sub Else @@ -115,7 +137,7 @@ Public Class usrCntlSND_ATBGestellung End If End If - 'falls nicht gefunden, 2 Schritt -> Gestellung nach AVISO ID, oder Aberftigungsnrand FilialNr + 'falls nicht gefunden, 2 Schritt -> Gestellung nach AVISO ID, oder Aberftigungsnr and FilialNr If gsnr = 0 Then Dim SQLString As String = "Select top (1) gs_gsNr from [tblGesamtsicherheit] where ([gs_filialenNr] = '" & SND.FilialenNr & "' and [gs_abfertigungsNr] = " & SND.AbfertigungsNr & " ) or gs_avisoId = '" & SND.tblSnd_AvisoID & "' order by gs_datum desc" dt = SQL.loadDgvBySql(SQLString, "AVISO", 100, True) @@ -124,13 +146,13 @@ Public Class usrCntlSND_ATBGestellung End If End If - + gsnr_global = gsnr If gsnr > 0 Then Dim gessicherheit As New cSicherheiten(gsnr) Dim GesSichRef = New VERAG_PROG_ALLGEMEIN.cAufschubKonten(gessicherheit.gs_standort) - Dim frm As New frmGesamtsicherheitenNEU + Dim frm As New frmGesamtsicherheitenNEU() Select Case gessicherheit.gs_standort Case "Verag GmbH" @@ -243,6 +265,58 @@ Public Class usrCntlSND_ATBGestellung End Sub + Private Sub usrCntlSND_ATBGestellung_Load(sender As Object, e As EventArgs) Handles MyBase.Load + + + initGesamtsicherheiten() + + End Sub + + + Private Sub initGesamtsicherheiten() + Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL + Dim gsnr As Integer = 0 + Dim sqlWhere = "" + + Dim dt As New DataTable + + If SND.tblSnd_ATB_T1 IsNot Nothing Then txtATBT1.Text = SND.tblSnd_ATB_T1.ToString + + '1.Schritt -> Gestellung nach aktuellster ATB-NR + If txtATBT1.Text <> "" Then + Dim SQLString As String = "Select top (1) gs_gsNr from [tblGesamtsicherheit] where [gs_ATBNr] = '" & txtATBT1.Text & "' order by gs_datum desc" + dt = SQL.loadDgvBySql(SQLString, "AVISO", 100, True) + If dt.Rows.Count > 0 Then + gsnr = dt.Rows(0).Item("gs_gsNr") + End If + End If + + 'falls nicht gefunden, 2 Schritt -> Gestellung nach AVISO ID, oder Aberftigungsnr and FilialNr + If gsnr = 0 Then + Dim SQLString As String = "Select top (1) gs_gsNr from [tblGesamtsicherheit] where ([gs_filialenNr] = '" & SND.FilialenNr & "' and [gs_abfertigungsNr] = " & SND.AbfertigungsNr & " ) or gs_avisoId = '" & SND.tblSnd_AvisoID & "' order by gs_datum desc" + dt = SQL.loadDgvBySql(SQLString, "AVISO", 100, True) + If dt.Rows.Count > 0 Then + gsnr = dt.Rows(0).Item("gs_gsNr") + End If + End If + + gsnr_global = gsnr + + If gsnr_global > 0 Then + + btnGesSicherheit.Enabled = True + Button1.Enabled = False + Else + btnGesSicherheit.Enabled = False + Button1.Enabled = True + + End If + + End Sub + + Private Sub DateTimePicker1_ValueChanged(sender As Object, e As EventArgs) Handles DateTimePicker1.ValueChanged + txtT1Datum._value = CDate(sender.value).ToShortDateString + End Sub 'Public Sub setValues()