You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

329 lines
12 KiB

Imports System.Resources
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.SqlTypes
Imports System.Runtime.InteropServices
Imports System.IO
Public Class frmSBPDFPrinter
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents MenuItem13 As System.Windows.Forms.MenuItem
Friend Shadows WithEvents contextMenu As System.Windows.Forms.ContextMenu
Friend WithEvents StatusBar1 As System.Windows.Forms.StatusBar
Friend WithEvents addressBar As System.Windows.Forms.ComboBox
Friend WithEvents ImageList1 As System.Windows.Forms.ImageList
Friend WithEvents Panel1 As System.Windows.Forms.Panel
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents webOCWrapper As WebOCHostCtrl
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents PictureBox2 As System.Windows.Forms.PictureBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmSBPDFPrinter))
Me.contextMenu = New System.Windows.Forms.ContextMenu()
Me.MenuItem13 = New System.Windows.Forms.MenuItem()
Me.StatusBar1 = New System.Windows.Forms.StatusBar()
Me.addressBar = New System.Windows.Forms.ComboBox()
Me.ImageList1 = New System.Windows.Forms.ImageList(Me.components)
Me.Panel1 = New System.Windows.Forms.Panel()
Me.PictureBox2 = New System.Windows.Forms.PictureBox()
Me.Button2 = New System.Windows.Forms.Button()
Me.Label1 = New System.Windows.Forms.Label()
Me.Button1 = New System.Windows.Forms.Button()
Me.webOCWrapper = New EDOKAApp.WebOCHostCtrl()
Me.Panel1.SuspendLayout()
Me.SuspendLayout()
'
'contextMenu
'
Me.contextMenu.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem13})
'
'MenuItem13
'
Me.MenuItem13.Index = 0
Me.MenuItem13.Text = "Print..."
'
'StatusBar1
'
Me.StatusBar1.Anchor = ((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right)
Me.StatusBar1.Dock = System.Windows.Forms.DockStyle.None
Me.StatusBar1.Location = New System.Drawing.Point(0, 405)
Me.StatusBar1.Name = "StatusBar1"
Me.StatusBar1.Size = New System.Drawing.Size(624, 24)
Me.StatusBar1.TabIndex = 1
'
'addressBar
'
Me.addressBar.Location = New System.Drawing.Point(16, 56)
Me.addressBar.Name = "addressBar"
Me.addressBar.Size = New System.Drawing.Size(352, 21)
Me.addressBar.Sorted = True
Me.addressBar.TabIndex = 3
Me.addressBar.Visible = False
'
'ImageList1
'
Me.ImageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit
Me.ImageList1.ImageSize = New System.Drawing.Size(16, 16)
Me.ImageList1.TransparentColor = System.Drawing.Color.Transparent
'
'Panel1
'
Me.Panel1.Controls.AddRange(New System.Windows.Forms.Control() {Me.PictureBox2, Me.Button2, Me.Label1, Me.Button1})
Me.Panel1.Name = "Panel1"
Me.Panel1.Size = New System.Drawing.Size(368, 176)
Me.Panel1.TabIndex = 10
'
'PictureBox2
'
Me.PictureBox2.Image = CType(resources.GetObject("PictureBox2.Image"), System.Drawing.Bitmap)
Me.PictureBox2.Location = New System.Drawing.Point(16, 8)
Me.PictureBox2.Name = "PictureBox2"
Me.PictureBox2.Size = New System.Drawing.Size(40, 50)
Me.PictureBox2.TabIndex = 15
Me.PictureBox2.TabStop = False
'
'Button2
'
Me.Button2.Location = New System.Drawing.Point(160, 88)
Me.Button2.Name = "Button2"
Me.Button2.TabIndex = 3
Me.Button2.Text = "&Nein"
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(56, 16)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(264, 48)
Me.Label1.TabIndex = 2
Me.Label1.Text = "Sind die Dokumente des Druckstapels erfolgreich gedruckt worden?"
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(240, 88)
Me.Button1.Name = "Button1"
Me.Button1.TabIndex = 1
Me.Button1.Text = "&Ja"
'
'webOCWrapper
'
Me.webOCWrapper.BrowserContextMenu = False
Me.webOCWrapper.Dock = System.Windows.Forms.DockStyle.Fill
Me.webOCWrapper.ImeMode = System.Windows.Forms.ImeMode.NoControl
Me.webOCWrapper.Name = "webOCWrapper"
Me.webOCWrapper.Size = New System.Drawing.Size(320, 125)
Me.webOCWrapper.TabIndex = 11
Me.webOCWrapper.TabStop = False
'
'frmSBPDFPrinter
'
Me.AutoScale = False
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(320, 125)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Panel1, Me.StatusBar1, Me.addressBar, Me.webOCWrapper})
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.Name = "frmSBPDFPrinter"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "Serienbriefe drucken"
Me.Panel1.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
#End Region
Dim m_druckjobnr As Integer
Public Event PrintDOne()
Private Sub delay(ByVal seconds As Integer)
Me.Cursor = Cursors.WaitCursor
Dim starttime As DateTime = DateTime.Now
Do
Application.DoEvents()
Loop While DateTime.Now.Subtract(starttime).TotalSeconds < seconds
Me.Cursor = Cursors.Default
End Sub
Public Sub PrintPDF()
delay(2)
'----------------------------
' Taskforce Korrektur
' BUD - 21.03.2006
'----------------------------
'webOCWrapper.Print(doUI:=True)
Dim objpdf As New clsPDF_print_show()
objpdf.PrintPDF(addressBar.Text, clsPDF_print_show.Enum_Art.Drucken)
'MsgBox(MyTxt.gettext(618), MsgBoxStyle.Information, "Banklagernd Druck")
'----------------------------
Me.Button1.Enabled = True
Application.DoEvents()
Dim i As Integer
End Sub
Dim m_showdoc As Boolean = True
Public Sub New(ByVal druckjobnr As Integer, ByVal ShowDoc As Boolean)
MyBase.New()
InitializeComponent()
Me.m_showdoc = ShowDoc
Me.m_druckjobnr = druckjobnr
End Sub
Private Sub frmPDFPrinter_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Get_Druckjob()
If Me.m_showdoc = True Then
Me.Width = Me.Width * 2.5
Me.Height = Me.Height * 3.5
Me.Panel1.Visible = False
webOCWrapper.Navigate(addressBar.Text)
Else
'----------------------------
' Taskforce Korrektur
' BUD - 21.03.2006
'----------------------------
'webOCWrapper.Navigate(addressBar.Text)
'----------------------------
End If
End Sub
''SHU Mehrfachdruck
'Public Sub Prepare_Form()
' Get_Druckjob()
' If Me.m_showdoc = True Then
' Me.Width = Me.Width * 2.5
' Me.Height = Me.Height * 3.5
' Me.Panel1.Visible = False
' webOCWrapper.Navigate(addressBar.Text)
' Else
' webOCWrapper.Navigate(addressBar.Text)
' End If
'End Sub
''Ende SHU Mehrfachdruck
Private Sub inetOptionsMI_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
webOCWrapper.InternetOptions()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.DialogResult = DialogResult.Yes
Me.Close()
End Sub
Private Function Get_Druckjob()
Try
''Test BUD
'If m_mitPfadNormal = True Then
' Dim dokumentname2 = m_Pfad
' Me.addressBar.Text = dokumentname2
' Return True
' Exit Function
'End If
Dim dokumentname = Globals.Applikationsdaten.Rows(0).Item("pfad_temporaer_dokumente") + Me.m_druckjobnr.ToString + "_empfaenger.pdf"
Dim Connection As New SqlConnection()
Dim DA As New SqlDataAdapter("select * from edex_sb_druckjob where druckjobnr=" + Me.m_druckjobnr.ToString, Connection)
Dim cb As SqlCommandBuilder = New SqlCommandBuilder(DA)
Dim ds As New DataSet()
Try
Connection.ConnectionString = Globals.sConnectionString
Connection.Open()
DA.Fill(ds, "empf")
Dim myRow As DataRow
If ds.Tables(0).Rows.Count = 0 Then
MyMsg.show_standardmessage(716, MsgBoxStyle.Critical)
Return False
Else
myRow = ds.Tables(0).Rows(0)
Dim MyData() As Byte
MyData = myRow.Item(6)
Dim K As Long
K = UBound(MyData)
Dim fs As New FileStream(dokumentname, FileMode.OpenOrCreate, FileAccess.Write)
fs.Write(MyData, 0, K)
fs.Close()
fs = Nothing
Me.addressBar.Text = dokumentname
End If
Catch ex As Exception
MyMsg.show_standardmessage(716, MsgBoxStyle.Critical)
' MsgBox(ex.Message)
Return False
End Try
cb = Nothing
ds = Nothing
DA = Nothing
Connection.Close()
Connection = Nothing
Return True
Catch EX As Exception
MyMsg.show_standardmessage(716, MsgBoxStyle.Critical)
Return False
End Try
End Function
Private Sub frmSBPDFPrinter_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
Me.Hide()
If Me.DialogResult = DialogResult.Yes Then RaiseEvent PrintDOne()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.DialogResult = DialogResult.No
Me.Close()
End Sub
'#Region " Test "
' Dim m_Pfad As String
' Property prop_Pfad() As String
' Get
' Return m_Pfad
' End Get
' Set(ByVal Value As String)
' m_Pfad = Value
' End Set
' End Property
' Dim m_mitPfadNormal As Boolean = False
' Property prop_mitPfadNormal() As Boolean
' Get
' Return m_mitPfadNormal
' End Get
' Set(ByVal Value As Boolean)
' m_mitPfadNormal = Value
' End Set
' End Property
'#End Region
End Class