This commit is contained in:
2021-02-02 21:16:08 +01:00
parent 2f7746d9ca
commit d22ee3d24c
13 changed files with 336 additions and 58 deletions

View File

@@ -4241,4 +4241,87 @@ Public Class frmSendungsdetailsNEU
f.ShowDialog(Me)
Me.Cursor = DefaultCursor
End Sub
Private Sub ImportToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ImportToolStripMenuItem.Click
Me.Cursor = Cursors.WaitCursor
Try
Dim Path = ""
If True Then
Dim sPath As String = Environment.GetFolderPath(Environment.SpecialFolder.Personal) & "\VERAG\ATANAK\"
If Not My.Computer.FileSystem.DirectoryExists(sPath) Then
My.Computer.FileSystem.CreateDirectory(sPath)
End If
Dim exclApp As Object 'as Application
Dim Datei As Object 'as WorkBook
Dim Blatt As Object 'Microsoft.Office.Interop.Excel.Worksheet 'As Object 'as Worksheet
exclApp = CreateObject("Excel.Application")
With exclApp
.Visible = False
Try
Path = sPath & "ATANAK_Import_" & SENDUNG_LIST(CURRENT_INDEX).FilialenNr & "-" & SENDUNG_LIST(CURRENT_INDEX).AbfertigungsNr & "" & " .xlsx"
While System.IO.File.Exists(Path)
Path = sPath & "ATANAK_Import_" & SENDUNG_LIST(CURRENT_INDEX).FilialenNr & "-" & SENDUNG_LIST(CURRENT_INDEX).AbfertigungsNr & "" & "_" & Now.ToString("ddMMyyyyHHmmss") & ".xlsx"
End While
My.Computer.FileSystem.WriteAllBytes(Path, My.Resources.ATANAK_Instructions_Import, False)
Catch ex As System.Exception
' MsgBox(ex.Message)
MsgBox("ERROR 01: " & ex.Message & vbNewLine & ex.StackTrace)
Me.Cursor = Cursors.Default
Exit Sub
End Try
Datei = .Workbooks.Open(Path) 'Anpassen
Blatt = Datei.Worksheets(1) 'Anpassen
Blatt.Range("E9").Value = SENDUNG_LIST(CURRENT_INDEX).FilialenNr & "/" & SENDUNG_LIST(CURRENT_INDEX).AbfertigungsNr
Blatt.Range("D10").Value = AVISO.LKW_Nr
Blatt.Range("D11").Value = SENDUNG_LIST(CURRENT_INDEX).tblSnd_Empfaenger
If SENDUNG_LIST(CURRENT_INDEX).tblSnd_EmpfaengerKdNr > 0 Then
Dim KD As New VERAG_PROG_ALLGEMEIN.cKunde(SENDUNG_LIST(CURRENT_INDEX).tblSnd_EmpfaengerKdNr)
If KD IsNot Nothing AndAlso If(KD.EORITIN, "") <> "" Then
Blatt.Range("D12").Value = KD.EORITIN
End If
End If
Blatt.Range("F13").Value = "" 'DDA
Blatt.Range("C26").Value = SENDUNG_LIST(CURRENT_INDEX).tblSnd_Gewicht
Blatt.Range("G26").Value = SENDUNG_LIST(CURRENT_INDEX).tblSnd_Colli
Blatt.Range("D27").Value = "" 'Procedure
Blatt.Range("F29").Value = "" 'CPC
Blatt.Range("F30").Value = "" 'Supervising HMRC Adress
Blatt.Range("F32").Value = "" 'LICENSE Y/N
Blatt.Range("A36").Value = "" 'Other1
Blatt.Range("A37").Value = "" 'Other2
Blatt.Range("A39").Value = "" 'Other3
Blatt.Range("B42").Value = VERAG_PROG_ALLGEMEIN.cAllgemein.MITARBEITER.Fullname
Blatt.Range("G42").Value = Now.ToShortDateString
Datei.Save
If False Then
Blatt.PrintOutEx()
Else
'Process.Start(Path)
.Visible = True
End If
End With
End If
Catch ex As Exception
MsgBox(ex.Message & ex.StackTrace)
End Try
Me.Cursor = Cursors.Default
End Sub
End Class