Sendungsdetails, formualre,

This commit is contained in:
2026-08-18 13:50:12 +02:00
parent 7bf914da5a
commit 9a5f4a3e57
3 changed files with 170 additions and 210 deletions

View File

@@ -1135,6 +1135,8 @@ Public Class frmFormulare
Dim listMail As New List(Of FormMangagerEmail) Dim listMail As New List(Of FormMangagerEmail)
Dim listofFormulare As New List(Of String)
Dim attachmentName As String = ""
Try Try
@@ -1143,7 +1145,7 @@ Public Class frmFormulare
Dim hassValidErr = False Dim hassValidErr = False
For Each c In MyFlowLayoutPanel1.Controls For Each c In MyFlowLayoutPanel1.Controls
Dim err = "" Dim err = ""
If Not FormularManagerNEU.validFormulare(c, err) Then If Not FormularManagerNEU.validFormulare(c, err, listofFormulare) Then
txtErr.Text &= err txtErr.Text &= err
hassValidErr = True hassValidErr = True
End If End If
@@ -1154,6 +1156,11 @@ Public Class frmFormulare
Exit Sub Exit Sub
End If End If
attachmentName = createAttachmentName(listofFormulare, KdNr)
If attachmentName = "" Then
attachmentName = "_Formular"
End If
If isSingleForm And sender Is btnPrint Then 'Sofortdruck --> wir bei ActiveRepots benötigt --> schneller, als zuerst pdf.... If isSingleForm And sender Is btnPrint Then 'Sofortdruck --> wir bei ActiveRepots benötigt --> schneller, als zuerst pdf....
If Not MyFlowLayoutPanel1.Controls.Count = 1 Then Me.Cursor = Cursors.Default : Exit Sub 'funkt. nur bei genau 1 Control If Not MyFlowLayoutPanel1.Controls.Count = 1 Then Me.Cursor = Cursors.Default : Exit Sub 'funkt. nur bei genau 1 Control
@@ -1162,6 +1169,7 @@ Public Class frmFormulare
Dim list As New List(Of String) ' Sammlung PDFs Dim list As New List(Of String) ' Sammlung PDFs
For Each c In MyFlowLayoutPanel1.Controls For Each c In MyFlowLayoutPanel1.Controls
Dim pfadList As List(Of String) = FormularManagerNEU.genPDF(c,,,,, listMail) Dim pfadList As List(Of String) = FormularManagerNEU.genPDF(c,,,,, listMail)
For Each pfad In pfadList For Each pfad In pfadList
@@ -1176,7 +1184,7 @@ Public Class frmFormulare
If list.Count = 1 Then If list.Count = 1 Then
dest_path = list(0) dest_path = list(0)
Else Else
dest_path = VERAG_PROG_ALLGEMEIN.DATENVERVER_OPTIONS.getTMPPath(VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA & "_Formular.pdf", ".pdf", False, False) dest_path = VERAG_PROG_ALLGEMEIN.DATENVERVER_OPTIONS.getTMPPath(VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA & attachmentName & ".pdf", ".pdf", False, False)
If Not FormularManagerNEU.MergePdfFiles(list, dest_path) Then If Not FormularManagerNEU.MergePdfFiles(list, dest_path) Then
dest_path = "" : MsgBox("Fehler PDF") dest_path = "" : MsgBox("Fehler PDF")
End If End If
@@ -1189,98 +1197,6 @@ Public Class frmFormulare
'System.Diagnostics.Process.Start("mailto:" & "" & "?subject=" & "?" & "&body=" & "?" & "&attachment=" & dest_path) 'System.Diagnostics.Process.Start("mailto:" & "" & "?subject=" & "?" & "&body=" & "?" & "&attachment=" & dest_path)
Try Try
'Dim Mail As New MailMessage
'Try
' Dim SMTP As New SmtpClient("smtp.gmail.com")
' SMTP.EnableSsl = True
' SMTP.Credentials = New System.Net.NetworkCredential("[your gmail address@gmail.com]", "[the associated password]")
' SMTP.Port = 587
' Mail.From = New MailAddress("""[Friendly Name]"" <[your gmail address@gmail.com>")
' Mail.Subject = ""
' Mail.Body = ""
' If dest_path <> "" Then Mail.Attachments.Add(New Mail.Attachment(dest_path))
' Mail.IsBodyHtml = True
' ' SMTP.Send(Mail)
' 'Clear Mail Object
' Mail.Dispose()
' 'Function Return
' Return True
'Catch ex As Exception
' 'Function Return
' Return False
'End Try
If False Then
Dim mapi As New VERAG_PROG_ALLGEMEIN.SendFileTo.MAPI
mapi.AddAttachment(dest_path)
mapi.SendMailPopup("testing", "body text")
Exit Sub
End If
If False Then
Call ShellExecute(Me.Handle, "open", "mailto:" & "" & "?subject=" & "?" & "&body=" & "?" & "&Attach=""" & dest_path & """", vbNullString, vbNullString, SW_SHOW)
' Call ShellExecute(Me.Handle, "open", "mailto:" & "" & "?subject=" & "?" & "&body=" & "?", "", "", SW_SHOW)
Exit Sub
Dim MailMessage As New System.Net.Mail.MailMessage()
' MailMessage.From = New MailAddress("someone@yourdomain.com")
MailMessage.Subject = "" ' "Your subject here"
MailMessage.IsBodyHtml = True
' MailMessage.Body = MailHTMLText '"<span style='font-size: 12pt; color: red;'>My HTML formatted body</span>"
MailMessage.Attachments.Add(New Attachment(dest_path))
Dim filename = "C://Temp/mymessage.eml"
'save the MailMessage to the filesystem
' MailMessage.save(filename)
Save(MailMessage, filename)
'Open the file with the default associated application registered on the local machine
Process.Start(filename)
'Dim mapi As New VERAG_PROG_ALLGEMEIN.SendFileTo.cSendMailAttach
'mapi.AddAttachment(dest_path)
''mapi.AddRecipientTo("person1@somewhere.com")
''mapi.AddRecipientTo("person2@somewhere.com")
'mapi.SendMailPopup("", "")
Exit Sub
End If
'Dim Mail As Outlook.MailItem = CType(Application.CreateItem(Outlook.OlItemType.olMailItem), Outlook.MailItem)
' If VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA = "IMEX" Then
' Else
' Dim outl = CreateObject("Outlook.Application")
' Dim Mail = CreateObject("Microsoft.Office.Interop.Outlook.MailItem")
If listMail IsNot Nothing AndAlso listMail.Count > 0 Then If listMail IsNot Nothing AndAlso listMail.Count > 0 Then
For Each l In listMail For Each l In listMail
Dim outl As New Outlook.Application Dim outl As New Outlook.Application
@@ -1306,7 +1222,7 @@ Public Class frmFormulare
End Try End Try
End If End If
Mail.Attachments.Add(dest_path, Microsoft.Office.Interop.Outlook.OlAttachmentType.olByValue, , VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA & "_Formular.pdf") Mail.Attachments.Add(dest_path, Microsoft.Office.Interop.Outlook.OlAttachmentType.olByValue, , VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA & attachmentName & ".pdf")
Mail.Display() Mail.Display()
Next Next
@@ -1359,7 +1275,7 @@ Public Class frmFormulare
Mail.Attachments.Add(dest_path, Microsoft.Office.Interop.Outlook.OlAttachmentType.olByValue, , VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA & "_Formular.pdf") Mail.Attachments.Add(dest_path, Microsoft.Office.Interop.Outlook.OlAttachmentType.olByValue, , VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA & attachmentName & ".pdf")
Mail.Display() Mail.Display()
End If End If
@@ -1393,6 +1309,40 @@ Public Class frmFormulare
' If list.Count > 0 Then ' If list.Count > 0 Then
End Sub End Sub
Private Function createAttachmentName(listOfFormular As List(Of String), KundenNr As Integer) As String
Dim Bez As String = ""
If KundenNr > 0 Then
Dim ADR As New cAdressen(KundenNr)
If ADR.Name_1 IsNot Nothing AndAlso ADR.Name_1 <> "" Then
Bez = "_" & ADR.Name_1
End If
End If
If listOfFormular.Count = 1 Then
Bez &= "_" & listOfFormular(0).ToString.Replace("SDL.usrcntl", "")
Return Bez
ElseIf listOfFormular.Count > 1 Then
For Each r In listOfFormular
Bez &= "_" & r.ToString.Replace("SDL.usrcntl", "")
Next
Return Bez
Else
Return ""
End If
End Function
Const SW_SHOW = 5 Const SW_SHOW = 5
Declare Function ShellExecute Lib "shell32.dll" _ Declare Function ShellExecute Lib "shell32.dll" _
Alias "ShellExecuteA" ( Alias "ShellExecuteA" (
@@ -1684,52 +1634,61 @@ Public Class FormularManagerNEU
Return striList Return striList
End Function End Function
Shared Function validFormulare(c As Control, ByRef err As String) As Boolean Shared Function validFormulare(c As Control, ByRef err As String, listOfFormulare As List(Of String)) As Boolean
validFormulare = True validFormulare = True
Dim striList As New List(Of String) Dim striList As New List(Of String)
Select Case c.GetType.ToString Select Case c.GetType.ToString
Case GetType(usrcntlVollmacht_DE).ToString Case GetType(usrcntlVollmacht_DE).ToString
' retStr = FormularManagerNEU.VM_De(c) listOfFormulare.Add(GetType(usrcntlVollmacht_DE).ToString())
Case GetType(usrcntlVollmacht_GB_IE).ToString
listOfFormulare.Add(GetType(usrcntlVollmacht_GB_IE).ToString())
Case GetType(usrcntlVollmacht_GB_indirekt).ToString
listOfFormulare.Add(GetType(usrcntlVollmacht_GB_indirekt).ToString())
Case GetType(usrcntlVollmacht_DE_indirekt).ToString Case GetType(usrcntlVollmacht_DE_indirekt).ToString
' retStr = FormularManagerNEU.VM_De(c) listOfFormulare.Add(GetType(usrcntlVollmacht_DE_indirekt).ToString)
Case GetType(usrcntlVollmacht_AT).ToString Case GetType(usrcntlVollmacht_AT).ToString
' retStr = FormularManagerNEU.VM_AT(c) listOfFormulare.Add(GetType(usrcntlVollmacht_AT).ToString)
Case GetType(usrcntlFormOhneFelder).ToString Case GetType(usrcntlFormOhneFelder).ToString
' retStr = FormularManagerNEU.SimplePDF(c)
Case GetType(usrcntlVollmacht_DE_Fiskal).ToString Case GetType(usrcntlVollmacht_DE_Fiskal).ToString
' retStr = FormularManagerNEU.VM_DE_Fiskal(c) listOfFormulare.Add(GetType(usrcntlVollmacht_DE_Fiskal).ToString)
Case GetType(usrcntlVollmacht_AT_EV).ToString Case GetType(usrcntlVollmacht_AT_EV).ToString
' retStr = FormularManagerNEU.VM_AT_EV(c) listOfFormulare.Add(GetType(usrcntlVollmacht_AT_EV).ToString)
Case GetType(usrcntlVollmacht_AT_Fiskal).ToString Case GetType(usrcntlVollmacht_AT_Fiskal).ToString
' retStr = FormularManagerNEU.VM_AT_Fiskal(c) listOfFormulare.Add(GetType(usrcntlVollmacht_AT_EV).ToString)
Case GetType(usrcntlVollmacht_ATILLA_EXPORT).ToString Case GetType(usrcntlVollmacht_ATILLA_EXPORT).ToString
' retStr = FormularManagerNEU.VM_ATILLA_EXPORT(c) listOfFormulare.Add(GetType(usrcntlVollmacht_AT_EV).ToString)
Case GetType(usrcntlVollmacht_VERAG_EXPORT).ToString Case GetType(usrcntlVollmacht_VERAG_EXPORT).ToString
' retStr = FormularManagerNEU.VM_VERAG_EXPORT(c) listOfFormulare.Add(GetType(usrcntlVollmacht_VERAG_EXPORT).ToString)
Case GetType(usrcntlVorauskasse).ToString Case GetType(usrcntlVorauskasse).ToString
listOfFormulare.Add(GetType(usrcntlVorauskasse).ToString)
If Not DirectCast(c, usrcntlVorauskasse).ValidValues(err) Then validFormulare = False If Not DirectCast(c, usrcntlVorauskasse).ValidValues(err) Then validFormulare = False
Case GetType(usrcntlGestellungsgarantie).ToString Case GetType(usrcntlGestellungsgarantie).ToString
' retStr = FormularManagerNEU.Gestellungsgarantie(c) listOfFormulare.Add(GetType(usrcntlGestellungsgarantie).ToString)
Case GetType(usrcntlVerzollungspreise).ToString Case GetType(usrcntlVerzollungspreise).ToString
' retStr = FormularManagerNEU.Verzollungspreise(c) listOfFormulare.Add(GetType(usrcntlVerzollungspreise).ToString)
Case GetType(usrcntlCreditreformBoniAuskunft).ToString Case GetType(usrcntlCreditreformBoniAuskunft).ToString
'retStr = FormularManagerNEU.Bonitaetsauskunft(c) listOfFormulare.Add(GetType(usrcntlCreditreformBoniAuskunft).ToString)
Case GetType(usrcntlSonstigesPDF).ToString Case GetType(usrcntlSonstigesPDF).ToString
' retStr = FormularManagerNEU.SonstPDF(c) listOfFormulare.Add(GetType(usrcntlSonstigesPDF).ToString)
Case GetType(usrCntlDispoliste).ToString Case GetType(usrCntlDispoliste).ToString
'retStr = FormularManagerNEU.DispoListe(c) listOfFormulare.Add(GetType(usrCntlDispoliste).ToString)
Case GetType(usrCntlVerpflichtungserklärungFahrer).ToString Case GetType(usrCntlVerpflichtungserklärungFahrer).ToString
' striList = FormularManagerNEU.VerpflichtungserklärungFahrer(c) listOfFormulare.Add(GetType(usrCntlVerpflichtungserklärungFahrer).ToString)
Case GetType(usrcntlFiskalInfoschreiben).ToString Case GetType(usrcntlFiskalInfoschreiben).ToString
' retStr = FormularManagerNEU.FiskalInfoschreiben(c) listOfFormulare.Add(GetType(usrcntlFiskalInfoschreiben).ToString)
Case GetType(usrcntlVerzollungsunterlagen).ToString Case GetType(usrcntlVerzollungsunterlagen).ToString
listOfFormulare.Add(GetType(usrcntlVerzollungsunterlagen).ToString)
If Not DirectCast(c, usrcntlVerzollungsunterlagen).ValidValues(err) Then validFormulare = False If Not DirectCast(c, usrcntlVerzollungsunterlagen).ValidValues(err) Then validFormulare = False
Case GetType(usrcntlVUB).ToString Case GetType(usrcntlVUB).ToString
' retStr = FormularManagerNEU.VUB(c) listOfFormulare.Add(GetType(usrcntlVUB).ToString)
Case GetType(usrcntlImportaviso).ToString
listOfFormulare.Add(GetType(usrcntlImportaviso).ToString)
End Select End Select

View File

@@ -4632,7 +4632,8 @@ Public Class frmMDM_USTVAntrag
BANK_OWNER = FIRMA.Firma_Bez BANK_OWNER = FIRMA.Firma_Bez
BANK_IBAN = FIRMA.Firma_IBAN1 BANK_IBAN = FIRMA.Firma_IBAN1
BANK_BIC = FIRMA.Firma_BIC1 BANK_BIC = FIRMA.Firma_BIC1
BankOwnerType = "applicant"
BankOwnerType = "representative"
If BANK_BIC.ToString.Contains("BIC:") Then If BANK_BIC.ToString.Contains("BIC:") Then
BANK_BIC = BANK_BIC.ToString.Replace("BIC:", "") BANK_BIC = BANK_BIC.ToString.Replace("BIC:", "")
BANK_BIC = BANK_BIC.Trim() BANK_BIC = BANK_BIC.Trim()
@@ -4656,7 +4657,7 @@ Public Class frmMDM_USTVAntrag
BANK_BIC = dtBank.Rows(0).Item("bnk_bic") BANK_BIC = dtBank.Rows(0).Item("bnk_bic")
End If End If
'wenn nicht hinterlegt, dann leer lassen! 'wenn nicht hinterlegt, dann leer lassen!
BankOwnerType = "representative" BankOwnerType = "applicant"
End Select End Select
Dim app As New GlobalVATRefundApplication_HR() With { Dim app As New GlobalVATRefundApplication_HR() With {

View File

@@ -201,7 +201,7 @@ Public Class cTrdInvoice
Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL() Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
Using cmd As New SqlCommand(" SELECT tblTrdinInvoice.Rechnungsdatum, tblTrdinInvoice.Rechnungsnummer, tblTrdinInvoice.SteuerbetragLokal,(SteuerpflichtigerBetragLokal+SteuerfreierBetragLokal) as Nettobetrag , tblTrdinInvoice.UStVAn_ID, tblTrdinInvoice.FilialenNr Using cmd As New SqlCommand(" SELECT tblTrdinInvoice.Rechnungsdatum, tblTrdinInvoice.Rechnungsnummer, tblTrdinInvoice.SteuerbetragLokal,(SteuerpflichtigerBetragLokal) as Nettobetrag , tblTrdinInvoice.UStVAn_ID, tblTrdinInvoice.FilialenNr
FROM tblTrdinInvoice FROM tblTrdinInvoice
WHERE tblTrdinInvoice.Rechnungsdatum Between @von And @bis AND tblTrdinInvoice.SteuerbetragLokal<>0 AND tblTrdinInvoice.RechnungsKundenNr=@AdressenNr AND tblTrdinInvoice.WährungLokal='EUR'" & IIf(Archiv, " ", " AND isnull(tblTrdinInvoice.UStVAn_ID,0) = 0 ") & " WHERE tblTrdinInvoice.Rechnungsdatum Between @von And @bis AND tblTrdinInvoice.SteuerbetragLokal<>0 AND tblTrdinInvoice.RechnungsKundenNr=@AdressenNr AND tblTrdinInvoice.WährungLokal='EUR'" & IIf(Archiv, " ", " AND isnull(tblTrdinInvoice.UStVAn_ID,0) = 0 ") & "
ORDER BY tblTrdinInvoice.Rechnungsdatum, tblTrdinInvoice.Rechnungsnummer", conn) ORDER BY tblTrdinInvoice.Rechnungsdatum, tblTrdinInvoice.Rechnungsnummer", conn)