Pruefung ATB-GEstellung

This commit is contained in:
2026-04-01 09:41:47 +02:00
parent 83aef7192d
commit cffd0804ce

View File

@@ -61,85 +61,87 @@ Public Class usrCntlSND_ATBGestellung
If If(SND.tblSnd_ATB_T1, "") = "" Then MsgBox("MRN (Gestellung) angeben!") : Exit Sub If If(SND.tblSnd_ATB_T1, "") = "" Then MsgBox("MRN (Gestellung) angeben!") : Exit Sub
If If(SND.tblSnd_Zollsystem_Land, "") = "" Then MsgBox("Abf-Land muss angegeben werden!") : Exit Sub
If SND.tblSnd_T1_Frist IsNot Nothing AndAlso IsDate(SND.tblSnd_T1_Frist) Then If SND.tblSnd_T1_Frist IsNot Nothing AndAlso IsDate(SND.tblSnd_T1_Frist) Then
If CDate(SND.tblSnd_T1_Frist) >= Today() Then If CDate(SND.tblSnd_T1_Frist) >= Today() Then
'-> OK '-> OK
Else
MsgBox("T1 Frist ist abgelaufen!")
Exit Sub
End If
Else Else
MsgBox("T1 Frist ist abgelaufen!") MsgBox("T1 Frist muss befüllt werden")
Exit Sub Exit Sub
End If End If
Else
MsgBox("T1 Frist muss befüllt werden")
Exit Sub
End If If WarenwertEUR = 0 Then
MsgBox("Warenwert in EUR ist mit 0 angegeben!")
Exit Sub
If WarenwertEUR = 0 Then End If
MsgBox("Warenwert in EUR ist mit 0 angegeben!")
Exit Sub
End If Dim Standort As String = ""
Dim Standort As String = ""
Select Case SND.FilialenNr
Case 4803, 4809
Standort = "VERAG AG"
Case 5601
Standort = "Unisped GmbH"
Case 5701
Standort = "AMBAR GmbH"
Case 4810, 5103, 5901
Standort = "VERAG GmbH"
Case 5501
Standort = "IMEX"
End Select
'sonderfälle lt. Mestan
If SND.tblSnd_Zollsystem_Land = "DE" Then
Select Case SND.FilialenNr Select Case SND.FilialenNr
Case 5501, 4803, 4809, 5103 Case 4803, 4809
Standort = "VERAG AG"
Case 5601
Standort = "Unisped GmbH"
Case 5701
Standort = "AMBAR GmbH"
Case 4810, 5103, 5901
Standort = "VERAG GmbH" Standort = "VERAG GmbH"
Case 5501
Standort = "IMEX"
End Select End Select
ElseIf SND.tblSnd_Zollsystem_Land = "AT" Then 'sonderfälle lt. Mestan
If SND.tblSnd_Zollsystem_Land = "DE" Then
If SND.tblSnd_Abfertigungsart_ID = 1 Then 'ZA
Standort = "VERAG CS"
ElseIf SND.tblSnd_Abfertigungsart_ID = 38 Then 'EV-Verz
Select Case SND.FilialenNr Select Case SND.FilialenNr
Case 4803, 5303, 4809, 5103 Case 5501, 4803, 4809, 5103
Standort = "VERAG CS" Standort = "VERAG GmbH"
End Select End Select
ElseIf SND.tblSnd_Zollsystem_Land = "AT" Then
If SND.tblSnd_Abfertigungsart_ID = 1 Then 'ZA
Standort = "VERAG CS"
ElseIf SND.tblSnd_Abfertigungsart_ID = 38 Then 'EV-Verz
Select Case SND.FilialenNr
Case 4803, 5303, 4809, 5103
Standort = "VERAG CS"
End Select
End If
End If End If
End If
Dim GesSichRef = New VERAG_PROG_ALLGEMEIN.cGesamtsicherheitsReferenz(Standort)
If GesSichRef Is Nothing Then MsgBox("Verwahrungsreferenz kann nicht ermittelt werden!") : Exit Sub
Dim saldo = CDbl(GesSichRef.CalcSaldo())
Dim sicherheitsbertrag As Double = WarenwertEUR * (GesSichRef.gsr_zollsatz / 100)
If sicherheitsbertrag > saldo Then
If MsgBox("Gestellung kann NICHT durchgeführt werden!" & vbNewLine & "Eingetragener Warenwert in EUR: " & WarenwertEUR & " (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"), GesSichRef, Standort, WarenwertEUR, gsnr_proLKW_global)
frMZA.Show()
Dim GesSichRef = New VERAG_PROG_ALLGEMEIN.cGesamtsicherheitsReferenz(Standort) AddHandler frMZA.FormClosed, Sub()
If GesSichRef Is Nothing Then MsgBox("Verwahrungsreferenz kann nicht ermittelt werden!") : Exit Sub initGesamtsicherheiten()
' initdgvZollAnmeldungen()
Dim saldo = CDbl(GesSichRef.CalcSaldo()) End Sub
Dim sicherheitsbertrag As Double = WarenwertEUR * (GesSichRef.gsr_zollsatz / 100)
If sicherheitsbertrag > saldo Then
If MsgBox("Gestellung kann NICHT durchgeführt werden!" & vbNewLine & "Eingetragener Warenwert in EUR: " & WarenwertEUR & " (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"), GesSichRef, Standort, WarenwertEUR, gsnr_proLKW_global)
frMZA.Show()
AddHandler frMZA.FormClosed, Sub()
initGesamtsicherheiten()
' initdgvZollAnmeldungen()
End Sub
Else Else
MsgBox("Fehler beim Speichern. Ankunftsanzeige abgebrochen.") MsgBox("Fehler beim Speichern. Ankunftsanzeige abgebrochen.")
End If End If
Me.Cursor = Cursors.Default Me.Cursor = Cursors.Default
End Sub End Sub