Mailsender

This commit is contained in:
2025-09-26 16:00:31 +02:00
parent 7c22afa197
commit 91a8717210
3 changed files with 121 additions and 75 deletions

View File

@@ -3,7 +3,6 @@ Imports System.IO
Imports System.Net
Imports System.Net.Mail
Imports ClosedXML.Excel
Imports com.sun.xml.internal.rngom.digested
Imports DAKOSY_Worker
Imports VERAG_PROG_ALLGEMEIN
@@ -52,7 +51,7 @@ Module Mail
'PARAM = "UID_OPS_SYSKA_ABGLEICH"
'PARAM = "JAHRESABRECHNUNG AG-ZS"
'PARAM = "BERICHT"
'------------------------------------------------------------------------------------
@@ -2581,7 +2580,7 @@ Module Mail
,Absender
,Rechnungsbetrag Betrag
,BelegNr
,[FilialenNr],[AbfertigungsNr],Speditionsbuch.Abfertigungsart,Abfertigungsbezeichnung,Speditionsbuch.Zollsystem_Land
,[FilialenNr],[AbfertigungsNr],Speditionsbuch.Abfertigungsart,Abfertigungsbezeichnung,Speditionsbuch.Zollsystem_Land, Speditionsbuch.[LKW Kennzeichen]
FROM Speditionsbuch INNER JOIN [Abfertigungsarten] ON Speditionsbuch.Abfertigungsart=Abfertigungsarten.Abfertigungsart
where EmpfängerKundenNr IN (" & KdNr & ") and VermittlerKundenNr IN (" & KdNr & ") and Abfertigungsdatum BETWEEN '" & von.ToShortDateString & "' AND '" & bis.ToShortDateString & "' And Speditionsbuch.Abfertigungsart IN (1,29,38)", "FMZOLL")
@@ -2746,39 +2745,90 @@ Module Mail
Datei = .Workbooks.Open(Path) 'Anpassen
Blatt = Datei.Worksheets(1) 'Anpassen
Blatt.Range("I1").Value = von.ToShortDateString & "-" & bis.ToShortDateString
Dim cnt = 3
For Each r In dt.Rows
Blatt.Range("A" & cnt).Value = cnt - 2
Blatt.Range("B" & cnt).Value = r("Abfertigungsnummer")
' Blatt.Range("C" & cnt).Value = r("RechnungsNr")
Blatt.Range("C" & cnt).Value = r("Abfertigungsdatum")
Blatt.Range("D" & cnt).Value = r("Abfertigungsbezeichnung")
Blatt.Range("E" & cnt).Value = r("Absender")
Blatt.Range("F" & cnt).Value = "" 'r("Betrag")
Blatt.Range("H" & cnt).Value = r("BelegNr")
If KUNDE.KundenNr = 902452 Then 'KUNDE WILL WIEDER EXZTAWURST!!!!!!!
Blatt.Range("H1").Value = von.ToShortDateString & "-" & bis.ToShortDateString
Blatt.Range("A" & 2).Value = "Nr"
Blatt.Range("B" & 2).Value = "Datum"
Blatt.Range("C" & 2).Value = "MRN-Nr."
Blatt.Range("D" & 2).Value = "LKW/Cont."
Blatt.Range("E" & 2).Value = "Rg.-Nr."
Blatt.Range("F" & 2).Value = "EUST"
Blatt.Range("G" & 2).Value = "Anzahl Pos."
Blatt.Range("H" & 2).Value = ""
Blatt.Range("I" & 2).Value = ""
Blatt.Range("J" & 2).Value = ""
Blatt.Range("K" & 2).Value = ""
Blatt.Range("L" & 2).Value = ""
Dim cnt = 3
For Each r In dt.Rows
Blatt.Range("A" & cnt).Value = cnt - 2
Blatt.Range("B" & cnt).Value = r("Abfertigungsdatum")
Blatt.Range("C" & cnt).Value = r("BelegNr")
Blatt.Range("D" & cnt).Value = r("LKW Kennzeichen")
Dim ZOLLANMELDUNG As New DAKOSY_Worker.cZollsysteme_Aktenbeschriftung
Try
Dim zS = If(r("Zollsystem_Land") IsNot DBNull.Value, r("Zollsystem_Land").ToString(), "")
If ZOLLANMELDUNG.getDataByBezugsnummer(r("FilialenNr") & "/" & r("AbfertigungsNr"), r("Abfertigungsart"), "", False, zS) Then
Blatt.Range("E" & cnt).Value = ZOLLANMELDUNG.Handelsrechnung.Replace(", ", "," & vbNewLine)
Blatt.Range("F" & cnt).Value = ZOLLANMELDUNG.ABGABEN_EUST
Blatt.Range("G" & cnt).Value = ZOLLANMELDUNG.ANZ_POS
If If(ZOLLANMELDUNG.ATCMRN, "") <> "" Then
Blatt.Range("E" & cnt).Value = ZOLLANMELDUNG.ATCMRN
End If
End If
Catch ex As Exception
MsgBox(ex.Message & ex.StackTrace)
End Try
cnt += 1
Next
Else
Blatt.Range("I1").Value = von.ToShortDateString & "-" & bis.ToShortDateString
Dim ZOLLANMELDUNG As New DAKOSY_Worker.cZollsysteme_Aktenbeschriftung
Try
Dim zS = If(r("Zollsystem_Land") IsNot DBNull.Value, r("Zollsystem_Land").ToString(), "")
If ZOLLANMELDUNG.getDataByBezugsnummer(r("FilialenNr") & "/" & r("AbfertigungsNr"), r("Abfertigungsart"), "", False, zS) Then
Blatt.Range("F" & cnt).Value = ZOLLANMELDUNG.RechnungspreisohneWahrung
Blatt.Range("G" & cnt).Value = ZOLLANMELDUNG.Handelsrechnung.Replace(", ", "," & vbNewLine)
Blatt.Range("I" & cnt).Value = ZOLLANMELDUNG.ABGABEN_ZOLL
Blatt.Range("J" & cnt).Value = ZOLLANMELDUNG.ANZ_POS
If If(ZOLLANMELDUNG.ATCMRN, "") <> "" Then
Blatt.Range("H" & cnt).Value = ZOLLANMELDUNG.ATCMRN
Dim cnt = 3
For Each r In dt.Rows
Blatt.Range("A" & cnt).Value = cnt - 2
Blatt.Range("B" & cnt).Value = r("Abfertigungsnummer")
Blatt.Range("C" & cnt).Value = r("Abfertigungsdatum")
Blatt.Range("D" & cnt).Value = r("Abfertigungsbezeichnung")
Blatt.Range("E" & cnt).Value = r("Absender")
Blatt.Range("F" & cnt).Value = "" 'r("Betrag")
Blatt.Range("H" & cnt).Value = r("BelegNr")
Try
Dim zS = If(r("Zollsystem_Land") IsNot DBNull.Value, r("Zollsystem_Land").ToString(), "")
If ZOLLANMELDUNG.getDataByBezugsnummer(r("FilialenNr") & "/" & r("AbfertigungsNr"), r("Abfertigungsart"), "", False, zS) Then
Blatt.Range("F" & cnt).Value = ZOLLANMELDUNG.RechnungspreisohneWahrung
Blatt.Range("G" & cnt).Value = ZOLLANMELDUNG.Handelsrechnung.Replace(", ", "," & vbNewLine)
Blatt.Range("I" & cnt).Value = ZOLLANMELDUNG.ABGABEN_ZOLL
Blatt.Range("J" & cnt).Value = ZOLLANMELDUNG.ABGABEN_EUST
Blatt.Range("K" & cnt).Value = ZOLLANMELDUNG.ANZ_POS
If If(ZOLLANMELDUNG.ATCMRN, "") <> "" Then
Blatt.Range("H" & cnt).Value = ZOLLANMELDUNG.ATCMRN
End If
End If
End If
Catch ex As Exception
MsgBox(ex.Message & ex.StackTrace)
End Try
Catch ex As Exception
MsgBox(ex.Message & ex.StackTrace)
End Try
cnt += 1
Next
End If
cnt += 1
Next
Datei.Save()
.DisplayAlerts = False
.quit()