CBAM Auswertung; Verzollungspreise; T2 aus EXG manuell
This commit is contained in:
@@ -16,6 +16,7 @@ Public Class frmAbrechnungsMaske
|
|||||||
Me.Height = Screen.FromRectangle(Me.Bounds).WorkingArea.Size.Height
|
Me.Height = Screen.FromRectangle(Me.Bounds).WorkingArea.Size.Height
|
||||||
Me.Top = 0
|
Me.Top = 0
|
||||||
initFilterPanel()
|
initFilterPanel()
|
||||||
|
|
||||||
cProgramFunctions.initDrucker(cboPrinter)
|
cProgramFunctions.initDrucker(cboPrinter)
|
||||||
|
|
||||||
txtAbfertDat.Text = Now.ToShortDateString 'CDate("01." & Now.ToString("MM.yyyy")).AddMonths(-1).ToShortDateString
|
txtAbfertDat.Text = Now.ToShortDateString 'CDate("01." & Now.ToString("MM.yyyy")).AddMonths(-1).ToShortDateString
|
||||||
@@ -63,6 +64,7 @@ Public Class frmAbrechnungsMaske
|
|||||||
|
|
||||||
MyComboBox2.Items.Clear()
|
MyComboBox2.Items.Clear()
|
||||||
|
|
||||||
|
|
||||||
Select Case FirmaTmp
|
Select Case FirmaTmp
|
||||||
|
|
||||||
Case "VERAG"
|
Case "VERAG"
|
||||||
@@ -121,6 +123,7 @@ Public Class frmAbrechnungsMaske
|
|||||||
MyComboBox2.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("*BAUBÖCK", "BAUBOECK"))
|
MyComboBox2.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("*BAUBÖCK", "BAUBOECK"))
|
||||||
End Select
|
End Select
|
||||||
|
|
||||||
|
|
||||||
' MyComboBox2.changeItem(VERAG_PROG_ALLGEMEIN.cAllgemein.USRID) 'Benutzerwechsel
|
' MyComboBox2.changeItem(VERAG_PROG_ALLGEMEIN.cAllgemein.USRID) 'Benutzerwechsel
|
||||||
'If MyComboBox2.Items.Count > 0 Then MyComboBox2.SelectedIndex = 0
|
'If MyComboBox2.Items.Count > 0 Then MyComboBox2.SelectedIndex = 0
|
||||||
MyComboBox2.changeItem(VERAG_PROG_ALLGEMEIN.cAllgemein.USRKURZNAME)
|
MyComboBox2.changeItem(VERAG_PROG_ALLGEMEIN.cAllgemein.USRKURZNAME)
|
||||||
|
|||||||
@@ -3349,7 +3349,7 @@ Nächste_Textzeile_lesen:
|
|||||||
|
|
||||||
|
|
||||||
Private Sub btnNeueUnterNR_Click(sender As Object, e As EventArgs) Handles btnNeueUnterNR.Click
|
Private Sub btnNeueUnterNR_Click(sender As Object, e As EventArgs) Handles btnNeueUnterNR.Click
|
||||||
If saveMe() Then
|
If (RECHNUNG IsNot Nothing AndAlso (RECHNUNG.DruckDatumZeit IsNot Nothing Or RECHNUNG.Status <> 0)) OrElse saveMe() Then
|
||||||
newRECHNUNG()
|
newRECHNUNG()
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -120,85 +120,100 @@ Public Class usrCntlATLAS_EXGestellung
|
|||||||
Next
|
Next
|
||||||
If Not err Then
|
If Not err Then
|
||||||
If cbxNCTS.Checked Then
|
If cbxNCTS.Checked Then
|
||||||
Dim BezugsNr = ""
|
Dim NCTS_OUT = usrCntlATLAS_NCTS004.genNCTSfromStammref(Me, FIRMA_DY, AVISO, SENDUNG, "")
|
||||||
|
NCTS_OUT.ncts_HOUSE_CONSIGNMENT.Clear()
|
||||||
|
NCTS_OUT.DELETE_HouseConsignment()
|
||||||
|
|
||||||
|
If NCTS_OUT IsNot Nothing AndAlso NCTS_OUT.ncts_Id > 0 Then
|
||||||
Dim NCTS_OUT As New DAKOSY_Worker.cDakosyNCTSOut004
|
MsgBox("Eine neue Versandanmeldung mit der BezugsNummer '" & NCTS_OUT.ncts_ObjectName & "' wurde erstellt. Befüllung wird bei Gestellvorgang automatisch vorgenommen.")
|
||||||
|
lblBezugsnummer.Text = NCTS_OUT.ncts_ObjectName
|
||||||
Dim f As New frmDakosyStammreferenz("DE", "NCTS", False,,, FIRMA_DY)
|
|
||||||
Dim Stammreferenz = Nothing
|
|
||||||
f.selectForEXG = True
|
|
||||||
If f.ShowDialog(Me.FindForm) Then
|
|
||||||
Stammreferenz = f.STAMMREF
|
|
||||||
sentToDakosy = f.sentToDakosy
|
|
||||||
End If
|
|
||||||
Try
|
|
||||||
|
|
||||||
BezugsNr = usrCntlATLAS_NCTS004.getBezugsnr(FIRMA_DY, SENDUNG, BezugsNr, "")
|
|
||||||
lblBezugsnummer.Text = BezugsNr
|
|
||||||
|
|
||||||
MsgBox(BezugsNr)
|
|
||||||
Catch ex As Exception
|
|
||||||
MsgBox(ex.Message & ex.StackTrace)
|
|
||||||
End Try
|
|
||||||
ncts_OUT = cDakosyNCTSOut004.LOADByBezugsNr(BezugsNr, True)
|
|
||||||
If True Then 'NCTS_OUT Is Nothing Then
|
|
||||||
|
|
||||||
Dim cDy_ART = "T2"
|
|
||||||
Select Case (SENDUNG.tblSnd_Abfertigungsart_ID)
|
|
||||||
Case 5 : cDy_ART = "T1"
|
|
||||||
Case Else : cDy_ART = "T2"
|
|
||||||
End Select
|
|
||||||
|
|
||||||
|
|
||||||
Dim DY_ANM As New cDakosy_Zollanmeldungen
|
|
||||||
If DY_ANM Is Nothing Then
|
|
||||||
DY_ANM = New cDakosy_Zollanmeldungen(NCTS_OUT.ncts_dyaAnmID)
|
|
||||||
End If
|
|
||||||
DY_ANM.dy_ART = cDy_ART 'cDy_ART
|
|
||||||
DY_ANM.dy_BezugsNr = BezugsNr
|
|
||||||
DY_ANM.dy_AvisoId = If(AVISO Is Nothing, Nothing, AVISO.AvisoID)
|
|
||||||
DY_ANM.dy_SendungsId = If(SENDUNG Is Nothing, Nothing, SENDUNG.tblSnd_SendungID)
|
|
||||||
'Status?
|
|
||||||
If DY_ANM.SAVE() Then 'Speichern, ID wird erzeugt
|
|
||||||
|
|
||||||
|
|
||||||
'Falls zur BezugsNr schon ein Eintrag in der DB vorhanden ist
|
|
||||||
NCTS_OUT = cDakosyNCTSOut004.LOADByAnmIDFull(f.STAMMREF_DYID, True) ' DyID --> Falls bei der Stammreferenz eine Vorlage hinterlegt ist!
|
|
||||||
If NCTS_OUT Is Nothing Then
|
|
||||||
NCTS_OUT = New cDakosyNCTSOut004
|
|
||||||
End If
|
|
||||||
|
|
||||||
NCTS_OUT.ncts_Id = -1
|
|
||||||
NCTS_OUT.ncts_dyaAnmID = DY_ANM.dy_Id
|
|
||||||
|
|
||||||
'If NCTS_OUT IsNot Nothing Then
|
|
||||||
' 'Stmmreferenz - Werte zurücksetzen, damit nicht falsch übergeben
|
|
||||||
' NCTS_OUT.ncts_dyaAnmID = -1
|
|
||||||
' NCTS_OUT.ncts_Id = -1
|
|
||||||
'Else
|
|
||||||
' NCTS_OUT = New cDakosyNCTSOut004
|
|
||||||
'End If
|
|
||||||
|
|
||||||
|
|
||||||
usrCntlATLAS_NCTS004.loaddataFromAVISO(AVISO, SENDUNG, cDy_ART, BezugsNr, NCTS_OUT)
|
|
||||||
'cboStammreferenz.changeItem(Stammreferenz)
|
|
||||||
|
|
||||||
If NCTS_OUT.SAVE() Then
|
|
||||||
MsgBox("Eine neue Versandanmeldung mit der BezugsNummer '" & BezugsNr & "' wurde erstellt. Befüllung wird bei Gestellvorgang automatisch vorgenommen.")
|
|
||||||
|
|
||||||
For Each exgId In exg_list
|
For Each exgId In exg_list
|
||||||
MsgBox(NCTS_OUT.ncts_dyaAnmID)
|
MsgBox(NCTS_OUT.ncts_dyaAnmID)
|
||||||
cDakosyEXG.UPDATE_FillNCTS_ID(exgId, NCTS_OUT.ncts_dyaAnmID)
|
cDakosyEXG.UPDATE_FillNCTS_ID(exgId, NCTS_OUT.ncts_dyaAnmID)
|
||||||
Next
|
Next
|
||||||
End If
|
|
||||||
|
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
'Dim BezugsNr = ""
|
||||||
|
|
||||||
|
|
||||||
End If
|
'Dim NCTS_OUT As New DAKOSY_Worker.cDakosyNCTSOut004
|
||||||
'ncts_OUT
|
|
||||||
|
'Dim f As New frmDakosyStammreferenz("DE", "NCTS", False,,, FIRMA_DY)
|
||||||
|
'Dim Stammreferenz = Nothing
|
||||||
|
'f.selectForEXG = True
|
||||||
|
'If f.ShowDialog(Me.FindForm) Then
|
||||||
|
' Stammreferenz = f.STAMMREF
|
||||||
|
' sentToDakosy = f.sentToDakosy
|
||||||
|
'End If
|
||||||
|
'Try
|
||||||
|
|
||||||
|
' BezugsNr = usrCntlATLAS_NCTS004.getBezugsnr(FIRMA_DY, SENDUNG, BezugsNr, "")
|
||||||
|
' lblBezugsnummer.Text = BezugsNr
|
||||||
|
|
||||||
|
' MsgBox(BezugsNr)
|
||||||
|
'Catch ex As Exception
|
||||||
|
' MsgBox(ex.Message & ex.StackTrace)
|
||||||
|
'End Try
|
||||||
|
'ncts_OUT = cDakosyNCTSOut004.LOADByBezugsNr(BezugsNr, True)
|
||||||
|
'If True Then 'NCTS_OUT Is Nothing Then
|
||||||
|
|
||||||
|
' Dim cDy_ART = "T2"
|
||||||
|
' Select Case (SENDUNG.tblSnd_Abfertigungsart_ID)
|
||||||
|
' Case 5 : cDy_ART = "T1"
|
||||||
|
' Case Else : cDy_ART = "T2"
|
||||||
|
' End Select
|
||||||
|
|
||||||
|
|
||||||
|
' Dim DY_ANM As New cDakosy_Zollanmeldungen
|
||||||
|
' If DY_ANM Is Nothing Then
|
||||||
|
' DY_ANM = New cDakosy_Zollanmeldungen(NCTS_OUT.ncts_dyaAnmID)
|
||||||
|
' End If
|
||||||
|
' DY_ANM.dy_ART = cDy_ART 'cDy_ART
|
||||||
|
' DY_ANM.dy_BezugsNr = BezugsNr
|
||||||
|
' DY_ANM.dy_AvisoId = If(AVISO Is Nothing, Nothing, AVISO.AvisoID)
|
||||||
|
' DY_ANM.dy_SendungsId = If(SENDUNG Is Nothing, Nothing, SENDUNG.tblSnd_SendungID)
|
||||||
|
' 'Status?
|
||||||
|
' If DY_ANM.SAVE() Then 'Speichern, ID wird erzeugt
|
||||||
|
|
||||||
|
|
||||||
|
' 'Falls zur BezugsNr schon ein Eintrag in der DB vorhanden ist
|
||||||
|
' NCTS_OUT = cDakosyNCTSOut004.LOADByAnmIDFull(f.STAMMREF_DYID, True) ' DyID --> Falls bei der Stammreferenz eine Vorlage hinterlegt ist!
|
||||||
|
' If NCTS_OUT Is Nothing Then
|
||||||
|
' NCTS_OUT = New cDakosyNCTSOut004
|
||||||
|
' End If
|
||||||
|
|
||||||
|
' NCTS_OUT.ncts_Id = -1
|
||||||
|
' NCTS_OUT.ncts_dyaAnmID = DY_ANM.dy_Id
|
||||||
|
|
||||||
|
' 'If NCTS_OUT IsNot Nothing Then
|
||||||
|
' ' 'Stmmreferenz - Werte zurücksetzen, damit nicht falsch übergeben
|
||||||
|
' ' NCTS_OUT.ncts_dyaAnmID = -1
|
||||||
|
' ' NCTS_OUT.ncts_Id = -1
|
||||||
|
' 'Else
|
||||||
|
' ' NCTS_OUT = New cDakosyNCTSOut004
|
||||||
|
' 'End If
|
||||||
|
|
||||||
|
|
||||||
|
' usrCntlATLAS_NCTS004.loaddataFromAVISO(AVISO, SENDUNG, cDy_ART, BezugsNr, NCTS_OUT)
|
||||||
|
' 'cboStammreferenz.changeItem(Stammreferenz)
|
||||||
|
|
||||||
|
' If NCTS_OUT.SAVE() Then
|
||||||
|
' MsgBox("Eine neue Versandanmeldung mit der BezugsNummer '" & BezugsNr & "' wurde erstellt. Befüllung wird bei Gestellvorgang automatisch vorgenommen.")
|
||||||
|
|
||||||
|
' For Each exgId In exg_list
|
||||||
|
' MsgBox(NCTS_OUT.ncts_dyaAnmID)
|
||||||
|
' cDakosyEXG.UPDATE_FillNCTS_ID(exgId, NCTS_OUT.ncts_dyaAnmID)
|
||||||
|
' Next
|
||||||
|
' End If
|
||||||
|
|
||||||
|
|
||||||
|
' End If
|
||||||
|
|
||||||
|
|
||||||
|
'End If
|
||||||
|
''ncts_OUT
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
Imports System.IO.Pipes
|
Imports System.IO.Pipes
|
||||||
Imports DAKOSY_Worker
|
Imports DAKOSY_Worker
|
||||||
|
Imports javax.management
|
||||||
Imports Tamir
|
Imports Tamir
|
||||||
Imports Tamir.SharpSsh
|
Imports Tamir.SharpSsh
|
||||||
Imports VERAG_PROG_ALLGEMEIN
|
Imports VERAG_PROG_ALLGEMEIN
|
||||||
@@ -159,6 +160,8 @@ Public Class usrCntlATLAS_NCTS004
|
|||||||
cboDakosyAction.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("Datensatz an ZOLL senden", DY_ObjektAktion.OBJ_SEND))
|
cboDakosyAction.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("Datensatz an ZOLL senden", DY_ObjektAktion.OBJ_SEND))
|
||||||
cboDakosyAction.changeItem(DY_ObjektAktion.OBJ_CREATE)
|
cboDakosyAction.changeItem(DY_ObjektAktion.OBJ_CREATE)
|
||||||
|
|
||||||
|
AusGestllungToolStripMenuItem.Visible = True
|
||||||
|
|
||||||
Select Case FIRMA_DY
|
Select Case FIRMA_DY
|
||||||
Case "VERAG" : txtDyMandant.Text = "VERG"
|
Case "VERAG" : txtDyMandant.Text = "VERG"
|
||||||
txtDyNiederlassung.Text = VERAG_PROG_ALLGEMEIN.cAllgemein.NIEDERLASSUNG
|
txtDyNiederlassung.Text = VERAG_PROG_ALLGEMEIN.cAllgemein.NIEDERLASSUNG
|
||||||
@@ -636,6 +639,81 @@ Public Class usrCntlATLAS_NCTS004
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub AusGestllungToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles AusGestllungToolStripMenuItem.Click
|
Private Sub AusGestllungToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles AusGestllungToolStripMenuItem.Click
|
||||||
|
Dim EXG_LRN = InputBox("Geben Sie die Gestellungs-LRN ein (ohne aufsteigende Zahlen):")
|
||||||
|
If EXG_LRN.Length < 13 Then MsgBox("LRN zu kurz!") : Exit Sub
|
||||||
|
|
||||||
|
|
||||||
|
Dim dt = (New VERAG_PROG_ALLGEMEIN.SQL).loadDgvBySql("SELECT TOP (500) [exg_Id] FROM [tblDakosy_EXG] where exg_ObjectName LIKE '" & EXG_LRN & "%' order by exg_ObjectName desc", "FMZOLL")
|
||||||
|
If dt IsNot Nothing Then
|
||||||
|
Dim BezugsNr = ""
|
||||||
|
Dim NCTS_OUT = usrCntlATLAS_NCTS004.genNCTSfromStammref(Me, FIRMA_DY, AVISO, SENDUNG, BezugsNr)
|
||||||
|
NCTS_OUT.ncts_HOUSE_CONSIGNMENT.Clear()
|
||||||
|
NCTS_OUT.DELETE_HouseConsignment()
|
||||||
|
|
||||||
|
For Each row In dt.Rows
|
||||||
|
Dim EXG As New cDakosyEXG(row("exg_Id"))
|
||||||
|
If EXG IsNot Nothing Then
|
||||||
|
DAKOSY_Worker.cDakosyNCTSOut004.fillNCTS_WithEXG(NCTS_OUT, EXG)
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
If NCTS_OUT.SAVE_ALL() Then
|
||||||
|
|
||||||
|
'--------------------------------------------------------------------------------
|
||||||
|
'----SENDEN----------------------------------------------------------------------
|
||||||
|
'--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Dim EXG_TMP As New cDakosyEXG(dt(0)("exg_Id"))
|
||||||
|
|
||||||
|
Dim DY_ANM = New cDakosy_Zollanmeldungen(NCTS_OUT.ncts_dyaAnmID)
|
||||||
|
If NCTS_OUT IsNot Nothing Then
|
||||||
|
'Dim cDY As New cDakosyNCTSOut(cDyAnm.dy_Id, cDyAnm.dy_Erstellung_SB)
|
||||||
|
NCTS_OUT.ncts_dyaAnmID = DY_ANM.dy_Id
|
||||||
|
NCTS_OUT.ncts_Erstellung_SB = DY_ANM.dy_Erstellung_SB
|
||||||
|
NCTS_OUT.ncts_LetzteBearbeitung = Now
|
||||||
|
NCTS_OUT.ncts_LetzteBearbeitung_SB = DY_ANM.dy_LetzteBearbeitung_SB
|
||||||
|
NCTS_OUT.ncts_firma = EXG_TMP.exg_firma
|
||||||
|
NCTS_OUT.ncts_niederlassung = EXG_TMP.exg_niederlassung
|
||||||
|
' DAKOSY_Interface_SEND.loadInClass_VersandanmeldungNCTSDE_004(NCTS_OUT, Me, DY_ANM, Me.FIRMA_DY)
|
||||||
|
DAKOSY_Interface_SEND.loadInClass_VersandanmeldungNCTSDE_004(NCTS_OUT, Me, DY_ANM, Me.FIRMA_DY)
|
||||||
|
|
||||||
|
|
||||||
|
'VON HIER löschnen ohne test
|
||||||
|
If NCTS_OUT.SAVE_ALL() Then
|
||||||
|
|
||||||
|
If vbYes = MsgBox("Erfolgreich erstellt! Soll(en) die Ausfuhr-Gestellung(en) abgeschickt werden?", vbYesNoCancel) Then
|
||||||
|
|
||||||
|
Dim saveFile = ""
|
||||||
|
If cDakosyNCTSOut004.generateVersandanmeldungNCTSDE_004(NCTS_OUT, saveFile, cboDakosyAction._value, Application.StartupPath) Then
|
||||||
|
If saveFile <> "" Then
|
||||||
|
If cDakosyFunftions.send_Data_To_Dakosy_FTP(saveFile, BezugsNr, DY_ANM.dy_Id, Me.FIRMA_DY) Then
|
||||||
|
DAKOSY_Worker.cDakosy_Statusmeldungen.InsertStatusMeldung(DY_ANM, DAKOSY_Worker.cDY_Statusliste.S_03)
|
||||||
|
If SENDUNG IsNot Nothing Then SENDUNG.SET_VGMA() ' MA Vorgeschrieben in Sendung setzen.
|
||||||
|
Else
|
||||||
|
DAKOSY_Worker.cDakosy_Statusmeldungen.InsertStatusMeldung(DY_ANM, DAKOSY_Worker.cDY_Statusliste.S_09)
|
||||||
|
MsgBox("Sendefehler!")
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
DY_ANM.UPDATE_DATA()
|
||||||
|
|
||||||
|
'Beim Senden soll die Sendung überhnommen + tblSnd_VG_MA gesetzt werden --> damit gleich gesehen wird, dass der Akt in Bearbeitung ist.
|
||||||
|
DY_ANM.UPDATE_AVISO_SND(DY_ANM.dy_SendungsId)
|
||||||
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
End If
|
||||||
|
'--------------------------------------------------------------------------------
|
||||||
|
'--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
'ncts_OUT.DELETE_HouseConsignment()
|
'ncts_OUT.DELETE_HouseConsignment()
|
||||||
|
|
||||||
|
|
||||||
@@ -649,6 +727,72 @@ Public Class usrCntlATLAS_NCTS004
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
|
Shared Function genNCTSfromStammref(CONTROL As Control, FIRMA_DY As String, AVISO As cAviso, SENDUNG As cSendungen, ByRef BezugsNr As String) As DAKOSY_Worker.cDakosyNCTSOut004
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Dim NCTS_OUT As New DAKOSY_Worker.cDakosyNCTSOut004
|
||||||
|
|
||||||
|
Dim f As New frmDakosyStammreferenz("DE", "NCTS", False,,, FIRMA_DY)
|
||||||
|
Dim Stammreferenz = Nothing
|
||||||
|
f.selectForEXG = True
|
||||||
|
If f.ShowDialog(CONTROL.FindForm) Then
|
||||||
|
Stammreferenz = f.STAMMREF
|
||||||
|
' sentToDakosy = f.sentToDakosy
|
||||||
|
End If
|
||||||
|
Try
|
||||||
|
|
||||||
|
If BezugsNr = "" Then BezugsNr = usrCntlATLAS_NCTS004.getBezugsnr(FIRMA_DY, SENDUNG, BezugsNr, "")
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
MsgBox(ex.Message & ex.StackTrace)
|
||||||
|
End Try
|
||||||
|
NCTS_OUT = cDakosyNCTSOut004.LOADByBezugsNr(BezugsNr, True)
|
||||||
|
If True Then 'NCTS_OUT Is Nothing Then
|
||||||
|
|
||||||
|
Dim cDy_ART = "T2"
|
||||||
|
Select Case (SENDUNG.tblSnd_Abfertigungsart_ID)
|
||||||
|
Case 5 : cDy_ART = "T1"
|
||||||
|
Case Else : cDy_ART = "T2"
|
||||||
|
End Select
|
||||||
|
|
||||||
|
|
||||||
|
Dim DY_ANM As New cDakosy_Zollanmeldungen
|
||||||
|
'If DY_ANM Is Nothing Then
|
||||||
|
' DY_ANM = New cDakosy_Zollanmeldungen(NCTS_OUT.ncts_dyaAnmID)
|
||||||
|
'End If
|
||||||
|
DY_ANM.dy_ART = cDy_ART 'cDy_ART
|
||||||
|
DY_ANM.dy_BezugsNr = BezugsNr
|
||||||
|
DY_ANM.dy_AvisoId = If(AVISO Is Nothing, Nothing, AVISO.AvisoID)
|
||||||
|
DY_ANM.dy_SendungsId = If(SENDUNG Is Nothing, Nothing, SENDUNG.tblSnd_SendungID)
|
||||||
|
'Status?
|
||||||
|
If DY_ANM.SAVE() Then 'Speichern, ID wird erzeugt
|
||||||
|
|
||||||
|
|
||||||
|
'Falls zur BezugsNr schon ein Eintrag in der DB vorhanden ist
|
||||||
|
NCTS_OUT = cDakosyNCTSOut004.LOADByAnmIDFull(f.STAMMREF_DYID, True) ' DyID --> Falls bei der Stammreferenz eine Vorlage hinterlegt ist!
|
||||||
|
If NCTS_OUT Is Nothing Then
|
||||||
|
NCTS_OUT = New cDakosyNCTSOut004
|
||||||
|
End If
|
||||||
|
|
||||||
|
NCTS_OUT.ncts_Id = -1
|
||||||
|
NCTS_OUT.ncts_dyaAnmID = DY_ANM.dy_Id
|
||||||
|
|
||||||
|
usrCntlATLAS_NCTS004.loaddataFromAVISO(AVISO, SENDUNG, cDy_ART, BezugsNr, NCTS_OUT)
|
||||||
|
'cboStammreferenz.changeItem(Stammreferenz)
|
||||||
|
|
||||||
|
If NCTS_OUT.SAVE() Then
|
||||||
|
|
||||||
|
|
||||||
|
Return NCTS_OUT
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
End If
|
||||||
|
Return Nothing
|
||||||
|
End Function
|
||||||
End Class
|
End Class
|
||||||
|
|
||||||
|
|||||||
@@ -29,34 +29,38 @@ Public Class usrCntlCBAM
|
|||||||
If txtVon._value = "" Then MsgBox("Datum von eingeben!") : Exit Sub
|
If txtVon._value = "" Then MsgBox("Datum von eingeben!") : Exit Sub
|
||||||
If txtBis._value = "" Then MsgBox("Datum bis eingeben!") : Exit Sub
|
If txtBis._value = "" Then MsgBox("Datum bis eingeben!") : Exit Sub
|
||||||
Me.Cursor = Cursors.WaitCursor
|
Me.Cursor = Cursors.WaitCursor
|
||||||
|
Dim SQLSTR_WHERE_FIRMEN = ""
|
||||||
|
If cbxVERAG.Checked Then SQLSTR_WHERE_FIRMEN &= "'SUB','WAI','SBG','NKD','NEU','AMBWO','AMB','IRU','EXP','SUW','DUR'"
|
||||||
|
If cbxIMEX.Checked Then SQLSTR_WHERE_FIRMEN &= IIf(SQLSTR_WHERE_FIRMEN <> "", ", ", "") & "'IME'"
|
||||||
|
If cbxUNISPED.Checked Then SQLSTR_WHERE_FIRMEN &= IIf(SQLSTR_WHERE_FIRMEN <> "", ", ", "") & "'ATSPED'" '???
|
||||||
'isnull( eza_anmeldedatum, eza_Trans_DatumZeit)
|
'isnull( eza_anmeldedatum, eza_Trans_DatumZeit)
|
||||||
Dim SQLSTR = "
|
Dim SQLSTR = "
|
||||||
SELECT COUNT(*) FROM [tblDakosy_EZA] inner join tblDakosy_EZA_Warenposition on ezaWP_EzaId=eza_Id
|
SELECT COUNT(distinct(Registriernummer_MRN)) FROM [tbl_DY_Zollmeldungen_Import]
|
||||||
where eza_anmeldedatum between '" & txtVon._value & "' and '" & txtBis._value & "'
|
where Überlassungsdatum between '" & txtVon._value & "' and '" & txtBis._value & "'
|
||||||
and
|
and
|
||||||
(
|
(
|
||||||
left(ezaWP_WarennummerEZT,4) IN (2523,2716,2808,2814,3102,3105,7201,7203,7318,7326,7601,7616)
|
left(Warentarifnummer,4) IN (2523,2716,2808,2814,3102,3105,7201,7203,7318,7326,7601,7616)
|
||||||
OR left(ezaWP_WarennummerEZT,4) between 7301 and 7311
|
OR left(Warentarifnummer,4) between 7301 and 7311
|
||||||
OR left(ezaWP_WarennummerEZT,4) between 7205 and 7229
|
OR left(Warentarifnummer,4) between 7205 and 7229
|
||||||
OR left(ezaWP_WarennummerEZT,4) between 7603 and 7614
|
OR left(Warentarifnummer,4) between 7603 and 7614
|
||||||
OR ezaWP_WarennummerEZT like '25070080%'
|
OR Warentarifnummer like '25070080%'
|
||||||
OR ezaWP_WarennummerEZT like '283421%'
|
OR Warentarifnummer like '283421%'
|
||||||
OR ezaWP_WarennummerEZT like '260112%'
|
OR Warentarifnummer like '260112%'
|
||||||
OR ezaWP_WarennummerEZT like '720211%'
|
OR Warentarifnummer like '720211%'
|
||||||
OR ezaWP_WarennummerEZT like '720219%'
|
OR Warentarifnummer like '720219%'
|
||||||
OR ezaWP_WarennummerEZT like '720241%'
|
OR Warentarifnummer like '720241%'
|
||||||
OR ezaWP_WarennummerEZT like '720249%'
|
OR Warentarifnummer like '720249%'
|
||||||
OR ezaWP_WarennummerEZT like '720260%'
|
OR Warentarifnummer like '720260%'
|
||||||
OR ezaWP_WarennummerEZT like '280410%'
|
OR Warentarifnummer like '280410%'
|
||||||
)
|
)
|
||||||
and ezaWP_WarennummerEZT not like '310560%'
|
and Warentarifnummer not like '310560%'
|
||||||
and (eza_status between 50 and 60 or [eza_ANR] LIKE 'ATC%')
|
|
||||||
"
|
"
|
||||||
|
|
||||||
If cbxVERAG.Checked Then
|
If SQLSTR_WHERE_FIRMEN <> "" Then
|
||||||
|
SQLSTR &= " and Teilnehmer in ( " & SQLSTR_WHERE_FIRMEN & ")"
|
||||||
SQLSTR &= "
|
SQLSTR &= "
|
||||||
and eza_VertretungsVerhaeltnisCode=2
|
and left(Art_der_Vertretung,1) IN (2)
|
||||||
"
|
"
|
||||||
Else
|
Else
|
||||||
'Die Unterabfrage hat mehr als einen Wert zurückgegeben. Das ist nicht zulässig, wenn die Unterabfrage auf =, !=, <, <=, > oder >= folgt oder als Ausdruck verwendet wird.
|
'Die Unterabfrage hat mehr als einen Wert zurückgegeben. Das ist nicht zulässig, wenn die Unterabfrage auf =, !=, <, <=, > oder >= folgt oder als Ausdruck verwendet wird.
|
||||||
@@ -65,14 +69,11 @@ Public Class usrCntlCBAM
|
|||||||
' "
|
' "
|
||||||
'korrigierte Query:
|
'korrigierte Query:
|
||||||
SQLSTR &= "
|
SQLSTR &= "
|
||||||
and EXISTS (SELECT 1 FROM tblDakosy_EZA_Adressen WHERE ezaAd_EZAId = eza_Id AND [ezaAd_AdressTyp] = 'CN' AND isnull([ezaAd_NameFirma1], [ezaAd_TeilnehmerEORI]) ='" & EORI & "')
|
and Empfänger_CN_EORI ='" & EORI & "'
|
||||||
"
|
"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Dim dt = SQL.loadDgvBySql(SQLSTR, "FMZOLL", 600)
|
Dim dt = SQL.loadDgvBySql(SQLSTR, "AVISO", 600)
|
||||||
If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then
|
If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then
|
||||||
txtCBAMPruef_DAKOSY.Text = dt.Rows(0)(0) & " Einträge"
|
txtCBAMPruef_DAKOSY.Text = dt.Rows(0)(0) & " Einträge"
|
||||||
Me.Cursor = Cursors.Default
|
Me.Cursor = Cursors.Default
|
||||||
@@ -88,6 +89,74 @@ Public Class usrCntlCBAM
|
|||||||
Me.Cursor = Cursors.Default
|
Me.Cursor = Cursors.Default
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
'Private Sub btnCBAMPruef_DAKOSY_Click(sender As Object, e As EventArgs) Handles btnCBAMPruef_DAKOSY.Click
|
||||||
|
' txtCBAMPruef_DAKOSY.Text = "-"
|
||||||
|
' Try
|
||||||
|
' Dim EORI = txtEori.Text
|
||||||
|
' If cbxVERAG.Checked Then EORI = "VERAG"
|
||||||
|
' If EORI = "" Then MsgBox("EORI eingeben!") : Exit Sub
|
||||||
|
' If txtVon._value = "" Then MsgBox("Datum von eingeben!") : Exit Sub
|
||||||
|
' If txtBis._value = "" Then MsgBox("Datum bis eingeben!") : Exit Sub
|
||||||
|
' Me.Cursor = Cursors.WaitCursor
|
||||||
|
|
||||||
|
' 'isnull( eza_anmeldedatum, eza_Trans_DatumZeit)
|
||||||
|
' Dim SQLSTR = "
|
||||||
|
' SELECT COUNT(*) FROM [tblDakosy_EZA] inner join tblDakosy_EZA_Warenposition on ezaWP_EzaId=eza_Id
|
||||||
|
' where eza_anmeldedatum between '" & txtVon._value & "' and '" & txtBis._value & "'
|
||||||
|
' and
|
||||||
|
' (
|
||||||
|
' left(ezaWP_WarennummerEZT,4) IN (2523,2716,2808,2814,3102,3105,7201,7203,7318,7326,7601,7616)
|
||||||
|
' OR left(ezaWP_WarennummerEZT,4) between 7301 and 7311
|
||||||
|
' OR left(ezaWP_WarennummerEZT,4) between 7205 and 7229
|
||||||
|
' OR left(ezaWP_WarennummerEZT,4) between 7603 and 7614
|
||||||
|
' OR ezaWP_WarennummerEZT like '25070080%'
|
||||||
|
' OR ezaWP_WarennummerEZT like '283421%'
|
||||||
|
' OR ezaWP_WarennummerEZT like '260112%'
|
||||||
|
' OR ezaWP_WarennummerEZT like '720211%'
|
||||||
|
' OR ezaWP_WarennummerEZT like '720219%'
|
||||||
|
' OR ezaWP_WarennummerEZT like '720241%'
|
||||||
|
' OR ezaWP_WarennummerEZT like '720249%'
|
||||||
|
' OR ezaWP_WarennummerEZT like '720260%'
|
||||||
|
' OR ezaWP_WarennummerEZT like '280410%'
|
||||||
|
' )
|
||||||
|
' and ezaWP_WarennummerEZT not like '310560%'
|
||||||
|
' and (eza_status between 50 and 60 or [eza_ANR] LIKE 'ATC%')
|
||||||
|
' "
|
||||||
|
|
||||||
|
' If cbxVERAG.Checked Then
|
||||||
|
' SQLSTR &= "
|
||||||
|
' and eza_VertretungsVerhaeltnisCode=2
|
||||||
|
' "
|
||||||
|
' Else
|
||||||
|
' 'Die Unterabfrage hat mehr als einen Wert zurückgegeben. Das ist nicht zulässig, wenn die Unterabfrage auf =, !=, <, <=, > oder >= folgt oder als Ausdruck verwendet wird.
|
||||||
|
' 'SQLSTR &= "
|
||||||
|
' ' and (select isnull([ezaAd_NameFirma1],[ezaAd_TeilnehmerEORI]) FROM tblDakosy_EZA_Adressen WHERE ezaAd_EZAId=eza_Id and [ezaAd_AdressTyp]='CN')='" & EORI & "'
|
||||||
|
' ' "
|
||||||
|
' 'korrigierte Query:
|
||||||
|
' SQLSTR &= "
|
||||||
|
' and EXISTS (SELECT 1 FROM tblDakosy_EZA_Adressen WHERE ezaAd_EZAId = eza_Id AND [ezaAd_AdressTyp] = 'CN' AND isnull([ezaAd_NameFirma1], [ezaAd_TeilnehmerEORI]) ='" & EORI & "')
|
||||||
|
' "
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
' End If
|
||||||
|
|
||||||
|
' Dim dt = SQL.loadDgvBySql(SQLSTR, "FMZOLL", 600)
|
||||||
|
' If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then
|
||||||
|
' txtCBAMPruef_DAKOSY.Text = dt.Rows(0)(0) & " Einträge"
|
||||||
|
' Me.Cursor = Cursors.Default
|
||||||
|
' Exit Sub
|
||||||
|
' End If
|
||||||
|
|
||||||
|
' txtCBAMPruef_DAKOSY.Text = "0"
|
||||||
|
|
||||||
|
|
||||||
|
' Catch ex As Exception
|
||||||
|
' VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
||||||
|
' End Try
|
||||||
|
' Me.Cursor = Cursors.Default
|
||||||
|
'End Sub
|
||||||
|
|
||||||
Private Sub btnCBAMPruef_ALLE_Click(sender As Object, e As EventArgs) Handles btnCBAMPruef_ALLE.Click
|
Private Sub btnCBAMPruef_ALLE_Click(sender As Object, e As EventArgs) Handles btnCBAMPruef_ALLE.Click
|
||||||
btnCBAMPruef_DAKOSY.PerformClick()
|
btnCBAMPruef_DAKOSY.PerformClick()
|
||||||
btnCBAMPruef_DHF_VERAG.PerformClick()
|
btnCBAMPruef_DHF_VERAG.PerformClick()
|
||||||
@@ -337,9 +406,9 @@ Public Class usrCntlCBAM
|
|||||||
btnCBAM_DS_DAKOSY_Deteil.Tag = ""
|
btnCBAM_DS_DAKOSY_Deteil.Tag = ""
|
||||||
|
|
||||||
Dim SQLSTR_WHERE_FIRMEN = ""
|
Dim SQLSTR_WHERE_FIRMEN = ""
|
||||||
If cbxVERAG.Checked Then SQLSTR_WHERE_FIRMEN &= "'VERAG'"
|
If cbxVERAG.Checked Then SQLSTR_WHERE_FIRMEN &= "'SUB','WAI','SBG','NKD','NEU','AMBWO','AMB','IRU','EXP','SUW','DUR'"
|
||||||
If cbxIMEX.Checked Then SQLSTR_WHERE_FIRMEN &= IIf(SQLSTR_WHERE_FIRMEN <> "", ", ", "") & "'IMEX'"
|
If cbxIMEX.Checked Then SQLSTR_WHERE_FIRMEN &= IIf(SQLSTR_WHERE_FIRMEN <> "", ", ", "") & "'IME'"
|
||||||
If cbxUNISPED.Checked Then SQLSTR_WHERE_FIRMEN &= IIf(SQLSTR_WHERE_FIRMEN <> "", ", ", "") & "'UNISPED'"
|
If cbxUNISPED.Checked Then SQLSTR_WHERE_FIRMEN &= IIf(SQLSTR_WHERE_FIRMEN <> "", ", ", "") & "'ATSPED'" '???
|
||||||
|
|
||||||
Try
|
Try
|
||||||
Dim EORI = txtEori.Text
|
Dim EORI = txtEori.Text
|
||||||
@@ -352,50 +421,53 @@ Public Class usrCntlCBAM
|
|||||||
|
|
||||||
Dim SQLSTR = "
|
Dim SQLSTR = "
|
||||||
SELECT
|
SELECT
|
||||||
[eza_ANR] RegistriernummerATLAS
|
[Registriernummer_MRN] RegistriernummerATLAS
|
||||||
,ezaWP_PositionsNummer PositionsNummer
|
,PositionNo PositionsNummer
|
||||||
,isnull( eza_anmeldedatum, eza_Trans_DatumZeit) Anmeldedatum
|
,max(Überlassungsdatum) Anmeldedatum
|
||||||
,[eza_ObjectName] BezugsNr
|
,max([Bezugsnummer_LRN]) BezugsNr
|
||||||
,[eza_VertretungsVerhaeltnisCode] VertretungsVerhaeltnis
|
,max([Art_der_Vertretung]) VertretungsVerhaeltnis
|
||||||
,ezaWP_WarennummerEZT Tarifnummer
|
,max(Warentarifnummer) Tarifnummer
|
||||||
,ezaWP_Eigenmasse Eigenmasse
|
,max(Eigenmasse) Eigenmasse
|
||||||
,[eza_VersendungsLandCode] VersendungsLand
|
,max([VersendungsLand]) VersendungsLand
|
||||||
,[eza_Bestimmungsland] Bestimmungsland
|
,'DE' Bestimmungsland
|
||||||
,[ezaWP_Artikelpreis]Rechnungspreis
|
,max([Rechnungsbetrag])Rechnungspreis
|
||||||
,[ezaWP_ArtikelpreisWaehrung] Rechnungswaehrung
|
,max([Rechnungswährung]) Rechnungswaehrung
|
||||||
,(select isnull([ezaAd_NameFirma1],[ezaAd_TeilnehmerEORI]) FROM tblDakosy_EZA_Adressen WHERE ezaAd_EZAId=eza_Id and [ezaAd_AdressTyp]='CN') as Empfänger
|
,isnull(max(Empfänger_CN_EORI),'') as EmpfängerEORI
|
||||||
,(select isnull([ezaAd_NameFirma1],[ezaAd_TeilnehmerEORI]) FROM tblDakosy_EZA_Adressen WHERE ezaAd_EZAId=eza_Id and [ezaAd_AdressTyp]='CZ') as Absender
|
,isnull(max(CZ_Name), '') as Empfänger
|
||||||
|
,isnull(max(Versender_CZ_EORI),'') as AbsenderEORI
|
||||||
|
,isnull(max(CN_Name), '') as Absender
|
||||||
|
|
||||||
FROM [VERAG].[dbo].[tblDakosy_EZA]
|
FROM [tbl_DY_Zollmeldungen_Import]
|
||||||
inner join tblDakosy_EZA_Warenposition on ezaWP_EzaId=eza_Id
|
|
||||||
where
|
where
|
||||||
eza_anmeldedatum between '" & txtVon._value & "' and '" & txtBis._value & "'
|
Überlassungsdatum between '" & txtVon._value & "' and '" & txtBis._value & "'
|
||||||
and
|
and
|
||||||
(
|
(
|
||||||
left(ezaWP_WarennummerEZT,4) IN (2523,2716,2808,2814,3102,3105,7201,7203,7318,7326,7601,7616)
|
left(Warentarifnummer,4) IN (2523,2716,2808,2814,3102,3105,7201,7203,7318,7326,7601,7616)
|
||||||
OR left(ezaWP_WarennummerEZT,4) between 7301 and 7311
|
OR left(Warentarifnummer,4) between 7301 and 7311
|
||||||
OR left(ezaWP_WarennummerEZT,4) between 7205 and 7229
|
OR left(Warentarifnummer,4) between 7205 and 7229
|
||||||
OR left(ezaWP_WarennummerEZT,4) between 7603 and 7614
|
OR left(Warentarifnummer,4) between 7603 and 7614
|
||||||
OR ezaWP_WarennummerEZT like '25070080%'
|
OR Warentarifnummer like '25070080%'
|
||||||
OR ezaWP_WarennummerEZT like '283421%'
|
OR Warentarifnummer like '283421%'
|
||||||
OR ezaWP_WarennummerEZT like '260112%'
|
OR Warentarifnummer like '260112%'
|
||||||
OR ezaWP_WarennummerEZT like '720211%'
|
OR Warentarifnummer like '720211%'
|
||||||
OR ezaWP_WarennummerEZT like '720219%'
|
OR Warentarifnummer like '720219%'
|
||||||
OR ezaWP_WarennummerEZT like '720241%'
|
OR Warentarifnummer like '720241%'
|
||||||
OR ezaWP_WarennummerEZT like '720249%'
|
OR Warentarifnummer like '720249%'
|
||||||
OR ezaWP_WarennummerEZT like '720260%'
|
OR Warentarifnummer like '720260%'
|
||||||
OR ezaWP_WarennummerEZT like '280410%'
|
OR Warentarifnummer like '280410%'
|
||||||
)
|
)
|
||||||
and ezaWP_WarennummerEZT not like '310560%'
|
and Warentarifnummer not like '310560%'
|
||||||
and (eza_status between 50 and 60 or [eza_ANR] LIKE 'ATC%')
|
|
||||||
|
|
||||||
"
|
"
|
||||||
|
|
||||||
|
|
||||||
If cbxVERAG.Checked Or cbxIMEX.Checked Or cbxUNISPED.Checked Then
|
|
||||||
|
If SQLSTR_WHERE_FIRMEN <> "" Then
|
||||||
|
SQLSTR &= " and Teilnehmer in ( " & SQLSTR_WHERE_FIRMEN & ")"
|
||||||
SQLSTR &= "
|
SQLSTR &= "
|
||||||
and eza_VertretungsVerhaeltnisCode=2
|
and left(Art_der_Vertretung,1) IN (2)
|
||||||
"
|
"
|
||||||
|
|
||||||
Else
|
Else
|
||||||
'Das ist nicht zulässig, wenn die Unterabfrage auf =, !=, <, <=, > oder >= folgt oder als Ausdruck verwendet wird.
|
'Das ist nicht zulässig, wenn die Unterabfrage auf =, !=, <, <=, > oder >= folgt oder als Ausdruck verwendet wird.
|
||||||
|
|
||||||
@@ -404,17 +476,17 @@ Public Class usrCntlCBAM
|
|||||||
' "
|
' "
|
||||||
|
|
||||||
SQLSTR &= "
|
SQLSTR &= "
|
||||||
and EXISTS (select 1 FROM tblDakosy_EZA_Adressen WHERE ezaAd_EZAId=eza_Id and [ezaAd_AdressTyp]='CN' AND isnull([ezaAd_NameFirma1],[ezaAd_TeilnehmerEORI])='" & EORI & "')
|
and Empfänger_CN_EORI='" & EORI & "'
|
||||||
"
|
"
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If SQLSTR_WHERE_FIRMEN <> "" Then SQLSTR &= " and EZA_firma in ( " & SQLSTR_WHERE_FIRMEN & ")"
|
SQLSTR &= " group by Registriernummer_MRN,PositionNo"
|
||||||
|
|
||||||
SQLSTR &= " order by Absender,eza_ANR, tblDakosy_EZA_Warenposition.ezaWP_PositionsNummer"
|
SQLSTR &= " order by Absender,Registriernummer_MRN, PositionNo"
|
||||||
|
|
||||||
|
|
||||||
Dim dt = SQL.loadDgvBySql(SQLSTR, "FMZOLL", 600)
|
Dim dt = SQL.loadDgvBySql(SQLSTR, "AVISO", 600)
|
||||||
MsgBox(SQLSTR)
|
' MsgBox(SQLSTR)
|
||||||
If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then
|
If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then
|
||||||
Dim path = VERAG_PROG_ALLGEMEIN.cProgramFunctions.genExcelFromDT_NEW(dt,,,,, False, EORI & "_Detailbericht_" & txtVon._value & "-" & txtBis._value)
|
Dim path = VERAG_PROG_ALLGEMEIN.cProgramFunctions.genExcelFromDT_NEW(dt,,,,, False, EORI & "_Detailbericht_" & txtVon._value & "-" & txtBis._value)
|
||||||
btnCBAM_DS_DAKOSY_Deteil.Tag = path
|
btnCBAM_DS_DAKOSY_Deteil.Tag = path
|
||||||
@@ -448,38 +520,57 @@ Public Class usrCntlCBAM
|
|||||||
|
|
||||||
Dim SQLSTR = "
|
Dim SQLSTR = "
|
||||||
SELECT
|
SELECT
|
||||||
left(ezaWP_WarennummerEZT,8) Tarifnummer,sum(ezaWP_Eigenmasse)Eigenmasse,sum(ezaWP_Rohmasse)Rohmasse,sum(ezaWP_Artikelpreis)Rechnungspreis,eza_VersendungsLandCode VersendungsLand ,isnull(ezaWP_AnmeldeVErfahren,'') Verfahren,isnull([ezaWP_VerfahrensCodeVorangegangenesVerfahren],'') VorangegangenesVerfahren
|
left(Tarifnummer,8) Tarifnummer,sum(Eigenmasse)Eigenmasse,sum(Rohmasse)Rohmasse,sum(Rechnungspreis)Rechnungspreis,VersendungsLand VersendungsLand ,isnull(LEFT(Verfahren2,2),'') Verfahren,isnull(right(left(Verfahren2,4),2),'') VorangegangenesVerfahren
|
||||||
|
FROM (
|
||||||
|
SELECT
|
||||||
|
[Registriernummer_MRN] RegistriernummerATLAS
|
||||||
|
,PositionNo PositionsNummer
|
||||||
|
,max(Überlassungsdatum) Anmeldedatum
|
||||||
|
,max([Bezugsnummer_LRN]) BezugsNr
|
||||||
|
,max([Art_der_Vertretung]) VertretungsVerhaeltnis
|
||||||
|
,max(Warentarifnummer) Tarifnummer
|
||||||
|
,max(Eigenmasse) Eigenmasse
|
||||||
|
,max([VersendungsLand]) VersendungsLand
|
||||||
|
,'DE' Bestimmungsland
|
||||||
|
,max([Rechnungsbetrag])Rechnungspreis
|
||||||
|
,max([Rechnungswährung]) Rechnungswaehrung
|
||||||
|
,isnull(max(Empfänger_CN_EORI),'') as EmpfängerEORI
|
||||||
|
,isnull(max(CZ_Name), '') as Empfänger
|
||||||
|
,isnull(max(Versender_CZ_EORI),'') as AbsenderEORI
|
||||||
|
,isnull(max(CN_Name), '') as Absender
|
||||||
|
,max(Rohmasse)Rohmasse
|
||||||
|
,max(Verfahren2)Verfahren2
|
||||||
|
|
||||||
FROM [VERAG].[dbo].[tblDakosy_EZA]
|
FROM [tbl_DY_Zollmeldungen_Import]
|
||||||
inner join tblDakosy_EZA_Warenposition on ezaWP_EzaId=eza_Id
|
|
||||||
where
|
where
|
||||||
eza_anmeldedatum between '" & txtVon._value & "' and '" & txtBis._value & "'
|
Überlassungsdatum between '" & txtVon._value & "' and '" & txtBis._value & "'
|
||||||
and
|
and
|
||||||
(
|
(
|
||||||
left(ezaWP_WarennummerEZT,4) IN (2523,2716,2808,2814,3102,3105,7201,7203,7318,7326,7601,7616)
|
left(Warentarifnummer,4) IN (2523,2716,2808,2814,3102,3105,7201,7203,7318,7326,7601,7616)
|
||||||
OR left(ezaWP_WarennummerEZT,4) between 7301 and 7311
|
OR left(Warentarifnummer,4) between 7301 and 7311
|
||||||
OR left(ezaWP_WarennummerEZT,4) between 7205 and 7229
|
OR left(Warentarifnummer,4) between 7205 and 7229
|
||||||
OR left(ezaWP_WarennummerEZT,4) between 7603 and 7614
|
OR left(Warentarifnummer,4) between 7603 and 7614
|
||||||
OR ezaWP_WarennummerEZT like '25070080%'
|
OR Warentarifnummer like '25070080%'
|
||||||
OR ezaWP_WarennummerEZT like '283421%'
|
OR Warentarifnummer like '283421%'
|
||||||
OR ezaWP_WarennummerEZT like '260112%'
|
OR Warentarifnummer like '260112%'
|
||||||
OR ezaWP_WarennummerEZT like '720211%'
|
OR Warentarifnummer like '720211%'
|
||||||
OR ezaWP_WarennummerEZT like '720219%'
|
OR Warentarifnummer like '720219%'
|
||||||
OR ezaWP_WarennummerEZT like '720241%'
|
OR Warentarifnummer like '720241%'
|
||||||
OR ezaWP_WarennummerEZT like '720249%'
|
OR Warentarifnummer like '720249%'
|
||||||
OR ezaWP_WarennummerEZT like '720260%'
|
OR Warentarifnummer like '720260%'
|
||||||
OR ezaWP_WarennummerEZT like '280410%'
|
OR Warentarifnummer like '280410%'
|
||||||
|
|
||||||
)
|
)
|
||||||
and ezaWP_WarennummerEZT not like '310560%'
|
and Warentarifnummer not like '310560%'
|
||||||
and (eza_status between 50 and 60 or [eza_ANR] LIKE 'ATC%')
|
|
||||||
|
|
||||||
"
|
"
|
||||||
|
|
||||||
If cbxVERAG.Checked Or cbxIMEX.Checked Or cbxUNISPED.Checked Then
|
|
||||||
|
If SQLSTR_WHERE_FIRMEN <> "" Then
|
||||||
|
SQLSTR &= " and Teilnehmer in ( " & SQLSTR_WHERE_FIRMEN & ")"
|
||||||
SQLSTR &= "
|
SQLSTR &= "
|
||||||
and eza_VertretungsVerhaeltnisCode=2
|
and left(Art_der_Vertretung,1) IN (2)
|
||||||
"
|
"
|
||||||
|
|
||||||
Else
|
Else
|
||||||
'Die Unterabfrage hat mehr als einen Wert zurückgegeben. Das ist nicht zulässig, wenn die Unterabfrage auf =, !=, <, <=, > oder >= folgt oder als Ausdruck verwendet wird.
|
'Die Unterabfrage hat mehr als einen Wert zurückgegeben. Das ist nicht zulässig, wenn die Unterabfrage auf =, !=, <, <=, > oder >= folgt oder als Ausdruck verwendet wird.
|
||||||
'SQLSTR &= "
|
'SQLSTR &= "
|
||||||
@@ -487,17 +578,17 @@ Public Class usrCntlCBAM
|
|||||||
' "
|
' "
|
||||||
|
|
||||||
SQLSTR &= "
|
SQLSTR &= "
|
||||||
and EXISTS (select 1 FROM tblDakosy_EZA_Adressen WHERE ezaAd_EZAId=eza_Id and [ezaAd_AdressTyp]='CN' and isnull([ezaAd_NameFirma1],[ezaAd_TeilnehmerEORI])='" & EORI & "')
|
and Empfänger_CN_EORI='" & EORI & "'
|
||||||
"
|
"
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If SQLSTR_WHERE_FIRMEN <> "" Then SQLSTR &= " and EZA_firma in ( " & SQLSTR_WHERE_FIRMEN & ")"
|
SQLSTR &= " group by Registriernummer_MRN,PositionNo
|
||||||
|
) as T1 group by VersendungsLand,left(Tarifnummer,8),Verfahren2 "
|
||||||
SQLSTR &= " group by eza_VersendungsLandCode,left(ezaWP_WarennummerEZT,8),ezaWP_AnmeldeVErfahren,ezaWP_VerfahrensCodeVorangegangenesVerfahren"
|
|
||||||
|
|
||||||
|
|
||||||
Dim dt = SQL.loadDgvBySql(SQLSTR, "FMZOLL", 600)
|
|
||||||
|
Dim dt = SQL.loadDgvBySql(SQLSTR, "AVISO", 600)
|
||||||
If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then
|
If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then
|
||||||
Dim path = VERAG_PROG_ALLGEMEIN.cProgramFunctions.genExcelFromDT_NEW(dt,,,,, False, EORI & "_Summenbericht_" & txtVon._value & "-" & txtBis._value)
|
Dim path = VERAG_PROG_ALLGEMEIN.cProgramFunctions.genExcelFromDT_NEW(dt,,,,, False, EORI & "_Summenbericht_" & txtVon._value & "-" & txtBis._value)
|
||||||
btnCBAM_DS_DAKOSY_Summe.Tag = path
|
btnCBAM_DS_DAKOSY_Summe.Tag = path
|
||||||
@@ -537,6 +628,212 @@ Public Class usrCntlCBAM
|
|||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
'Private Sub btnCBAM_DS_DAKOSY_Click(sender As Object, e As EventArgs) Handles btnCBAM_DS_DAKOSY.Click
|
||||||
|
' btnCBAM_DS_DAKOSY_Deteil.Enabled = False
|
||||||
|
' btnCBAM_DS_DAKOSY_Copy.Enabled = False
|
||||||
|
' btnCBAM_DS_DAKOSY_Deteil.Tag = ""
|
||||||
|
|
||||||
|
' Dim SQLSTR_WHERE_FIRMEN = ""
|
||||||
|
' If cbxVERAG.Checked Then SQLSTR_WHERE_FIRMEN &= "'VERAG'"
|
||||||
|
' If cbxIMEX.Checked Then SQLSTR_WHERE_FIRMEN &= IIf(SQLSTR_WHERE_FIRMEN <> "", ", ", "") & "'IMEX'"
|
||||||
|
' If cbxUNISPED.Checked Then SQLSTR_WHERE_FIRMEN &= IIf(SQLSTR_WHERE_FIRMEN <> "", ", ", "") & "'UNISPED'"
|
||||||
|
|
||||||
|
' Try
|
||||||
|
' Dim EORI = txtEori.Text
|
||||||
|
' If cbxVERAG.Checked Then EORI = "VERAG"
|
||||||
|
' If EORI = "" Then MsgBox("EORI eingeben!") : Exit Sub
|
||||||
|
' If txtVon._value = "" Then MsgBox("Datum von eingeben!") : Exit Sub
|
||||||
|
' If txtBis._value = "" Then MsgBox("Datum bis eingeben!") : Exit Sub
|
||||||
|
' Me.Cursor = Cursors.WaitCursor
|
||||||
|
|
||||||
|
|
||||||
|
' Dim SQLSTR = "
|
||||||
|
' SELECT
|
||||||
|
' [eza_ANR] RegistriernummerATLAS
|
||||||
|
' ,ezaWP_PositionsNummer PositionsNummer
|
||||||
|
' ,isnull( eza_anmeldedatum, eza_Trans_DatumZeit) Anmeldedatum
|
||||||
|
' ,[eza_ObjectName] BezugsNr
|
||||||
|
' ,[eza_VertretungsVerhaeltnisCode] VertretungsVerhaeltnis
|
||||||
|
' ,ezaWP_WarennummerEZT Tarifnummer
|
||||||
|
' ,ezaWP_Eigenmasse Eigenmasse
|
||||||
|
' ,[eza_VersendungsLandCode] VersendungsLand
|
||||||
|
' ,[eza_Bestimmungsland] Bestimmungsland
|
||||||
|
' ,[ezaWP_Artikelpreis]Rechnungspreis
|
||||||
|
' ,[ezaWP_ArtikelpreisWaehrung] Rechnungswaehrung
|
||||||
|
' ,(select isnull([ezaAd_NameFirma1],[ezaAd_TeilnehmerEORI]) FROM tblDakosy_EZA_Adressen WHERE ezaAd_EZAId=eza_Id and [ezaAd_AdressTyp]='CN') as Empfänger
|
||||||
|
' ,(select isnull([ezaAd_NameFirma1],[ezaAd_TeilnehmerEORI]) FROM tblDakosy_EZA_Adressen WHERE ezaAd_EZAId=eza_Id and [ezaAd_AdressTyp]='CZ') as Absender
|
||||||
|
|
||||||
|
' FROM [VERAG].[dbo].[tblDakosy_EZA]
|
||||||
|
' inner join tblDakosy_EZA_Warenposition on ezaWP_EzaId=eza_Id
|
||||||
|
' where
|
||||||
|
' eza_anmeldedatum between '" & txtVon._value & "' and '" & txtBis._value & "'
|
||||||
|
' and
|
||||||
|
' (
|
||||||
|
' left(ezaWP_WarennummerEZT,4) IN (2523,2716,2808,2814,3102,3105,7201,7203,7318,7326,7601,7616)
|
||||||
|
' OR left(ezaWP_WarennummerEZT,4) between 7301 and 7311
|
||||||
|
' OR left(ezaWP_WarennummerEZT,4) between 7205 and 7229
|
||||||
|
' OR left(ezaWP_WarennummerEZT,4) between 7603 and 7614
|
||||||
|
' OR ezaWP_WarennummerEZT like '25070080%'
|
||||||
|
' OR ezaWP_WarennummerEZT like '283421%'
|
||||||
|
' OR ezaWP_WarennummerEZT like '260112%'
|
||||||
|
' OR ezaWP_WarennummerEZT like '720211%'
|
||||||
|
' OR ezaWP_WarennummerEZT like '720219%'
|
||||||
|
' OR ezaWP_WarennummerEZT like '720241%'
|
||||||
|
' OR ezaWP_WarennummerEZT like '720249%'
|
||||||
|
' OR ezaWP_WarennummerEZT like '720260%'
|
||||||
|
' OR ezaWP_WarennummerEZT like '280410%'
|
||||||
|
' )
|
||||||
|
' and ezaWP_WarennummerEZT not like '310560%'
|
||||||
|
' and (eza_status between 50 and 60 or [eza_ANR] LIKE 'ATC%')
|
||||||
|
|
||||||
|
' "
|
||||||
|
|
||||||
|
|
||||||
|
' If cbxVERAG.Checked Or cbxIMEX.Checked Or cbxUNISPED.Checked Then
|
||||||
|
' SQLSTR &= "
|
||||||
|
' and eza_VertretungsVerhaeltnisCode=2
|
||||||
|
' "
|
||||||
|
' Else
|
||||||
|
' 'Das ist nicht zulässig, wenn die Unterabfrage auf =, !=, <, <=, > oder >= folgt oder als Ausdruck verwendet wird.
|
||||||
|
|
||||||
|
' 'SQLSTR &= "
|
||||||
|
' ' and (select isnull([ezaAd_NameFirma1],[ezaAd_TeilnehmerEORI]) FROM tblDakosy_EZA_Adressen WHERE ezaAd_EZAId=eza_Id and [ezaAd_AdressTyp]='CN')='" & EORI & "'
|
||||||
|
' ' "
|
||||||
|
|
||||||
|
' SQLSTR &= "
|
||||||
|
' and EXISTS (select 1 FROM tblDakosy_EZA_Adressen WHERE ezaAd_EZAId=eza_Id and [ezaAd_AdressTyp]='CN' AND isnull([ezaAd_NameFirma1],[ezaAd_TeilnehmerEORI])='" & EORI & "')
|
||||||
|
' "
|
||||||
|
' End If
|
||||||
|
|
||||||
|
' If SQLSTR_WHERE_FIRMEN <> "" Then SQLSTR &= " and EZA_firma in ( " & SQLSTR_WHERE_FIRMEN & ")"
|
||||||
|
|
||||||
|
' SQLSTR &= " order by Absender,eza_ANR, tblDakosy_EZA_Warenposition.ezaWP_PositionsNummer"
|
||||||
|
|
||||||
|
|
||||||
|
' Dim dt = SQL.loadDgvBySql(SQLSTR, "FMZOLL", 600)
|
||||||
|
' MsgBox(SQLSTR)
|
||||||
|
' If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then
|
||||||
|
' Dim path = VERAG_PROG_ALLGEMEIN.cProgramFunctions.genExcelFromDT_NEW(dt,,,,, False, EORI & "_Detailbericht_" & txtVon._value & "-" & txtBis._value)
|
||||||
|
' btnCBAM_DS_DAKOSY_Deteil.Tag = path
|
||||||
|
' btnCBAM_DS_DAKOSY_Deteil.Enabled = True
|
||||||
|
' btnCBAM_DS_DAKOSY_Copy.Enabled = True
|
||||||
|
' Me.Cursor = Cursors.Default
|
||||||
|
|
||||||
|
' End If
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
' Catch ex As Exception
|
||||||
|
' VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
||||||
|
' End Try
|
||||||
|
' Me.Cursor = Cursors.Default
|
||||||
|
|
||||||
|
|
||||||
|
' '-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
' btnCBAM_DS_DAKOSY_Summe.Enabled = False
|
||||||
|
' btnCBAM_DS_DAKOSY_Summe.Tag = ""
|
||||||
|
|
||||||
|
' Try
|
||||||
|
' Dim EORI = txtEori.Text
|
||||||
|
' If cbxVERAG.Checked Then EORI = "VERAG"
|
||||||
|
' If EORI = "" Then MsgBox("EORI eingeben!") : Exit Sub
|
||||||
|
' If txtVon._value = "" Then MsgBox("Datum von eingeben!") : Exit Sub
|
||||||
|
' If txtBis._value = "" Then MsgBox("Datum bis eingeben!") : Exit Sub
|
||||||
|
' Me.Cursor = Cursors.WaitCursor
|
||||||
|
|
||||||
|
' Dim SQLSTR = "
|
||||||
|
' SELECT
|
||||||
|
' left(ezaWP_WarennummerEZT,8) Tarifnummer,sum(ezaWP_Eigenmasse)Eigenmasse,sum(ezaWP_Rohmasse)Rohmasse,sum(ezaWP_Artikelpreis)Rechnungspreis,eza_VersendungsLandCode VersendungsLand ,isnull(ezaWP_AnmeldeVErfahren,'') Verfahren,isnull([ezaWP_VerfahrensCodeVorangegangenesVerfahren],'') VorangegangenesVerfahren
|
||||||
|
|
||||||
|
' FROM [VERAG].[dbo].[tblDakosy_EZA]
|
||||||
|
' inner join tblDakosy_EZA_Warenposition on ezaWP_EzaId=eza_Id
|
||||||
|
' where
|
||||||
|
' eza_anmeldedatum between '" & txtVon._value & "' and '" & txtBis._value & "'
|
||||||
|
' and
|
||||||
|
' (
|
||||||
|
' left(ezaWP_WarennummerEZT,4) IN (2523,2716,2808,2814,3102,3105,7201,7203,7318,7326,7601,7616)
|
||||||
|
' OR left(ezaWP_WarennummerEZT,4) between 7301 and 7311
|
||||||
|
' OR left(ezaWP_WarennummerEZT,4) between 7205 and 7229
|
||||||
|
' OR left(ezaWP_WarennummerEZT,4) between 7603 and 7614
|
||||||
|
' OR ezaWP_WarennummerEZT like '25070080%'
|
||||||
|
' OR ezaWP_WarennummerEZT like '283421%'
|
||||||
|
' OR ezaWP_WarennummerEZT like '260112%'
|
||||||
|
' OR ezaWP_WarennummerEZT like '720211%'
|
||||||
|
' OR ezaWP_WarennummerEZT like '720219%'
|
||||||
|
' OR ezaWP_WarennummerEZT like '720241%'
|
||||||
|
' OR ezaWP_WarennummerEZT like '720249%'
|
||||||
|
' OR ezaWP_WarennummerEZT like '720260%'
|
||||||
|
' OR ezaWP_WarennummerEZT like '280410%'
|
||||||
|
|
||||||
|
' )
|
||||||
|
' and ezaWP_WarennummerEZT not like '310560%'
|
||||||
|
' and (eza_status between 50 and 60 or [eza_ANR] LIKE 'ATC%')
|
||||||
|
|
||||||
|
' "
|
||||||
|
|
||||||
|
' If cbxVERAG.Checked Or cbxIMEX.Checked Or cbxUNISPED.Checked Then
|
||||||
|
' SQLSTR &= "
|
||||||
|
' and eza_VertretungsVerhaeltnisCode=2
|
||||||
|
' "
|
||||||
|
' Else
|
||||||
|
' 'Die Unterabfrage hat mehr als einen Wert zurückgegeben. Das ist nicht zulässig, wenn die Unterabfrage auf =, !=, <, <=, > oder >= folgt oder als Ausdruck verwendet wird.
|
||||||
|
' 'SQLSTR &= "
|
||||||
|
' ' and (select isnull([ezaAd_NameFirma1],[ezaAd_TeilnehmerEORI]) FROM tblDakosy_EZA_Adressen WHERE ezaAd_EZAId=eza_Id and [ezaAd_AdressTyp]='CN')='" & EORI & "'
|
||||||
|
' ' "
|
||||||
|
|
||||||
|
' SQLSTR &= "
|
||||||
|
' and EXISTS (select 1 FROM tblDakosy_EZA_Adressen WHERE ezaAd_EZAId=eza_Id and [ezaAd_AdressTyp]='CN' and isnull([ezaAd_NameFirma1],[ezaAd_TeilnehmerEORI])='" & EORI & "')
|
||||||
|
' "
|
||||||
|
|
||||||
|
' End If
|
||||||
|
|
||||||
|
' If SQLSTR_WHERE_FIRMEN <> "" Then SQLSTR &= " and EZA_firma in ( " & SQLSTR_WHERE_FIRMEN & ")"
|
||||||
|
|
||||||
|
' SQLSTR &= " group by eza_VersendungsLandCode,left(ezaWP_WarennummerEZT,8),ezaWP_AnmeldeVErfahren,ezaWP_VerfahrensCodeVorangegangenesVerfahren"
|
||||||
|
|
||||||
|
|
||||||
|
' Dim dt = SQL.loadDgvBySql(SQLSTR, "FMZOLL", 600)
|
||||||
|
' If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then
|
||||||
|
' Dim path = VERAG_PROG_ALLGEMEIN.cProgramFunctions.genExcelFromDT_NEW(dt,,,,, False, EORI & "_Summenbericht_" & txtVon._value & "-" & txtBis._value)
|
||||||
|
' btnCBAM_DS_DAKOSY_Summe.Tag = path
|
||||||
|
' btnCBAM_DS_DAKOSY_Summe.Enabled = True
|
||||||
|
' btnCBAM_DS_DAKOSY_Copy.Enabled = True
|
||||||
|
|
||||||
|
' Me.Cursor = Cursors.Default
|
||||||
|
|
||||||
|
' End If
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
' ''----- XML ----------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
' 'btnCBAM_DS_DAKOSY_XML.Enabled = False
|
||||||
|
' 'btnCBAM_DS_DAKOSY_XML.Tag = ""
|
||||||
|
|
||||||
|
' 'If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then
|
||||||
|
' ' '---------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
' ' doCBAM_XML(dt, EORI)
|
||||||
|
' ' '---------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
' 'End If
|
||||||
|
|
||||||
|
|
||||||
|
' ''---------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
' Catch ex As Exception
|
||||||
|
' VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
||||||
|
' End Try
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
' Me.Cursor = Cursors.Default
|
||||||
|
|
||||||
|
'End Sub
|
||||||
|
|
||||||
Private Sub ButtonXML_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
Private Sub ButtonXML_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
||||||
Button2.Enabled = False
|
Button2.Enabled = False
|
||||||
btnCBAM_DS_DAKOSY_XML.Enabled = False
|
btnCBAM_DS_DAKOSY_XML.Enabled = False
|
||||||
|
|||||||
@@ -333,7 +333,7 @@ Public Class cHMRC
|
|||||||
' genGVMS_GMR(AccessToken)
|
' genGVMS_GMR(AccessToken)
|
||||||
'End If
|
'End If
|
||||||
End Sub
|
End Sub
|
||||||
Shared Sub grantAccess(ByRef AccessToken, scope, HMRC_APPLICATION)
|
Shared Sub grantAccess(ByRef AccessToken, ByRef RefreshToken, scope, HMRC_APPLICATION)
|
||||||
Try
|
Try
|
||||||
VERAG_PROG_ALLGEMEIN.cChilkat_Helper.UnlockCilkat()
|
VERAG_PROG_ALLGEMEIN.cChilkat_Helper.UnlockCilkat()
|
||||||
|
|
||||||
@@ -458,6 +458,7 @@ Public Class cHMRC
|
|||||||
' MsgBox("OAuth2 authorization granted!")
|
' MsgBox("OAuth2 authorization granted!")
|
||||||
Debug.WriteLine("OAuth2 authorization granted!")
|
Debug.WriteLine("OAuth2 authorization granted!")
|
||||||
Debug.WriteLine("Access Token = " & oauth2.AccessToken)
|
Debug.WriteLine("Access Token = " & oauth2.AccessToken)
|
||||||
|
Debug.WriteLine("Refresh Token = " & oauth2.RefreshToken)
|
||||||
Dim json As Chilkat.JsonObject = New Chilkat.JsonObject()
|
Dim json As Chilkat.JsonObject = New Chilkat.JsonObject()
|
||||||
json.Load(oauth2.AccessTokenResponse)
|
json.Load(oauth2.AccessTokenResponse)
|
||||||
json.EmitCompact = False
|
json.EmitCompact = False
|
||||||
@@ -495,6 +496,10 @@ Public Class cHMRC
|
|||||||
'fac.WriteEntireTextFile("qa_data/tokens/hmrc.json", json.Emit(), "utf-8", False)
|
'fac.WriteEntireTextFile("qa_data/tokens/hmrc.json", json.Emit(), "utf-8", False)
|
||||||
' fac.WriteEntireTextFile("C:\Users\DEVELOPER1\Desktop\hmrc.json", json.Emit(), "utf-8", False)
|
' fac.WriteEntireTextFile("C:\Users\DEVELOPER1\Desktop\hmrc.json", json.Emit(), "utf-8", False)
|
||||||
AccessToken = oauth2.AccessToken
|
AccessToken = oauth2.AccessToken
|
||||||
|
RefreshToken = oauth2.RefreshToken
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
||||||
End Try
|
End Try
|
||||||
@@ -503,7 +508,7 @@ Public Class cHMRC
|
|||||||
|
|
||||||
Shared Sub HMRC_RefreshToken(ByRef TOKEN As cHMRCToken, HMRC_APPLICATION As String)
|
Shared Sub HMRC_RefreshToken(ByRef TOKEN As cHMRCToken, HMRC_APPLICATION As String)
|
||||||
|
|
||||||
If DateDiff(DateInterval.Minute, TOKEN.token_refresh_datetime, Now) < 230 Then 'bis 240 MIN / 4hr
|
If DateDiff(DateInterval.Minute, TOKEN.token_accestoken_datetime, Now) < 230 Then 'bis 240 MIN / 4hr
|
||||||
'Token ist noch frisch
|
'Token ist noch frisch
|
||||||
Exit Sub
|
Exit Sub
|
||||||
End If
|
End If
|
||||||
@@ -527,11 +532,10 @@ Public Class cHMRC
|
|||||||
Dim CREDENTIALS = getCredentials(HMRC_APPLICATION)
|
Dim CREDENTIALS = getCredentials(HMRC_APPLICATION)
|
||||||
|
|
||||||
|
|
||||||
Dim TOKEN_NEW = ""
|
|
||||||
req.AddParam("client_secret", CREDENTIALS.CLIENT_SECRET)
|
req.AddParam("client_secret", CREDENTIALS.CLIENT_SECRET)
|
||||||
req.AddParam("client_id", CREDENTIALS.CLIENT_ID)
|
req.AddParam("client_id", CREDENTIALS.CLIENT_ID)
|
||||||
req.AddParam("grant_type", "client_credentials")
|
req.AddParam("grant_type", "client_credentials")
|
||||||
req.AddParam("refresh_token", TOKEN_NEW)
|
req.AddParam("refresh_token", TOKEN.token_REFRESH_TOKEN)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -565,8 +569,9 @@ Public Class cHMRC
|
|||||||
'json.EmitCompact = False
|
'json.EmitCompact = False
|
||||||
'json.WriteFile(tokenFile)
|
'json.WriteFile(tokenFile)
|
||||||
|
|
||||||
TOKEN.token_BEARER_TOKEN = If(accessToken <> "", accessToken, newRefreshToken)
|
TOKEN.token_REFRESH_TOKEN = newRefreshToken
|
||||||
TOKEN.token_refresh_datetime = Now
|
TOKEN.token_BEARER_TOKEN = accessToken
|
||||||
|
TOKEN.token_accestoken_datetime = Now
|
||||||
TOKEN.SAVE()
|
TOKEN.SAVE()
|
||||||
|
|
||||||
Console.WriteLine("Tokens wurden in TokenDB gespeichert.")
|
Console.WriteLine("Tokens wurden in TokenDB gespeichert.")
|
||||||
@@ -1538,13 +1543,18 @@ Public Class cHMRC
|
|||||||
|
|
||||||
|
|
||||||
If forceNewToken OrElse TOKEN.hasEntry = False OrElse TOKEN.token_BEARER_TOKEN Is Nothing OrElse TOKEN.token_BEARER_TOKEN = "" Then
|
If forceNewToken OrElse TOKEN.hasEntry = False OrElse TOKEN.token_BEARER_TOKEN Is Nothing OrElse TOKEN.token_BEARER_TOKEN = "" Then
|
||||||
|
'Neuer Token
|
||||||
Dim AccessToken = ""
|
Dim AccessToken = ""
|
||||||
grantAccess(AccessToken, appl, HMRC_APPLICATION)
|
Dim RefreshToken = ""
|
||||||
|
grantAccess(AccessToken, RefreshToken, appl, HMRC_APPLICATION)
|
||||||
TOKEN.token_Application = APPLICATION
|
TOKEN.token_Application = APPLICATION
|
||||||
TOKEN.token_BEARER_TOKEN = AccessToken
|
TOKEN.token_BEARER_TOKEN = AccessToken
|
||||||
|
TOKEN.token_REFRESH_TOKEN = RefreshToken
|
||||||
TOKEN.token_refresh_datetime = Now
|
TOKEN.token_refresh_datetime = Now
|
||||||
|
TOKEN.token_accestoken_datetime = Now
|
||||||
TOKEN.SAVE()
|
TOKEN.SAVE()
|
||||||
Else
|
Else
|
||||||
|
'Refresh
|
||||||
HMRC_RefreshToken(TOKEN, HMRC_APPLICATION)
|
HMRC_RefreshToken(TOKEN, HMRC_APPLICATION)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|||||||
@@ -3,12 +3,13 @@ Imports System.Reflection
|
|||||||
|
|
||||||
Public Class cHMRCToken
|
Public Class cHMRCToken
|
||||||
Property token_id As Integer
|
Property token_id As Integer
|
||||||
Property token_BEARER_TOKEN As String = ""
|
Property token_BEARER_TOKEN As String = "" 'Accesstoken
|
||||||
Property token_datetime As Date = Now
|
Property token_datetime As Date = Now
|
||||||
Property token_Firma As String = VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA
|
Property token_Firma As String = VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA
|
||||||
Property token_Application As String = ""
|
Property token_Application As String = ""
|
||||||
Property token_refresh_datetime As Object = Nothing
|
Property token_refresh_datetime As Object = Nothing ' tmstmp für generelles refresh -> 18 Monate
|
||||||
|
Property token_accestoken_datetime As Object = Nothing ' Accesstoken 4 Std gültig
|
||||||
|
Property token_REFRESH_TOKEN As Object = Nothing ' wird wirds refresh benötigt
|
||||||
|
|
||||||
|
|
||||||
Public hasEntry = False
|
Public hasEntry = False
|
||||||
@@ -32,6 +33,8 @@ Public Class cHMRCToken
|
|||||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("token_Firma", token_Firma))
|
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("token_Firma", token_Firma))
|
||||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("token_Application", token_Application))
|
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("token_Application", token_Application))
|
||||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("token_refresh_datetime", token_refresh_datetime))
|
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("token_refresh_datetime", token_refresh_datetime))
|
||||||
|
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("token_accestoken_datetime", token_accestoken_datetime))
|
||||||
|
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("token_REFRESH_TOKEN", token_REFRESH_TOKEN))
|
||||||
|
|
||||||
Return list
|
Return list
|
||||||
End Function
|
End Function
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ Public Class cHMRC_ENS
|
|||||||
|
|
||||||
Return False
|
Return False
|
||||||
End Function
|
End Function
|
||||||
Shared Function insertENS(ENS_CC315A As CC315AType, ByVal responseStr As String) As Boolean
|
Shared Function insertENS(ENS_CC315A As CC315AType, ByVal responseStr As String, Optional forceRefrehtoken As Boolean = False) As Boolean
|
||||||
Try
|
Try
|
||||||
' Chilkat-Objekt initialisieren
|
' Chilkat-Objekt initialisieren
|
||||||
' Dim http As New Chilkat.Http()
|
' Dim http As New Chilkat.Http()
|
||||||
@@ -128,7 +128,7 @@ Public Class cHMRC_ENS
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
Dim TOKEN = cHMRC.getTOKEN("ENS")
|
Dim TOKEN = cHMRC.getTOKEN("ENS", forceRefrehtoken)
|
||||||
|
|
||||||
If TOKEN.hasEntry Then
|
If TOKEN.hasEntry Then
|
||||||
|
|
||||||
@@ -143,13 +143,22 @@ Public Class cHMRC_ENS
|
|||||||
http.SetRequestHeader("Accept", "application/vnd.hmrc.1.0+xml")
|
http.SetRequestHeader("Accept", "application/vnd.hmrc.1.0+xml")
|
||||||
|
|
||||||
' Setzen des Content-Type-Headers für die Anfrage
|
' Setzen des Content-Type-Headers für die Anfrage
|
||||||
|
|
||||||
|
If cHMRC_ENS.TEST Then
|
||||||
|
Dim mode = "Accept"
|
||||||
|
http.SetRequestHeader("simulateRiskingResponse", mode)
|
||||||
|
http.SetRequestHeader("simulateInterventionResponse", True)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
End If
|
||||||
http.SetRequestHeader("Content-Type", "application/xml; charset=UTF-8")
|
http.SetRequestHeader("Content-Type", "application/xml; charset=UTF-8")
|
||||||
|
|
||||||
' Definieren Sie die URL für die POST-Anfrage
|
' Definieren Sie die URL für die POST-Anfrage
|
||||||
Dim urlHTTP As String = url & "/customs/imports/declarations"
|
Dim urlHTTP As String = url & "/customs/imports/declarations"
|
||||||
Dim xmlContent As String = ENS_CC315A.Serialize
|
Dim xmlContent As String = ENS_CC315A.Serialize
|
||||||
|
|
||||||
' xmlContent = File.ReadAllText("D:\Andreas\TMP\CC315A_Example1.xml")
|
xmlContent = File.ReadAllText("D:\Andreas\TMP\CC315A_Example1.xml")
|
||||||
|
|
||||||
MsgBox(xmlContent)
|
MsgBox(xmlContent)
|
||||||
' Senden Sie die POST-Anfrage mit dem XML-Inhalt
|
' Senden Sie die POST-Anfrage mit dem XML-Inhalt
|
||||||
@@ -275,31 +284,46 @@ Public Class cHMRC_ENS
|
|||||||
|
|
||||||
|
|
||||||
' Erstellen Sie eine Instanz des Http-Objekts
|
' Erstellen Sie eine Instanz des Http-Objekts
|
||||||
Dim http As New Chilkat.Http()
|
Dim http As New Chilkat.Http
|
||||||
|
|
||||||
' Authentifizierung: Setzen des Bearer-Tokens
|
|
||||||
http.AuthToken = TOKEN.token_BEARER_TOKEN
|
' Token hinzufügen (z. B. Bearer Token für Authentifizierung)
|
||||||
|
http.SetRequestHeader("Authorization", "Bearer " & TOKEN.token_BEARER_TOKEN)
|
||||||
|
|
||||||
' Setzen des Accept-Headers für die erwartete Antwort im XML-Format
|
' Setzen des Accept-Headers für die erwartete Antwort im XML-Format
|
||||||
http.SetRequestHeader("Accept", "application/vnd.hmrc.1.0+xml")
|
http.SetRequestHeader("Accept", "application/vnd.hmrc.1.0+xml")
|
||||||
|
|
||||||
' Setzen des Content-Type-Headers (kann erforderlich sein)
|
' Setzen des Content-Type-Headers (kann erforderlich sein)
|
||||||
http.SetRequestHeader("Content-Type", "application/xml")
|
http.SetRequestHeader("Content-Type", "application/xml; charset=UTF-8")
|
||||||
|
|
||||||
|
If cHMRC_ENS.TEST Then
|
||||||
|
Dim mode = "Accept"
|
||||||
|
http.SetRequestHeader("simulateRiskingResponse", mode)
|
||||||
|
End If
|
||||||
|
|
||||||
' Definieren Sie die URL für die PUT-Anfrage
|
' Definieren Sie die URL für die PUT-Anfrage
|
||||||
Dim urlHttp As String = url & "/customs/imports/declarations/{" & MRN & "}"
|
Dim urlHttp As String = url & "/customs/imports/declarations/" & MRN & ""
|
||||||
|
|
||||||
' Senden Sie die PUT-Anfrage ohne Body
|
' Senden Sie die PUT-Anfrage ohne Body
|
||||||
Dim response As Chilkat.HttpResponse = http.QuickRequest("PUT", urlHttp)
|
Dim xmlContent = File.ReadAllText("D:\Andreas\TMP\example_Amend.xml")
|
||||||
|
|
||||||
|
MsgBox(xmlContent)
|
||||||
|
' Senden Sie die POST-Anfrage mit dem XML-Inhalt
|
||||||
|
|
||||||
|
|
||||||
|
' Sende die PUT-Anfrage mit XML-Daten
|
||||||
|
|
||||||
|
Dim response As Chilkat.HttpResponse = http.PText("PUT", urlHttp, xmlContent, "utf-8", "application/xml", False, False)
|
||||||
|
' Dim response As Chilkat.HttpResponse = http.QuickRequest("PUT", urlHttp)
|
||||||
|
|
||||||
If (http.LastMethodSuccess = False) Then
|
If (http.LastMethodSuccess = False) Then
|
||||||
Console.WriteLine("❌ Fehler bei der Anfrage: " & http.LastErrorText)
|
Console.WriteLine("Fehler bei der Anfrage: " & http.LastErrorText)
|
||||||
Return False
|
Return False
|
||||||
End If
|
End If
|
||||||
|
|
||||||
' Überprüfen Sie den HTTP-Statuscode der Antwort
|
' Überprüfen Sie den HTTP-Statuscode der Antwort
|
||||||
If (response.StatusCode = 200) Then
|
If (response.StatusCode = 200) Then
|
||||||
Console.WriteLine("✅ Entry Summary Declaration erfolgreich geändert.")
|
Console.WriteLine("Entry Summary Declaration erfolgreich geändert.")
|
||||||
Console.WriteLine("Antwort:")
|
Console.WriteLine("Antwort:")
|
||||||
Console.WriteLine(response.BodyStr) ' XML-Ausgabe der Antwort
|
Console.WriteLine(response.BodyStr) ' XML-Ausgabe der Antwort
|
||||||
|
|
||||||
@@ -432,8 +456,15 @@ Public Class cHMRC_ENS
|
|||||||
http.SetRequestHeader("Accept", "application/vnd.hmrc.1.0+xml")
|
http.SetRequestHeader("Accept", "application/vnd.hmrc.1.0+xml")
|
||||||
|
|
||||||
' Definieren Sie die URL für die GET-Anfrage
|
' Definieren Sie die URL für die GET-Anfrage
|
||||||
Dim urlHttp As String = url & "/customs/imports/outcomes/{" & correlationId & "}"
|
|
||||||
|
|
||||||
|
'If cHMRC_ENS.TEST Then
|
||||||
|
' Dim mode = "Accept"
|
||||||
|
' http.SetRequestHeader("simulateRiskingResponse", mode)
|
||||||
|
'End If
|
||||||
|
|
||||||
|
|
||||||
|
Dim urlHttp As String = url & "/customs/imports/outcomes/" & correlationId & ""
|
||||||
|
MsgBox(urlHttp)
|
||||||
' Senden Sie die GET-Anfrage
|
' Senden Sie die GET-Anfrage
|
||||||
Dim response As Chilkat.HttpResponse = http.QuickRequest("GET", urlHttp)
|
Dim response As Chilkat.HttpResponse = http.QuickRequest("GET", urlHttp)
|
||||||
|
|
||||||
@@ -573,9 +604,9 @@ Public Class cHMRC_ENS
|
|||||||
http.SetRequestHeader("Content-Type", "application/xml")
|
http.SetRequestHeader("Content-Type", "application/xml")
|
||||||
|
|
||||||
' Definieren Sie die URL für die POST-Anfrage
|
' Definieren Sie die URL für die POST-Anfrage
|
||||||
Dim urlHttp As String = url & "/customs/imports/outcomes/{" & correlationId & "}"
|
Dim urlHttp As String = url & "/customs/imports/outcomes/" & correlationId & ""
|
||||||
' Senden Sie die POST-Anfrage ohne Body
|
' Senden Sie die POST-Anfrage ohne Body
|
||||||
Dim response As Chilkat.HttpResponse = http.QuickRequest("POST", urlHttp)
|
Dim response As Chilkat.HttpResponse = http.QuickRequest("DELETE", urlHttp)
|
||||||
|
|
||||||
If (http.LastMethodSuccess = False) Then
|
If (http.LastMethodSuccess = False) Then
|
||||||
Console.WriteLine("Fehler bei der Anfrage: " & http.LastErrorText)
|
Console.WriteLine("Fehler bei der Anfrage: " & http.LastErrorText)
|
||||||
@@ -583,7 +614,7 @@ Public Class cHMRC_ENS
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
' Überprüfen Sie den HTTP-Statuscode der Antwort
|
' Überprüfen Sie den HTTP-Statuscode der Antwort
|
||||||
If (response.StatusCode = 204) Then
|
If (response.StatusCode = 200) Then
|
||||||
Console.WriteLine("✅ Benachrichtigung erfolgreich bestätigt.")
|
Console.WriteLine("✅ Benachrichtigung erfolgreich bestätigt.")
|
||||||
Return True
|
Return True
|
||||||
Else
|
Else
|
||||||
@@ -747,9 +778,9 @@ Public Class cHMRC_ENS
|
|||||||
http.SetRequestHeader("Content-Type", "application/xml")
|
http.SetRequestHeader("Content-Type", "application/xml")
|
||||||
|
|
||||||
' Definieren Sie die URL für die POST-Anfrage
|
' Definieren Sie die URL für die POST-Anfrage
|
||||||
Dim urlHttp As String = url & "/customs/imports/notifications/{" & notificationID & "}/acknowledge"
|
Dim urlHttp As String = url & "/customs/imports/notifications/" & notificationID & ""
|
||||||
' Senden Sie die POST-Anfrage ohne Body
|
' Senden Sie die POST-Anfrage ohne Body
|
||||||
Dim response As Chilkat.HttpResponse = http.QuickRequest("POST", urlHttp)
|
Dim response As Chilkat.HttpResponse = http.QuickRequest("DELETE", urlHttp)
|
||||||
|
|
||||||
If (http.LastMethodSuccess = False) Then
|
If (http.LastMethodSuccess = False) Then
|
||||||
Console.WriteLine("Fehler bei der Anfrage: " & http.LastErrorText)
|
Console.WriteLine("Fehler bei der Anfrage: " & http.LastErrorText)
|
||||||
@@ -803,7 +834,8 @@ Public Class cHMRC_ENS
|
|||||||
http.SetRequestHeader("Accept", "application/vnd.hmrc.1.0+xml")
|
http.SetRequestHeader("Accept", "application/vnd.hmrc.1.0+xml")
|
||||||
|
|
||||||
' Definieren Sie die URL für die GET-Anfrage
|
' Definieren Sie die URL für die GET-Anfrage
|
||||||
Dim urlHttp As String = url & "/customs/imports/notifications/{" & notificationID & "}"
|
|
||||||
|
Dim urlHttp As String = url & "/customs/imports/notifications/" & notificationID & ""
|
||||||
|
|
||||||
' Senden Sie die GET-Anfrage
|
' Senden Sie die GET-Anfrage
|
||||||
Dim response As Chilkat.HttpResponse = http.QuickRequest("GET", urlHttp)
|
Dim response As Chilkat.HttpResponse = http.QuickRequest("GET", urlHttp)
|
||||||
|
|||||||
Reference in New Issue
Block a user