Mailversand, etc.

This commit is contained in:
2025-04-30 16:56:55 +02:00
parent 9ebf29e1e5
commit 7713060873
6 changed files with 136 additions and 67 deletions

View File

@@ -229,8 +229,15 @@ Public Class cAutomailversand
Mail.BCC = MailtoBCC
Mail.CC = MailtoCC
For Each a In ATTACHMENTS
Mail.Attachments.Add(a.Pfad, Microsoft.Office.Interop.Outlook.OlAttachmentType.olByValue, , a.MailName)
For Each att In ATTACHMENTS
If att.Pfad.ToString.ToLower.EndsWith("maut_at.pdf") Or att.Pfad.ToString.ToLower.EndsWith("maut_uta.pdf") Or att.Pfad.ToString.ToLower.EndsWith("maut_mse.pdf") Then
'diese Anh. nicht mitanfügen!
Else
Mail.Attachments.Add(att.Pfad, Microsoft.Office.Interop.Outlook.OlAttachmentType.olByValue, , att.MailName)
End If
Next
Return Mail

View File

@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.3.9.5")>
<Assembly: AssemblyFileVersion("1.3.9.5")>
<Assembly: AssemblyVersion("1.3.9.6")>
<Assembly: AssemblyFileVersion("1.3.9.6")>

View File

@@ -1,7 +1,7 @@
Imports System.IO
Imports System.Reflection
Imports System.Windows.Documents
Imports iTextSharp.text.pdf
Imports itextsharp.text.pdf
Imports Microsoft.Office.Interop
Imports VERAG_PROG_ALLGEMEIN
@@ -578,6 +578,7 @@ Public Class frmMDM_USTVAntrag
If VERAG_PROG_ALLGEMEIN.cAllgemein.AUTO_ABF_NR Then btnAbfertigungsNrVergeben.Visible = True
initScanUSTVA()
End Sub
@@ -2671,9 +2672,8 @@ Public Class frmMDM_USTVAntrag
If Not vbYes = MsgBox("Der Erstattungsbetrag beträgt 0 EUR." & vbNewLine & "Fortfahren?", vbYesNo) Then Exit Sub
End If
'dTLANDEU = (New SQL).loadDgvBySql("select LandKz, MitgliedslandEU from Währungstabelle where LandKz is not null", "FMZOLL")
'Dim isEU As Boolean = dTLANDEU.AsEnumerable().Where(Function(res) res.Field(Of String)("LandKz") = Antrag_LandKz).Select(Function(res) res.Field(Of Boolean)("MitgliedslandEU")).FirstOrDefault()
dTLANDEU = (New SQL).loadDgvBySql("select LandKz, MitgliedslandEU from Währungstabelle where LandKz is not null", "FMZOLL")
Dim isEU As Boolean = dTLANDEU.AsEnumerable().Where(Function(res) res.Field(Of String)("LandKz") = USTV_ANTRAG.UStVAn_LandKz).Select(Function(res) res.Field(Of Boolean)("MitgliedslandEU")).FirstOrDefault()
With spedBuch
.Abfertigungsdatum = Today()
@@ -2681,7 +2681,7 @@ Public Class frmMDM_USTVAntrag
.Sachbearbeiter = VERAG_PROG_ALLGEMEIN.cAllgemein.USRKURZNAME
.ErfassungsNr = USTV_ANTRAG.UStVAn_ID
.AnzahlSonstiges = 1
.Abfertigungsart = 10
.Abfertigungsart = IIf(isEU, 114, 115)
.Abfertigungsanzahl = 1
.Packstücke = "Mehrwertsteuerrückerstattung " & Antrag_LandKz & " / " & USTV_ANTRAG.UStVAn_ReDatVon & " - " & USTV_ANTRAG.UStVAn_ReDatBis
.VermittlerKundenNr = USTV_ANTRAG.UStVAn_KuNr
@@ -2969,9 +2969,11 @@ Public Class frmMDM_USTVAntrag
cnS_KIUPLOAD.Hide()
Dim item As ToolStripMenuItem = TryCast(sender, ToolStripMenuItem)
If item IsNot Nothing Then
If item IsNot Nothing AndAlso scanUSTVA IsNot Nothing Then
Dim daid As Integer = 0
If scanUSTVA.getDS() IsNot Nothing Then daid = scanUSTVA.getDS().da_id
Dim daid As Integer = scanUSTVA.getDS().da_id
If daid > 0 Then
@@ -3062,6 +3064,8 @@ Public Class frmMDM_USTVAntrag
scanUSTVA.INIT(USTV_ANTRAG.UStVAn_KuNr, "MDM", "USTVA_KI_" & USTV_ANTRAG.UStVAn_ID)
btnPDFauslesen.Enabled = scanUSTVA.getDS().da_id > 0
cbxKIUploaddelete.Enabled = btnPDFauslesen.Enabled
Else
cbxKIUploaddelete.Enabled = False
End If

View File

@@ -988,13 +988,19 @@ Public Class cMDMFunctionsAllgemein
For page As Integer = 1 To pdfReader.NumberOfPages
Dim canvas As PdfContentByte = stamper.GetOverContent(page)
Dim bf As BaseFont = BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.EMBEDDED)
canvas.SetFontAndSize(bf, 16)
canvas.SetFontAndSize(bf, 12)
canvas.BeginText()
'The origin (0,0) is at the bottom-left corner of the page and represent coordinates in points!!!!!
Dim _height = pdfReader.GetPageSizeWithRotation(page).GetTop(25) 'oberer Rand
Dim _width = pdfReader.GetPageSizeWithRotation(page).GetRight(0) / 2 'Mitte
'Workaround!
If _height > 2000 Then
canvas.SetFontAndSize(bf, 45)
_height -= 70
End If
canvas.ShowTextAligned(PdfContentByte.ALIGN_CENTER, nummierung, _width, _height, 0)
'canvas.ShowTextAligned(PdfContentByte.ALIGN_CENTER, nummierung, 350, 550, 0)

View File

@@ -1,9 +1,9 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
Partial Class frmScan
Inherits System.Windows.Forms.Form
'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.
<System.Diagnostics.DebuggerNonUserCode()> _
<System.Diagnostics.DebuggerNonUserCode()>
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
@@ -20,7 +20,7 @@ Partial Class frmScan
'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich.
'Das Bearbeiten ist mit dem Windows Form-Designer möglich.
'Das Bearbeiten mit dem Code-Editor ist nicht möglich.
<System.Diagnostics.DebuggerStepThrough()> _
<System.Diagnostics.DebuggerStepThrough()>
Private Sub InitializeComponent()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmScan))
Me.dsViewer = New Dynamsoft.Forms.DSViewer()
@@ -56,6 +56,7 @@ Partial Class frmScan
Me.tbxCurrentImageIndex = New System.Windows.Forms.Label()
Me.tbxTotalImageNum = New System.Windows.Forms.Label()
Me.pnl = New System.Windows.Forms.Panel()
Me.cboOrientation = New System.Windows.Forms.ComboBox()
Me.cbxAltFormat = New System.Windows.Forms.CheckBox()
Me.cboFormat = New System.Windows.Forms.ComboBox()
Me.grpFarbe.SuspendLayout()
@@ -383,7 +384,7 @@ Partial Class frmScan
'Label3
'
Me.Label3.AutoSize = True
Me.Label3.Location = New System.Drawing.Point(395, 654)
Me.Label3.Location = New System.Drawing.Point(405, 654)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(31, 13)
Me.Label3.TabIndex = 18
@@ -406,7 +407,7 @@ Partial Class frmScan
'Label2
'
Me.Label2.AutoSize = True
Me.Label2.Location = New System.Drawing.Point(436, 654)
Me.Label2.Location = New System.Drawing.Point(446, 654)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(25, 13)
Me.Label2.TabIndex = 17
@@ -415,7 +416,7 @@ Partial Class frmScan
'tbxCurrentImageIndex
'
Me.tbxCurrentImageIndex.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.tbxCurrentImageIndex.Location = New System.Drawing.Point(416, 654)
Me.tbxCurrentImageIndex.Location = New System.Drawing.Point(426, 654)
Me.tbxCurrentImageIndex.Name = "tbxCurrentImageIndex"
Me.tbxCurrentImageIndex.Size = New System.Drawing.Size(28, 13)
Me.tbxCurrentImageIndex.TabIndex = 19
@@ -425,7 +426,7 @@ Partial Class frmScan
'tbxTotalImageNum
'
Me.tbxTotalImageNum.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.tbxTotalImageNum.Location = New System.Drawing.Point(447, 654)
Me.tbxTotalImageNum.Location = New System.Drawing.Point(457, 654)
Me.tbxTotalImageNum.Name = "tbxTotalImageNum"
Me.tbxTotalImageNum.Size = New System.Drawing.Size(25, 13)
Me.tbxTotalImageNum.TabIndex = 20
@@ -434,6 +435,7 @@ Partial Class frmScan
'
'pnl
'
Me.pnl.Controls.Add(Me.cboOrientation)
Me.pnl.Controls.Add(Me.cbxAltFormat)
Me.pnl.Controls.Add(Me.cboFormat)
Me.pnl.Controls.Add(Me.Label2)
@@ -464,6 +466,15 @@ Partial Class frmScan
Me.pnl.Size = New System.Drawing.Size(741, 683)
Me.pnl.TabIndex = 21
'
'cboOrientation
'
Me.cboOrientation.Enabled = False
Me.cboOrientation.FormattingEnabled = True
Me.cboOrientation.Location = New System.Drawing.Point(639, 565)
Me.cboOrientation.Name = "cboOrientation"
Me.cboOrientation.Size = New System.Drawing.Size(88, 21)
Me.cboOrientation.TabIndex = 23
'
'cbxAltFormat
'
Me.cbxAltFormat.AutoSize = True
@@ -479,9 +490,9 @@ Partial Class frmScan
'
Me.cboFormat.Enabled = False
Me.cboFormat.FormattingEnabled = True
Me.cboFormat.Location = New System.Drawing.Point(594, 565)
Me.cboFormat.Location = New System.Drawing.Point(575, 565)
Me.cboFormat.Name = "cboFormat"
Me.cboFormat.Size = New System.Drawing.Size(133, 21)
Me.cboFormat.Size = New System.Drawing.Size(58, 21)
Me.cboFormat.TabIndex = 22
'
'frmScan
@@ -539,4 +550,5 @@ Partial Class frmScan
Friend WithEvents pnl As System.Windows.Forms.Panel
Friend WithEvents cboFormat As Windows.Forms.ComboBox
Friend WithEvents cbxAltFormat As Windows.Forms.CheckBox
Friend WithEvents cboOrientation As Windows.Forms.ComboBox
End Class

View File

@@ -1,27 +1,22 @@
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Text
Imports System.Windows.Forms
Imports System.Drawing
Imports System.IO
Imports System.Runtime.InteropServices
Imports System.Text
Imports System.Threading
'Imports Dynamsoft.Barcode
Imports Dynamsoft.TWAIN
Imports System.Windows.Forms
Imports Dynamsoft.Core
Imports Dynamsoft.Core.Annotation
Imports Dynamsoft.Core.Enums
'Imports Dynamsoft.UVC
'Imports Dynamsoft.OCR
Imports Dynamsoft.PDF
Imports Dynamsoft.Core.Annotation
Imports Dynamsoft.PDF.Enums
'Imports Dynamsoft.Barcode
Imports Dynamsoft.TWAIN
'Imports Dynamsoft.UVC.Common
Imports Dynamsoft.TWAIN.Interface
Imports Dynamsoft.Core.Enums
Imports System.IO
Imports Dynamsoft.TWAIN.Enums
Imports Dynamsoft.DotTwain
Imports ClosedXML.Excel
Imports Dynamsoft.PDF.Enums
Imports Spire.Pdf
'Aktuell3
@@ -64,25 +59,6 @@ Public Class frmScan
init()
End Sub
Public Enum TwainSupportedSizes As UShort
TWSS_NONE = 0
TWSS_A4 = 1
TWSS_JISB5 = 2
TWSS_USLETTER = 3
TWSS_USLEGAL = 4
TWSS_A5 = 5
TWSS_ISOB4 = 6
TWSS_ISOB6 = 7
TWSS_USLEDGER = 9
TWSS_USEXECUTIVE = 10
TWSS_A3 = 11
TWSS_B4 = 12
TWSS_B6 = 13
TWSS_BUSINESSCARD = 14
End Enum
Public Sub OnPostAllTransfers() Implements IAcquireCallback.OnPostAllTransfers
Me.Invoke(New CrossThreadOperationControl(AddressOf CallMe))
End Sub
@@ -267,8 +243,8 @@ Public Class frmScan
'startScanTimeout()
startScan()
cboFormat.SelectedIndex = cboFormat.FindStringExact("A4")
If cboFormat.SelectedIndex > 0 Then cbxAltFormat.Checked = True
'cboFormat.SelectedIndex = cboFormat.FindStringExact("A4")
'If cboFormat.SelectedIndex > 0 Then cbxAltFormat.Checked = True
End Sub
@@ -457,6 +433,18 @@ Public Class frmScan
.ValueMember = "Value"
End With
cboOrientation.Items.Clear()
Dim itemsOrient = [Enum].GetValues(GetType(PdfPageOrientation)).Cast(Of PdfPageOrientation)().Select(Function(e) New KeyValuePair(Of String, PdfPageOrientation)(e.ToString(), e)).ToList()
With cboOrientation
.DataSource = itemsOrient
.DisplayMember = "Key"
.ValueMember = "Value"
End With
If hasTwainSource Then
cboSource.Enabled = True
@@ -497,9 +485,13 @@ Public Class frmScan
Select Case ART
Case "DirectScan"
If cboFormat.SelectedIndex >= 0 Then
Dim selectedPaper As EnumPageSize = CType(cboFormat.SelectedValue, EnumPageSize)
If cbxAltFormat.Checked Then m_PDFCreator.PageSize = selectedPaper
Dim selectedPaper As EnumPageSize = CType(cboFormat.SelectedValue, EnumPageSize)
Dim orient As PdfPageOrientation = CType(cboOrientation.SelectedValue, PdfPageOrientation)
If cbxAltFormat.Checked Then
m_PDFCreator.PageSize = selectedPaper
If orient = PdfPageOrientation.Landscape Then
saveAsLandscape()
End If
End If
Dim PDF_bytes As Byte() = m_PDFCreator.SaveAsBytes(TryCast(Me, ISave))
@@ -596,10 +588,17 @@ Public Class frmScan
If SaveFileDialog.ShowDialog() = DialogResult.OK Then
' Multi page PDF
If cboFormat.SelectedIndex >= 0 Then
Dim selectedPaper As EnumPageSize = CType(cboFormat.SelectedValue, EnumPageSize)
If cbxAltFormat.Checked Then m_PDFCreator.PageSize = selectedPaper
End If
m_PDFCreator.Save(TryCast(Me, ISave), SaveFileDialog.FileName)
Dim orient As PdfPageOrientation = CType(cboOrientation.SelectedValue, PdfPageOrientation)
If cbxAltFormat.Checked Then
m_PDFCreator.PageSize = selectedPaper
If orient = PdfPageOrientation.Landscape Then
saveAsLandscape()
End If
End If
End If
m_PDFCreator.Save(TryCast(Me, ISave), SaveFileDialog.FileName)
End If
End If
Else
@@ -775,9 +774,13 @@ Public Class frmScan
Case "QuickScan"
Do
startScan()
If cboFormat.SelectedIndex >= 0 Then
Dim selectedPaper As EnumPageSize = CType(cboFormat.SelectedValue, EnumPageSize)
If cbxAltFormat.Checked Then m_PDFCreator.PageSize = selectedPaper
Dim selectedPaper As EnumPageSize = CType(cboFormat.SelectedValue, EnumPageSize)
Dim orient As PdfPageOrientation = CType(cboOrientation.SelectedValue, PdfPageOrientation)
If cbxAltFormat.Checked Then
m_PDFCreator.PageSize = selectedPaper
If orient = PdfPageOrientation.Landscape Then
saveAsLandscape()
End If
End If
Dim PDF_bytes As Byte() = m_PDFCreator.SaveAsBytes(TryCast(Me, ISave))
Me.fileName = addExtension(tbxSaveFileName.Text) ' DS.LAST_ID
@@ -828,7 +831,44 @@ Public Class frmScan
Private Sub cbxAltFormat_CheckedChanged(sender As Object, e As EventArgs) Handles cbxAltFormat.CheckedChanged
cboFormat.Enabled = cbxAltFormat.Checked
cboOrientation.Enabled = cbxAltFormat.Checked
End Sub
Private Sub saveAsLandscape()
Dim iImageWidth As Integer = m_ImageCore.ImageBuffer.GetBitmap(m_ImageCore.ImageBuffer.CurrentImageIndexInBuffer).Width
Dim iImageHeight As Integer = m_ImageCore.ImageBuffer.GetBitmap(m_ImageCore.ImageBuffer.CurrentImageIndexInBuffer).Height
'Dim tempListAnnotation As List(Of AnnotationData) = DirectCast(m_ImageCore.ImageBuffer.GetMetaData(m_ImageCore.ImageBuffer.CurrentImageIndexInBuffer, EnumMetaDataType.enumAnnotation), List(Of AnnotationData))
'For Each tempAnnotation As AnnotationData In tempListAnnotation
' Dim x As Integer = iImageHeight - (tempAnnotation.Location.Y + tempAnnotation.Size.Height)
' Dim y As Integer = tempAnnotation.Location.X
' Dim iWidth As Integer = tempAnnotation.Size.Height
' Dim iHeight As Integer = tempAnnotation.Size.Width
' Select Case tempAnnotation.AnnotationType
' 'case AnnotationType.enumLine:
' Case Dynamsoft.Core.Enums.AnnotationType.enumEllipse, Dynamsoft.Core.Enums.AnnotationType.enumRectangle, Dynamsoft.Core.Enums.AnnotationType.enumText
' tempAnnotation.StartPoint = New Point(x, y)
' tempAnnotation.EndPoint = New Point((tempAnnotation.StartPoint.X + iWidth), (tempAnnotation.StartPoint.Y + iHeight))
' Exit Select
' Case Dynamsoft.Core.Enums.AnnotationType.enumLine
' Dim startPoint As Point = tempAnnotation.StartPoint
' x = iImageHeight - startPoint.Y
' y = startPoint.X
' tempAnnotation.StartPoint = New Point(x, y)
' Dim endPoint As Point = tempAnnotation.EndPoint
' x = iImageHeight - endPoint.Y
' y = endPoint.X
' tempAnnotation.EndPoint = New Point(x, y)
' Exit Select
' End Select
'Next
If iImageHeight > iImageWidth Then
m_ImageCore.ImageProcesser.Rotate(m_ImageCore.ImageBuffer.CurrentImageIndexInBuffer, 90, False, EnumInterpolationMethod.BestQuality)
End If
End Sub
End Class