281 lines
10 KiB
VB.net
281 lines
10 KiB
VB.net
Imports DAKOSY_Worker
|
|
Imports SDL
|
|
|
|
Imports VERAG_PROG_ALLGEMEIN
|
|
|
|
|
|
Public Class usrCntlSND_ATBGestellung
|
|
|
|
Dim _SendungsId As Object
|
|
Public firmaId As Integer
|
|
|
|
'Public NCTS_GA As VERAG_PROG_ALLGEMEIN.cNCTSGestellungsadressen
|
|
|
|
Dim AVISO As VERAG_PROG_ALLGEMEIN.cAviso = Nothing
|
|
Dim SND As VERAG_PROG_ALLGEMEIN.cSendungen = Nothing
|
|
|
|
Sub New(AVISO, SND)
|
|
|
|
|
|
' Dieser Aufruf ist für den Designer erforderlich.
|
|
InitializeComponent()
|
|
|
|
Me.AVISO = AVISO
|
|
Me.SND = SND
|
|
|
|
' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu.
|
|
|
|
End Sub
|
|
|
|
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
|
|
|
Me.Refresh()
|
|
Me.Cursor = Cursors.WaitCursor
|
|
|
|
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
|
|
|
|
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
|
|
Case 5501, 4803, 4809, 5103
|
|
Standort = "VERAG GmbH"
|
|
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
|
|
|
|
|
|
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())
|
|
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
|
|
End If
|
|
|
|
Dim frMZA As New SDL.frmZollanmeldung("AA", Nothing, AVISO, SND, Now.ToString("yy"))
|
|
frMZA.Show()
|
|
AddHandler frMZA.FormClosed, Sub()
|
|
' initdgvZollAnmeldungen()
|
|
End Sub
|
|
Else
|
|
MsgBox("Fehler beim Speichern. Ankunftsanzeige abgebrochen.")
|
|
End If
|
|
Me.Cursor = Cursors.Default
|
|
End Sub
|
|
|
|
|
|
Private Sub btnGesSicherheit_Click(sender As Object, e As EventArgs) Handles btnGesSicherheit.Click
|
|
|
|
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
|
|
Dim gsnr As Integer = 0
|
|
Dim sqlWhere = ""
|
|
|
|
Dim dt As New DataTable
|
|
|
|
|
|
'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 Aberftigungsnrand 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
|
|
|
|
|
|
|
|
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
|
|
|
|
Select Case gessicherheit.gs_standort
|
|
Case "Verag GmbH"
|
|
firmaId = 2
|
|
Case "Verag AG"
|
|
firmaId = 1
|
|
Case "Unisped GmbH"
|
|
firmaId = 21
|
|
Case "AMBAR GmbH"
|
|
firmaId = 24
|
|
Case "Verag CS"
|
|
firmaId = 11
|
|
Case "IMEX"
|
|
firmaId = 20
|
|
|
|
End Select
|
|
|
|
With frm
|
|
|
|
.currentGesSichRef = GesSichRef
|
|
.gessicherheitID = gessicherheit.gs_gsNr
|
|
.datum = gessicherheit.gs_datum
|
|
.Standort = gessicherheit.gs_standort
|
|
.FilialNummer = SND.FilialenNr
|
|
.Abfertigungsnummer = SND.AbfertigungsNr
|
|
.warenortID = gessicherheit.gs_warenort
|
|
.LKWKZ = gessicherheit.gs_LKWKZ
|
|
.avisoID = gessicherheit.gs_avisoId
|
|
.firmaId = firmaId
|
|
'.warenortPrefix = SND.tblSnd_Zollsystem_Land
|
|
End With
|
|
|
|
AddHandler frm.FormClosing, Function()
|
|
GesSichRef.CalcSaldo()
|
|
Me.BringToFront()
|
|
End Function
|
|
frm.Show()
|
|
Else
|
|
|
|
|
|
Dim Standort As String = ""
|
|
|
|
|
|
Select Case SND.FilialenNr
|
|
Case 4803, 4809
|
|
Standort = "VERAG AG" : firmaId = 1
|
|
Case 5601
|
|
Standort = "Unisped GmbH" : firmaId = 21
|
|
Case 5701
|
|
Standort = "AMBAR GmbH" : firmaId = 24
|
|
Case 4810, 5103, 5901
|
|
Standort = "VERAG GmbH" : firmaId = 2
|
|
Case 5501
|
|
Standort = "IMEX" : firmaId = 20
|
|
End Select
|
|
|
|
'sonderfälle lt. Mestan
|
|
If SND.tblSnd_Zollsystem_Land = "DE" Then
|
|
|
|
Select Case SND.FilialenNr
|
|
Case 5501, 4803, 4809, 5103
|
|
Standort = "VERAG GmbH" : firmaId = 2
|
|
End Select
|
|
|
|
ElseIf SND.tblSnd_Zollsystem_Land = "AT" Then
|
|
|
|
If SND.tblSnd_Abfertigungsart_ID = 1 Then 'ZA
|
|
Standort = "VERAG CS" : firmaId = 11
|
|
ElseIf SND.tblSnd_Abfertigungsart_ID = 38 Then 'EV-Verz
|
|
Select Case SND.FilialenNr
|
|
Case 4803, 5303, 4809, 5103
|
|
Standort = "VERAG CS" : firmaId = 11
|
|
End Select
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
Dim GesSichRef = New VERAG_PROG_ALLGEMEIN.cAufschubKonten(Standort)
|
|
Dim frm As New frmGesamtsicherheitenNEU
|
|
|
|
|
|
If GesSichRef Is Nothing Then
|
|
Exit Sub
|
|
End If
|
|
|
|
|
|
With frm
|
|
.currentGesSichRef = GesSichRef
|
|
.Standort = Standort
|
|
.datum = Date.Now
|
|
.Neu = True
|
|
.FilialNummer = SND.FilialenNr
|
|
.Abfertigungsnummer = SND.AbfertigungsNr
|
|
.firmaId = firmaId
|
|
.grenzstelle = AVISO.Grenzstelle.ToString.Replace("WO_", "")
|
|
.txtlkwIdSearch.Text = AVISO.LKW_Nr
|
|
.txtSicherheitWarenwert.Text = SND.tblSnd_Warenwert
|
|
.txtSicherheitATBNr.Text = txtATBT1.Text
|
|
End With
|
|
AddHandler frm.FormClosing, Function()
|
|
GesSichRef.CalcSaldo()
|
|
Me.BringToFront()
|
|
End Function
|
|
frm.Show(Me)
|
|
|
|
End If
|
|
|
|
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
'Public Sub setValues()
|
|
' txtATBT1.Text = If(NCTS_GA.nga_name, "")
|
|
' txtT1VerzollungsadresseStrasse.Text = If(NCTS_GA.nga_strasse, "")
|
|
' txtT1VerzollungsadressePlz.Text = If(NCTS_GA.nga_plz, "")
|
|
' txtT1VerzollungsadresseOrt.Text = If(NCTS_GA.nga_ort, "")
|
|
' sbT1VerzollungsadresseLand.SET_VALUE(If(NCTS_GA.nga_land, ""))
|
|
|
|
' txtT1VerzollungsadresseAnspr.Text = If(NCTS_GA.nga_Ansprechpartner, "")
|
|
' txtT1VerzollungsadresseEORI.Text = If(NCTS_GA.nga_EORI, "")
|
|
' txtT1VerzollungsadresseEORI_NL.Text = If(NCTS_GA.nga_EORI_NL, "")
|
|
' txtT1VerzollungsadresseBestimmungszollstelle.SET_VALUE(If(NCTS_GA.nga_bestZollst, ""))
|
|
|
|
|
|
' lblNGAId.Text = If(NCTS_GA.nga_id > 0, NCTS_GA.nga_id, "-")
|
|
' picDel.Visible = (NCTS_GA.nga_id > 0)
|
|
'End Sub
|
|
|
|
|
|
'Public Sub getValues()
|
|
' NCTS_GA.nga_name = txtATBT1.Text
|
|
' NCTS_GA.nga_strasse = VERAG_PROG_ALLGEMEIN.SQL.isNullNothing(txtT1VerzollungsadresseStrasse.Text)
|
|
' NCTS_GA.nga_plz = VERAG_PROG_ALLGEMEIN.SQL.isNullNothing(txtT1VerzollungsadressePlz.Text)
|
|
' NCTS_GA.nga_ort = VERAG_PROG_ALLGEMEIN.SQL.isNullNothing(txtT1VerzollungsadresseOrt.Text)
|
|
' NCTS_GA.nga_land = VERAG_PROG_ALLGEMEIN.SQL.isNullNothing(sbT1VerzollungsadresseLand._value)
|
|
|
|
' NCTS_GA.nga_Ansprechpartner = VERAG_PROG_ALLGEMEIN.SQL.isNullNothing(txtT1VerzollungsadresseAnspr.Text)
|
|
' NCTS_GA.nga_EORI = VERAG_PROG_ALLGEMEIN.SQL.isNullNothing(txtT1VerzollungsadresseEORI.Text)
|
|
' NCTS_GA.nga_EORI_NL = VERAG_PROG_ALLGEMEIN.SQL.isNullNothing(txtT1VerzollungsadresseEORI_NL.Text)
|
|
' NCTS_GA.nga_bestZollst = VERAG_PROG_ALLGEMEIN.SQL.isNullNothing(txtT1VerzollungsadresseBestimmungszollstelle._value)
|
|
'End Sub
|
|
|
|
|
|
End Class
|