This commit is contained in:
2023-02-28 17:07:16 +01:00
parent 1a7834db94
commit a6ba393fe4
10 changed files with 731 additions and 410 deletions

View File

@@ -1238,9 +1238,9 @@ Public Class cRKSV
rpt.lblGesamtbetrag.Text = CDbl(sum + (sum * s)).ToString("C")
If sum < 0 Then rpt.Label2.Text = "Rechnungskorrektur Nr."
End Sub
If POSPayment Then
Dim Pos = New POS(rpt, sum)
Pos.ShowDialog()
If False Then 'POSPayment Then
'Dim Pos = New frmPOSTerminal(rpt, sum)
'Pos.ShowDialog()
End If
'PaperKind = System.Drawing.Printing.PaperKind.Custom

146
SDL/Classes/cRKSV_POS.vb Normal file
View File

@@ -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