diff --git a/SDL/Formulare/KDFormulare/frmFormulare.vb b/SDL/Formulare/KDFormulare/frmFormulare.vb
index 573396c6..2e055acc 100644
--- a/SDL/Formulare/KDFormulare/frmFormulare.vb
+++ b/SDL/Formulare/KDFormulare/frmFormulare.vb
@@ -1135,6 +1135,8 @@ Public Class frmFormulare
Dim listMail As New List(Of FormMangagerEmail)
+ Dim listofFormulare As New List(Of String)
+ Dim attachmentName As String = ""
Try
@@ -1143,7 +1145,7 @@ Public Class frmFormulare
Dim hassValidErr = False
For Each c In MyFlowLayoutPanel1.Controls
Dim err = ""
- If Not FormularManagerNEU.validFormulare(c, err) Then
+ If Not FormularManagerNEU.validFormulare(c, err, listofFormulare) Then
txtErr.Text &= err
hassValidErr = True
End If
@@ -1154,6 +1156,11 @@ Public Class frmFormulare
Exit Sub
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 Not MyFlowLayoutPanel1.Controls.Count = 1 Then Me.Cursor = Cursors.Default : Exit Sub 'funkt. nur bei genau 1 Control
@@ -1162,229 +1169,138 @@ Public Class frmFormulare
Dim list As New List(Of String) ' Sammlung PDFs
+
For Each c In MyFlowLayoutPanel1.Controls
- Dim pfadList As List(Of String) = FormularManagerNEU.genPDF(c,,,,, listMail)
- For Each pfad In pfadList
- If pfad <> "" Then list.Add(pfad)
+ Dim pfadList As List(Of String) = FormularManagerNEU.genPDF(c,,,,, listMail)
+ For Each pfad In pfadList
+ If pfad <> "" Then list.Add(pfad)
+ Next
Next
- Next
- Dim dest_path = ""
- If list.Count = 0 Then Me.Cursor = Cursors.Default : Exit Sub
+ Dim dest_path = ""
+ If list.Count = 0 Then Me.Cursor = Cursors.Default : Exit Sub
- If list.Count = 1 Then
- dest_path = list(0)
- Else
- dest_path = VERAG_PROG_ALLGEMEIN.DATENVERVER_OPTIONS.getTMPPath(VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA & "_Formular.pdf", ".pdf", False, False)
- If Not FormularManagerNEU.MergePdfFiles(list, dest_path) Then
- dest_path = "" : MsgBox("Fehler PDF")
+ If list.Count = 1 Then
+ dest_path = list(0)
+ Else
+ 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
+ dest_path = "" : MsgBox("Fehler PDF")
+ End If
End If
- End If
- If dest_path <> "" Then
- If sender Is Button2 Then
- Process.Start(dest_path)
- ElseIf sender Is btn Then
- 'System.Diagnostics.Process.Start("mailto:" & "" & "?subject=" & "?" & "&body=" & "?" & "&attachment=" & dest_path)
- 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 '"My HTML formatted body"
-
- 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 dest_path <> "" Then
+ If sender Is Button2 Then
+ Process.Start(dest_path)
+ ElseIf sender Is btn Then
+ 'System.Diagnostics.Process.Start("mailto:" & "" & "?subject=" & "?" & "&body=" & "?" & "&attachment=" & dest_path)
+ Try
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 Mail As Microsoft.Office.Interop.Outlook.MailItem
+ Mail = outl.CreateItem(0)
+
+ 'Dim StandAcc = VERAG_PROG_ALLGEMEIN.cProgramFunctions.getdefaultOutlookAccount(outl)
+ 'If StandAcc IsNot Nothing Then Mail.SendUsingAccount = StandAcc
+
+ If l.MailHTMLText <> "" Then Mail.HTMLBody = l.MailHTMLText
+ If l.Mail_To <> "" Then Mail.To = l.Mail_To
+ If l.Mail_CC <> "" Then Mail.CC = l.Mail_CC
+ If l.Mail_BCC <> "" Then Mail.CC = l.Mail_BCC
+ If l.Mail_Subject <> "" Then Mail.Subject = l.Mail_Subject
+
+ If VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA = "AMBAR" Then
+ Try
+ Mail.SentOnBehalfOfName = SDL.cFakturierung.getDefaultMail("AMBAR")
+ Mail.HTMLBody &= cFakturierung.getSignature(cboTextKonserveSprache._value, 24, False, True)
+ Catch ex2 As Exception
+ MsgBox(ex2.Message)
+ End Try
+ End If
+
+ Mail.Attachments.Add(dest_path, Microsoft.Office.Interop.Outlook.OlAttachmentType.olByValue, , VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA & attachmentName & ".pdf")
+ Mail.Display()
+
+ Next
+ Else
Dim outl As New Outlook.Application
Dim Mail As Microsoft.Office.Interop.Outlook.MailItem
Mail = outl.CreateItem(0)
+ 'MsgBox(VERAG_PROG_ALLGEMEIN.cProgramFunctions.printdefaultOutlookAccount(outl))
'Dim StandAcc = VERAG_PROG_ALLGEMEIN.cProgramFunctions.getdefaultOutlookAccount(outl)
- 'If StandAcc IsNot Nothing Then Mail.SendUsingAccount = StandAcc
+ 'Mail.SendUsingAccount = outl.Session.DefaultAccount
- If l.MailHTMLText <> "" Then Mail.HTMLBody = l.MailHTMLText
- If l.Mail_To <> "" Then Mail.To = l.Mail_To
- If l.Mail_CC <> "" Then Mail.CC = l.Mail_CC
- If l.Mail_BCC <> "" Then Mail.CC = l.Mail_BCC
- If l.Mail_Subject <> "" Then Mail.Subject = l.Mail_Subject
If VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA = "AMBAR" Then
Try
Mail.SentOnBehalfOfName = SDL.cFakturierung.getDefaultMail("AMBAR")
- Mail.HTMLBody &= cFakturierung.getSignature(cboTextKonserveSprache._value, 24, False, True)
+ Mail.HTMLBody &= cFakturierung.getSignature(cboTextKonserveSprache._value, 24, True, True)
Catch ex2 As Exception
MsgBox(ex2.Message)
End Try
+
+
+ End If
+ If Me.txtEmail.Text <> "" Then Mail.To = Me.txtEmail.Text
+ If cboTextkonserve._value <> "" AndAlso cboTextKonserveSprache._value <> "" Then
+ Dim tX As New VERAG_PROG_ALLGEMEIN.cTextkonserve("FRM_MNGR_MailText", cboTextkonserve._value, cboTextKonserveSprache._value, VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA)
+
+ Dim TextHTML = ""
+ TextHTML &= tX.txt_text
+ TextHTML &= "
"
+ TextHTML &= "
"
+ TextHTML &= "Mit freundlichen Grüßen
"
+ TextHTML &= VERAG_PROG_ALLGEMEIN.cAllgemein.USRNAME & "
"
+ TextHTML &= "
"
+ TextHTML &= cFakturierung.getSignature(cboTextKonserveSprache._value, tX.txt_firmaSig, True, True)
+
+
+ Mail.HTMLBody = "