IDS RechnungenNachLand, PloseImport, etc.
This commit is contained in:
@@ -302,11 +302,12 @@ Public Class frmNachrichtenVerarbeitung_MDM_divers
|
||||
|
||||
End Function
|
||||
|
||||
Private Function createIDSInvoice(Dateiname As String, Optional isMail As Boolean = False)
|
||||
Private Function createIDSInvoice(Dateiname As String, Type As String, Optional isMail As Boolean = False)
|
||||
|
||||
Dim Zielpfad = ids.VERARBEITUNG_PFAD
|
||||
Dim customerNo = ""
|
||||
Dim invoiceNo = ""
|
||||
Dim country = ""
|
||||
Dim dateNo = ""
|
||||
Dim outputDate = ""
|
||||
Dim customerString = "customer"
|
||||
@@ -314,9 +315,6 @@ Public Class frmNachrichtenVerarbeitung_MDM_divers
|
||||
Dim dateString = "from"
|
||||
Dim filename = ""
|
||||
|
||||
|
||||
'0060003362_20012025_DE00707031
|
||||
|
||||
If Dateiname.Contains(customerString) Then
|
||||
customerNo = Dateiname.Substring(Dateiname.IndexOf(customerString) + customerString.Length, 10)
|
||||
Else
|
||||
@@ -326,7 +324,51 @@ Public Class frmNachrichtenVerarbeitung_MDM_divers
|
||||
If Dateiname.Contains(InvoiceString) Then
|
||||
invoiceNo = Dateiname.Substring(Dateiname.IndexOf(InvoiceString) + InvoiceString.Length, 10)
|
||||
Else
|
||||
invoiceNo = Dateiname.Substring(Dateiname.LastIndexOf("_") + 1, 10)
|
||||
Select Case Type
|
||||
Case "INVOICE"
|
||||
invoiceNo = Dateiname.Substring(Dateiname.LastIndexOf("_") + 1, 10)
|
||||
|
||||
Case "INVOICEBYCOUNTRY"
|
||||
Dim i1 = Dateiname.LastIndexOf(".pdf")
|
||||
Dim i2 = Dateiname.LastIndexOf("_") + 1
|
||||
invoiceNo = Dateiname.Substring(Dateiname.LastIndexOf("_") + 1, (Dateiname.LastIndexOf(".pdf") - (Dateiname.LastIndexOf("_") + 1)))
|
||||
country = Dateiname.Substring(Dateiname.LastIndexOf("_") + 1, 2)
|
||||
|
||||
If IsNumeric(country) Then
|
||||
country = "SE" 'wenn kein Land angegeben, dann SCHWEDEN!
|
||||
|
||||
ElseIf country = "IG" Then
|
||||
'wenn mit IG startet, dann steht das Land am Ende
|
||||
If invoiceNo.Length > 2 Then
|
||||
Dim invEndung As String = ""
|
||||
invEndung = invoiceNo.ToString.Substring(invoiceNo.Length - 2, 2)
|
||||
|
||||
If invEndung <> "" Then
|
||||
|
||||
If IsNumeric(invEndung) Then 'wenn am ENde kein Land, dann IT
|
||||
country = "IT"
|
||||
Else
|
||||
|
||||
Select Case invEndung
|
||||
Case "SP" : country = "ES" 'SPANIEN
|
||||
Case "DA" : country = "DK" 'DÄNEMARK
|
||||
'Case "RO" : country = "RO" 'RUMÄNIEN
|
||||
'Case "PL" : country = "PL" 'POLEN
|
||||
'Case "LV" : country = "LV" 'LETTLAND
|
||||
|
||||
Case Else
|
||||
country = invEndung
|
||||
|
||||
End Select
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
|
||||
End Select
|
||||
|
||||
End If
|
||||
|
||||
If Dateiname.Contains(dateString) Then
|
||||
@@ -342,30 +384,67 @@ Public Class frmNachrichtenVerarbeitung_MDM_divers
|
||||
|
||||
If outputDate IsNot Nothing AndAlso customerNo <> "" AndAlso invoiceNo <> "" Then
|
||||
|
||||
Dim idsInvoice As New cIDSInvoice(outputDate, customerNo, invoiceNo)
|
||||
If Not idsInvoice.hasEntry Then idsInvoice.SAVE()
|
||||
Select Case Type
|
||||
Case "INVOICE"
|
||||
|
||||
|
||||
Try
|
||||
Dim idsInvoice As New cIDSInvoice(outputDate, customerNo, invoiceNo)
|
||||
If Not idsInvoice.hasEntry Then idsInvoice.SAVE()
|
||||
|
||||
'Dim htmlText = File.ReadAllText(pfad)
|
||||
|
||||
'If htmlText IsNot Nothing Then
|
||||
' If idsInvoice.isMail_IDS(htmlText) Then
|
||||
' If idsInvoice.getPDF_IDS(htmlText, filename, Zielpfad & invoiceNo & "_" & customerNo & ".pdf") Then
|
||||
' idsInvoice.DocumentName = filename
|
||||
' End If
|
||||
Try
|
||||
|
||||
' End If
|
||||
'Dim htmlText = File.ReadAllText(pfad)
|
||||
|
||||
'End If
|
||||
'If htmlText IsNot Nothing Then
|
||||
' If idsInvoice.isMail_IDS(htmlText) Then
|
||||
' If idsInvoice.getPDF_IDS(htmlText, filename, Zielpfad & invoiceNo & "_" & customerNo & ".pdf") Then
|
||||
' idsInvoice.DocumentName = filename
|
||||
' End If
|
||||
|
||||
' End If
|
||||
|
||||
'End If
|
||||
|
||||
If Not isMail Then idsInvoice.DocumentName = Dateiname
|
||||
idsInvoice.Zeitstempel = Now()
|
||||
idsInvoice.SAVE()
|
||||
Catch ex As Exception
|
||||
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod.Name, VERAG_PROG_ALLGEMEIN.ERROR_OP.LOG)
|
||||
End Try
|
||||
|
||||
|
||||
Case "INVOICEBYCOUNTRY"
|
||||
|
||||
|
||||
Dim idsInvoice As New cIDSInvoiceSplittedByCountry(outputDate, customerNo, invoiceNo, country)
|
||||
If Not idsInvoice.hasEntry Then idsInvoice.SAVE()
|
||||
|
||||
|
||||
Try
|
||||
|
||||
'Dim htmlText = File.ReadAllText(pfad)
|
||||
|
||||
'If htmlText IsNot Nothing Then
|
||||
' If idsInvoice.isMail_IDS(htmlText) Then
|
||||
' If idsInvoice.getPDF_IDS(htmlText, filename, Zielpfad & invoiceNo & "_" & customerNo & ".pdf") Then
|
||||
' idsInvoice.DocumentName = filename
|
||||
' End If
|
||||
|
||||
' End If
|
||||
|
||||
'End If
|
||||
|
||||
If Not isMail Then idsInvoice.DocumentName = Dateiname
|
||||
idsInvoice.Zeitstempel = Now()
|
||||
idsInvoice.SAVE()
|
||||
Catch ex As Exception
|
||||
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod.Name, VERAG_PROG_ALLGEMEIN.ERROR_OP.LOG)
|
||||
End Try
|
||||
|
||||
|
||||
End Select
|
||||
|
||||
If Not isMail Then idsInvoice.DocumentName = Dateiname
|
||||
idsInvoice.Zeitstempel = Now()
|
||||
idsInvoice.SAVE()
|
||||
Catch ex As Exception
|
||||
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodBase.GetCurrentMethod.Name, VERAG_PROG_ALLGEMEIN.ERROR_OP.LOG)
|
||||
End Try
|
||||
|
||||
End If
|
||||
|
||||
@@ -601,7 +680,7 @@ Public Class frmNachrichtenVerarbeitung_MDM_divers
|
||||
found = True
|
||||
If invoiceNr <> "" AndAlso invoiceDate <> "" AndAlso Kundenummer > 0 Then
|
||||
|
||||
If SQL.doSQL("Update [tblUTAImportNew] SET [daId]='" & DS.da_id & "' where [Rechnungsnummer_pro_Lieferland] = '" & invoiceNr & "' AND cast(Rechnungsdatum as Date) = '" & invoiceDate & "' AND Kundennummer =" & Kundenummer, "FMZOLL") Then
|
||||
If SQL.doSQL("Update [tblUTAImportNew] SET [daId]='" & DS.da_id & "' where [Rechnungsnummer_pro_Lieferland] = '" & invoiceNr & "' AND cast(Rechnungsdatum as Date) = '" & invoiceDate & "' AND Kundennummer =" & Kundenummer & " and daId is null ", "FMZOLL") Then
|
||||
frmStartOptions.moveFile_DateBack(d, zielpfad & "Invoice_PDF\" & Now.Year & "\" & Now.ToString("yyyyMMdd") & "\")
|
||||
cntDatenEingelesen += 1
|
||||
End If
|
||||
@@ -691,7 +770,7 @@ Public Class frmNachrichtenVerarbeitung_MDM_divers
|
||||
|
||||
If fi.Name.ToString.StartsWith("COPY_INVOICE_") Then
|
||||
|
||||
createIDSInvoice(fi.Name.ToString.Replace("COPY_INVOICE_", ""))
|
||||
createIDSInvoice(fi.Name.ToString.Replace("COPY_INVOICE_", ""), "INVOICE")
|
||||
|
||||
Dim DS As New VERAG_PROG_ALLGEMEIN.cDATENSERVER("MDM", "MDM_DATEN", "IDS", Now.Year, Now.ToString("yyyyMMdd"), frmStartOptions.getFileName(d))
|
||||
|
||||
@@ -707,6 +786,36 @@ Public Class frmNachrichtenVerarbeitung_MDM_divers
|
||||
Catch ex As System.Exception
|
||||
End Try
|
||||
|
||||
ElseIf fi.Name.ToString.StartsWith("OBO_") Then
|
||||
|
||||
createIDSInvoice(fi.Name.ToString.Replace("OBO_", ""), "INVOICEBYCOUNTRY")
|
||||
|
||||
Dim DS As New VERAG_PROG_ALLGEMEIN.cDATENSERVER("MDM", "MDM_DATEN", "IDS_COUNTRY", Now.Year, Now.ToString("yyyyMMdd"), frmStartOptions.getFileName(d))
|
||||
|
||||
If DS.uploadDataToDATENSERVER(d,,,,,, True) Then
|
||||
If SQL.doSQL("Update [tblIDSInvoicesNewSplittedByCountry] SET [daId]='" & DS.da_id & "' where [DocumentName] = '" & DS.da_name.ToString.Replace("OBO_", "") & "' ", "FMZOLL") Then
|
||||
frmStartOptions.moveFile_DateBack(d, zielpfad & "Invoice_PDF_Country\" & Now.Year & "\" & Now.ToString("yyyyMMdd") & "\")
|
||||
cntDatenEingelesen += 1
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
ElseIf fi.Name.ToString.StartsWith("VATR_") Then
|
||||
|
||||
createIDSInvoice(fi.Name.ToString.Replace("VATR_", ""), "INVOICEBYCOUNTRY")
|
||||
|
||||
Dim DS As New VERAG_PROG_ALLGEMEIN.cDATENSERVER("MDM", "MDM_DATEN", "IDS_COUNTRY", Now.Year, Now.ToString("yyyyMMdd"), frmStartOptions.getFileName(d))
|
||||
|
||||
If DS.uploadDataToDATENSERVER(d,,,,,, True) Then
|
||||
If SQL.doSQL("Update [tblIDSInvoicesNewSplittedByCountry] SET [daId]='" & DS.da_id & "' where [DocumentName] = '" & DS.da_name.ToString.Replace("VATR_", "") & "' ", "FMZOLL") Then
|
||||
frmStartOptions.moveFile_DateBack(d, zielpfad & "Invoice_PDF_Country\" & Now.Year & "\" & Now.ToString("yyyyMMdd") & "\")
|
||||
cntDatenEingelesen += 1
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
Reference in New Issue
Block a user