This commit is contained in:
2024-11-15 09:03:55 +01:00
parent 11f3850877
commit 7723e5c2b6

View File

@@ -344,9 +344,9 @@ Public Class frmStartOptions
pfad = parameter(2) pfad = parameter(2)
betreff = parameter(3) betreff = parameter(3)
'pfad = "C:\Users\d.breimaier\Downloads\ids_customer_0060003360_invoice_de00360936_from_150615 (5).msg" 'pfad = "C:\Users\d.breimaier\Downloads\0CD522B58DB96E184EFBD2C622DD4C3B781A2D35.html"
'betreff = "IDS, customer: 0060003360 Invoice: DE00360936 from 15/06/15" 'betreff = "IDS, customer 0060003360 Invoice: DE00360936 from 15/06/15"
'von = "ids.de@q8.com" 'von = "d.breimaier@verag.ag"
If (parameter.Count - 1) >= 5 Then von = parameter(5) If (parameter.Count - 1) >= 5 Then von = parameter(5)
@@ -355,6 +355,7 @@ Public Class frmStartOptions
If von.Contains("ebilling@uta.com") Then If von.Contains("ebilling@uta.com") Then
'---------------------UTA---------------------- '---------------------UTA----------------------
importFileFromUTAMailAnhang(pfad, betreff) importFileFromUTAMailAnhang(pfad, betreff)
ElseIf von.Contains("ids.de@q8.com") Or von.Contains("isselh@q8.com") Or von.Contains("d.breimaier@verag.ag") Or von.Contains("s.kriegner@verag.ag") Then ElseIf von.Contains("ids.de@q8.com") Or von.Contains("isselh@q8.com") Or von.Contains("d.breimaier@verag.ag") Or von.Contains("s.kriegner@verag.ag") Then
'---------------------IDS---------------------- '---------------------IDS----------------------
importFileFromIDSMailAnhang(pfad, betreff, PARAM) importFileFromIDSMailAnhang(pfad, betreff, PARAM)
@@ -599,7 +600,7 @@ Public Class frmStartOptions
fehler = mse.getNewestTransactions(token, dt, batchrequestNr, totalPages, 0, True) fehler = mse.getNewestTransactions(token, dt, batchrequestNr, totalPages, 0, True)
If fehler <> "" Then If fehler <> "" Then
API.UPDTAE_ERR("Batch-Nr: " & batchrequestNr & "-" & totalPages, fehler, "getNewestTransactions") API.UPDTAE_ERR("Batch-Nr: " & batchrequestNr & "-" & totalPages, fehler, "getNewestTransactions")
closeMe() closeMe()
Exit Sub Exit Sub
End If End If
@@ -1616,32 +1617,34 @@ Public Class frmStartOptions
End If End If
ElseIf betreff.contains("IDS, customer:") AndAlso type = "mdm_mail_attach" Then 'Email mit Rechnungslink ElseIf betreff.contains("IDS, customer") AndAlso type = "mdm_mail_attach" Then 'Email mit Rechnungslink
Dim ids As New cIDS Dim ids As New cIDS
ids.initImportPfade("IDS") ids.initImportPfade("IDS")
Dim Zielpfad = ids.VERARBEITUNG_PFAD Dim Zielpfad = ids.VERARBEITUNG_PFAD
If betreff.ToString.ToLower.Contains("ids") Then If betreff.ToString.ToLower.Contains("ids") Then
betreff = betreff.replace("WG: ", "")
betreff = betreff.replace("FW: ", "")
Dim customerNo = "" Dim customerNo = ""
Dim invoiceNo = "" Dim invoiceNo = ""
Dim dateNo = "" Dim dateNo = ""
Dim outputDate = "" Dim outputDate = ""
Dim customerString = "customer: " Dim customerString = "customer "
Dim InvoiceString = "Invoice: " Dim InvoiceString = "Invoice: "
Dim dateString = "from " Dim dateString = "from "
Dim filename = "" Dim filename = ""
If betreff.Length > 58 AndAlso betreff.Contains(customerString) Then If betreff.Length >= 58 AndAlso betreff.Contains(customerString) Then
customerNo = betreff.Substring(betreff.IndexOf(customerString) + customerString.Length, 10) customerNo = betreff.Substring(betreff.IndexOf(customerString) + customerString.Length, 10)
End If End If
If betreff.Length > 58 AndAlso betreff.Contains(InvoiceString) Then If betreff.Length >= 58 AndAlso betreff.Contains(InvoiceString) Then
invoiceNo = betreff.Substring(betreff.IndexOf(InvoiceString) + InvoiceString.Length, 10) invoiceNo = betreff.Substring(betreff.IndexOf(InvoiceString) + InvoiceString.Length, 10)
End If End If
If betreff.Length > 58 AndAlso betreff.Contains(dateString) Then If betreff.Length >= 58 AndAlso betreff.Contains(dateString) Then
dateNo = betreff.Substring(betreff.IndexOf(dateString) + dateString.Length, 8) dateNo = betreff.Substring(betreff.IndexOf(dateString) + dateString.Length, 8)
Dim parsedDate As DateTime = DateTime.ParseExact(dateNo, "dd/MM/yy", System.Globalization.CultureInfo.InvariantCulture) Dim parsedDate As DateTime = DateTime.ParseExact(dateNo, "dd/MM/yy", System.Globalization.CultureInfo.InvariantCulture)
outputDate = parsedDate.ToString("dd.MM.yyyy") outputDate = parsedDate.ToString("dd.MM.yyyy")
@@ -1654,17 +1657,18 @@ Public Class frmStartOptions
If Not idsInvoice.hasEntry Then idsInvoice.SAVE() If Not idsInvoice.hasEntry Then idsInvoice.SAVE()
Dim outlookApp As Object 'Dim outlookApp As Object
Dim mailItem As Outlook.MailItem 'Dim mailItem As Outlook.MailItem
Try Try
outlookApp = CreateObject("Outlook.Application") Dim htmlText = File.ReadAllText(pfad)
mailItem = outlookApp.Session.OpenSharedItem(pfad) 'outlookApp = CreateObject("Outlook.Application")
'mailItem = outlookApp.Session.OpenSharedItem(pfad)
If mailItem IsNot Nothing Then If htmlText IsNot Nothing Then
If idsInvoice.isMail_IDS(mailItem) Then If idsInvoice.isMail_IDS(htmlText) Then
If idsInvoice.getPDF_IDS(mailItem, filename, Zielpfad & idsInvoice.Invoicenumber & ".pdf") Then If idsInvoice.getPDF_IDS(htmlText, filename, Zielpfad & idsInvoice.Invoicenumber & ".pdf") Then
idsInvoice.DocumentName = filename idsInvoice.DocumentName = filename
End If End If
@@ -1678,9 +1682,9 @@ Public Class frmStartOptions
Finally Finally
Try Try
If mailItem IsNot Nothing Then 'If mailItem IsNot Nothing Then
Marshal.ReleaseComObject(mailItem) ' Marshal.ReleaseComObject(mailItem)
End If 'End If
Catch ex As Exception Catch ex As Exception
End Try End Try