1205 lines
49 KiB
VB.net
1205 lines
49 KiB
VB.net
Imports TELOTEC_Worker
|
|
Imports Tamir
|
|
Imports Tamir.SharpSsh
|
|
|
|
Imports Microsoft.Office.Interop
|
|
Imports Org.BouncyCastle.Crypto.Agreement
|
|
Imports VERAG_PROG_ALLGEMEIN
|
|
Imports TAlex.WPF.Helpers
|
|
Imports GrapeCity.DataVisualization.TypeScript
|
|
Imports Org.BouncyCastle.Math.EC.Multiplier
|
|
Public Class usrCntlTCeZOLL_EZA
|
|
|
|
Property ALLG As usrCntlTCeZOLL_EZA_Allg
|
|
Property ADRESSEN As usrCntlATLAS_EZA_Adressen
|
|
Property POSITIONEN As usrCntlATLAS_EZA_Positionen
|
|
Property DV1 As usrCntlATLAS_EZA_DV1
|
|
|
|
Property Jahr2Stellig As Integer
|
|
Property zusatz As String
|
|
Property BezugsNr As String = ""
|
|
Dim sentToDakosy = False
|
|
|
|
Property AVISO As VERAG_PROG_ALLGEMEIN.cAviso
|
|
Property SENDUNG As VERAG_PROG_ALLGEMEIN.cSendungen
|
|
|
|
Dim cDy_ART As String = "EZA"
|
|
|
|
'Dim EZA As cDakosyEZA = Nothing
|
|
Dim TC_ANM As cTelotec_Anmeldung = Nothing
|
|
|
|
Dim FIRMA_DY = VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA
|
|
Property isSTAMMREF As Boolean = False
|
|
Property STAMMREF As String = ""
|
|
|
|
|
|
Sub New(TC_ANM As cTelotec_Anmeldung, AVISO As VERAG_PROG_ALLGEMEIN.cAviso, SENDUNG As VERAG_PROG_ALLGEMEIN.cSendungen, Jahr2Stellig As Integer, Optional zusatz As String = "", Optional isSTAMMREF As Boolean = False, Optional STAMMREF As String = "")
|
|
' Dieser Aufruf ist für den Designer erforderlich.
|
|
InitializeComponent()
|
|
|
|
' Me.cDy_ART = If(ART = "NCTS", "T2", ART)
|
|
|
|
Me.Jahr2Stellig = Jahr2Stellig
|
|
Me.zusatz = zusatz
|
|
|
|
Me.AVISO = AVISO
|
|
Me.SENDUNG = SENDUNG
|
|
Me.TC_ANM = TC_ANM
|
|
|
|
Me.isSTAMMREF = isSTAMMREF
|
|
Me.STAMMREF = STAMMREF
|
|
|
|
If TC_ANM IsNot Nothing Then
|
|
' Me.EZA = DAKOSY_Worker.cDakosyEZA.LOADByAnmIDFull(TC_ANM.dy_Id, True)
|
|
Me.FIRMA_DY = Me.TC_ANM.telanm_firma
|
|
End If
|
|
|
|
|
|
|
|
|
|
' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu.
|
|
End Sub
|
|
|
|
|
|
|
|
Sub New(TC_ANM As cTelotec_Anmeldung, Optional isSTAMMREF As Boolean = False, Optional STAMMREF As String = "")
|
|
InitializeComponent()
|
|
Me.TC_ANM = TC_ANM
|
|
'TC_ANM = New cDakosy_Zollanmeldungen(EZA.eza_dyaAnmID)
|
|
|
|
Me.isSTAMMREF = isSTAMMREF
|
|
Me.STAMMREF = STAMMREF
|
|
|
|
If TC_ANM.telanm_AvisoId > 0 Then
|
|
Dim AV As New VERAG_PROG_ALLGEMEIN.cAvisoDAL
|
|
AVISO = AV.LesenAviso(TC_ANM.telanm_AvisoId, "")
|
|
End If
|
|
If TC_ANM.telanm_SendungsId > 0 Then
|
|
SENDUNG = New VERAG_PROG_ALLGEMEIN.cSendungen(TC_ANM.telanm_SendungsId)
|
|
End If
|
|
End Sub
|
|
|
|
Sub New(ART As String, AvisoId As Integer, SENDUNGS_ID As Integer, Jahr2Stellig As Integer, Optional zusatz As String = "", Optional isSTAMMREF As Boolean = False, Optional STAMMREF As String = "")
|
|
' Dieser Aufruf ist für den Designer erforderlich.
|
|
InitializeComponent()
|
|
Me.cDy_ART = If(ART <> "", ART, "EX")
|
|
|
|
If AvisoId > 0 Then
|
|
Dim AV As New VERAG_PROG_ALLGEMEIN.cAvisoDAL
|
|
AVISO = AV.LesenAviso(AvisoId, "")
|
|
End If
|
|
If SENDUNGS_ID > 0 Then
|
|
SENDUNG = New VERAG_PROG_ALLGEMEIN.cSendungen(SENDUNGS_ID)
|
|
End If
|
|
|
|
Me.isSTAMMREF = isSTAMMREF
|
|
Me.STAMMREF = STAMMREF
|
|
|
|
Me.Jahr2Stellig = Jahr2Stellig
|
|
Me.zusatz = zusatz
|
|
|
|
' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu.
|
|
End Sub
|
|
|
|
Sub New(ART As String, Aviso As VERAG_PROG_ALLGEMEIN.cAviso, SENDUNG As VERAG_PROG_ALLGEMEIN.cSendungen, Jahr2Stellig As Integer, Optional zusatz As String = "", Optional isSTAMMREF As Boolean = False, Optional STAMMREF As String = "", Optional FIRMA_DY As String = "")
|
|
' Dieser Aufruf ist für den Designer erforderlich.
|
|
InitializeComponent()
|
|
|
|
Me.cDy_ART = If(ART <> "", ART, "EX")
|
|
Me.AVISO = Aviso
|
|
Me.SENDUNG = SENDUNG
|
|
|
|
Me.Jahr2Stellig = Jahr2Stellig
|
|
Me.zusatz = zusatz
|
|
|
|
|
|
Me.isSTAMMREF = isSTAMMREF
|
|
Me.STAMMREF = STAMMREF
|
|
|
|
If FIRMA_DY <> "" Then Me.FIRMA_DY = FIRMA_DY
|
|
' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu.
|
|
End Sub
|
|
|
|
|
|
Function getBezugsnr(ByRef BezugsNr)
|
|
Dim BezugsNrTmp = ""
|
|
Select Case FIRMA_DY
|
|
Case "UNISPED"
|
|
If If(SENDUNG.tblSnd_DakosyRef, "") <> "" Then
|
|
BezugsNrTmp = SENDUNG.tblSnd_DakosyRef
|
|
Else
|
|
BezugsNrTmp = SENDUNG.FilialenNr & "/" & SENDUNG.AbfertigungsNr
|
|
End If
|
|
Case Else
|
|
BezugsNrTmp = SENDUNG.FilialenNr & "/" & SENDUNG.AbfertigungsNr '& If(zusatz <> "", "/" & zusatz, "") 'zusatz ' & "/" & Jahr2Stellig
|
|
End Select
|
|
BezugsNr = BezugsNrTmp
|
|
zusatz = "A"
|
|
'Soloagne bis die Bezugsnummer noch nicht existiert
|
|
While DAKOSY_Worker.cDakosy_Zollanmeldungen.ExistsBezugsNr(BezugsNr) 'IsNot Nothing
|
|
BezugsNr = SENDUNG.FilialenNr & "/" & SENDUNG.AbfertigungsNr & "/" & zusatz
|
|
If zusatz.Length = 1 Then
|
|
zusatz = Chr(Asc(zusatz.ToString) + 1)
|
|
Else
|
|
zusatz = zusatz.Substring(0, 1) & Chr(Asc(zusatz.Substring(0, 2).ToString) + 1)
|
|
End If
|
|
If zusatz = "Z" Then zusatz = "AA"
|
|
End While
|
|
lblBezugsnummer.Text = BezugsNr
|
|
|
|
Return BezugsNr
|
|
End Function
|
|
|
|
|
|
Function getKdnr(ByRef art) As Integer
|
|
Try
|
|
If ADRESSEN IsNot Nothing Then
|
|
Select Case art
|
|
Case "EMPF" : Return ADRESSEN.usrCntl_Empfaenger.kdFirma.KdNr_value
|
|
Case "ABS" : Return ADRESSEN.usrCntl_Versender.kdFirma.KdNr_value
|
|
Case "ANM" : Return ADRESSEN.usrCntl_Anmelder.kdFirma.KdNr_value
|
|
Case "VERTR" : Return ADRESSEN.usrCntl_Vertretener.kdFirma.KdNr_value
|
|
Case "VERTRANM" : Return ADRESSEN.usrCntl_VertreterAnmelder.kdFirma.KdNr_value
|
|
End Select
|
|
End If
|
|
Catch ex As Exception
|
|
Return -1
|
|
End Try
|
|
End Function
|
|
|
|
|
|
|
|
|
|
Private Sub usrCntlATLAS_Load(sender As Object, e As EventArgs) Handles Me.Load
|
|
|
|
cboDakosyAction.Items.Clear()
|
|
cboDakosyAction.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("Neuen Datensatz erstellen", TC_ObjektAktion.OBJ_CREATE))
|
|
cboDakosyAction.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("Vohr. DS ändern", TC_ObjektAktion.OBJ_CHANGE))
|
|
cboDakosyAction.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("Vorh. DS stornieren", TC_ObjektAktion.OBJ_CANCEL))
|
|
cboDakosyAction.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("Datensatz an ZOLL senden", TC_ObjektAktion.OBJ_SEND))
|
|
cboDakosyAction.changeItem(TC_ObjektAktion.OBJ_CREATE)
|
|
|
|
'ADRESSEN = New usrCntlATLAS_EZA_Adressen(TC_ANM)
|
|
ALLG = New usrCntlTCeZOLL_EZA_Allg(TC_ANM)
|
|
'POSITIONEN = New usrCntlATLAS_EZA_Positionen(TC_ANM, Me)
|
|
'DV1 = New usrCntlATLAS_EZA_DV1(TC_ANM)
|
|
|
|
Select Case FIRMA_DY
|
|
Case "VERAG" : txtDyMandant.Text = "VERG"
|
|
txtDyNiederlassung.Text = VERAG_PROG_ALLGEMEIN.cAllgemein.NIEDERLASSUNG
|
|
Case "ATILLA" : txtDyMandant.Text = "ATIL" : txtDyNiederlassung.Text = "SUW"
|
|
Case "UNISPED" : txtDyMandant.Text = "UNAT" : txtDyNiederlassung.Text = "ATSPED"
|
|
Case "IMEX" : txtDyMandant.Text = "IMEX" : txtDyNiederlassung.Text = "IME"
|
|
End Select
|
|
|
|
|
|
cboStammreferenz.fillWithSQL("SELECT [dySr_Stammreferenz],[dySr_Bezeichnung] FROM [tblDakosy_Stammreferenzen] WHERE dySr_Land='DE' AND dySr_Verfahren='EZA' and dySr_dy_Mandant='" & txtDyMandant.Text & "' and dySr_dy_Niederlassung='" & txtDyNiederlassung.Text & "' and dySr_visible=1", False, "FMZOLL", True)
|
|
cboStammreferenz.changeItem("")
|
|
|
|
|
|
If isSTAMMREF Then
|
|
Me.BezugsNr = "STAMMREFERENZ"
|
|
If TC_ANM Is Nothing Then TC_ANM = New cTelotec_Anmeldung
|
|
TC_ANM.telanm_BezugsNr = BezugsNr
|
|
Button1.Enabled = False
|
|
cboDakosyAction.Enabled = False
|
|
Else
|
|
If TC_ANM Is Nothing Then ' NEUE ZOLLANMELDUNG
|
|
|
|
Dim kdnr As Object = Nothing
|
|
If SENDUNG IsNot Nothing AndAlso SENDUNG.tblSnd_EmpfaengerKdNr > 0 Then
|
|
kdnr = SENDUNG.tblSnd_EmpfaengerKdNr
|
|
End If
|
|
|
|
Dim f As New frmDakosyStammreferenz("DE", "EZA", False, kdnr,, FIRMA_DY)
|
|
Dim Stammreferenz = Nothing
|
|
If False Then
|
|
'STAMMREF ERST MACHEN
|
|
If f.ShowDialog(Me) Then
|
|
Stammreferenz = f.STAMMREF
|
|
sentToDakosy = f.sentToDakosy
|
|
End If
|
|
|
|
End If
|
|
|
|
Try
|
|
|
|
BezugsNr = getBezugsnr(BezugsNr)
|
|
|
|
Catch ex As Exception
|
|
MsgBox(ex.Message & ex.StackTrace)
|
|
End Try
|
|
TC_ANM = cTelotec_Anmeldung.LOADByBezugsNr(BezugsNr, True)
|
|
If TC_ANM Is Nothing Then
|
|
'Falls zur BezugsNr schon ein Eintrag in der DB vorhanden ist
|
|
'TC_ANM = cTelotec_Anmeldung.LOADByAnmIDFull(f.STAMMREF_DYID, True) ' DyID --> Falls bei der Stammreferenz eine Vorlage hinterlegt ist!
|
|
'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
If TC_ANM IsNot Nothing Then
|
|
'Stmmreferenz - Werte zurücksetzen, damit nicht falsch übergeben
|
|
'TC_ANM.eza_dyaAnmID = -1
|
|
TC_ANM.telanm_id = -1
|
|
Else
|
|
TC_ANM = New cTelotec_Anmeldung
|
|
End If
|
|
|
|
'Wenn bei der Stammref eine andere NL ausgewählt wurde, wird dies hier korrigiert (zb. IMEX / GLOBAL!):
|
|
If f.nl <> txtDyNiederlassung.Text Then
|
|
txtDyNiederlassung.Text = f.nl
|
|
cboStammreferenz.fillWithSQL("SELECT [dySr_Stammreferenz],[dySr_Bezeichnung] FROM [tblDakosy_Stammreferenzen] WHERE dySr_Land='DE' AND dySr_Verfahren='EZA' and dySr_dy_Mandant='" & txtDyMandant.Text & "' and dySr_dy_Niederlassung='" & txtDyNiederlassung.Text & "' and dySr_visible=1", False, "FMZOLL", True)
|
|
|
|
End If
|
|
|
|
loaddataFromAVISO(TC_ANM)
|
|
cboStammreferenz.changeItem(Stammreferenz)
|
|
|
|
|
|
End If
|
|
'eza_OUT
|
|
|
|
Else
|
|
' eza_OUT is ot nothing
|
|
Me.BezugsNr = TC_ANM.telanm_BezugsNr
|
|
'MsgBox(eza_OUT.eza_Hauptverpflichteter_Name)
|
|
|
|
End If
|
|
End If
|
|
If If(TC_ANM.telanm_firma, "") = "" Then If FIRMA_DY <> "" Then TC_ANM.telanm_firma = FIRMA_DY
|
|
|
|
|
|
' If EZA.ncts_ArtAnmeldung Is Nothing Or EZA.ncts_ArtAnmeldung = "" Then
|
|
'EZA.ncts_ArtAnmeldung = "T2"
|
|
'End If
|
|
|
|
|
|
'hinzufügen, damit alle Controls richtig geladen und initialisiert werden:s
|
|
Me.SplitContainer.Panel2.Controls.Add(ALLG)
|
|
'Me.SplitContainer.Panel2.Controls.Add(POSITIONEN)
|
|
'Me.SplitContainer.Panel2.Controls.Add(ADRESSEN)
|
|
'Me.SplitContainer.Panel2.Controls.Add(DV1)
|
|
|
|
AddHandler ALLG.DV1_changed, Sub(dv1)
|
|
btnDV1.Visible = dv1
|
|
End Sub
|
|
|
|
' MsgBox(EZA.ncts_Hauptverpflichteter_Name)
|
|
'Werte setzen:
|
|
'ADRESSEN.setValues(TC_ANM)
|
|
ALLG.setValues(TC_ANM)
|
|
'POSITIONEN.setValues(TC_ANM)
|
|
'DV1.setValues(TC_ANM)
|
|
|
|
'Controls wieder entfernen:
|
|
Me.SplitContainer.Panel2.Controls.Clear()
|
|
|
|
|
|
|
|
'If ALLG.txtRechnungspreis.Text = "" Then ALLG.txtRechnungspreis.Text = BezugsNr
|
|
|
|
|
|
|
|
' ADRESSEN.CreateControl()
|
|
For Each c In MyFlowLayoutPanel1.Controls
|
|
If c.GetType.ToString = GetType(System.Windows.Forms.Button).ToString Then
|
|
AddHandler DirectCast(c, System.Windows.Forms.Button).Click, AddressOf buttonClick
|
|
End If
|
|
Next
|
|
|
|
SplitContainer.Panel2.Controls.Add(ALLG)
|
|
lblBezugsnummer.Text = BezugsNr
|
|
|
|
ALLG.Dock = DockStyle.Fill
|
|
'ADRESSEN.Dock = DockStyle.Fill
|
|
'POSITIONEN.Dock = DockStyle.Fill
|
|
'DV1.Dock = DockStyle.Fill
|
|
|
|
If POSITIONEN IsNot Nothing Then
|
|
|
|
AddHandler POSITIONEN.RohmasseChanged, Sub(rohmasse)
|
|
Label5.Text = rohmasse.ToString("N2") & " kg"
|
|
End Sub
|
|
AddHandler POSITIONEN.PosAnzChanged, Sub(anz)
|
|
Label3.Text = anz
|
|
End Sub
|
|
End If
|
|
|
|
If sentToDakosy Then
|
|
Try
|
|
Me.Button1.PerformClick()
|
|
Me.FindForm.Close()
|
|
Catch
|
|
End Try
|
|
|
|
End If
|
|
Try
|
|
If Not VERAG_PROG_ALLGEMEIN.cBerechtignunen.CHECK_BERECHTIGUNG_bool("ZOLL_DakosyZA_AVISO_Edit", "AVISO") Then
|
|
Me.FindForm.Close()
|
|
End If
|
|
Catch
|
|
End Try
|
|
End Sub
|
|
|
|
Sub buttonClick(sender As Object, e As EventArgs) 'HANDLED
|
|
Dim btn As System.Windows.Forms.Button = DirectCast(sender, System.Windows.Forms.Button)
|
|
|
|
For Each c In MyFlowLayoutPanel1.Controls
|
|
If c.GetType.ToString = GetType(System.Windows.Forms.Button).ToString Then
|
|
DirectCast(c, System.Windows.Forms.Button).BackColor = Drawing.Color.White
|
|
DirectCast(c, System.Windows.Forms.Button).ForeColor = Drawing.Color.Black
|
|
End If
|
|
Next
|
|
|
|
btn.BackColor = Drawing.Color.SteelBlue 'Drawing.Color.FromArgb(0, 54, 128)
|
|
btn.ForeColor = Drawing.Color.White
|
|
|
|
|
|
SplitContainer.Panel2.Controls.Clear()
|
|
|
|
If btn Is btnAllgemein Then
|
|
SplitContainer.Panel2.Controls.Add(ALLG)
|
|
ElseIf btn Is btnAdressen Then
|
|
SplitContainer.Panel2.Controls.Add(ADRESSEN)
|
|
ElseIf btn Is btnPositionen Then
|
|
SplitContainer.Panel2.Controls.Add(POSITIONEN)
|
|
ElseIf btn Is btnDV1 Then
|
|
SplitContainer.Panel2.Controls.Add(DV1)
|
|
|
|
End If
|
|
End Sub
|
|
|
|
|
|
Sub loaddataFromAVISO(ByRef cdy As cTelotec_Anmeldung)
|
|
Try
|
|
|
|
'==> VORBLENDUNG:
|
|
|
|
' Dim cdy As New cDakosyEZA
|
|
cdy.telanm_BezugsNr = BezugsNr
|
|
|
|
'frmZollanmeldung.setZollstelle(cdy.eza_AdressierteZollstelle, AVISO)
|
|
'If cdy.eza_AdressierteZollstelle IsNot Nothing AndAlso cdy.eza_AdressierteZollstelle.Length = 8 Then 'nur 4 stellen erlaubt!! 'DE00 fällt weg
|
|
' EZA.eza_AdressierteZollstelle = cdy.eza_AdressierteZollstelle.Substring(4, 4)
|
|
'End If
|
|
|
|
'cdy.eza_dyaArt = cDy_ART
|
|
'If AVISO IsNot Nothing Then
|
|
|
|
'End If
|
|
|
|
|
|
|
|
'If SENDUNG IsNot Nothing Then
|
|
' Dim Vorsystem = False
|
|
' If (SENDUNG.VORSYSTEM IsNot Nothing) AndAlso MsgBox("Möchten Sie die Daten aus dem Vorsystem laden?", vbYesNoCancel) Then
|
|
' Try
|
|
' Dim SH As New VERAG_PROG_ALLGEMEIN.cVERAG_in_eza_FULL(CInt(SENDUNG.VORSYSTEM_Id))
|
|
' If SH IsNot Nothing Then
|
|
|
|
' TC_ANM.eza_GesamtRohmasse = SH.EZA.TotGrossWeight
|
|
' If If(SH.EZA.Incoterm, "") <> "" Then TC_ANM.eza_LieferbedingungCode = SH.EZA.Incoterm
|
|
|
|
' For Each SH_POS In SH.EZA.POSITIONS
|
|
' Dim EZA_POS As New DAKOSY_Worker.cDakosy_EZA_Warenposition
|
|
' EZA_POS.ezaWP_PackstueckAnzahl = SH_POS.NumberOfPackages
|
|
' EZA_POS.ezaWP_Rohmasse = SH_POS.GrossWeight
|
|
' EZA_POS.ezaWP_Eigenmasse = SH_POS.NetWeight
|
|
' EZA_POS.ezaWP_Warenbezeichnung = SH_POS.GoodsDescription
|
|
' EZA_POS.ezaWP_WarennummerEZT = SH_POS.GoodsTariff
|
|
|
|
' EZA_POS.ezaWP_UrsprungslandCode = SH_POS.OriginCountryCode
|
|
' If If(SH_POS.KindOfPackages, "") <> "" Then EZA_POS.ezaWP_PackstueckArt = SH_POS.KindOfPackages
|
|
|
|
' If SH_POS.ItemInvoiceAmount IsNot Nothing Then
|
|
' EZA_POS.ezaWP_Artikelpreis = SH_POS.ItemInvoiceAmount
|
|
' EZA_POS.ezaWP_AHStatWert = SH_POS.ItemInvoiceAmount
|
|
' Else
|
|
|
|
' End If
|
|
|
|
|
|
' TC_ANM.eza_WARENPOS.Add(EZA_POS)
|
|
' Next
|
|
|
|
' For Each SH_AD In SH.EZA.ADDRESS
|
|
' Dim EZA_AD As New DAKOSY_Worker.cDakosy_EZA_Adressen
|
|
' EZA_AD.ezaAd_AdressTyp = SH_AD.AddressCode
|
|
' EZA_AD.ezaAd_LandCode = SH_AD.CountryCode
|
|
|
|
' EZA_AD.ezaAd_TeilnehmerEORI = SH_AD.EORI
|
|
' EZA_AD.ezaAd_TeilnehmerNLNR = SH_AD.NLNR
|
|
' EZA_AD.ezaAd_NameFirma1 = SH_AD.Name1
|
|
' EZA_AD.ezaAd_NameFirma2 = SH_AD.Name2
|
|
' EZA_AD.ezaAd_NameFirma3 = SH_AD.Name3
|
|
' EZA_AD.ezaAd_StrasseHausNr1 = SH_AD.Street1
|
|
' EZA_AD.ezaAd_StrasseHausNr2 = SH_AD.Street2
|
|
' EZA_AD.ezaAd_Ort = SH_AD.City
|
|
' EZA_AD.ezaAd_PLZ = SH_AD.PostalCode
|
|
' EZA_AD.ezaAd_UStIDAnmelder = SH_AD.UStID
|
|
|
|
' TC_ANM.eza_ADRESSEN.Add(EZA_AD)
|
|
' Next
|
|
|
|
' Vorsystem = True
|
|
' End If
|
|
|
|
' Catch ex As Exception
|
|
' MsgBox(ex.Message & ex.StackTrace)
|
|
' End Try
|
|
' End If
|
|
|
|
' If Not Vorsystem Then
|
|
|
|
' TC_ANM.eza_GesamtRohmasse = SENDUNG.tblSnd_Gewicht
|
|
' TC_ANM.eza_Rechnungspreis = SENDUNG.tblSnd_Warenwert
|
|
' TC_ANM.eza_Rechnungswaehrung = SENDUNG.tblSnd_WarenwertWaehrung
|
|
|
|
' If SENDUNG.tblSnd_Abfertigungsart_ID = 1 Then
|
|
' If SENDUNG.tblSnd_EmpfaengerKdNr > 0 Then
|
|
|
|
' Dim AD As New DAKOSY_Worker.cDakosy_EZA_Adressen
|
|
' AD.ezaAd_AdressCode = SENDUNG.tblSnd_EmpfaengerKdNr
|
|
' AD.ezaAd_AdressTyp = "CN"
|
|
' Dim ADFmzoll As New VERAG_PROG_ALLGEMEIN.cAdressen(SENDUNG.tblSnd_EmpfaengerKdNr)
|
|
' Dim KDFmzoll As New VERAG_PROG_ALLGEMEIN.cKunde(SENDUNG.tblSnd_EmpfaengerKdNr)
|
|
|
|
' AD.ezaAd_NameFirma1 = ADFmzoll.Name_1
|
|
' AD.ezaAd_NameFirma2 = ADFmzoll.Name_2
|
|
|
|
' AD.ezaAd_StrasseHausNr1 = ADFmzoll.Straße
|
|
' AD.ezaAd_PLZ = ADFmzoll.PLZ
|
|
' AD.ezaAd_Ort = ADFmzoll.Ort
|
|
' AD.ezaAd_LandCode = cProgramFunctions.getISO2Land(ADFmzoll.LandKz)
|
|
' AD.ezaAd_TeilnehmerEORI = KDFmzoll.EORITIN
|
|
' AD.ezaAd_TeilnehmerNLNR = KDFmzoll.EORITIN_NL
|
|
|
|
' If If(AD.ezaAd_LandCode, "") <> "" Then
|
|
' TC_ANM.eza_Bestimmungsland = AD.ezaAd_LandCode
|
|
' End If
|
|
|
|
' If If(AD.ezaAd_LandCode, "") = "DE" And AD.ezaAd_PLZ IsNot Nothing Then
|
|
' TC_ANM.eza_Bestimmungsbundesland = VERAG_PROG_ALLGEMEIN.cDEBundeslaenderPLZ.LOADBundeslandCode_ByPLZ(AD.ezaAd_PLZ)
|
|
' ElseIf If(AD.ezaAd_LandCode, "") <> "" Then
|
|
' TC_ANM.eza_Bestimmungsbundesland = 25
|
|
' End If
|
|
|
|
' cdy.eza_ADRESSEN.Add(AD)
|
|
' End If
|
|
' If SENDUNG.tblSnd_AbsenderKdNr > 0 Then
|
|
|
|
' Dim AD As New DAKOSY_Worker.cDakosy_EZA_Adressen
|
|
' AD.ezaAd_AdressCode = SENDUNG.tblSnd_AbsenderKdNr
|
|
' AD.ezaAd_AdressTyp = "CZ"
|
|
' Dim ADFmzoll As New VERAG_PROG_ALLGEMEIN.cAdressen(SENDUNG.tblSnd_AbsenderKdNr)
|
|
' Dim KDFmzoll As New VERAG_PROG_ALLGEMEIN.cKunde(SENDUNG.tblSnd_AbsenderKdNr)
|
|
|
|
' AD.ezaAd_NameFirma1 = ADFmzoll.Name_1
|
|
' AD.ezaAd_NameFirma2 = ADFmzoll.Name_2
|
|
|
|
' AD.ezaAd_StrasseHausNr1 = ADFmzoll.Straße
|
|
' AD.ezaAd_PLZ = ADFmzoll.PLZ
|
|
' AD.ezaAd_Ort = ADFmzoll.Ort
|
|
' AD.ezaAd_LandCode = cProgramFunctions.getISO2Land(ADFmzoll.LandKz)
|
|
' AD.ezaAd_TeilnehmerEORI = KDFmzoll.EORITIN
|
|
' AD.ezaAd_TeilnehmerNLNR = KDFmzoll.EORITIN_NL
|
|
|
|
' If If(AD.ezaAd_LandCode, "") <> "" Then
|
|
' TC_ANM.eza_VersendungsLandCode = AD.ezaAd_LandCode
|
|
' End If
|
|
|
|
' cdy.eza_ADRESSEN.Add(AD)
|
|
|
|
' End If
|
|
|
|
' End If
|
|
|
|
' End If
|
|
'End If
|
|
|
|
|
|
|
|
'cdy.eza_KennzeichenNameBefoerderungsmittelAnkunft = AVISO.LKW_Nr
|
|
'cdy.eza_BeförderungsmittelGrenzeStaatszugehörigkeitCode = AVISO.LKW_Nationalitaet
|
|
|
|
Catch ex As Exception
|
|
MsgBox(ex.StackTrace)
|
|
End Try
|
|
End Sub
|
|
|
|
|
|
Sub setValue(EZA)
|
|
BezugsNr = EZA.ncts_ObjectName
|
|
|
|
End Sub
|
|
|
|
|
|
Private Sub pnl_Paint(sender As Object, e As PaintEventArgs)
|
|
|
|
End Sub
|
|
|
|
Sub loadDYZollanmeldungen(Optional Status As String = "") ' + Speichern
|
|
If TC_ANM Is Nothing Then
|
|
TC_ANM = New cTelotec_Anmeldung '(TC_ANM.eza_dyaAnmID)
|
|
End If
|
|
TC_ANM.telanm_ART = ALLG.EZA_ART 'cDy_ART
|
|
TC_ANM.telanm_BezugsNr = BezugsNr
|
|
TC_ANM.telanm_AvisoId = If(AVISO Is Nothing, Nothing, AVISO.AvisoID)
|
|
TC_ANM.telanm_SendungsId = If(SENDUNG Is Nothing, Nothing, SENDUNG.tblSnd_SendungID)
|
|
'Status?
|
|
TC_ANM.initData()
|
|
'TC_ANM.SAVE() 'Speichern, ID wird erzeugt
|
|
|
|
End Sub
|
|
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
|
|
|
Me.Refresh()
|
|
cboDakosyAction.Focus() 'nur, damit alle _value aktualisuiert sind...
|
|
If sentToDakosy OrElse vbYes = MsgBox("Sollen die Daten abgeschickt werden?" & vbNewLine & "Eine Änderung ist nur noch in der Telotec Software möglich.", vbYesNoCancel) Then
|
|
' Dim cDyAnm As New cDakosy_Zollanmeldungen(cDy_ART, BezugsNr, AVISO.AvisoID, SENDUNG.tblSnd_SendungID)
|
|
|
|
|
|
loadDYZollanmeldungen() '--> SAVE Ausgebelende!!!!!!!!!
|
|
|
|
If TC_ANM IsNot Nothing Then
|
|
'Dim cDY As New cDakosyEZA(cDyAnm.dy_Id, cDyAnm.dy_Erstellung_SB)
|
|
'TC_ANM.eza_dyaAnmID = TC_ANM.dy_Id
|
|
'TC_ANM.eza_Erstellung_SB = TC_ANM.dy_Erstellung_SB
|
|
'EZA.eza_LetzteBearbeitung = Now
|
|
'EZA.eza_LetzteBearbeitung_SB = TC_ANM.dy_LetzteBearbeitung_SB
|
|
|
|
|
|
TC_ANM.initData() ' Basic
|
|
|
|
TC_ANM.ComIndicator = 1 ' 1=Datenimport
|
|
TC_ANM.dec_ProzessArt = "IM" ' IMPORT
|
|
TC_ANM.dec_CreateDate = Now
|
|
TC_ANM.Hea_DecTy = "IMA" ' IMPORT
|
|
TC_ANM.Hea_TotItem = TC_ANM.POSITIONSDATEN.Count
|
|
TC_ANM.Hea_Simp = 0
|
|
|
|
TC_ANM.Hea_DecDT = Now 'Anmeldedatum
|
|
' TC_ANM.Hea_DecPlc Ort
|
|
'C_ANM.Mandant_ID = "VERCUS"
|
|
TC_ANM.Transp_ContInd = 0
|
|
TC_ANM.Declarant_TIN = "ATEOS1000059735" 'EORI
|
|
|
|
|
|
|
|
cTELOTECInterface_Send.loadInClass_VersandanmeldungEZA(TC_ANM, Me)
|
|
' If Not TC_ANM.SAVE() Then Exit Sub
|
|
|
|
|
|
Dim saveFile = ""
|
|
If cTELOTECInterface_Send.generateVersandanmeldungEZA(TC_ANM, saveFile, cboDakosyAction._value) Then
|
|
'MsgBox(saveFile)
|
|
If saveFile <> "" Then
|
|
If Not cTC_Functions.send_Data_To_TC(saveFile, BezugsNr, TC_ANM.telanm_id, FIRMA_DY) Then
|
|
MsgBox("Sendefehler!")
|
|
End If
|
|
End If
|
|
End If
|
|
End If
|
|
TC_ANM.UPDATE_DATA()
|
|
Me.FindForm.Close()
|
|
|
|
End If
|
|
End Sub
|
|
|
|
|
|
|
|
Private Sub SpeichernToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles SpeichernToolStripMenuItem.Click
|
|
|
|
Me.Refresh()
|
|
|
|
cboDakosyAction.Focus() 'nur, damit alle _value aktualisuiert sind...
|
|
|
|
' Dim cDyAnm As New cDakosy_Zollanmeldungen(cDy_ART, BezugsNr, If(AVISO Is Nothing, Nothing, AVISO.AvisoID), If(SENDUNG Is Nothing, Nothing, SENDUNG.tblSnd_SendungID))
|
|
loadDYZollanmeldungen()
|
|
|
|
If TC_ANM IsNot Nothing Then
|
|
'Dim cDY As New cDakosyEZA(cDyAnm.dy_Id, cDyAnm.dy_Erstellung_SB)
|
|
'TC_ANM.eza_dyaAnmID = TC_ANM.dy_Id
|
|
'TC_ANM.eza_Erstellung_SB = TC_ANM.dy_Erstellung_SB
|
|
TC_ANM.telanm_LetzteBearbeitung = Now
|
|
'TC_ANM.telanm_LetzteBearbeitung_SB = Now
|
|
'TC_ANM.eza_LetzteBearbeitung_SB = TC_ANM.dy_LetzteBearbeitung_SB
|
|
cTELOTECInterface_Send.loadInClass_VersandanmeldungEZA(TC_ANM, Me)
|
|
|
|
If Not TC_ANM.SAVE() Then
|
|
'gespeichert
|
|
End If
|
|
|
|
|
|
End If
|
|
TC_ANM.UPDATE_DATA()
|
|
|
|
End Sub
|
|
|
|
Private Function importExcel_trendyol(splitTNR) As Boolean
|
|
lblUpload.Text = "Excel öffnen..."
|
|
lblUpload.Visible = True
|
|
|
|
Dim fd As New OpenFileDialog
|
|
fd.Filter = "Excel Dateien|*.xls;*.xlsx"
|
|
Dim result As DialogResult = fd.ShowDialog()
|
|
|
|
If Not fd.FileName.EndsWith(".xls") And Not fd.FileName.EndsWith(".xlsx") Then
|
|
Me.Cursor = Cursors.Default
|
|
lblUpload.Visible = False : Return False
|
|
End If
|
|
|
|
If result = System.Windows.Forms.DialogResult.OK Then
|
|
|
|
|
|
Me.Cursor = Cursors.WaitCursor
|
|
Dim exclApp As New Excel.Application 'Object 'as Application
|
|
Dim Datei As Excel.Workbook ' 'as WorkBook
|
|
Dim Blatt As Excel.Worksheet 'Object 'as WorkSheet
|
|
|
|
With exclApp
|
|
Try
|
|
|
|
.CutCopyMode = False
|
|
.DisplayAlerts = False
|
|
|
|
|
|
Datei = .Workbooks.Open(fd.FileName)
|
|
Blatt = Datei.Worksheets(1)
|
|
|
|
Datei.Activate()
|
|
|
|
Try
|
|
Blatt.ShowAllData() 'Falls Filter ausgewählt wurde
|
|
Catch ex As Exception
|
|
|
|
End Try
|
|
|
|
Dim startFound As Boolean = False
|
|
Dim endFound As Boolean = False
|
|
Dim startRows As Integer = -1
|
|
|
|
If Not checkExcel_trendyol(Blatt, startRows) Then 'VALIDIERUNG
|
|
Me.Cursor = Cursors.Default
|
|
lblUpload.Visible = False : Return False
|
|
End If
|
|
|
|
If TC_ANM.POSITIONSDATEN.Count > 0 Then
|
|
If vbYes = MsgBox("Sollten die aktuellen Einträge gelöscht werden?", vbYesNo) Then
|
|
TC_ANM.POSITIONSDATEN.Clear() 'Zurücksetzen
|
|
End If
|
|
End If
|
|
|
|
|
|
|
|
' Inhalt durchlaufen
|
|
|
|
|
|
Dim endRows As Integer = startRows
|
|
While endRows < Blatt.UsedRange.Rows.Count
|
|
If Not Blatt.Range("B" & endRows) Is Nothing AndAlso Not Blatt.Range("B" & endRows).Value Is Nothing AndAlso Not Blatt.Range("B" & endRows).Value.ToString.Trim = "" Then
|
|
endFound = True
|
|
Else
|
|
Exit While
|
|
End If
|
|
endRows += 1
|
|
End While
|
|
endRows -= 1
|
|
|
|
If Not endFound Then
|
|
MsgBox("Keine Daten vorhanden!")
|
|
Me.Cursor = Cursors.Default
|
|
lblUpload.Visible = False : Return False
|
|
End If
|
|
|
|
lblUpload.Text = "Daten auslesen..."
|
|
'Laden des Bereiches aus dem Excel:
|
|
Dim myRange As Excel.Range
|
|
myRange = Blatt.Range("B" & startRows & ":N" & endRows & "")
|
|
' MsgBox("B" & startRows & ":N" & endRows & "")
|
|
Dim myArray As Object(,) '<-- declared as 2D Array
|
|
myArray = myRange.Value 'store the content of each cell
|
|
'myArray(i_soll2 - startRows + 1, 4)
|
|
lblUpload.Text = "Aggregieren..."
|
|
|
|
Dim DT As DataTable = Nothing
|
|
If splitTNR Then
|
|
DT = aggregierenTrendxolTNR(myArray) '--> TNR, Orig, Curr
|
|
Else
|
|
DT = aggregierenTrendxol(myArray) '--> !!BEschreibung!! , TNR, Orig, Curr
|
|
End If
|
|
' MsgBox("agg" & myArray.Count)
|
|
|
|
Dim cnt = 0
|
|
|
|
|
|
Dim sqlTest = "SELECT ezt_Codenummer,case when ezt_text Like '%für Frauen%' then 'Damen' when ezt_text Like '%für Männer%' THEN 'HERREN' ELSE '' END,
|
|
case
|
|
when ezt_text Like '%aus synthetischen Chemiefasern%' then ', aus synthetischen Chemiefasern'
|
|
when ezt_text Like '%Gewirken oder Gestricken%' then ', gewirkt oder gestickt'
|
|
when ezt_text Like '%aus Kunststoff%' THEN ', aus Kunststoff'
|
|
ELSE '' END,
|
|
ezt_text
|
|
FROM [VERAG].[dbo].[tblEZT_Importcodenummern]
|
|
where ezt_Codenummer LIKE '6206400000%'
|
|
"
|
|
|
|
|
|
lblUpload.Text = "Laden & Übersetzen..."
|
|
|
|
If DT IsNot Nothing Then
|
|
Try
|
|
For Each row As DataRow In DT.Rows
|
|
Dim POSITION As New TELOTEC_Worker.cTelotec_Positionsdaten
|
|
POSITION.Item_ComCd = row("Tariff").ToString().Replace(".", "")
|
|
|
|
|
|
POSITION.PACKSTUECKE.Clear()
|
|
Dim PK As New TELOTEC_Worker.cTelotec_Packstuecke
|
|
PK.Pack_Kind = "PK"
|
|
' MsgBox(row("SumQty"))
|
|
PK.Pack_Nr = CInt(row("SumQty"))
|
|
POSITION.PACKSTUECKE.Add(PK)
|
|
|
|
If row("Currency") = "EUR" Then
|
|
POSITION.Item_ItVal = CDbl(row("SumAmount").ToString()).ToString("N2")
|
|
End If
|
|
Dim desc = row("Description").ToString
|
|
cDeeplAPI.deepl_Translate(row("Description").ToString, desc, "DE", "EN")
|
|
POSITION.Item_GdsDes = desc
|
|
POSITION.Item_Orig = row("Origin").ToString()
|
|
|
|
' MsgBox(POSITION.Item_GdsDes)
|
|
|
|
|
|
TC_ANM.POSITIONSDATEN.Add(POSITION)
|
|
cnt += 1
|
|
Next
|
|
|
|
'For i As Integer = 1 To endRows - startRows + 1 Step 1
|
|
' Dim POSITION As New TELOTEC_Worker.cTelotec_Positionsdaten
|
|
' POSITION.Item_ComCd = myArray(i, 6).ToString().Replace(".", "")
|
|
|
|
' POSITION.PACKSTUECKE.Clear()
|
|
' Dim PK As New TELOTEC_Worker.cTelotec_Packstuecke
|
|
' PK.Pack_Kind = "PK"
|
|
' PK.Pack_Nr = myArray(i, 8).ToString()
|
|
' POSITION.PACKSTUECKE.Add(PK)
|
|
|
|
' If myArray(i, 13).ToString() = "EUR" Then
|
|
' POSITION.Item_ItVal = CDbl(myArray(i, 12).ToString()).ToString("N2")
|
|
' End If
|
|
' POSITION.Item_GdsDes = myArray(i, 5).ToString()
|
|
' POSITION.Item_Orig = myArray(i, 4).ToString()
|
|
|
|
' TC_ANM.POSITIONSDATEN.Add(POSITION)
|
|
' cnt += 1
|
|
'Next
|
|
Catch ex As Exception
|
|
MsgBox("Fehler beim Einlesen der Excel-Datei!" & vbNewLine & vbNewLine & ex.Message & ex.StackTrace)
|
|
Datei.Close()
|
|
Me.Cursor = Cursors.Default
|
|
lblUpload.Visible = False : Return False
|
|
End Try
|
|
|
|
|
|
End If
|
|
.Visible = False
|
|
|
|
|
|
Datei.Close()
|
|
|
|
Me.FindForm.SuspendLayout()
|
|
' POSITIONEN.setValues(TC_ANM)
|
|
|
|
ALLG.setPosValues(TC_ANM)
|
|
|
|
btnPositionen.PerformClick()
|
|
' MsgBox(cnt & " Datensätze wurden eingelesen. ")
|
|
Me.FindForm.ResumeLayout()
|
|
lblUpload.Text = "Fertig! " & cnt & " Datensätze wurden eingelesen. "
|
|
|
|
Me.Cursor = Cursors.Default
|
|
Return True
|
|
Catch ex As Exception
|
|
'
|
|
Me.Cursor = Cursors.Default
|
|
MsgBox("FEHLER! Datei im richtigen Format?" & vbNewLine & vbNewLine & ex.Message & ex.StackTrace)
|
|
lblUpload.Visible = False
|
|
' Return False
|
|
End Try
|
|
End With
|
|
Return True
|
|
Else
|
|
MsgBox("Keine Datei ausgewählt!")
|
|
End If
|
|
|
|
Me.Cursor = Cursors.Default
|
|
lblUpload.Visible = False
|
|
Return False
|
|
|
|
End Function
|
|
|
|
Sub CreateDataTable(ByRef DT As DataTable)
|
|
'DT.Columns.Add("A")
|
|
DT.Columns.Add("B")
|
|
DT.Columns.Add("C")
|
|
DT.Columns.Add("D")
|
|
DT.Columns.Add("E")
|
|
DT.Columns.Add("F")
|
|
DT.Columns.Add("G")
|
|
DT.Columns.Add("H")
|
|
DT.Columns.Add("I", System.Type.GetType("System.Int32"))
|
|
DT.Columns.Add("J")
|
|
DT.Columns.Add("K")
|
|
DT.Columns.Add("L")
|
|
DT.Columns.Add("M", System.Type.GetType("System.Decimal"))
|
|
DT.Columns.Add("N")
|
|
|
|
End Sub
|
|
|
|
Sub CreateDataTableAgg(ByRef DT As DataTable)
|
|
'DT.Columns.Add("A")
|
|
DT.Columns.Add("Description")
|
|
DT.Columns.Add("Tariff")
|
|
DT.Columns.Add("TariffNf")
|
|
DT.Columns.Add("Currency")
|
|
DT.Columns.Add("Origin")
|
|
DT.Columns.Add("SumQty")
|
|
DT.Columns.Add("SumAmount")
|
|
|
|
End Sub
|
|
Function aggregierenTrendxol(myArray) As DataTable
|
|
Try
|
|
Dim DT As DataTable = New DataTable()
|
|
Call CreateDataTable(DT) 'Create the DataTable and all Columns
|
|
|
|
|
|
'Add the 2D Array to the DataTable
|
|
For i As Integer = 1 To myArray.GetUpperBound(0)
|
|
DT.Rows.Add()
|
|
For j As Integer = 1 To myArray.GetUpperBound(1)
|
|
'If j = 8 Then
|
|
' DT.Rows(i - 1).Item(j - 1) = CInt(myArray(i, j))
|
|
'Else
|
|
' DT.Rows(i - 1).Item(j - 1) = myArray(i, j)
|
|
'End If
|
|
DT.Rows(i - 1).Item(j - 1) = myArray(i, j)
|
|
|
|
Next j
|
|
Next i
|
|
|
|
' MsgBox(DT.Rows.Count)
|
|
'Dim amountGrpByDates = From row In DT
|
|
' Group row By dateGroup = New With {
|
|
' Key .Yr = row.Field(Of Integer)("Yr"),
|
|
' Key .Mnth = row.Field(Of Integer)("Mnth"),
|
|
' Key .Period = row.Field(Of String)("Period")
|
|
' } Into Group
|
|
' Select New With {
|
|
' Key .Dates = dateGroup,
|
|
' .SumAmount = Group.Sum(Function(x) x.Field(Of Decimal)("Amount"))}
|
|
|
|
|
|
'For Each r In DT.Rows
|
|
' '' MsgBox("a> " & r("A"))
|
|
' 'MsgBox("b> " & r("B"))
|
|
' 'MsgBox("c> " & r("C"))
|
|
' 'MsgBox("d> " & r("D"))
|
|
' 'MsgBox("e> " & r("E"))
|
|
' 'MsgBox("f> " & r("F"))
|
|
' 'MsgBox("g> " & r("G"))
|
|
' 'MsgBox("h> " & r("H"))
|
|
' MsgBox("i> " & r("I"))
|
|
'Next
|
|
|
|
'Key .Description = row.Field(Of String)("D") & ", " & row.Field(Of String)("F"),
|
|
|
|
Dim amountGrpByDates = From row In DT
|
|
Group row By groupKeys = New With {
|
|
Key .Orig = row.Field(Of String)("E"),
|
|
Key .Description = VERAG_PROG_ALLGEMEIN.cTariffKN8_Interface.getKN8FromTNR(row.Field(Of String)("G")) & ", hier: " & row.Field(Of String)("D") & "," & row.Field(Of String)("F") & ",etc.",
|
|
Key .Tnr = row.Field(Of String)("G"),
|
|
Key .Curr = row.Field(Of String)("N")
|
|
} Into Group
|
|
Select New With {
|
|
Key .Params = groupKeys,
|
|
.SumQTY = Group.Sum(Function(x) x.Field(Of Integer)("I")),
|
|
.SumAmount = Group.Sum(Function(x) x.Field(Of Decimal)("M"))}
|
|
' .SumQTY = Group.Sum(Function(x) x.Field(Of Integer)("I"))}
|
|
|
|
|
|
Dim DT_AGG As New DataTable
|
|
Call CreateDataTableAgg(DT_AGG) 'Create the DataTable and all Columns
|
|
|
|
|
|
|
|
|
|
For Each grp In amountGrpByDates
|
|
'Dim row As New DataRow
|
|
'MsgBox("" & grp.Params.Orig & " " & grp.Params.Description & " " & grp.Params.Tnr & " " & grp.Params.Curr & "= " & grp.SumQTY & " " & grp.SumAmount & "")
|
|
DT_AGG.Rows.Add({grp.Params.Description, grp.Params.Tnr, "", grp.Params.Curr, grp.Params.Orig, grp.SumQTY, grp.SumAmount})
|
|
Next
|
|
|
|
If MsgBox("Excel ausgeben?", vbYesNo) = vbYes Then
|
|
|
|
'Excel ausgeben
|
|
SDL.cProgramFunctions.genExcelCSVFromDT(DT_AGG)
|
|
|
|
End If
|
|
|
|
|
|
|
|
'DT.AsEnumerable().GroupBy(row >= row.Field < Int() > ("G"))
|
|
'Dim myArrayAgg As Object(,) '<-- declared as 2D Array
|
|
|
|
|
|
'For iOuter As Integer = myArray.GetLowerBound(0) To myArray.GetUpperBound(0)
|
|
' 'iOuter represents the first dimension
|
|
' MsgBox(myArray(iOuter, 6))
|
|
|
|
|
|
' 'For iInner As Integer = myArray.GetLowerBound(1) To myArray.GetUpperBound(1)
|
|
' ' 'iInner represents the second dimension
|
|
' ' myArray(iOuter, iInner) = "This Isn't Nothing" 'Set the value
|
|
|
|
' 'Next 'iInner
|
|
|
|
' 'If you are only interested in the first element you don't need the inner loop
|
|
' myArray(iOuter, 0) = "This is the first element in the second dimension"
|
|
'Next 'iOuter
|
|
'MasterIndex is now filled completely
|
|
|
|
|
|
|
|
'For i As Integer = 1 To endRows - startRows + 1 Step 1
|
|
' Dim POSITION As New TELOTEC_Worker.cTelotec_Positionsdaten
|
|
' POSITION.Item_ComCd = myArray(i, 6).ToString().Replace(".", "")
|
|
|
|
' POSITION.PACKSTUECKE.Clear()
|
|
' Dim PK As New TELOTEC_Worker.cTelotec_Packstuecke
|
|
' PK.Pack_Kind = "PK"
|
|
' PK.Pack_Nr = myArray(i, 8).ToString()
|
|
' POSITION.PACKSTUECKE.Add(PK)
|
|
|
|
' If myArray(i, 13).ToString() = "EUR" Then
|
|
' POSITION.Item_ItVal = CDbl(myArray(i, 12).ToString()).ToString("N2")
|
|
' End If
|
|
' POSITION.Item_GdsDes = myArray(i, 5).ToString()
|
|
' POSITION.Item_Orig = myArray(i, 4).ToString()
|
|
|
|
' TC_ANM.POSITIONSDATEN.Add(POSITION)
|
|
' cnt += 1
|
|
'Next
|
|
Return DT_AGG
|
|
Catch ex As Exception
|
|
MsgBox("Fehler beim Aggregieren !" & vbNewLine & vbNewLine & ex.Message & ex.StackTrace)
|
|
Me.Cursor = Cursors.Default
|
|
Return Nothing
|
|
End Try
|
|
|
|
End Function
|
|
|
|
|
|
Function aggregierenTrendxolTNR(myArray) As DataTable
|
|
Try
|
|
Dim DT As DataTable = New DataTable()
|
|
Call CreateDataTable(DT) 'Create the DataTable and all Columns
|
|
|
|
|
|
'Add the 2D Array to the DataTable
|
|
For i As Integer = 1 To myArray.GetUpperBound(0)
|
|
DT.Rows.Add()
|
|
For j As Integer = 1 To myArray.GetUpperBound(1)
|
|
'If j = 8 Then
|
|
' DT.Rows(i - 1).Item(j - 1) = CInt(myArray(i, j))
|
|
'Else
|
|
' DT.Rows(i - 1).Item(j - 1) = myArray(i, j)
|
|
'End If
|
|
DT.Rows(i - 1).Item(j - 1) = myArray(i, j)
|
|
|
|
Next j
|
|
Next i
|
|
|
|
' MsgBox(DT.Rows.Count)
|
|
'Dim amountGrpByDates = From row In DT
|
|
' Group row By dateGroup = New With {
|
|
' Key .Yr = row.Field(Of Integer)("Yr"),
|
|
' Key .Mnth = row.Field(Of Integer)("Mnth"),
|
|
' Key .Period = row.Field(Of String)("Period")
|
|
' } Into Group
|
|
' Select New With {
|
|
' Key .Dates = dateGroup,
|
|
' .SumAmount = Group.Sum(Function(x) x.Field(Of Decimal)("Amount"))}
|
|
|
|
|
|
'For Each r In DT.Rows
|
|
' '' MsgBox("a> " & r("A"))
|
|
' 'MsgBox("b> " & r("B"))
|
|
' 'MsgBox("c> " & r("C"))
|
|
' 'MsgBox("d> " & r("D"))
|
|
' 'MsgBox("e> " & r("E"))
|
|
' 'MsgBox("f> " & r("F"))
|
|
' 'MsgBox("g> " & r("G"))
|
|
' 'MsgBox("h> " & r("H"))
|
|
' MsgBox("i> " & r("I"))
|
|
'Next
|
|
VERAG_PROG_ALLGEMEIN.cChilkat_Helper.UnlockCilkat()
|
|
|
|
Dim amountGrpByDates = From row In DT
|
|
Group row By groupKeys = New With {
|
|
Key .Orig = row.Field(Of String)("E"),
|
|
Key .Tnr = row.Field(Of String)("G"),
|
|
Key .Description = VERAG_PROG_ALLGEMEIN.cTariffKN8_Interface.getKN8FromTNR(row.Field(Of String)("G")),
|
|
Key .Curr = row.Field(Of String)("N")
|
|
} Into Group
|
|
Select New With {
|
|
Key .Params = groupKeys,
|
|
.SumQTY = Group.Sum(Function(x) x.Field(Of Integer)("I")),
|
|
.Desc = ", hier: " & Group.Min(Function(x) (x.Field(Of String)("D") & ", " & x.Field(Of String)("F"))) & " / " & Group.Max(Function(x) (x.Field(Of String)("D") & ", " & x.Field(Of String)("F"))) & ", etc.",
|
|
.SumAmount = Group.Sum(Function(x) x.Field(Of Decimal)("M"))}
|
|
' .SumQTY = Group.Sum(Function(x) x.Field(Of Integer)("I"))}
|
|
'row.Field(Of String)("D") & ", " & row.Field(Of String)("F")
|
|
|
|
Dim DT_AGG As New DataTable
|
|
Call CreateDataTableAgg(DT_AGG) 'Create the DataTable and all Columns
|
|
|
|
|
|
For Each grp In amountGrpByDates
|
|
'Dim row As New DataRow
|
|
'MsgBox("" & grp.Params.Orig & " " & grp.Params.Description & " " & grp.Params.Tnr & " " & grp.Params.Curr & "= " & grp.SumQTY & " " & grp.SumAmount & "")
|
|
' MsgBox(grp.SumQTY)
|
|
DT_AGG.Rows.Add({grp.Params.Description & grp.Desc, grp.Params.Tnr, "", grp.Params.Curr, grp.Params.Orig, grp.SumQTY, grp.SumAmount})
|
|
Next
|
|
|
|
|
|
If MsgBox("Excel ausgeben?", vbYesNo) = vbYes Then
|
|
|
|
'Excel ausgeben
|
|
SDL.cProgramFunctions.genExcelCSVFromDT(DT_AGG)
|
|
|
|
End If
|
|
|
|
|
|
'DT.AsEnumerable().GroupBy(row >= row.Field < Int() > ("G"))
|
|
'Dim myArrayAgg As Object(,) '<-- declared as 2D Array
|
|
|
|
|
|
'For iOuter As Integer = myArray.GetLowerBound(0) To myArray.GetUpperBound(0)
|
|
' 'iOuter represents the first dimension
|
|
' MsgBox(myArray(iOuter, 6))
|
|
|
|
|
|
' 'For iInner As Integer = myArray.GetLowerBound(1) To myArray.GetUpperBound(1)
|
|
' ' 'iInner represents the second dimension
|
|
' ' myArray(iOuter, iInner) = "This Isn't Nothing" 'Set the value
|
|
|
|
' 'Next 'iInner
|
|
|
|
' 'If you are only interested in the first element you don't need the inner loop
|
|
' myArray(iOuter, 0) = "This is the first element in the second dimension"
|
|
'Next 'iOuter
|
|
'MasterIndex is now filled completely
|
|
|
|
|
|
|
|
'For i As Integer = 1 To endRows - startRows + 1 Step 1
|
|
' Dim POSITION As New TELOTEC_Worker.cTelotec_Positionsdaten
|
|
' POSITION.Item_ComCd = myArray(i, 6).ToString().Replace(".", "")
|
|
|
|
' POSITION.PACKSTUECKE.Clear()
|
|
' Dim PK As New TELOTEC_Worker.cTelotec_Packstuecke
|
|
' PK.Pack_Kind = "PK"
|
|
' PK.Pack_Nr = myArray(i, 8).ToString()
|
|
' POSITION.PACKSTUECKE.Add(PK)
|
|
|
|
' If myArray(i, 13).ToString() = "EUR" Then
|
|
' POSITION.Item_ItVal = CDbl(myArray(i, 12).ToString()).ToString("N2")
|
|
' End If
|
|
' POSITION.Item_GdsDes = myArray(i, 5).ToString()
|
|
' POSITION.Item_Orig = myArray(i, 4).ToString()
|
|
|
|
' TC_ANM.POSITIONSDATEN.Add(POSITION)
|
|
' cnt += 1
|
|
'Next
|
|
Return DT_AGG
|
|
Catch ex As Exception
|
|
MsgBox("Fehler beim Aggregieren !" & vbNewLine & vbNewLine & ex.Message & ex.StackTrace)
|
|
Me.Cursor = Cursors.Default
|
|
Return Nothing
|
|
End Try
|
|
|
|
End Function
|
|
|
|
Private Function checkExcel_trendyol(Blatt As Excel.Worksheet, ByRef startRows As Integer) As Boolean
|
|
'Prüfung
|
|
Try
|
|
If Blatt Is Nothing Then Return False
|
|
'If Blatt.Range("B24") Is Nothing Then Return False
|
|
'If Blatt.Range("B24").Value.ToString <> "DESCRIPTION" Then Return False
|
|
|
|
|
|
|
|
|
|
'---> Start finden:
|
|
' Dim startRows As Integer = -1
|
|
|
|
|
|
Dim zeile As Integer = 1
|
|
Dim gefunden As Boolean = False
|
|
|
|
Try
|
|
' Schleife durch alle Zeilen
|
|
While zeile < 100 Or Blatt.Range("B" & zeile).Value IsNot Nothing
|
|
' MsgBox(Blatt.Range("B" & zeile).Value.ToString())
|
|
' Überprüfen, ob in Spalte B (2) "DESCRIPTION" steht
|
|
If Blatt.Range("B" & zeile).Value IsNot Nothing AndAlso Blatt.Range("B" & zeile).Value.ToString().Trim().ToUpper() = "DESCRIPTION" Then
|
|
' MsgBox(Blatt.Range("B" & zeile).Value.ToString())
|
|
startRows = zeile + 1
|
|
gefunden = True
|
|
Exit While
|
|
End If
|
|
zeile += 1
|
|
End While
|
|
|
|
If Not gefunden Then
|
|
MsgBox("Format nicht erkannt!")
|
|
Me.Cursor = Cursors.Default
|
|
lblUpload.Visible = False : Return False
|
|
End If
|
|
|
|
Catch ex As Exception
|
|
Console.WriteLine("Fehler: " & ex.Message)
|
|
End Try
|
|
|
|
|
|
Catch ex As Exception
|
|
MsgBox("Fehler bei der Prüfung!" & ex.Message)
|
|
Me.Cursor = Cursors.Default
|
|
Return False
|
|
End Try
|
|
Return True
|
|
|
|
End Function
|
|
|
|
|
|
Private Sub NeueBezugsnummerVergebenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles NeueBezugsnummerVergebenToolStripMenuItem.Click
|
|
BezugsNr = getBezugsnr(BezugsNr)
|
|
End Sub
|
|
|
|
Private Sub EZAIDToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles EZAIDToolStripMenuItem.Click
|
|
If TC_ANM IsNot Nothing Then
|
|
MsgBox(TC_ANM.telanm_id)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub DynamicAutomotiveXLSToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles DynamicAutomotiveXLSToolStripMenuItem.Click, ToolStripMenuItem2.Click
|
|
If sender Is DynamicAutomotiveXLSToolStripMenuItem Then
|
|
importExcel_trendyol(True)
|
|
Else
|
|
importExcel_trendyol(False)
|
|
End If
|
|
End Sub
|
|
|
|
|
|
End Class
|
|
|