MDM_USTVA

This commit is contained in:
2025-01-29 12:13:21 +01:00
parent 936bcce7d6
commit 07531c5547
2 changed files with 247 additions and 78 deletions

View File

@@ -86,12 +86,13 @@ Partial Class frmMDM_USTVAntrag
Me.dgvUSTVPositionen = New VERAG_PROG_ALLGEMEIN.MyDatagridview(Me.components)
Me.pnl = New System.Windows.Forms.Panel()
Me.Panel2 = New System.Windows.Forms.Panel()
Me.UstCntlUSTV_AntragPosition1 = New SDL.ustCntlUSTV_AntragPosition()
Me.Panel4 = New System.Windows.Forms.Panel()
Me.btnEintragloeschen = New System.Windows.Forms.Button()
Me.btnNeuerEintrag = New System.Windows.Forms.Button()
Me.ContextMenuStrip1 = New System.Windows.Forms.ContextMenuStrip(Me.components)
Me.ContextMenuStrip2 = New System.Windows.Forms.ContextMenuStrip(Me.components)
Me.UstCntlUSTV_AntragPosition1 = New SDL.ustCntlUSTV_AntragPosition()
Me.picPDF = New System.Windows.Forms.PictureBox()
Me.Panel3.SuspendLayout()
Me.Panel1.SuspendLayout()
Me.Panel9.SuspendLayout()
@@ -104,12 +105,14 @@ Partial Class frmMDM_USTVAntrag
Me.pnl.SuspendLayout()
Me.Panel2.SuspendLayout()
Me.Panel4.SuspendLayout()
CType(Me.picPDF, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'Panel3
'
Me.Panel3.BackColor = System.Drawing.Color.FromArgb(CType(CType(224, Byte), Integer), CType(CType(224, Byte), Integer), CType(CType(224, Byte), Integer))
Me.Panel3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.Panel3.Controls.Add(Me.picPDF)
Me.Panel3.Controls.Add(Me.btnMail)
Me.Panel3.Controls.Add(Me.btnAntrageeinarbeiten)
Me.Panel3.Controls.Add(Me.cbxArchivierteEintracheNochmalsEinarbetien)
@@ -1033,6 +1036,14 @@ Partial Class frmMDM_USTVAntrag
Me.Panel2.Size = New System.Drawing.Size(1300, 269)
Me.Panel2.TabIndex = 1
'
'UstCntlUSTV_AntragPosition1
'
Me.UstCntlUSTV_AntragPosition1.Dock = System.Windows.Forms.DockStyle.Fill
Me.UstCntlUSTV_AntragPosition1.Location = New System.Drawing.Point(0, 0)
Me.UstCntlUSTV_AntragPosition1.Name = "UstCntlUSTV_AntragPosition1"
Me.UstCntlUSTV_AntragPosition1.Size = New System.Drawing.Size(1298, 267)
Me.UstCntlUSTV_AntragPosition1.TabIndex = 0
'
'Panel4
'
Me.Panel4.BackColor = System.Drawing.Color.WhiteSmoke
@@ -1083,13 +1094,15 @@ Partial Class frmMDM_USTVAntrag
Me.ContextMenuStrip2.Name = "ContextMenuStrip1"
Me.ContextMenuStrip2.Size = New System.Drawing.Size(61, 4)
'
'UstCntlUSTV_AntragPosition1
'picPDF
'
Me.UstCntlUSTV_AntragPosition1.Dock = System.Windows.Forms.DockStyle.Fill
Me.UstCntlUSTV_AntragPosition1.Location = New System.Drawing.Point(0, 0)
Me.UstCntlUSTV_AntragPosition1.Name = "UstCntlUSTV_AntragPosition1"
Me.UstCntlUSTV_AntragPosition1.Size = New System.Drawing.Size(1298, 267)
Me.UstCntlUSTV_AntragPosition1.TabIndex = 0
Me.picPDF.Image = Global.SDL.My.Resources.Resources.pdf
Me.picPDF.Location = New System.Drawing.Point(972, 29)
Me.picPDF.Name = "picPDF"
Me.picPDF.Size = New System.Drawing.Size(50, 50)
Me.picPDF.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize
Me.picPDF.TabIndex = 27
Me.picPDF.TabStop = False
'
'frmMDM_USTVAntrag
'
@@ -1123,6 +1136,7 @@ Partial Class frmMDM_USTVAntrag
Me.pnl.ResumeLayout(False)
Me.Panel2.ResumeLayout(False)
Me.Panel4.ResumeLayout(False)
CType(Me.picPDF, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
@@ -1194,4 +1208,5 @@ Partial Class frmMDM_USTVAntrag
Friend WithEvents Label4 As Label
Friend WithEvents Label2 As Label
Friend WithEvents txtBezugsNr As VERAG_PROG_ALLGEMEIN.MyTextBox
Friend WithEvents picPDF As PictureBox
End Class

View File

@@ -7,6 +7,7 @@ Imports com.sun.tools.internal.ws.wsdl.framework
Imports DocumentFormat.OpenXml.Office2010.Drawing.Charts
Imports itextsharp.text.pdf
Imports itextsharp.text.pdf.parser
Imports java.awt.geom
Imports java.text.Normalizer
Imports jdk.nashorn.internal.objects.annotations
'Imports DocumentFormat.OpenXml.Drawing.Charts
@@ -470,7 +471,7 @@ Public Class frmMDM_USTVAntrag
AddHandler plose.Click, AddressOf mnuItemAuftrauege_Clicked
End If
If USTV_ANTRAG.UStVAn_ReDatVon.year >= 2025 Then 'wenn INFO von PLOSE WÄHRUNGSCODE IN INV_DATA, dann freischalten
If USTV_ANTRAG.UStVAn_ReDatVon.year >= 2025 Then
If Not ContextMenuStrip2.Items.ContainsKey("ploseneu") Then
Dim plose = New ToolStripMenuItem() With {.Text = "Plose NEUE LOGIK", .Name = "ploseneu", .Font = New Font(Me.Font.FontFamily, Me.Font.Size)}
ContextMenuStrip2.Items.Add(plose)
@@ -1490,99 +1491,109 @@ Public Class frmMDM_USTVAntrag
If e.RowIndex >= 0 AndAlso e.ColumnIndex >= 0 Then
Dim schnnittstellenNr = dgvUSTVPositionen.Rows(e.RowIndex).Cells("UStVPo_SchnittstellenNr").Value
Dim ReNr = dgvUSTVPositionen.Rows(e.RowIndex).Cells("UStVPo_ReNr").Value
Dim ReDat = dgvUSTVPositionen.Rows(e.RowIndex).Cells("UStVPo_ReDat").Value
Dim dsID
If Not IsDBNull(dgvUSTVPositionen.Rows(e.RowIndex).Cells("UStVPo_daId").Value) AndAlso IsNumeric(dgvUSTVPositionen.Rows(e.RowIndex).Cells("UStVPo_daId").Value) AndAlso dgvUSTVPositionen.Rows(e.RowIndex).Cells("UStVPo_daId").Value > 0 Then
dsID = dgvUSTVPositionen.Rows(e.RowIndex).Cells("UStVPo_daId").Value
Else
dsID = getDaID_OLD(schnnittstellenNr, ReDat, ReNr)
Dim pdf As String = ""
pdf = getPDF(dgvUSTVPositionen.Rows(e.RowIndex).Cells("UStVPo_SchnittstellenNr").Value, dgvUSTVPositionen.Rows(e.RowIndex).Cells("UStVPo_ReNr").Value, dgvUSTVPositionen.Rows(e.RowIndex).Cells("UStVPo_ReDat").Value, dgvUSTVPositionen.Rows(e.RowIndex).Cells("UStVPo_daId").Value)
If IO.File.Exists(pdf) Then
Process.Start(pdf)
End If
Select Case schnnittstellenNr
Case 1
If dsID > 0 Then
Me.Cursor = Cursors.WaitCursor
cFakturierung.doRechnungsDruck_SRorER(dsID,, False, 3)
End If
'Dim schnnittstellenNr = dgvUSTVPositionen.Rows(e.RowIndex).Cells("UStVPo_SchnittstellenNr").Value
'Dim ReNr = dgvUSTVPositionen.Rows(e.RowIndex).Cells("UStVPo_ReNr").Value
'Dim ReDat = dgvUSTVPositionen.Rows(e.RowIndex).Cells("UStVPo_ReDat").Value
Case 8
'Dim dsID
Me.Cursor = Cursors.WaitCursor
Dim ds As New VERAG_PROG_ALLGEMEIN.cDATENSERVER(dsID)
'If Not IsDBNull(dgvUSTVPositionen.Rows(e.RowIndex).Cells("UStVPo_daId").Value) AndAlso IsNumeric(dgvUSTVPositionen.Rows(e.RowIndex).Cells("UStVPo_daId").Value) AndAlso dgvUSTVPositionen.Rows(e.RowIndex).Cells("UStVPo_daId").Value > 0 Then
' dsID = dgvUSTVPositionen.Rows(e.RowIndex).Cells("UStVPo_daId").Value
'Else
' dsID = getDaID_OLD(schnnittstellenNr, ReDat, ReNr)
'If Not IsDBNull(dgvUSTVPositionen.Rows(e.RowIndex).Cells("UStVPo_daId").Value) Then
' ds.OPEN_SINGLE()
' Exit Sub
'End If
'End If
Dim path_src As String = ds.OPEN_SINGLE(False)
If path_src = "" Then Exit Sub
'Select Case schnnittstellenNr
' Case 1
' If dsID > 0 Then
' Me.Cursor = Cursors.WaitCursor
' cFakturierung.doRechnungsDruck_SRorER(dsID,, False, 3)
' End If
Try
' Case 8
Dim fi As New System.IO.DirectoryInfo(path_src)
Dim pdfReader As itextsharp.text.pdf.PdfReader = New itextsharp.text.pdf.PdfReader(path_src)
' Me.Cursor = Cursors.WaitCursor
' Dim ds As New VERAG_PROG_ALLGEMEIN.cDATENSERVER(dsID)
Dim TMP_Path_New = VERAG_PROG_ALLGEMEIN.DATENVERVER_OPTIONS.getTMPPath(fi.Name, fi.Extension,, True, "IDS-Rechnungen")
Dim srcDoc As New itextsharp.text.Document()
Dim PdfCopyProvider As New itextsharp.text.pdf.PdfCopy(srcDoc, New FileStream(TMP_Path_New, System.IO.FileMode.Create))
PdfCopyProvider.SetFullCompression()
srcDoc.Open()
PdfReader.unethicalreading = True
Dim pages As New List(Of Integer)()
' 'If Not IsDBNull(dgvUSTVPositionen.Rows(e.RowIndex).Cells("UStVPo_daId").Value) Then
' ' ds.OPEN_SINGLE()
' ' Exit Sub
' 'End If
For page As Integer = 1 To pdfReader.NumberOfPages
' Dim path_src As String = ds.OPEN_SINGLE(False)
' If path_src = "" Then Exit Sub
Dim strategy As ITextExtractionStrategy = New SimpleTextExtractionStrategy()
Dim currentpagetext As String = PdfTextExtractor.GetTextFromPage(pdfReader, page, strategy)
Dim searchtext As String = ReNr
Dim impPage As itextsharp.text.pdf.PdfImportedPage = Nothing
' Try
If (currentpagetext.Contains(searchtext)) Then
' Dim fi As New System.IO.DirectoryInfo(path_src)
' Dim pdfReader As itextsharp.text.pdf.PdfReader = New itextsharp.text.pdf.PdfReader(path_src)
If page > pdfReader.NumberOfPages Then
MsgBox("Seitenanzahl überschritten!")
srcDoc.Close() : pdfReader.Close()
Exit Sub
End If
Try
' Dim TMP_Path_New = VERAG_PROG_ALLGEMEIN.DATENVERVER_OPTIONS.getTMPPath(fi.Name, fi.Extension,, True, "IDS-Rechnungen")
' Dim srcDoc As New itextsharp.text.Document()
' Dim PdfCopyProvider As New itextsharp.text.pdf.PdfCopy(srcDoc, New FileStream(TMP_Path_New, System.IO.FileMode.Create))
' PdfCopyProvider.SetFullCompression()
' srcDoc.Open()
' PdfReader.unethicalreading = True
' Dim pages As New List(Of Integer)()
impPage = PdfCopyProvider.GetImportedPage(pdfReader, page)
' ----- Ermitteln der Seitenauflösung und setzen für die neue Seite
PdfCopyProvider.SetPageSize(New itextsharp.text.Rectangle(0.0F, 0.0F, impPage.Width, impPage.Height, pdfReader.GetPageRotation(page)))
' ----- PDF Seite in das neue Dokument einfügen
If impPage IsNot Nothing Then PdfCopyProvider.AddPage(impPage)
Catch ex As Exception
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
End Try
' For page As Integer = 1 To pdfReader.NumberOfPages
' Dim strategy As ITextExtractionStrategy = New SimpleTextExtractionStrategy()
' Dim currentpagetext As String = PdfTextExtractor.GetTextFromPage(pdfReader, page, strategy)
' Dim searchtext As String = ReNr
' Dim impPage As itextsharp.text.pdf.PdfImportedPage = Nothing
' If (currentpagetext.Contains(searchtext)) Then
' If page > pdfReader.NumberOfPages Then
' MsgBox("Seitenanzahl überschritten!")
' srcDoc.Close() : pdfReader.Close()
' Exit Sub
' End If
' Try
' impPage = PdfCopyProvider.GetImportedPage(pdfReader, page)
' ' ----- Ermitteln der Seitenauflösung und setzen für die neue Seite
' PdfCopyProvider.SetPageSize(New itextsharp.text.Rectangle(0.0F, 0.0F, impPage.Width, impPage.Height, pdfReader.GetPageRotation(page)))
' ' ----- PDF Seite in das neue Dokument einfügen
' If impPage IsNot Nothing Then PdfCopyProvider.AddPage(impPage)
' Catch ex As Exception
' VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
' End Try
End If
' End If
Next
' Next
srcDoc.Close()
pdfReader.Close()
' srcDoc.Close()
' pdfReader.Close()
If IO.File.Exists(TMP_Path_New) Then
Process.Start(TMP_Path_New)
End If
' If IO.File.Exists(TMP_Path_New) Then
' Process.Start(TMP_Path_New)
' End If
Catch ex As Exception
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
End Try
Case Else
If dsID > 0 Then
Me.Cursor = Cursors.WaitCursor
Dim DS As New VERAG_PROG_ALLGEMEIN.cDATENSERVER(dsID)
DS.OPEN_SINGLE()
End If
End Select
' Catch ex As Exception
' VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
' End Try
' Case Else
' If dsID > 0 Then
' Me.Cursor = Cursors.WaitCursor
' Dim DS As New VERAG_PROG_ALLGEMEIN.cDATENSERVER(dsID)
' DS.OPEN_SINGLE()
' End If
'End Select
End If
Catch ex As Exception
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
@@ -1613,6 +1624,52 @@ Public Class frmMDM_USTVAntrag
lblLand.Text = IIf(cbxLand.SelectedItem IsNot Nothing, cbxLand.SelectedItem.Text, "")
End Sub
Private Sub picPDF_Click(sender As Object, e As EventArgs) Handles picPDF.Click
If dgvUSTVPositionen.SelectedRows.Count = 0 Then Exit Sub
Try
Dim list As New List(Of String)
If dgvUSTVPositionen.SelectedRows.Count > 0 Then
For Each row As DataGridViewRow In dgvUSTVPositionen.SelectedRows
Dim pdf As String = ""
pdf = getPDF(row.Cells("UStVPo_SchnittstellenNr").Value, row.Cells("UStVPo_ReNr").Value, row.Cells("UStVPo_ReDat").Value, row.Cells("UStVPo_daId").Value)
If pdf <> "" Then list.Add(pdf)
Next
End If
If list.Count = 0 Then Exit Sub
If list.Count > 1 Then
Dim pathPDF = VERAG_PROG_ALLGEMEIN.DATENVERVER_OPTIONS.getTMPPath("RG_" & Now.ToString("ddMMyyyyHHmmss") & ".pdf", ".pdf", False, False)
If FormularManagerNEU.MergePdfFiles(list, pathPDF) Then
Process.Start(pathPDF)
End If
Else
Dim PDFFile As String = ""
PDFFile = list(0)
Process.Start(PDFFile)
End If
Me.Cursor = Cursors.Default
Catch ex As Exception
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
Me.Cursor = Cursors.Default
End Try
End Sub
Private Sub dgvUSTVPositionen_Sorted(sender As Object, e As EventArgs) Handles dgvUSTVPositionen.Sorted
For Each r As DataGridViewRow In dgvUSTVPositionen.Rows
@@ -1627,4 +1684,101 @@ Public Class frmMDM_USTVAntrag
Next
End Sub
Private Function getPDF(schnittstellenNr, ReNr, ReDat, daId) As String
Dim schnnittstellenNr = schnittstellenNr
Dim dsID
If Not IsDBNull(daId) AndAlso IsNumeric(daId) AndAlso daId > 0 Then
dsID = daId
Else
dsID = getDaID_OLD(schnnittstellenNr, ReDat, ReNr)
End If
If dsID < 0 Then Return ""
Select Case schnnittstellenNr
Case 1
If dsID > 0 Then
Me.Cursor = Cursors.WaitCursor
Dim path As String
cFakturierung.doRechnungsDruck_SRorER(dsID,, False, 3, path)
Return path
End If
Case 8
Me.Cursor = Cursors.WaitCursor
Dim ds As New VERAG_PROG_ALLGEMEIN.cDATENSERVER(dsID)
Dim path_src As String = ds.OPEN_SINGLE(False)
If path_src = "" Then Return ""
Try
Dim fi As New System.IO.DirectoryInfo(path_src)
Dim pdfReader As itextsharp.text.pdf.PdfReader = New itextsharp.text.pdf.PdfReader(path_src)
Dim TMP_Path_New = VERAG_PROG_ALLGEMEIN.DATENVERVER_OPTIONS.getTMPPath(fi.Name, fi.Extension,, False, "IDS-Rechnungen")
Dim srcDoc As New itextsharp.text.Document()
Dim PdfCopyProvider As New itextsharp.text.pdf.PdfCopy(srcDoc, New FileStream(TMP_Path_New, System.IO.FileMode.Create))
PdfCopyProvider.SetFullCompression()
srcDoc.Open()
PdfReader.unethicalreading = True
Dim pages As New List(Of Integer)()
For page As Integer = 1 To pdfReader.NumberOfPages
Dim strategy As ITextExtractionStrategy = New SimpleTextExtractionStrategy()
Dim currentpagetext As String = PdfTextExtractor.GetTextFromPage(pdfReader, page, strategy)
Dim searchtext As String = ReNr
Dim impPage As itextsharp.text.pdf.PdfImportedPage = Nothing
If (currentpagetext.Contains(searchtext)) Then
If page > pdfReader.NumberOfPages Then
MsgBox("Seitenanzahl überschritten!")
srcDoc.Close() : pdfReader.Close()
Return False
End If
Try
impPage = PdfCopyProvider.GetImportedPage(pdfReader, page)
' ----- Ermitteln der Seitenauflösung und setzen für die neue Seite
PdfCopyProvider.SetPageSize(New itextsharp.text.Rectangle(0.0F, 0.0F, impPage.Width, impPage.Height, pdfReader.GetPageRotation(page)))
' ----- PDF Seite in das neue Dokument einfügen
If impPage IsNot Nothing Then PdfCopyProvider.AddPage(impPage)
Catch ex As Exception
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
End Try
End If
Next
srcDoc.Close()
pdfReader.Close()
Return TMP_Path_New
Catch ex As Exception
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
End Try
Case Else
If dsID > 0 Then
Me.Cursor = Cursors.WaitCursor
Dim DS As New VERAG_PROG_ALLGEMEIN.cDATENSERVER(dsID)
Return DS.GET_TOP1_PATH
End If
End Select
End Function
End Class