From 7723e5c2b6e5a351495aa77521cc4028780f4b83 Mon Sep 17 00:00:00 2001 From: "d.breimaier" Date: Fri, 15 Nov 2024 09:03:55 +0100 Subject: [PATCH] ids --- initATLASAufschubkonten/frmStartOptions.vb | 42 ++++++++++++---------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/initATLASAufschubkonten/frmStartOptions.vb b/initATLASAufschubkonten/frmStartOptions.vb index d3562a5..04348a1 100644 --- a/initATLASAufschubkonten/frmStartOptions.vb +++ b/initATLASAufschubkonten/frmStartOptions.vb @@ -344,9 +344,9 @@ Public Class frmStartOptions pfad = parameter(2) betreff = parameter(3) - 'pfad = "C:\Users\d.breimaier\Downloads\ids_customer_0060003360_invoice_de00360936_from_150615 (5).msg" - 'betreff = "IDS, customer: 0060003360 Invoice: DE00360936 from 15/06/15" - 'von = "ids.de@q8.com" + 'pfad = "C:\Users\d.breimaier\Downloads\0CD522B58DB96E184EFBD2C622DD4C3B781A2D35.html" + 'betreff = "IDS, customer 0060003360 Invoice: DE00360936 from 15/06/15" + 'von = "d.breimaier@verag.ag" If (parameter.Count - 1) >= 5 Then von = parameter(5) @@ -355,6 +355,7 @@ Public Class frmStartOptions If von.Contains("ebilling@uta.com") Then '---------------------UTA---------------------- 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 '---------------------IDS---------------------- importFileFromIDSMailAnhang(pfad, betreff, PARAM) @@ -599,7 +600,7 @@ Public Class frmStartOptions fehler = mse.getNewestTransactions(token, dt, batchrequestNr, totalPages, 0, True) If fehler <> "" Then - API.UPDTAE_ERR("Batch-Nr: " & batchrequestNr & "-" & totalPages, fehler, "getNewestTransactions") + API.UPDTAE_ERR("Batch-Nr: " & batchrequestNr & "-" & totalPages, fehler, "getNewestTransactions") closeMe() Exit Sub End If @@ -1616,32 +1617,34 @@ Public Class frmStartOptions 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 ids.initImportPfade("IDS") Dim Zielpfad = ids.VERARBEITUNG_PFAD If betreff.ToString.ToLower.Contains("ids") Then + betreff = betreff.replace("WG: ", "") + betreff = betreff.replace("FW: ", "") Dim customerNo = "" Dim invoiceNo = "" Dim dateNo = "" Dim outputDate = "" - Dim customerString = "customer: " + Dim customerString = "customer " Dim InvoiceString = "Invoice: " Dim dateString = "from " 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) 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) 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) Dim parsedDate As DateTime = DateTime.ParseExact(dateNo, "dd/MM/yy", System.Globalization.CultureInfo.InvariantCulture) outputDate = parsedDate.ToString("dd.MM.yyyy") @@ -1654,17 +1657,18 @@ Public Class frmStartOptions If Not idsInvoice.hasEntry Then idsInvoice.SAVE() - Dim outlookApp As Object - Dim mailItem As Outlook.MailItem + 'Dim outlookApp As Object + 'Dim mailItem As Outlook.MailItem Try - outlookApp = CreateObject("Outlook.Application") - mailItem = outlookApp.Session.OpenSharedItem(pfad) + Dim htmlText = File.ReadAllText(pfad) + 'outlookApp = CreateObject("Outlook.Application") + 'mailItem = outlookApp.Session.OpenSharedItem(pfad) - If mailItem IsNot Nothing Then - If idsInvoice.isMail_IDS(mailItem) Then - If idsInvoice.getPDF_IDS(mailItem, filename, Zielpfad & idsInvoice.Invoicenumber & ".pdf") Then + If htmlText IsNot Nothing Then + If idsInvoice.isMail_IDS(htmlText) Then + If idsInvoice.getPDF_IDS(htmlText, filename, Zielpfad & idsInvoice.Invoicenumber & ".pdf") Then idsInvoice.DocumentName = filename End If @@ -1678,9 +1682,9 @@ Public Class frmStartOptions Finally Try - If mailItem IsNot Nothing Then - Marshal.ReleaseComObject(mailItem) - End If + 'If mailItem IsNot Nothing Then + ' Marshal.ReleaseComObject(mailItem) + 'End If Catch ex As Exception End Try