This commit is contained in:
2025-10-02 09:09:16 +02:00
10 changed files with 1613 additions and 1178 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
@@ -2582,7 +2581,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")
@@ -2747,39 +2746,108 @@ 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
'-------------------------------------------------------
Dim RechnungsString = ZOLLANMELDUNG.Handelsrechnung.Replace(", ", "," & vbNewLine)
Dim rows() As String = RechnungsString.Split(New Char() {" "c}, StringSplitOptions.RemoveEmptyEntries)
For Each row As String In rows
If IsDate(row) AndAlso row.Length = 10 Then
RechnungsString = RechnungsString.Replace(row.ToString, "")
End If
Next
Blatt.Range("E" & cnt).Value = RechnungsString.Trim
'-------------------------------------------------------
Blatt.Range("F" & cnt).Value = ZOLLANMELDUNG.ABGABEN_EUST
Blatt.Range("G" & cnt).Value = ZOLLANMELDUNG.ANZ_POS
If If(ZOLLANMELDUNG.ATCMRN, "") <> "" Then
Blatt.Range("C" & 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()