sammelrechnungsdruck, ustva, etc.

This commit is contained in:
2025-03-03 16:09:02 +01:00
parent 051cf0fce7
commit 2c906976cb
20 changed files with 2360 additions and 431 deletions

View File

@@ -27,13 +27,13 @@ Partial Class usrcntlPDFScanList
Me.ToolStripMenuItem1 = New System.Windows.Forms.ToolStripMenuItem()
Me.ToolStripMenuItem2 = New System.Windows.Forms.ToolStripMenuItem()
Me.picAdd = New System.Windows.Forms.PictureBox()
Me.MyListBox1 = New VERAG_PROG_ALLGEMEIN.MyListBox()
Me.UmbenennenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.KopierenZwischenablageToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.AlsEmailSendenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.ToolStripSeparator1 = New System.Windows.Forms.ToolStripSeparator()
Me.LöschenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.cntxt = New System.Windows.Forms.ContextMenuStrip(Me.components)
Me.MyListBox1 = New VERAG_PROG_ALLGEMEIN.MyListBox()
Me.cntxtMulti.SuspendLayout()
CType(Me.picAdd, System.ComponentModel.ISupportInitialize).BeginInit()
Me.cntxt.SuspendLayout()
@@ -71,19 +71,6 @@ Partial Class usrcntlPDFScanList
Me.picAdd.TabIndex = 3
Me.picAdd.TabStop = False
'
'MyListBox1
'
Me.MyListBox1._value = ""
Me.MyListBox1.Cursor = System.Windows.Forms.Cursors.Default
Me.MyListBox1.Dock = System.Windows.Forms.DockStyle.Fill
Me.MyListBox1.FormattingEnabled = True
Me.MyListBox1.Location = New System.Drawing.Point(0, 0)
Me.MyListBox1.Margin = New System.Windows.Forms.Padding(0)
Me.MyListBox1.Name = "MyListBox1"
Me.MyListBox1.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended
Me.MyListBox1.Size = New System.Drawing.Size(118, 64)
Me.MyListBox1.TabIndex = 4
'
'UmbenennenToolStripMenuItem
'
Me.UmbenennenToolStripMenuItem.Name = "UmbenennenToolStripMenuItem"
@@ -121,8 +108,22 @@ Partial Class usrcntlPDFScanList
Me.cntxt.Name = "cntxt"
Me.cntxt.Size = New System.Drawing.Size(218, 98)
'
'MyListBox1
'
Me.MyListBox1._value = ""
Me.MyListBox1.Cursor = System.Windows.Forms.Cursors.Default
Me.MyListBox1.Dock = System.Windows.Forms.DockStyle.Fill
Me.MyListBox1.FormattingEnabled = True
Me.MyListBox1.Location = New System.Drawing.Point(0, 0)
Me.MyListBox1.Margin = New System.Windows.Forms.Padding(0)
Me.MyListBox1.Name = "MyListBox1"
Me.MyListBox1.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended
Me.MyListBox1.Size = New System.Drawing.Size(118, 64)
Me.MyListBox1.TabIndex = 4
'
'usrcntlPDFScanList
'
Me.AllowDrop = True
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink

View File

@@ -1,6 +1,7 @@
Imports System.Windows.Forms
Imports System.IO
Imports Microsoft.Office.Interop
Imports System.Drawing
Public Class usrcntlPDFScanList
Public Property _DATENSERVER_KATEGORIE As String = "DOKUMENTE"
@@ -27,6 +28,8 @@ Public Class usrcntlPDFScanList
Public Event FileAdded(id As String, path As String, name As String)
Public Event FileDeleted()
Private draggedFilePath As String = ""
Private Sub usrcntlPDFScan_Layout(sender As Object, e As LayoutEventArgs) Handles Me.Layout
' Me.txt.Text = _TEXT_PDF
Me.MyListBox1.Dock = DockStyle.Fill
@@ -401,9 +404,58 @@ Public Class usrcntlPDFScanList
End Sub
Private Function GetFolderUnderCursor() As String
Try
Dim cursorPos As Point = Cursor.Position
Dim shell As Object = CreateObject("Shell.Application")
Dim folder As Object = shell.Namespace(0) ' Desktop level
' Get all open Explorer windows
For Each window In shell.Windows()
Dim explorerPath As String = window.Document.Folder.Self.Path
If Not String.IsNullOrEmpty(explorerPath) Then
' Check if the cursor is within the window bounds
Dim rect As Rectangle = New Rectangle(window.Left, window.Top, window.Width, window.Height)
If rect.Contains(cursorPos) Then
Return explorerPath ' Return detected folder path
End If
End If
Next
Catch ex As Exception
Return ""
End Try
Return ""
End Function
Private Sub cntxt_Opening(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles cntxt.Opening
UmbenennenToolStripMenuItem.Visible = (MyListBox1.SelectedItems.Count = 1)
End Sub
Private Sub usrcntlPDFScanList_DragLeave(sender As Object, e As EventArgs) 'Handles MyBase.DragLeave
If Not String.IsNullOrEmpty(draggedFilePath) Then
Try
' Get the folder path where the cursor moved
Dim cursorPath As String = GetFolderUnderCursor()
If Not String.IsNullOrEmpty(cursorPath) AndAlso Directory.Exists(cursorPath) Then
' Copy file to the detected folder
Dim destinationPath As String = Path.Combine(cursorPath, Path.GetFileName(draggedFilePath))
File.Copy(draggedFilePath, destinationPath, True)
MessageBox.Show("PDF saved to: " & destinationPath, "File Saved", MessageBoxButtons.OK, MessageBoxIcon.Information)
Else
MessageBox.Show("Could not determine the target folder.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning)
End If
Catch ex As Exception
MessageBox.Show("Error saving PDF: " & ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End If
End Sub
End Class

View File

@@ -7,12 +7,68 @@ Imports System.Windows.Forms
Imports ClosedXML.Excel
Imports Microsoft.Office.Interop
Imports ThoughtWorks.QRCode.Codec
Imports VERAG_PROG_ALLGEMEIN.TESTJSON
Public Class cProgramFunctions
Shared SQL As New VERAG_PROG_ALLGEMEIN.SQL
Public Shared Function getdefaultOutlookAccount(outlookApp As Outlook.Application) As Outlook.Account
' Get the MAPI namespace
Dim outlookNamespace As Outlook.NameSpace = outlookApp.GetNamespace("MAPI")
' Get the default store (default email account)
Dim defaultStore As Outlook.Store = outlookNamespace.DefaultStore
' Find the corresponding account
Dim defaultAccount As Outlook.Account = Nothing
For Each acc As Outlook.Account In outlookNamespace.Accounts
If acc.DeliveryStore.StoreID = defaultStore.StoreID Then
defaultAccount = acc
Exit For
End If
Next
Return defaultAccount
End Function
Public Shared Function printdefaultOutlookAccount(outlookApp As Outlook.Application) As String
' Get the MAPI namespace
Dim outlookNamespace As Outlook.NameSpace = outlookApp.GetNamespace("MAPI")
' Get the default store (default email account)
Dim defaultStore As Outlook.Store = outlookNamespace.DefaultStore
' Find the corresponding account
Dim defaultAccount As Outlook.Account = Nothing
For Each acc As Outlook.Account In outlookNamespace.Accounts
If acc.DeliveryStore.StoreID = defaultStore.StoreID Then
defaultAccount = acc
Exit For
End If
Next
' Display the default email account
If defaultAccount IsNot Nothing Then
Return "Default Email Account: " & defaultAccount.DisplayName
Else
Return "Default email account not found."
End If
End Function
Public Shared Function fktEuro(varBetrag As Object, varVonWährung As Object, varNachWährung As Object) As Object
'(FixeTaxe, "ATS", RECHNUNG.Währungscode)
'Dim varVonWährung As Object