Merge branch 'master' of https://verag.visualstudio.com/SDL/_git/SDL
This commit is contained in:
@@ -24,13 +24,17 @@ Public Class cRechnungsnummern
|
||||
Case 3
|
||||
VonRechnungsNr = Now.ToString("yy") & "300001"
|
||||
BisRechnungsNr = Now.ToString("yy") & "399999"
|
||||
Case 4 'VERAG AG (DE)
|
||||
VonRechnungsNr = Now.ToString("yy") & "800001"
|
||||
BisRechnungsNr = Now.ToString("yy") & "899999"
|
||||
|
||||
Case 7
|
||||
VonRechnungsNr = Now.ToString("yy") & "700001"
|
||||
BisRechnungsNr = Now.ToString("yy") & "799999"
|
||||
Case 11
|
||||
VonRechnungsNr = Now.ToString("yy") & "900001"
|
||||
BisRechnungsNr = Now.ToString("yy") & "999999"
|
||||
Case 15
|
||||
Case 15, 19 'VERAG 360
|
||||
VonRechnungsNr = Now.ToString("yy") & "200001"
|
||||
BisRechnungsNr = Now.ToString("yy") & "299999"
|
||||
Case 20
|
||||
|
||||
@@ -823,110 +823,129 @@ Public Class cFormularManager
|
||||
|
||||
|
||||
|
||||
Public Sub fillPDF(vorlagenname As String, list As List(Of VERAG_PROG_ALLGEMEIN.MyListItem), listToWrite As List(Of cPDFWriteValues), Optional editierbar As Boolean = True, Optional autoDruck As Boolean = False, Optional printerName As String = "", Optional barcode As Image = Nothing, Optional barcodeLKW As Image = Nothing, Optional uo2 As String = "")
|
||||
Dim DS As New cDATENSERVER("DOKUMENTE", "VORLAGEN", "", uo2, "", vorlagenname)
|
||||
If Not DS.hasITEMS Then Exit Sub
|
||||
Dim path_src = DS.OPEN_SINGLE(False)
|
||||
If path_src = "" Then Exit Sub
|
||||
Public Function fillPDF(vorlagenname As String, list As List(Of VERAG_PROG_ALLGEMEIN.MyListItem), listToWrite As List(Of cPDFWriteValues), Optional editierbar As Boolean = True, Optional autoDruck As Boolean = False, Optional printerName As String = "", Optional barcode As Image = Nothing, Optional barcodeLKW As Image = Nothing, Optional uo2 As String = "", Optional openfile As Boolean = True) As String
|
||||
|
||||
Dim fi As New IO.DirectoryInfo(path_src)
|
||||
Dim destPath = DATENVERVER_OPTIONS.getTMPPath(fi.Name, fi.Extension, True, False)
|
||||
Dim pdf As iTextSharp.text.pdf.PdfReader = New iTextSharp.text.pdf.PdfReader(path_src)
|
||||
Using fw As New FileStream(destPath, FileMode.OpenOrCreate)
|
||||
Return fillPDF_Editierbar("DOKUMENTE", "VORLAGEN", "", uo2, "", vorlagenname, list, listToWrite, editierbar, autoDruck, printerName, barcode, barcodeLKW)
|
||||
|
||||
Dim stamper = New PdfStamper(pdf, fw)
|
||||
If True Then
|
||||
Try
|
||||
Dim f = stamper.AcroFields
|
||||
f.GenerateAppearances = True
|
||||
For Each i In list
|
||||
f.SetField(i.Text, i.Value)
|
||||
Next
|
||||
Catch ex As Exception
|
||||
End Function
|
||||
|
||||
End Try
|
||||
Public Function fillPDF_Editierbar(da_kategorie As String, da_ordner As String, da_uOrdner1 As String, da_uOrdner2 As String, da_uOrdner3 As String, da_name As String, list As List(Of VERAG_PROG_ALLGEMEIN.MyListItem), listToWrite As List(Of cPDFWriteValues), Optional editierbar As Boolean = True, Optional autoDruck As Boolean = False, Optional printerName As String = "", Optional barcode As Image = Nothing, Optional barcodeLKW As Image = Nothing, Optional openfile As Boolean = True) As String
|
||||
Try
|
||||
Dim DS As New cDATENSERVER(da_kategorie, da_ordner, da_uOrdner1, da_uOrdner2, da_uOrdner3, da_name)
|
||||
If Not DS.hasITEMS Then Return ""
|
||||
Dim path_src = DS.OPEN_SINGLE(False)
|
||||
If path_src = "" Then Return ""
|
||||
|
||||
If listToWrite IsNot Nothing Then
|
||||
Dim overStr As PdfContentByte = stamper.GetOverContent(1)
|
||||
For Each i In listToWrite
|
||||
If i.Text <> "" Then write(overStr, i, pdf.GetPageSize(1).Height)
|
||||
Next
|
||||
Dim fi As New IO.DirectoryInfo(path_src)
|
||||
Dim destPath = DATENVERVER_OPTIONS.getTMPPath(fi.Name, fi.Extension, True, False)
|
||||
Dim pdf As iTextSharp.text.pdf.PdfReader = New iTextSharp.text.pdf.PdfReader(path_src)
|
||||
Using fw As New FileStream(destPath, FileMode.OpenOrCreate)
|
||||
|
||||
Dim stamper = New PdfStamper(pdf, fw)
|
||||
If True Then
|
||||
Try
|
||||
Dim f = stamper.AcroFields
|
||||
f.GenerateAppearances = True
|
||||
For Each i In list
|
||||
f.SetField(i.Text, i.Value)
|
||||
Next
|
||||
Catch ex As Exception
|
||||
|
||||
End Try
|
||||
|
||||
If listToWrite IsNot Nothing Then
|
||||
Dim overStr As PdfContentByte = stamper.GetOverContent(1)
|
||||
For Each i In listToWrite
|
||||
If i.Text <> "" Then write(overStr, i, pdf.GetPageSize(1).Height)
|
||||
Next
|
||||
|
||||
End If
|
||||
|
||||
End If
|
||||
If barcode IsNot Nothing Then
|
||||
Try
|
||||
|
||||
End If
|
||||
If barcode IsNot Nothing Then
|
||||
Try
|
||||
Dim n = pdf.NumberOfPages
|
||||
Dim pagesize As iTextSharp.text.Rectangle
|
||||
For cnt = 1 To pdf.NumberOfPages
|
||||
|
||||
Dim n = pdf.NumberOfPages
|
||||
Dim pagesize As iTextSharp.text.Rectangle
|
||||
For cnt = 1 To pdf.NumberOfPages
|
||||
Dim over As PdfContentByte = stamper.GetOverContent(cnt)
|
||||
pagesize = pdf.GetPageSize(cnt)
|
||||
Dim x As Double = 15 'pagesize.Left + 10
|
||||
Dim y As Double = pagesize.Height / 2 - 100 'pagesize.Top - 50
|
||||
' barcode = btnScale_Click2(barcode, 40)
|
||||
barcode.RotateFlip(RotateFlipType.Rotate270FlipNone)
|
||||
'MsgBox(mm(pagesize.Height))
|
||||
Dim image As iTextSharp.text.Image = iTextSharp.text.Image.GetInstance(barcode, System.Drawing.Imaging.ImageFormat.Png)
|
||||
' Dim image As iTextSharp.text.Image = iTextSharp.text.Image.GetInstance(New Bitmap(80, 80), System.Drawing.Imaging.ImageFormat.Bmp)
|
||||
image.SetAbsolutePosition(x, y)
|
||||
|
||||
Dim over As PdfContentByte = stamper.GetOverContent(cnt)
|
||||
pagesize = pdf.GetPageSize(cnt)
|
||||
Dim x As Double = 15 'pagesize.Left + 10
|
||||
Dim y As Double = pagesize.Height / 2 - 100 'pagesize.Top - 50
|
||||
' barcode = btnScale_Click2(barcode, 40)
|
||||
barcode.RotateFlip(RotateFlipType.Rotate270FlipNone)
|
||||
'MsgBox(mm(pagesize.Height))
|
||||
Dim image As iTextSharp.text.Image = iTextSharp.text.Image.GetInstance(barcode, System.Drawing.Imaging.ImageFormat.Png)
|
||||
' Dim image As iTextSharp.text.Image = iTextSharp.text.Image.GetInstance(New Bitmap(80, 80), System.Drawing.Imaging.ImageFormat.Bmp)
|
||||
image.SetAbsolutePosition(x, y)
|
||||
|
||||
'Dim r As iTextSharp.text.Image = iTextSharp.text.Rectangle
|
||||
'Dim r As iTextSharp.text.Image = iTextSharp.text.Rectangle
|
||||
|
||||
|
||||
|
||||
'image.Width = 35
|
||||
over.AddImage(image)
|
||||
Next
|
||||
'image.Width = 35
|
||||
over.AddImage(image)
|
||||
Next
|
||||
|
||||
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message & ex.StackTrace)
|
||||
End Try
|
||||
End If
|
||||
Catch ex As Exception
|
||||
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
||||
End Try
|
||||
End If
|
||||
|
||||
|
||||
If barcodeLKW IsNot Nothing Then
|
||||
Try
|
||||
If barcodeLKW IsNot Nothing Then
|
||||
Try
|
||||
|
||||
Dim n = pdf.NumberOfPages
|
||||
Dim pagesize As iTextSharp.text.Rectangle
|
||||
For cnt = 1 To pdf.NumberOfPages
|
||||
Dim n = pdf.NumberOfPages
|
||||
Dim pagesize As iTextSharp.text.Rectangle
|
||||
For cnt = 1 To pdf.NumberOfPages
|
||||
|
||||
Dim over As PdfContentByte = stamper.GetOverContent(cnt)
|
||||
pagesize = pdf.GetPageSize(cnt)
|
||||
Dim x As Double = 40 'pagesize.Left + 10
|
||||
Dim y As Double = pagesize.Top - 80
|
||||
Dim over As PdfContentByte = stamper.GetOverContent(cnt)
|
||||
pagesize = pdf.GetPageSize(cnt)
|
||||
Dim x As Double = 40 'pagesize.Left + 10
|
||||
Dim y As Double = pagesize.Top - 80
|
||||
|
||||
Dim image As iTextSharp.text.Image = iTextSharp.text.Image.GetInstance(barcodeLKW, System.Drawing.Imaging.ImageFormat.Png)
|
||||
image.SetAbsolutePosition(x, y)
|
||||
Dim image As iTextSharp.text.Image = iTextSharp.text.Image.GetInstance(barcodeLKW, System.Drawing.Imaging.ImageFormat.Png)
|
||||
image.SetAbsolutePosition(x, y)
|
||||
|
||||
over.AddImage(image)
|
||||
Next
|
||||
over.AddImage(image)
|
||||
Next
|
||||
|
||||
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message & ex.StackTrace)
|
||||
End Try
|
||||
End If
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message & ex.StackTrace)
|
||||
End Try
|
||||
End If
|
||||
|
||||
|
||||
stamper.FormFlattening = Not editierbar
|
||||
stamper.Close()
|
||||
stamper.FormFlattening = Not editierbar
|
||||
stamper.Close()
|
||||
|
||||
If autoDruck Then
|
||||
PrintViaGS(destPath, printerName)
|
||||
'If Not PrintFile(destPath, printerName) Then Process.Start(destPath) ' Druck! Wenn Problem, wird das PDF geöffnet
|
||||
Else
|
||||
Process.Start(destPath)
|
||||
End If
|
||||
fw.Close()
|
||||
End Using
|
||||
pdf.Close()
|
||||
If openfile Then
|
||||
|
||||
End Sub
|
||||
If autoDruck Then
|
||||
PrintViaGS(destPath, printerName)
|
||||
'If Not PrintFile(destPath, printerName) Then Process.Start(destPath) ' Druck! Wenn Problem, wird das PDF geöffnet
|
||||
Else
|
||||
Process.Start(destPath)
|
||||
End If
|
||||
Else
|
||||
'weiter zu return
|
||||
End If
|
||||
fw.Close()
|
||||
|
||||
End Using
|
||||
pdf.Close()
|
||||
Return destPath
|
||||
|
||||
|
||||
Catch ex As Exception
|
||||
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
||||
End Try
|
||||
Return ""
|
||||
End Function
|
||||
|
||||
Public Function fillPDFVorhandenesLokalesPDF_Path(path As String, listToWrite As List(Of cPDFWriteValues), Optional editierbar As Boolean = True, Optional autoDruck As Boolean = False, Optional printerName As String = "", Optional genNewPath As Boolean = True, Optional barcode As List(Of barcodeToPdf) = Nothing) As String
|
||||
Return fillPDF("", "", "", "", "", "", listToWrite, editierbar, autoDruck, printerName, genNewPath, path, barcode)
|
||||
|
||||
Reference in New Issue
Block a user