diff --git a/SDL/Classes/cRKSV_POS.vb b/SDL/Classes/cRKSV_POS.vb new file mode 100644 index 00000000..55ce391d --- /dev/null +++ b/SDL/Classes/cRKSV_POS.vb @@ -0,0 +1,146 @@ + +Imports System.Data.SqlClient +Imports System.Reflection + + +Public Class cRKSV_POS + + Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL + Property pos_Id As Integer + Property pos_aktiv As Object = Nothing + Property pos_kasse As Object = Nothing + Property pos_kassennr As Object = Nothing + Property pos_com As Object = Nothing + Property pos_baudrate As Object = Nothing + Property pos_comspeed As Object = Nothing + Property pos_comstop As Object = Nothing + Property pos_ip As Object = Nothing + Property pos_port As Object = Nothing + Property pos_typ As Object = Nothing + Property pos_lizenz As Object = Nothing + Property pos_kassendruck As Object = Nothing + Property pos_demoausdruck As Object = Nothing + Property pos_demodummyausdruck As Object = Nothing + Property pos_pin As Object = Nothing + Property pos_händerbeleg_drucken As Object = Nothing + Property pos_storno As Object = Nothing + Property pos_wartezeit As Object = Nothing + + Public hasEntry = False + + + Public Sub New(pos_Id) + Me.pos_Id = pos_Id + LOAD() + End Sub + Function getParameterList() As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) + Dim list As New List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) + list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("pos_Id", pos_Id,, True)) + list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("pos_aktiv", pos_aktiv)) + list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("pos_kasse", pos_kasse)) + list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("pos_kassennr", pos_kassennr)) + list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("pos_com", pos_com)) + list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("pos_baudrate", pos_baudrate)) + list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("pos_comspeed", pos_comspeed)) + list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("pos_comstop", pos_comstop)) + list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("pos_ip", pos_ip)) + list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("pos_port", pos_port)) + list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("pos_typ", pos_typ)) + list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("pos_lizenz", pos_lizenz)) + list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("pos_kassendruck", pos_kassendruck)) + list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("pos_demoausdruck", pos_demoausdruck)) + list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("pos_demodummyausdruck", pos_demodummyausdruck)) + list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("pos_apos_pinktiv", pos_pin)) + list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("pos_händerbeleg_drucken", pos_händerbeleg_drucken)) + list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("pos_storno", pos_storno)) + list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("pos_wartezeit", pos_wartezeit)) + + Return list + End Function + + + + Public Function SAVE() As Boolean + Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList() + + Dim sqlstr = " BEGIN TRAN IF EXISTS(SELECT * FROM tblRKSV_POS WHERE pos_Id=@pos_Id) " & + " BEGIN " & getUpdateCmd() & " END " & + " Else " & + " BEGIN " & getInsertCmd() & " END " & + " commit tran " + + Return SQL.doSQLVarList(sqlstr, "FMZOLL", , list) + End Function + + Public Sub LOAD() + Try + hasEntry = False + Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL() + Using cmd As New SqlCommand("SELECT * FROM tblRKSV_POS WHERE pos_Id=@pos_Id ", conn) + cmd.Parameters.AddWithValue("@pos_Id", pos_Id) + Dim dr = cmd.ExecuteReader() + If dr.Read Then + For Each li In getParameterList() + Dim propInfo As PropertyInfo = Me.GetType.GetProperty(li.Scalarvariable) + + If dr.Item(li.Text) Is DBNull.Value Then + propInfo.SetValue(Me, Nothing) + Else + propInfo.SetValue(Me, dr.Item(li.Text)) + End If + + Next + hasEntry = True + End If + dr.Close() + End Using + End Using + Catch ex As Exception + MsgBox("Fehler in der Funktion '" & System.Reflection.MethodInfo.GetCurrentMethod.Name & "'" & vbNewLine & vbNewLine & ex.Message & vbNewLine & vbNewLine & ex.StackTrace) + End Try + End Sub + + + + Public Function getUpdateCmd() As String + Try + Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList() + + Dim str As String = "" + For Each i In list + If Not i.isPrimaryParam Then + str &= "[" & i.Text & "] = @" & i.Scalarvariable & "," '.Replace("-", "").Replace(" ", "") & "," + End If + Next + str = str.Substring(0, str.Length - 1) 'wg. ',' + Return (" UPDATE [tblRKSV_POS] SET " & str & " WHERE pos_Id=@pos_Id ") + + Catch ex As Exception + MsgBox("Fehler in der Funktion '" & System.Reflection.MethodInfo.GetCurrentMethod.Name & "'" & vbNewLine & vbNewLine & ex.Message & vbNewLine & vbNewLine & ex.StackTrace) + End Try + Return "" + End Function + + + Public Function getInsertCmd() As String + Try + Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList() + Dim str As String = "" + Dim values As String = "" + For Each i In list + If Not i.isPrimaryParam Then + str &= "[" & i.Text & "]," + values &= "@" & i.Scalarvariable & "," '.Replace("-", "").Replace(" ", "") & "," + End If + Next + str = str.Substring(0, str.Length - 1) 'wg. ',' + values = values.Substring(0, values.Length - 1) 'wg. ',' + Return (" INSERT INTO tblRKSV_POS (" & str & ") VALUES(" & values & ") ") + Catch ex As Exception + MsgBox("Fehler in der Funktion '" & System.Reflection.MethodInfo.GetCurrentMethod.Name & "'" & vbNewLine & vbNewLine & ex.Message & vbNewLine & vbNewLine & ex.StackTrace) + End Try + Return "" + End Function + + +End Class diff --git a/SDL/SDL.vbproj b/SDL/SDL.vbproj index e53ec12a..7c278d03 100644 --- a/SDL/SDL.vbproj +++ b/SDL/SDL.vbproj @@ -512,6 +512,7 @@ + @@ -578,6 +579,12 @@ Form + + POSTerminal.vb + + + Form + frmKundenBesonderheiten_Add.vb @@ -2835,6 +2842,9 @@ frmEssensbestellungen.vb + + POSTerminal.vb + frmKundenBesonderheiten_Add.vb diff --git a/SDL/kassenbuch/POSTerminal.Designer.vb b/SDL/kassenbuch/POSTerminal.Designer.vb new file mode 100644 index 00000000..8fe406f4 --- /dev/null +++ b/SDL/kassenbuch/POSTerminal.Designer.vb @@ -0,0 +1,582 @@ + _ +Partial Class POSTerminal + Inherits System.Windows.Forms.Form + + 'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen. + _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Wird vom Windows Form-Designer benötigt. + Private components As System.ComponentModel.IContainer + + '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. + _ + Private Sub InitializeComponent() + Me.CheckBoxDummy = New System.Windows.Forms.CheckBox() + Me.CheckBoxAutodruck = New System.Windows.Forms.CheckBox() + Me.Label15 = New System.Windows.Forms.Label() + Me.comboInstalledPrinters = New System.Windows.Forms.ComboBox() + Me.Label12 = New System.Windows.Forms.Label() + Me.TextBox_BelegNr = New System.Windows.Forms.TextBox() + Me.Label14 = New System.Windows.Forms.Label() + Me.StornoBelegNr = New System.Windows.Forms.TextBox() + Me.TextBox_Aktiv = New System.Windows.Forms.TextBox() + Me.Label13 = New System.Windows.Forms.Label() + Me.ComboBox_Typ = New System.Windows.Forms.ComboBox() + Me.Button_Haendlerbeleg_drucken = New System.Windows.Forms.Button() + Me.TextBox_Kassenbon = New System.Windows.Forms.TextBox() + Me.Button_Kundenbeleg_drucken = New System.Windows.Forms.Button() + Me.Button_Gutschrift = New System.Windows.Forms.Button() + Me.Button_Storno = New System.Windows.Forms.Button() + Me.Button_Tagesabschluss = New System.Windows.Forms.Button() + Me.Button_Diagnose = New System.Windows.Forms.Button() + Me.Button_Exit = New System.Windows.Forms.Button() + Me.CheckBox_Kassedruck = New System.Windows.Forms.CheckBox() + Me.Label11 = New System.Windows.Forms.Label() + Me.TextBox_Drucktext2 = New System.Windows.Forms.TextBox() + Me.Label10 = New System.Windows.Forms.Label() + Me.TextBox_Drucktext = New System.Windows.Forms.TextBox() + Me.TextBox_ErgebnisText = New System.Windows.Forms.TextBox() + Me.TextBox_Ergebnis = New System.Windows.Forms.TextBox() + Me.Label9 = New System.Windows.Forms.Label() + Me.Button_Autorisierung = New System.Windows.Forms.Button() + Me.TextBox_Betrag = New System.Windows.Forms.TextBox() + Me.Label8 = New System.Windows.Forms.Label() + Me.TextBox_Lizenz = New System.Windows.Forms.TextBox() + Me.Label7 = New System.Windows.Forms.Label() + Me.ComboBox_ComStop = New System.Windows.Forms.ComboBox() + Me.Label6 = New System.Windows.Forms.Label() + Me.ComboBox_ComSpeed = New System.Windows.Forms.ComboBox() + Me.Label5 = New System.Windows.Forms.Label() + Me.TextBox_Port = New System.Windows.Forms.TextBox() + Me.Label4 = New System.Windows.Forms.Label() + Me.Label3 = New System.Windows.Forms.Label() + Me.TextBox_IP = New System.Windows.Forms.TextBox() + Me.Label2 = New System.Windows.Forms.Label() + Me.ComboBox_COM = New System.Windows.Forms.ComboBox() + Me.TextBox_KasseNr = New System.Windows.Forms.TextBox() + Me.Label1 = New System.Windows.Forms.Label() + Me.lblKasse = New System.Windows.Forms.Label() + Me.SuspendLayout() + ' + 'CheckBoxDummy + ' + Me.CheckBoxDummy.AutoSize = True + Me.CheckBoxDummy.Location = New System.Drawing.Point(669, 26) + Me.CheckBoxDummy.Name = "CheckBoxDummy" + Me.CheckBoxDummy.Size = New System.Drawing.Size(128, 17) + Me.CheckBoxDummy.TabIndex = 90 + Me.CheckBoxDummy.Text = "Dummy-Kopf drucken" + Me.CheckBoxDummy.UseVisualStyleBackColor = True + ' + 'CheckBoxAutodruck + ' + Me.CheckBoxAutodruck.AutoSize = True + Me.CheckBoxAutodruck.Location = New System.Drawing.Point(582, 27) + Me.CheckBoxAutodruck.Name = "CheckBoxAutodruck" + Me.CheckBoxAutodruck.Size = New System.Drawing.Size(75, 17) + Me.CheckBoxAutodruck.TabIndex = 89 + Me.CheckBoxAutodruck.Text = "Autodruck" + Me.CheckBoxAutodruck.UseVisualStyleBackColor = True + ' + 'Label15 + ' + Me.Label15.AutoSize = True + Me.Label15.Location = New System.Drawing.Point(246, 27) + Me.Label15.Name = "Label15" + Me.Label15.Size = New System.Drawing.Size(45, 13) + Me.Label15.TabIndex = 88 + Me.Label15.Text = "Drucker" + ' + 'comboInstalledPrinters + ' + Me.comboInstalledPrinters.FormattingEnabled = True + Me.comboInstalledPrinters.Location = New System.Drawing.Point(312, 24) + Me.comboInstalledPrinters.Name = "comboInstalledPrinters" + Me.comboInstalledPrinters.Size = New System.Drawing.Size(229, 21) + Me.comboInstalledPrinters.TabIndex = 87 + ' + 'Label12 + ' + Me.Label12.AutoSize = True + Me.Label12.Location = New System.Drawing.Point(11, 226) + Me.Label12.Name = "Label12" + Me.Label12.Size = New System.Drawing.Size(45, 13) + Me.Label12.TabIndex = 86 + Me.Label12.Text = "BelegNr" + ' + 'TextBox_BelegNr + ' + Me.TextBox_BelegNr.Location = New System.Drawing.Point(108, 223) + Me.TextBox_BelegNr.Name = "TextBox_BelegNr" + Me.TextBox_BelegNr.ReadOnly = True + Me.TextBox_BelegNr.Size = New System.Drawing.Size(44, 20) + Me.TextBox_BelegNr.TabIndex = 85 + ' + 'Label14 + ' + Me.Label14.AutoSize = True + Me.Label14.Location = New System.Drawing.Point(587, 251) + Me.Label14.Name = "Label14" + Me.Label14.Size = New System.Drawing.Size(76, 13) + Me.Label14.TabIndex = 84 + Me.Label14.Text = "StornoBelegNr" + ' + 'StornoBelegNr + ' + Me.StornoBelegNr.Location = New System.Drawing.Point(669, 248) + Me.StornoBelegNr.Name = "StornoBelegNr" + Me.StornoBelegNr.Size = New System.Drawing.Size(78, 20) + Me.StornoBelegNr.TabIndex = 83 + ' + 'TextBox_Aktiv + ' + Me.TextBox_Aktiv.BackColor = System.Drawing.Color.Gray + Me.TextBox_Aktiv.Location = New System.Drawing.Point(14, 517) + Me.TextBox_Aktiv.Name = "TextBox_Aktiv" + Me.TextBox_Aktiv.Size = New System.Drawing.Size(123, 20) + Me.TextBox_Aktiv.TabIndex = 82 + ' + 'Label13 + ' + Me.Label13.AutoSize = True + Me.Label13.Location = New System.Drawing.Point(320, 121) + Me.Label13.Name = "Label13" + Me.Label13.Size = New System.Drawing.Size(25, 13) + Me.Label13.TabIndex = 81 + Me.Label13.Text = "Typ" + ' + 'ComboBox_Typ + ' + Me.ComboBox_Typ.FormattingEnabled = True + Me.ComboBox_Typ.Items.AddRange(New Object() {"0: ZVT Standard", "1: ICP mit Shutter", "2: ICT 220 alt", "3: ICP Zelos", "4: Clover", "5: CCV Base seriell", "10: SIX", "11: OPI", "12: myPOS", "13: TIM-Server"}) + Me.ComboBox_Typ.Location = New System.Drawing.Point(386, 117) + Me.ComboBox_Typ.MaxDropDownItems = 12 + Me.ComboBox_Typ.Name = "ComboBox_Typ" + Me.ComboBox_Typ.Size = New System.Drawing.Size(154, 21) + Me.ComboBox_Typ.TabIndex = 80 + Me.ComboBox_Typ.Text = "0: ZVT Standard" + ' + 'Button_Haendlerbeleg_drucken + ' + Me.Button_Haendlerbeleg_drucken.Location = New System.Drawing.Point(314, 488) + Me.Button_Haendlerbeleg_drucken.Name = "Button_Haendlerbeleg_drucken" + Me.Button_Haendlerbeleg_drucken.Size = New System.Drawing.Size(122, 23) + Me.Button_Haendlerbeleg_drucken.TabIndex = 79 + Me.Button_Haendlerbeleg_drucken.Text = "Drucken" + Me.Button_Haendlerbeleg_drucken.UseVisualStyleBackColor = True + ' + 'TextBox_Kassenbon + ' + Me.TextBox_Kassenbon.Font = New System.Drawing.Font("Consolas", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.TextBox_Kassenbon.Location = New System.Drawing.Point(581, 57) + Me.TextBox_Kassenbon.Multiline = True + Me.TextBox_Kassenbon.Name = "TextBox_Kassenbon" + Me.TextBox_Kassenbon.ReadOnly = True + Me.TextBox_Kassenbon.Size = New System.Drawing.Size(221, 76) + Me.TextBox_Kassenbon.TabIndex = 78 + Me.TextBox_Kassenbon.Text = "Kassenbon" + ' + 'Button_Kundenbeleg_drucken + ' + Me.Button_Kundenbeleg_drucken.Location = New System.Drawing.Point(15, 488) + Me.Button_Kundenbeleg_drucken.Name = "Button_Kundenbeleg_drucken" + Me.Button_Kundenbeleg_drucken.Size = New System.Drawing.Size(122, 23) + Me.Button_Kundenbeleg_drucken.TabIndex = 77 + Me.Button_Kundenbeleg_drucken.Text = "Drucken" + Me.Button_Kundenbeleg_drucken.UseVisualStyleBackColor = True + ' + 'Button_Gutschrift + ' + Me.Button_Gutschrift.Location = New System.Drawing.Point(586, 327) + Me.Button_Gutschrift.Name = "Button_Gutschrift" + Me.Button_Gutschrift.Size = New System.Drawing.Size(163, 29) + Me.Button_Gutschrift.TabIndex = 76 + Me.Button_Gutschrift.Text = "4 = Gutschrift" + Me.Button_Gutschrift.UseVisualStyleBackColor = True + ' + 'Button_Storno + ' + Me.Button_Storno.Location = New System.Drawing.Point(586, 274) + Me.Button_Storno.Name = "Button_Storno" + Me.Button_Storno.Size = New System.Drawing.Size(163, 34) + Me.Button_Storno.TabIndex = 75 + Me.Button_Storno.Text = "3 = Storno" + Me.Button_Storno.UseVisualStyleBackColor = True + ' + 'Button_Tagesabschluss + ' + Me.Button_Tagesabschluss.Location = New System.Drawing.Point(585, 200) + Me.Button_Tagesabschluss.Name = "Button_Tagesabschluss" + Me.Button_Tagesabschluss.Size = New System.Drawing.Size(163, 34) + Me.Button_Tagesabschluss.TabIndex = 74 + Me.Button_Tagesabschluss.Text = "2 = Tagesabschluss" + Me.Button_Tagesabschluss.UseVisualStyleBackColor = True + ' + 'Button_Diagnose + ' + Me.Button_Diagnose.Location = New System.Drawing.Point(585, 150) + Me.Button_Diagnose.Name = "Button_Diagnose" + Me.Button_Diagnose.Size = New System.Drawing.Size(164, 33) + Me.Button_Diagnose.TabIndex = 73 + Me.Button_Diagnose.Text = "1 = Diagnose" + Me.Button_Diagnose.UseVisualStyleBackColor = True + ' + 'Button_Exit + ' + Me.Button_Exit.DialogResult = System.Windows.Forms.DialogResult.Cancel + Me.Button_Exit.Location = New System.Drawing.Point(585, 488) + Me.Button_Exit.Name = "Button_Exit" + Me.Button_Exit.Size = New System.Drawing.Size(162, 23) + Me.Button_Exit.TabIndex = 72 + Me.Button_Exit.Text = "Programmende" + Me.Button_Exit.UseVisualStyleBackColor = True + ' + 'CheckBox_Kassedruck + ' + Me.CheckBox_Kassedruck.AutoSize = True + Me.CheckBox_Kassedruck.Location = New System.Drawing.Point(386, 88) + Me.CheckBox_Kassedruck.Name = "CheckBox_Kassedruck" + Me.CheckBox_Kassedruck.Size = New System.Drawing.Size(82, 17) + Me.CheckBox_Kassedruck.TabIndex = 71 + Me.CheckBox_Kassedruck.Text = "Kassedruck" + Me.CheckBox_Kassedruck.UseVisualStyleBackColor = True + ' + 'Label11 + ' + Me.Label11.AutoSize = True + Me.Label11.Location = New System.Drawing.Point(311, 248) + Me.Label11.Name = "Label11" + Me.Label11.Size = New System.Drawing.Size(131, 13) + Me.Label11.TabIndex = 70 + Me.Label11.Text = "Drucktext2 (Händlerbeleg)" + ' + 'TextBox_Drucktext2 + ' + Me.TextBox_Drucktext2.Location = New System.Drawing.Point(314, 274) + Me.TextBox_Drucktext2.Multiline = True + Me.TextBox_Drucktext2.Name = "TextBox_Drucktext2" + Me.TextBox_Drucktext2.ReadOnly = True + Me.TextBox_Drucktext2.ScrollBars = System.Windows.Forms.ScrollBars.Vertical + Me.TextBox_Drucktext2.Size = New System.Drawing.Size(226, 208) + Me.TextBox_Drucktext2.TabIndex = 69 + ' + 'Label10 + ' + Me.Label10.AutoSize = True + Me.Label10.Location = New System.Drawing.Point(12, 248) + Me.Label10.Name = "Label10" + Me.Label10.Size = New System.Drawing.Size(125, 13) + Me.Label10.TabIndex = 68 + Me.Label10.Text = "Drucktext (Kundenbeleg)" + ' + 'TextBox_Drucktext + ' + Me.TextBox_Drucktext.Location = New System.Drawing.Point(14, 273) + Me.TextBox_Drucktext.Multiline = True + Me.TextBox_Drucktext.Name = "TextBox_Drucktext" + Me.TextBox_Drucktext.ReadOnly = True + Me.TextBox_Drucktext.ScrollBars = System.Windows.Forms.ScrollBars.Vertical + Me.TextBox_Drucktext.Size = New System.Drawing.Size(223, 209) + Me.TextBox_Drucktext.TabIndex = 67 + ' + 'TextBox_ErgebnisText + ' + Me.TextBox_ErgebnisText.Location = New System.Drawing.Point(166, 200) + Me.TextBox_ErgebnisText.Multiline = True + Me.TextBox_ErgebnisText.Name = "TextBox_ErgebnisText" + Me.TextBox_ErgebnisText.ReadOnly = True + Me.TextBox_ErgebnisText.Size = New System.Drawing.Size(375, 43) + Me.TextBox_ErgebnisText.TabIndex = 66 + ' + 'TextBox_Ergebnis + ' + Me.TextBox_Ergebnis.Location = New System.Drawing.Point(108, 200) + Me.TextBox_Ergebnis.Name = "TextBox_Ergebnis" + Me.TextBox_Ergebnis.ReadOnly = True + Me.TextBox_Ergebnis.Size = New System.Drawing.Size(44, 20) + Me.TextBox_Ergebnis.TabIndex = 65 + ' + 'Label9 + ' + Me.Label9.AutoSize = True + Me.Label9.Location = New System.Drawing.Point(12, 203) + Me.Label9.Name = "Label9" + Me.Label9.Size = New System.Drawing.Size(48, 13) + Me.Label9.TabIndex = 64 + Me.Label9.Text = "Ergebnis" + ' + 'Button_Autorisierung + ' + Me.Button_Autorisierung.Location = New System.Drawing.Point(166, 164) + Me.Button_Autorisierung.Name = "Button_Autorisierung" + Me.Button_Autorisierung.Size = New System.Drawing.Size(199, 24) + Me.Button_Autorisierung.TabIndex = 49 + Me.Button_Autorisierung.Text = "Autorisierung starten" + Me.Button_Autorisierung.UseVisualStyleBackColor = True + ' + 'TextBox_Betrag + ' + Me.TextBox_Betrag.Location = New System.Drawing.Point(106, 167) + Me.TextBox_Betrag.MaxLength = 8 + Me.TextBox_Betrag.Name = "TextBox_Betrag" + Me.TextBox_Betrag.Size = New System.Drawing.Size(46, 20) + Me.TextBox_Betrag.TabIndex = 48 + Me.TextBox_Betrag.TextAlign = System.Windows.Forms.HorizontalAlignment.Right + ' + 'Label8 + ' + Me.Label8.AutoSize = True + Me.Label8.Location = New System.Drawing.Point(12, 170) + Me.Label8.Name = "Label8" + Me.Label8.Size = New System.Drawing.Size(38, 13) + Me.Label8.TabIndex = 63 + Me.Label8.Text = "Betrag" + ' + 'TextBox_Lizenz + ' + Me.TextBox_Lizenz.Location = New System.Drawing.Point(106, 114) + Me.TextBox_Lizenz.Name = "TextBox_Lizenz" + Me.TextBox_Lizenz.Size = New System.Drawing.Size(190, 20) + Me.TextBox_Lizenz.TabIndex = 62 + ' + 'Label7 + ' + Me.Label7.AutoSize = True + Me.Label7.Location = New System.Drawing.Point(12, 117) + Me.Label7.Name = "Label7" + Me.Label7.Size = New System.Drawing.Size(37, 13) + Me.Label7.TabIndex = 61 + Me.Label7.Text = "Lizenz" + ' + 'ComboBox_ComStop + ' + Me.ComboBox_ComStop.FormattingEnabled = True + Me.ComboBox_ComStop.Items.AddRange(New Object() {"1", "2"}) + Me.ComboBox_ComStop.Location = New System.Drawing.Point(314, 85) + Me.ComboBox_ComStop.Name = "ComboBox_ComStop" + Me.ComboBox_ComStop.Size = New System.Drawing.Size(38, 21) + Me.ComboBox_ComStop.TabIndex = 60 + Me.ComboBox_ComStop.Text = "1" + ' + 'Label6 + ' + Me.Label6.AutoSize = True + Me.Label6.Location = New System.Drawing.Point(246, 88) + Me.Label6.Name = "Label6" + Me.Label6.Size = New System.Drawing.Size(50, 13) + Me.Label6.TabIndex = 59 + Me.Label6.Text = "ComStop" + ' + 'ComboBox_ComSpeed + ' + Me.ComboBox_ComSpeed.FormattingEnabled = True + Me.ComboBox_ComSpeed.Items.AddRange(New Object() {"9600", "115000"}) + Me.ComboBox_ComSpeed.Location = New System.Drawing.Point(106, 84) + Me.ComboBox_ComSpeed.Name = "ComboBox_ComSpeed" + Me.ComboBox_ComSpeed.Size = New System.Drawing.Size(121, 21) + Me.ComboBox_ComSpeed.TabIndex = 58 + Me.ComboBox_ComSpeed.Text = "9600" + ' + 'Label5 + ' + Me.Label5.AutoSize = True + Me.Label5.Location = New System.Drawing.Point(12, 88) + Me.Label5.Name = "Label5" + Me.Label5.Size = New System.Drawing.Size(59, 13) + Me.Label5.TabIndex = 57 + Me.Label5.Text = "ComSpeed" + ' + 'TextBox_Port + ' + Me.TextBox_Port.Location = New System.Drawing.Point(483, 58) + Me.TextBox_Port.MaxLength = 5 + Me.TextBox_Port.Name = "TextBox_Port" + Me.TextBox_Port.Size = New System.Drawing.Size(58, 20) + Me.TextBox_Port.TabIndex = 56 + ' + 'Label4 + ' + Me.Label4.AutoSize = True + Me.Label4.Location = New System.Drawing.Point(451, 61) + Me.Label4.Name = "Label4" + Me.Label4.Size = New System.Drawing.Size(26, 13) + Me.Label4.TabIndex = 55 + Me.Label4.Text = "Port" + ' + 'Label3 + ' + Me.Label3.AutoSize = True + Me.Label3.Location = New System.Drawing.Point(246, 61) + Me.Label3.Name = "Label3" + Me.Label3.Size = New System.Drawing.Size(17, 13) + Me.Label3.TabIndex = 54 + Me.Label3.Text = "IP" + ' + 'TextBox_IP + ' + Me.TextBox_IP.Location = New System.Drawing.Point(314, 58) + Me.TextBox_IP.MaxLength = 30 + Me.TextBox_IP.Name = "TextBox_IP" + Me.TextBox_IP.Size = New System.Drawing.Size(114, 20) + Me.TextBox_IP.TabIndex = 53 + ' + 'Label2 + ' + Me.Label2.AutoSize = True + Me.Label2.Location = New System.Drawing.Point(12, 60) + Me.Label2.Name = "Label2" + Me.Label2.Size = New System.Drawing.Size(31, 13) + Me.Label2.TabIndex = 52 + Me.Label2.Text = "COM" + ' + 'ComboBox_COM + ' + Me.ComboBox_COM.FormattingEnabled = True + Me.ComboBox_COM.Items.AddRange(New Object() {"LAN", "COM", "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9"}) + Me.ComboBox_COM.Location = New System.Drawing.Point(106, 57) + Me.ComboBox_COM.Name = "ComboBox_COM" + Me.ComboBox_COM.Size = New System.Drawing.Size(121, 21) + Me.ComboBox_COM.TabIndex = 51 + Me.ComboBox_COM.Text = "LAN" + ' + 'TextBox_KasseNr + ' + Me.TextBox_KasseNr.Location = New System.Drawing.Point(106, 31) + Me.TextBox_KasseNr.MaxLength = 4 + Me.TextBox_KasseNr.Name = "TextBox_KasseNr" + Me.TextBox_KasseNr.Size = New System.Drawing.Size(46, 20) + Me.TextBox_KasseNr.TabIndex = 50 + Me.TextBox_KasseNr.Text = "1" + ' + 'Label1 + ' + Me.Label1.AutoSize = True + Me.Label1.Location = New System.Drawing.Point(12, 34) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(47, 13) + Me.Label1.TabIndex = 47 + Me.Label1.Text = "KasseNr" + ' + 'lblKasse + ' + Me.lblKasse.AutoSize = True + Me.lblKasse.Location = New System.Drawing.Point(13, 9) + Me.lblKasse.Name = "lblKasse" + Me.lblKasse.Size = New System.Drawing.Size(51, 13) + Me.lblKasse.TabIndex = 91 + Me.lblKasse.Text = "Kasse 01" + ' + 'POSTerminal + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(962, 550) + Me.Controls.Add(Me.lblKasse) + Me.Controls.Add(Me.CheckBoxDummy) + Me.Controls.Add(Me.CheckBoxAutodruck) + Me.Controls.Add(Me.Label15) + Me.Controls.Add(Me.comboInstalledPrinters) + Me.Controls.Add(Me.Label12) + Me.Controls.Add(Me.TextBox_BelegNr) + Me.Controls.Add(Me.Label14) + Me.Controls.Add(Me.StornoBelegNr) + Me.Controls.Add(Me.TextBox_Aktiv) + Me.Controls.Add(Me.Label13) + Me.Controls.Add(Me.ComboBox_Typ) + Me.Controls.Add(Me.Button_Haendlerbeleg_drucken) + Me.Controls.Add(Me.TextBox_Kassenbon) + Me.Controls.Add(Me.Button_Kundenbeleg_drucken) + Me.Controls.Add(Me.Button_Gutschrift) + Me.Controls.Add(Me.Button_Storno) + Me.Controls.Add(Me.Button_Tagesabschluss) + Me.Controls.Add(Me.Button_Diagnose) + Me.Controls.Add(Me.Button_Exit) + Me.Controls.Add(Me.CheckBox_Kassedruck) + Me.Controls.Add(Me.Label11) + Me.Controls.Add(Me.TextBox_Drucktext2) + Me.Controls.Add(Me.Label10) + Me.Controls.Add(Me.TextBox_Drucktext) + Me.Controls.Add(Me.TextBox_ErgebnisText) + Me.Controls.Add(Me.TextBox_Ergebnis) + Me.Controls.Add(Me.Label9) + Me.Controls.Add(Me.Button_Autorisierung) + Me.Controls.Add(Me.TextBox_Betrag) + Me.Controls.Add(Me.Label8) + Me.Controls.Add(Me.TextBox_Lizenz) + Me.Controls.Add(Me.Label7) + Me.Controls.Add(Me.ComboBox_ComStop) + Me.Controls.Add(Me.Label6) + Me.Controls.Add(Me.ComboBox_ComSpeed) + Me.Controls.Add(Me.Label5) + Me.Controls.Add(Me.TextBox_Port) + Me.Controls.Add(Me.Label4) + Me.Controls.Add(Me.Label3) + Me.Controls.Add(Me.TextBox_IP) + Me.Controls.Add(Me.Label2) + Me.Controls.Add(Me.ComboBox_COM) + Me.Controls.Add(Me.TextBox_KasseNr) + Me.Controls.Add(Me.Label1) + Me.Name = "POSTerminal" + Me.Text = "POSTerminal" + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + + Friend WithEvents CheckBoxDummy As CheckBox + Friend WithEvents CheckBoxAutodruck As CheckBox + Friend WithEvents Label15 As Label + Friend WithEvents comboInstalledPrinters As ComboBox + Friend WithEvents Label12 As Label + Friend WithEvents TextBox_BelegNr As TextBox + Friend WithEvents Label14 As Label + Friend WithEvents StornoBelegNr As TextBox + Friend WithEvents TextBox_Aktiv As TextBox + Friend WithEvents Label13 As Label + Friend WithEvents ComboBox_Typ As ComboBox + Friend WithEvents Button_Haendlerbeleg_drucken As Button + Friend WithEvents TextBox_Kassenbon As TextBox + Friend WithEvents Button_Kundenbeleg_drucken As Button + Friend WithEvents Button_Gutschrift As Button + Friend WithEvents Button_Storno As Button + Friend WithEvents Button_Tagesabschluss As Button + Friend WithEvents Button_Diagnose As Button + Friend WithEvents Button_Exit As Button + Friend WithEvents CheckBox_Kassedruck As CheckBox + Friend WithEvents Label11 As Label + Friend WithEvents TextBox_Drucktext2 As TextBox + Friend WithEvents Label10 As Label + Friend WithEvents TextBox_Drucktext As TextBox + Friend WithEvents TextBox_ErgebnisText As TextBox + Friend WithEvents TextBox_Ergebnis As TextBox + Friend WithEvents Label9 As Label + Friend WithEvents Button_Autorisierung As Button + Friend WithEvents TextBox_Betrag As TextBox + Friend WithEvents Label8 As Label + Friend WithEvents TextBox_Lizenz As TextBox + Friend WithEvents Label7 As Label + Friend WithEvents ComboBox_ComStop As ComboBox + Friend WithEvents Label6 As Label + Friend WithEvents ComboBox_ComSpeed As ComboBox + Friend WithEvents Label5 As Label + Friend WithEvents TextBox_Port As TextBox + Friend WithEvents Label4 As Label + Friend WithEvents Label3 As Label + Friend WithEvents TextBox_IP As TextBox + Friend WithEvents Label2 As Label + Friend WithEvents ComboBox_COM As ComboBox + Friend WithEvents TextBox_KasseNr As TextBox + Friend WithEvents Label1 As Label + Friend WithEvents lblKasse As Label +End Class diff --git a/SDL/kassenbuch/POSTerminal.resx b/SDL/kassenbuch/POSTerminal.resx new file mode 100644 index 00000000..1af7de15 --- /dev/null +++ b/SDL/kassenbuch/POSTerminal.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/SDL/kassenbuch/POSTerminal.vb b/SDL/kassenbuch/POSTerminal.vb new file mode 100644 index 00000000..a11c0ebe --- /dev/null +++ b/SDL/kassenbuch/POSTerminal.vb @@ -0,0 +1,359 @@ +Imports Microsoft.Win32 + +Public Class POSTerminal + + ' Erstellt durch Jan Groetzner, Groetzner Unternehmensberatung, Seevetal + ' Version: 02.03.2020 + ' Kontakt: easyzvt@groetzner.de + + ' Dieser Quellcode dient als Beispielimplementierung zur Einbindung von EasyZVT in die eigene Kassenanwendung. + ' Der Code und auch Teile davon dürfen frei kopiert und in der Kassenanwendung verwendet werden + + Private EasyZVT_Worker As System.ComponentModel.BackgroundWorker = New System.ComponentModel.BackgroundWorker() + Private Funktion As Integer + Private Betrag As Integer = 0 + + Private WithEvents PDoc As Printing.PrintDocument + + Private Sub EasyZVT_DemoApp_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load + ' Anwendungsstart + ' Worker-Thread wird initialisiert + ' Vorherige Werte werden aus der Registry gelesen und in die Oberfläche eingetragen + ' Die Werte in der Oberfläche sollten in der echten Anwendung in der Stammdatentabelle der Kasse gespeichert werden und nicht in der Registry. Geht aber natürlich auch hier. + + Try + AddHandler EasyZVT_Worker.DoWork, New System.ComponentModel.DoWorkEventHandler(AddressOf EasyZVT_Async) + AddHandler EasyZVT_Worker.RunWorkerCompleted, New System.ComponentModel.RunWorkerCompletedEventHandler(AddressOf EasyZVT_OnCompleted) + + Dim ZVTKey As RegistryKey = Registry.CurrentUser.OpenSubKey("Software\GUB\ZVT", True) + TextBox_KasseNr.Text = ZVTKey.GetValue("KasseNr", "1") + ComboBox_COM.Text = ZVTKey.GetValue("COM", "LAN") + TextBox_IP.Text = ZVTKey.GetValue("IP", "192.168.86.122") + TextBox_Port.Text = ZVTKey.GetValue("Port", "20007") + ComboBox_ComSpeed.Text = ZVTKey.GetValue("ComSpeed", "9600") + ComboBox_ComStop.Text = ZVTKey.GetValue("ComStop", "1") + TextBox_Lizenz.Text = ZVTKey.GetValue("Lizenz", "") + If ZVTKey.GetValue("Kassedruck", 0) = 1 Then + CheckBox_Kassedruck.Checked = True + Else + CheckBox_Kassedruck.Checked = False + End If + ComboBox_Typ.SelectedIndex = ComboBox_Typ.FindString(ZVTKey.GetValue("Typ", 0).ToString) + PopulateInstalledPrintersCombo() + comboInstalledPrinters.SelectedIndex = comboInstalledPrinters.FindString(ZVTKey.GetValue("DemoDruckername", "")) + If ZVTKey.GetValue("DemoAutodruck", 0) = 0 Then + CheckBoxAutodruck.Checked = False + Else + CheckBoxAutodruck.Checked = True + End If + If ZVTKey.GetValue("DemoDummydruck", 1) = 0 Then + CheckBoxDummy.Checked = False + Else + CheckBoxDummy.Checked = True + End If + ZVTKey.Close() + + Catch ex As Exception + MessageBox.Show("Fehler beim Einlesen der Standardwerte: " & ex.Message) + End Try + End Sub + + + Private Sub SetRegistryParameter() + 'Funktion holt Werte direkt aus der Oberfläche (TextBox_...) und schreibt diese in die Registry als Eingabeparameter für EasyZVT. + 'Im wahren Leben stehen diese Werte in Datenbankeinträgen der Stammdatenverwaltung in der Hauptanwendung + + Dim ZVTKey As RegistryKey = Registry.CurrentUser.OpenSubKey("Software\GUB\ZVT", True) + Dim TypSelected As String + Dim Typ As Long + + Try + ZVTKey.SetValue("Funktion", Funktion, RegistryValueKind.DWord) + TypSelected = Strings.Left(ComboBox_Typ.Text, 2).Replace(":", "") + Typ = TypSelected + ZVTKey.SetValue("Typ", Typ, RegistryValueKind.DWord) + ZVTKey.SetValue("KasseNr", TextBox_KasseNr.Text, RegistryValueKind.String) + ZVTKey.SetValue("COM", ComboBox_COM.Text, RegistryValueKind.String) + ZVTKey.SetValue("IP", TextBox_IP.Text, RegistryValueKind.String) + ZVTKey.SetValue("Port", CInt(TextBox_Port.Text), RegistryValueKind.DWord) + ZVTKey.SetValue("ComSpeed", CInt(ComboBox_ComSpeed.Text), RegistryValueKind.DWord) + ZVTKey.SetValue("ComStop", CInt(ComboBox_ComStop.Text), RegistryValueKind.DWord) + ZVTKey.SetValue("Lizenz", TextBox_Lizenz.Text, RegistryValueKind.String) + If Funktion = 0 Or Funktion = 4 Then + Betrag = CInt("0" & TextBox_Betrag.Text) + ZVTKey.SetValue("Betrag", Betrag, RegistryValueKind.DWord) + End If + If Funktion = 3 Then + ZVTKey.SetValue("StornoBetrag", CInt("0" & TextBox_Betrag.Text), RegistryValueKind.DWord) + ZVTKey.SetValue("StornoBelegNr", CInt("0" & StornoBelegNr.Text), RegistryValueKind.DWord) + End If + If CheckBox_Kassedruck.Checked Then + ZVTKey.SetValue("Kassedruck", 1, RegistryValueKind.DWord) + Else + ZVTKey.SetValue("Kassedruck", 0, RegistryValueKind.DWord) + End If + ZVTKey.SetValue("Ergebnis", 1000, RegistryValueKind.DWord) ' Zur Sicherheit, falls EasyZVT gar nicht installiert ist oder nicht gestartet werden kann + ZVTKey.SetValue("ErgebnisText", "EasyZVT konnte nicht gestartet werden", RegistryValueKind.String) + ZVTKey.SetValue("DemoDruckername", comboInstalledPrinters.Text, RegistryValueKind.String) + If CheckBoxAutodruck.Checked Then + ZVTKey.SetValue("DemoAutodruck", 1, RegistryValueKind.DWord) + Else + ZVTKey.SetValue("DemoAutodruck", 0, RegistryValueKind.DWord) + End If + If CheckBoxDummy.Checked Then + ZVTKey.SetValue("DemoDummydruck", 1, RegistryValueKind.DWord) + Else + ZVTKey.SetValue("DemoDummydruck", 0, RegistryValueKind.DWord) + End If + Button_Autorisierung.Enabled = False + Button_Diagnose.Enabled = False + Button_Tagesabschluss.Enabled = False + Button_Storno.Enabled = False + Button_Gutschrift.Enabled = False + Button_Exit.Enabled = False + + TextBox_ErgebnisText.Text = "EasyZVT-Zahlung aktiv" + TextBox_Aktiv.Text = "warte auf Aktiv=0" + + + Catch ex As Exception + MessageBox.Show("Das Schreiben der Parameter ist fehlgeschlagen: " & ex.Message) + Exit Sub + End Try + ZVTKey.Close() + + End Sub + Private Sub Autorisierung() + + Funktion = 0 + SetRegistryParameter() + EasyZVT_Worker.RunWorkerAsync() + + End Sub + Private Sub Button_Autorisierung_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_Autorisierung.Click + 'Zahlung per Klick auslösen + Autorisierung() + End Sub + Private Sub TextBox_Betrag_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox_Betrag.KeyPress + ' Damit die Zahlung auch per Enter-Taste ausgelöst werden kann + If e.KeyChar = Chr(Keys.Enter) Then + e.Handled = True + Autorisierung() + End If + End Sub + + Private Sub EasyZVT_Async(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs) + ' Programmstart von ZVTStart.exe und warten auf Programmende + + Dim ZVTKey As RegistryKey = Registry.CurrentUser.OpenSubKey("Software\GUB\ZVT", True) + Try + Dim ZVTStart As String = ZVTKey.GetValue("Start") + Dim Proc As System.Diagnostics.Process + + If (Len(ZVTStart) > 1) Then + ZVTKey.SetValue("Ergebnis", 1000, RegistryValueKind.DWord) ' Wenn das Ergebnis 1000 bleibt konnte EasyZVT nicht gestartet werden + Proc = System.Diagnostics.Process.Start(ZVTStart) + System.Threading.Thread.Sleep(3000) ' Warte drei Sekunden bis Prozess ZVTStart geladen ist, dann erst anfangen Flag Aktiv abzufragen + While ZVTKey.GetValue("Aktiv") = 1 + System.Threading.Thread.Sleep(500) ' Warten... + If TextBox_Aktiv.BackColor = Color.Gray Then ' kleine Spielerei :-) + TextBox_Aktiv.BackColor = Color.Red + Else + TextBox_Aktiv.BackColor = Color.Gray + End If + End While + TextBox_Aktiv.BackColor = Color.Gray + Else + MsgBox("EasyZVT ist nicht installiert. Bitte im Internet Explorer über www.easyzvt.de/publish installieren") + End If + Catch ex As Exception + MessageBox.Show("Der Programmstart ist fehlgeschlagen: " & ex.Message) + Exit Sub + End Try + ZVTKey.Close() + End Sub + Private Sub EasyZVT_OnCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) + ' Diese Funktion wird automatisch aufgerufen wenn der Worker-Thread seine Arbeit beendet + ' und EasyZVT seine Ausgabewerte in die Registry zurückgeschrieben hat + + + Dim ZVTKey As RegistryKey = Registry.CurrentUser.OpenSubKey("Software\GUB\ZVT", True) + TextBox_Aktiv.Text = "" + TextBox_Ergebnis.Text = ZVTKey.GetValue("Ergebnis") + TextBox_ErgebnisText.Text = ZVTKey.GetValue("ErgebnisText") + TextBox_Drucktext.Text = Replace(ZVTKey.GetValue("Drucktext"), vbLf, vbCrLf) + TextBox_Drucktext2.Text = Replace(ZVTKey.GetValue("Drucktext2"), vbLf, vbCrLf) + + TextBox_BelegNr.Text = ZVTKey.GetValue("BelegNr").ToString + TextBox_Betrag.Text = "" + + If CheckBoxAutodruck.Checked Then + If Len(TextBox_Drucktext.Text) > 1 Then + Button_Kundenbeleg_drucken.PerformClick() + End If + If Len(TextBox_Drucktext2.Text) > 1 Then + Button_Haendlerbeleg_drucken.PerformClick() + End If + + End If + + TextBox_Betrag.Focus() + Button_Autorisierung.Enabled = True + Button_Diagnose.Enabled = True + Button_Tagesabschluss.Enabled = True + Button_Storno.Enabled = True + Button_Gutschrift.Enabled = True + Button_Exit.Enabled = True + ZVTKey.Close() + End Sub + + + Private Sub Button_Diagnose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_Diagnose.Click + Funktion = 1 + SetRegistryParameter() + EasyZVT_Worker.RunWorkerAsync() + + End Sub + + Private Sub Button_Exit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_Exit.Click + Application.Exit() + End Sub + + Private Sub Button_Tagesabschluss_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_Tagesabschluss.Click + Funktion = 2 + SetRegistryParameter() + EasyZVT_Worker.RunWorkerAsync() + + End Sub + + Private Sub Button_Storno_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_Storno.Click + Funktion = 3 + SetRegistryParameter() + EasyZVT_Worker.RunWorkerAsync() + + End Sub + + Private Sub Button_Gutschrift_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_Gutschrift.Click + Funktion = 4 + SetRegistryParameter() + EasyZVT_Worker.RunWorkerAsync() + + End Sub + + + Private Sub PDoc_SeiteDrucken(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PDoc.PrintPage + + Dim Textfont As Font = TextBox_Kassenbon.Font + Dim Hoehe, Breite As Integer + Dim Links, Oben As Integer + With PDoc.DefaultPageSettings + 'Hoehe = .PaperSize.Height - .Margins.Top - .Margins.Bottom + 'Breite = .PaperSize.Width - .Margins.Left - .Margins.Right + Hoehe = 500 ' 5,00 Zoll + Breite = 270 ' = 2,70 zoll + 'Links = PDoc.DefaultPageSettings.Margins.Left + 'Oben = PDoc.DefaultPageSettings.Margins.Top + Links = 10 + Oben = 10 + End With + ' Einen Rahmen zeichnen + Dim Rahmen As New Rectangle(Links, Oben, Breite, Hoehe) + e.Graphics.DrawRectangle(Pens.Blue, Rahmen) + ' In den Rahmen den Kassenbontext zeichnen + Dim StrFormat As StringFormat + StrFormat = New StringFormat(StringFormatFlags.LineLimit) + e.Graphics.DrawString(TextBox_Kassenbon.Text, Textfont, Brushes.Black, Rahmen, StrFormat) + e.HasMorePages = False + + End Sub + Private Sub Button_Kundenbeleg_drucken_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_Kundenbeleg_drucken.Click + + Dim PDlg As PrintDialog = New PrintDialog() + PDlg.UseEXDialog = True ' Notwendig für x64 + PDoc = New Printing.PrintDocument() + AddHandler PDoc.PrintPage, AddressOf PDoc_SeiteDrucken + + If CheckBoxDummy.Checked Then + TextBox_Kassenbon.Text = "Kassenbon EasyZVT DemoApp" & vbCrLf + TextBox_Kassenbon.Text &= "KasseNr: " & TextBox_KasseNr.Text & vbCrLf & vbCrLf + If Betrag > 0 And Funktion = 0 Then + TextBox_Kassenbon.Text &= "Testartikel Menge 1 Betrag " & (CDbl(Betrag) / 100.0).ToString("###,##0.00") & vbCrLf + TextBox_Kassenbon.Text &= "Gesamtbetrag " & (CDbl(Betrag) / 100.0).ToString("###,##0.00") & vbCrLf + TextBox_Kassenbon.Text &= "Kartenzahlung " & (CDbl(Betrag) / 100.0).ToString("###,##0.00") & vbCrLf + End If + + TextBox_Kassenbon.Text &= TextBox_Drucktext.Text ' Hier den Kundenbeleg hinzufügen + Else + TextBox_Kassenbon.Text = TextBox_Drucktext.Text + End If + + If comboInstalledPrinters.SelectedIndex <> -1 Then + PDoc.PrinterSettings.PrinterName = comboInstalledPrinters.Text + PDoc.Print() + Else + PDlg.Document = PDoc + If PDlg.ShowDialog() = Windows.Forms.DialogResult.OK Then + PDoc.Print() + End If + + End If + + End Sub + + Private Sub Button_Haendlerbeleg_drucken_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_Haendlerbeleg_drucken.Click + + Dim PDlg As PrintDialog = New PrintDialog() + PDlg.UseEXDialog = True ' Notwendig für x64 + PDoc = New Printing.PrintDocument() + AddHandler PDoc.PrintPage, AddressOf PDoc_SeiteDrucken + + If CheckBoxDummy.Checked Then + TextBox_Kassenbon.Text = "Kassenbon EasyZVT DemoApp" & vbCrLf + TextBox_Kassenbon.Text &= "KasseNr: " & TextBox_KasseNr.Text & vbCrLf & vbCrLf + If Betrag > 0 And Funktion = 0 Then + TextBox_Kassenbon.Text &= "Testartikel Menge 1 Betrag " & (CDbl(Betrag) / 100.0).ToString("###,##0.00") & vbCrLf + TextBox_Kassenbon.Text &= "Gesamtbetrag " & (CDbl(Betrag) / 100.0).ToString("###,##0.00") & vbCrLf + TextBox_Kassenbon.Text &= "Kartenzahlung " & (CDbl(Betrag) / 100.0).ToString("###,##0.00") & vbCrLf + End If + + TextBox_Kassenbon.Text &= TextBox_Drucktext2.Text ' Hier den Händlerbeleg hinzufügen + Else + TextBox_Kassenbon.Text &= TextBox_Drucktext.Text + End If + + If comboInstalledPrinters.SelectedIndex <> -1 Then + PDoc.PrinterSettings.PrinterName = comboInstalledPrinters.Text + PDoc.Print() + Else + PDlg.Document = PDoc + If PDlg.ShowDialog() = Windows.Forms.DialogResult.OK Then + PDoc.Print() + End If + + End If + + End Sub + Private Sub PopulateInstalledPrintersCombo() + ' Add list of installed printers found to the combo box. + ' The pkInstalledPrinters string will be used to provide the display string. + Dim i As Integer + Dim pkInstalledPrinters As String + + For i = 0 To PrinterSettings.InstalledPrinters.Count - 1 + pkInstalledPrinters = PrinterSettings.InstalledPrinters.Item(i) + comboInstalledPrinters.Items.Add(pkInstalledPrinters) + Next + End Sub + + Private Sub comboInstalledPrinters_SelectionChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles comboInstalledPrinters.SelectedIndexChanged + ' Set the printer to a printer in the combo box when the selection changes. + + If comboInstalledPrinters.SelectedIndex <> -1 Then + ' The combo box's Text property returns the selected item's text, which is the printer name. + ' printDoc.PrinterSettings.PrinterName = comboInstalledPrinters.Text + End If + + + End Sub + +End Class \ No newline at end of file diff --git a/SDL/kassenbuch/frmKassenbuch.Designer.vb b/SDL/kassenbuch/frmKassenbuch.Designer.vb index 9efe2d42..2f3b12b6 100644 --- a/SDL/kassenbuch/frmKassenbuch.Designer.vb +++ b/SDL/kassenbuch/frmKassenbuch.Designer.vb @@ -78,6 +78,7 @@ Partial Class frmKassenbuch Me.btnBelegLeihgeld = New System.Windows.Forms.Button() Me.UsrCntlTestsystem1 = New VERAG_PROG_ALLGEMEIN.usrCntlTestsystem() Me.Button1 = New System.Windows.Forms.Button() + Me.Button11 = New System.Windows.Forms.Button() CType(Me.DataGridView1, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.DataGridView2, System.ComponentModel.ISupportInitialize).BeginInit() Me.pnlTop.SuspendLayout() @@ -659,6 +660,7 @@ Partial Class frmKassenbuch ' 'pnl ' + Me.pnl.Controls.Add(Me.Button11) Me.pnl.Controls.Add(Me.Button7) Me.pnl.Controls.Add(Me.Label11) Me.pnl.Controls.Add(Me.Label12) @@ -792,6 +794,19 @@ Partial Class frmKassenbuch Me.Button1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft Me.Button1.UseVisualStyleBackColor = True ' + 'Button11 + ' + Me.Button11.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.Button11.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!) + Me.Button11.ForeColor = System.Drawing.Color.Black + Me.Button11.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft + Me.Button11.Location = New System.Drawing.Point(147, 193) + Me.Button11.Name = "Button11" + Me.Button11.Size = New System.Drawing.Size(129, 30) + Me.Button11.TabIndex = 430 + Me.Button11.Text = "POS Terminal" + Me.Button11.UseVisualStyleBackColor = True + ' 'frmKassenbuch ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) @@ -875,4 +890,5 @@ Partial Class frmKassenbuch Friend WithEvents Button1 As System.Windows.Forms.Button Friend WithEvents Button7 As System.Windows.Forms.Button Friend WithEvents Button10 As Button + Friend WithEvents Button11 As Button End Class diff --git a/SDL/kassenbuch/frmKassenbuch.vb b/SDL/kassenbuch/frmKassenbuch.vb index 8a7dd8f4..af979634 100644 --- a/SDL/kassenbuch/frmKassenbuch.vb +++ b/SDL/kassenbuch/frmKassenbuch.vb @@ -1274,4 +1274,15 @@ Public Class frmKassenbuch print.Viewer.ViewType = GrapeCity.Viewer.Common.Model.ViewType.Continuous print.Show() End Sub + + Private Sub Button11_Click(sender As Object, e As EventArgs) Handles Button11.Click + + Label18.ForeColor = Color.Black + If Not IsNumeric(cboKassen._value) Then + Label18.ForeColor = Color.Red + Exit Sub + End If + + Dim posTerminal As New POSTerminal() + End Sub End Class \ No newline at end of file