Uta, Mailsender
This commit is contained in:
@@ -3,16 +3,13 @@ Imports System.Net
|
||||
Imports System.Text
|
||||
Imports System.Text.RegularExpressions
|
||||
Imports System.Web
|
||||
Imports io.konik
|
||||
Imports io.konik.carriage.pdfbox.xmp
|
||||
Imports io.konik.validation
|
||||
Imports io.konik.zugferd
|
||||
Imports java.nio.channels
|
||||
Imports System.Xml
|
||||
Imports Renci.SshNet
|
||||
Imports Renci.SshNet.Sftp
|
||||
Imports VERAG_PROG_ALLGEMEIN
|
||||
|
||||
|
||||
|
||||
Public Class frmNachrichtenVerarbeitung_MDM_divers
|
||||
Dim cntDatenEingelesen As Integer = 0
|
||||
Dim dsNichtErkannt As Integer = 0
|
||||
@@ -412,29 +409,78 @@ Public Class frmNachrichtenVerarbeitung_MDM_divers
|
||||
'PDFs über EEA und Zugpfrd
|
||||
If fi.Extension.ToLower = ".pdf" Then
|
||||
|
||||
If Not System.IO.Directory.Exists(zielpfad & "Invoice_PDF\" & Now.Year & "\" & Now.ToString("yyyyMMdd") & "\") Then System.IO.Directory.CreateDirectory(zielpfad & Now.Year & "\" & Now.ToString("yyyyMMdd") & "\")
|
||||
If True Then 'Not System.IO.Directory.Exists(zielpfad & "Invoice_PDF\" & Now.Year & "\" & Now.ToString("yyyyMMdd") & "\") Then System.IO.Directory.CreateDirectory(zielpfad & Now.Year & "\" & Now.ToString("yyyyMMdd") & "\")
|
||||
|
||||
If fi.Name.ToString.StartsWith("invoice_") Then
|
||||
If fi.Name.ToString.StartsWith("invoice_") Then
|
||||
|
||||
Dim DS As New VERAG_PROG_ALLGEMEIN.cDATENSERVER("MDM", "MDM_DATEN", "UTA", Now.Year, Now.ToString("yyyyMMdd"), frmStartOptions.getFileName(d))
|
||||
Dim DS As New VERAG_PROG_ALLGEMEIN.cDATENSERVER("MDM", "MDM_DATEN", "UTA", Now.Year, Now.ToString("yyyyMMdd"), frmStartOptions.getFileName(d))
|
||||
|
||||
DS.uploadDataToDATENSERVER(d,,,,,, True)
|
||||
DS.uploadDataToDATENSERVER(d,,,,,, True)
|
||||
|
||||
|
||||
'zugferd-Daten aus pdf auslesen!
|
||||
Dim invoice As New Invoice(zugferd.profile.ConformanceLevel.BASIC)
|
||||
Dim validator As InvoiceValidator = New InvoiceValidator()
|
||||
Dim test = validator.validate(invoice)
|
||||
'zugferd-Daten aus pdf auslesen!
|
||||
|
||||
'1 Read your PDF
|
||||
'2 Get the catalog inside your PDF
|
||||
'3 Get the Array with name AF from Catalog
|
||||
'4 Get first element from AF array (should be file spec)
|
||||
'5 From file spec get the dictionary named EF
|
||||
'6 Get the stream content of EF
|
||||
|
||||
Try
|
||||
|
||||
Dim invoiceNr As String = ""
|
||||
Dim invoiceDate As String = ""
|
||||
Dim UTA_Beleg_ID As String = ""
|
||||
Dim doc = New Spire.Pdf.PdfDocument()
|
||||
doc.LoadFromFile(fi.FullName)
|
||||
|
||||
Dim pdfAtt = doc.Attachments(0)
|
||||
If pdfAtt.FileName = "ZUGFeRD-invoice.xml" Then
|
||||
|
||||
Dim filename = Path.GetFileName(pdfAtt.FileName)
|
||||
File.WriteAllBytes(filename, pdfAtt.Data)
|
||||
|
||||
Dim docxml As New XmlDocument()
|
||||
docxml.Load(New XmlTextReader(filename))
|
||||
If docxml.HasChildNodes Then
|
||||
|
||||
If docxml.GetElementsByTagName("rsm:ExchangedDocument").Count > 0 Then
|
||||
Dim count As Integer = 1
|
||||
For Each node As XmlElement In docxml.GetElementsByTagName("rsm:ExchangedDocument")
|
||||
If node.HasChildNodes Then
|
||||
For Each element As XmlElement In node.ChildNodes
|
||||
If element.Name = "ram:ID" AndAlso element.InnerText <> "" Then invoiceNr = element.InnerText 'Rechnungsnummer
|
||||
If element.Name = "ram:IssueDateTime" AndAlso element.InnerText <> "" Then invoiceDate = element.InnerText
|
||||
|
||||
Next
|
||||
|
||||
count = count + 1
|
||||
|
||||
End If
|
||||
Next
|
||||
|
||||
End If
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
If UTA_Beleg_ID <> "" Then
|
||||
'TO DO -> ÄNDERN----------------------
|
||||
SQL.doSQL("Update [tblUTAImportNew] SET [daId]='" & DS.da_id & "' where [UTA_Beleg_ID] = '" & UTA_Beleg_ID & "' and [rmc_importDatum] > DATEADD(DAY,-4,getdate()) ", "FMZOLL")
|
||||
'TO DO -> ÄNDERN----------------------
|
||||
End If
|
||||
|
||||
|
||||
'TO DO -> ÄNDERN----------------------
|
||||
' SQL.doSQL("Update [tblUTAImport] SET [daId]='" & DS.da_id & "' where [rmc_pdfFileName] = '" & DS.da_name & "' and [rmc_importDatum] > DATEADD(DAY,-4,getdate()) ", "FMZOLL")
|
||||
'TO DO -> ÄNDERN----------------------
|
||||
Catch ex As System.Exception
|
||||
End Try
|
||||
|
||||
End If
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
frmStartOptions.moveFile_DateBack(d, zielpfad & "Invoice_PDF\" & Now.Year & "\" & Now.ToString("yyyyMMdd") & "\")
|
||||
'frmStartOptions.moveFile_DateBack(d, zielpfad & "Invoice_PDF\" & Now.Year & "\" & Now.ToString("yyyyMMdd") & "\")
|
||||
If fi.Name.ToLower.Contains("pdf") Then addDGVEinarbeitung("PDF", fi.Name)
|
||||
dgvEinarbeitung.Refresh()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user