feature_gesamtsicherheiten
This commit is contained in:
@@ -5,6 +5,7 @@ Public Class cGesamtsicherheitsPositionen
|
|||||||
|
|
||||||
Property gsp_gspPosId As Integer
|
Property gsp_gspPosId As Integer
|
||||||
Property gsp_gsId As Object = Nothing
|
Property gsp_gsId As Object = Nothing
|
||||||
|
Property gsp_gsNr As Object = Nothing
|
||||||
Property gsp_warenwert As Object = Nothing
|
Property gsp_warenwert As Object = Nothing
|
||||||
Property gsp_sicherheitsbetrag As Object = Nothing
|
Property gsp_sicherheitsbetrag As Object = Nothing
|
||||||
Property gsp_freitext As Object = Nothing
|
Property gsp_freitext As Object = Nothing
|
||||||
@@ -35,6 +36,7 @@ Public Class cGesamtsicherheitsPositionen
|
|||||||
Dim list As New List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
|
Dim list As New List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
|
||||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("gsp_gspPosId", gsp_gspPosId))
|
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("gsp_gspPosId", gsp_gspPosId))
|
||||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("gsp_gsId", gsp_gsId))
|
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("gsp_gsId", gsp_gsId))
|
||||||
|
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("gsp_gsNr", gsp_gsNr))
|
||||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("gsp_warenwert", gsp_warenwert))
|
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("gsp_warenwert", gsp_warenwert))
|
||||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("gsp_sicherheitsbetrag", gsp_sicherheitsbetrag))
|
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("gsp_sicherheitsbetrag", gsp_sicherheitsbetrag))
|
||||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("gsp_freitext", gsp_freitext))
|
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("gsp_freitext", gsp_freitext))
|
||||||
|
|||||||
@@ -171,12 +171,22 @@ Public Class cGesamtsicherheitsReferenz
|
|||||||
|
|
||||||
Public Function CalcSaldo() As String
|
Public Function CalcSaldo() As String
|
||||||
Dim SaldoString As String =
|
Dim SaldoString As String =
|
||||||
"select SUM(
|
"select
|
||||||
|
|
||||||
|
(select SUM(
|
||||||
case
|
case
|
||||||
when gs_art = 'Open' then (gs_sicherheitsbetrag * -1)
|
when gs_art = 'Open' then (gs_sicherheitsbetrag * -1)
|
||||||
when gs_art = 'Close' then gs_sicherheitsbetrag
|
when gs_art = 'Close' then gs_sicherheitsbetrag
|
||||||
end) as SicherheitsSaldo
|
end)
|
||||||
from [tblGesamtsicherheit] Where gs_standort = '" & gsr_standort & "'"
|
|
||||||
|
as SicherheitsSaldoGS from [tblGesamtsicherheit] Where gs_standort = '" & gsr_standort & "')+
|
||||||
|
|
||||||
|
(select SUM(
|
||||||
|
case
|
||||||
|
when gsp_art = 'Open' then (gsp_sicherheitsbetrag * -1)
|
||||||
|
when gsp_art = 'Close' then gsp_sicherheitsbetrag
|
||||||
|
end)
|
||||||
|
as SicherheitsSaldoPositionen from [tblGesamtsicherheitsPositionen] Where gsp_gsid IN (select gs_gsId from [tblGesamtsicherheit] where gs_standort = '" & gsr_standort & "' ))"
|
||||||
|
|
||||||
Dim dt As New DataTable
|
Dim dt As New DataTable
|
||||||
Dim mrn As Double = 0
|
Dim mrn As Double = 0
|
||||||
|
|||||||
@@ -21,22 +21,28 @@ Public Class cSicherheiten
|
|||||||
Property gs_LKWKZ As String
|
Property gs_LKWKZ As String
|
||||||
Property gs_atr As String = ""
|
Property gs_atr As String = ""
|
||||||
Property gs_warenort As String
|
Property gs_warenort As String
|
||||||
Property gs_warenwertFix As Object
|
|
||||||
Property gs_sicherheitsbetragFix As Object
|
|
||||||
Property gs_zollsatz As Object
|
Property gs_zollsatz As Object
|
||||||
|
Property gs_avisoId As Integer
|
||||||
|
|
||||||
Public hasEntry = False
|
Public hasEntry = False
|
||||||
|
|
||||||
Dim SQL As New SQL
|
Dim SQL As New SQL
|
||||||
|
|
||||||
Sub New(gs_gsID)
|
Sub New(gs_gsID, gs_posNr)
|
||||||
Me.gs_gsId = gs_gsID
|
Me.gs_gsId = gs_gsID
|
||||||
|
Me.gs_posNr = gs_posNr
|
||||||
LOAD()
|
LOAD()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Sub New(gs_gsNr)
|
||||||
|
Me.gs_gsNr = gs_gsNr
|
||||||
|
LOADGSNR()
|
||||||
|
End Sub
|
||||||
|
|
||||||
Sub New()
|
Sub New()
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Function getParameterList() As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
|
Function getParameterList() As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
|
||||||
Dim list As New List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
|
Dim list As New List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
|
||||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("gs_gsId", gs_gsId,, True))
|
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("gs_gsId", gs_gsId,, True))
|
||||||
@@ -57,9 +63,8 @@ Public Class cSicherheiten
|
|||||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("gs_LKWKZ", gs_LKWKZ))
|
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("gs_LKWKZ", gs_LKWKZ))
|
||||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("gs_atr", gs_atr))
|
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("gs_atr", gs_atr))
|
||||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("gs_warenort", gs_warenort))
|
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("gs_warenort", gs_warenort))
|
||||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("gs_warenwertFix", gs_warenwertFix))
|
|
||||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("gs_sicherheitsbetragFix", gs_sicherheitsbetragFix))
|
|
||||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("gs_zollsatz", gs_zollsatz))
|
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("gs_zollsatz", gs_zollsatz))
|
||||||
|
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("gs_avisoId", gs_avisoId))
|
||||||
|
|
||||||
Return list
|
Return list
|
||||||
End Function
|
End Function
|
||||||
@@ -69,7 +74,7 @@ Public Class cSicherheiten
|
|||||||
Public Function SAVE() As Boolean
|
Public Function SAVE() As Boolean
|
||||||
Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
|
Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
|
||||||
|
|
||||||
Dim sqlstr = " BEGIN TRAN IF EXISTS(SELECT * FROM [tblGesamtsicherheit] WHERE gs_gsId=@gs_gsId) " &
|
Dim sqlstr = " BEGIN TRAN IF EXISTS(SELECT * FROM [tblGesamtsicherheit] WHERE gs_gsId=@gs_gsId AND gs_posNr=@gs_posNr) " &
|
||||||
" BEGIN " & getUpdateCmd() & " END " &
|
" BEGIN " & getUpdateCmd() & " END " &
|
||||||
" Else " &
|
" Else " &
|
||||||
" BEGIN " & getInsertCmd() & " END " &
|
" BEGIN " & getInsertCmd() & " END " &
|
||||||
@@ -81,7 +86,7 @@ Public Class cSicherheiten
|
|||||||
Public Function SAVEOBJECT() As Integer
|
Public Function SAVEOBJECT() As Integer
|
||||||
Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
|
Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
|
||||||
|
|
||||||
Dim sqlstr = " BEGIN TRAN IF EXISTS(SELECT * FROM [tblGesamtsicherheit] WHERE gs_gsId=@gs_gsId) " &
|
Dim sqlstr = " BEGIN TRAN IF EXISTS(SELECT * FROM [tblGesamtsicherheit] WHERE gs_gsId=@gs_gsId AND gs_posNr=@gs_posNr) " &
|
||||||
" BEGIN " & getUpdateCmd() & " END " &
|
" BEGIN " & getUpdateCmd() & " END " &
|
||||||
" Else " &
|
" Else " &
|
||||||
" BEGIN " & getInsertCmd() & " END " &
|
" BEGIN " & getInsertCmd() & " END " &
|
||||||
@@ -97,8 +102,39 @@ Public Class cSicherheiten
|
|||||||
Try
|
Try
|
||||||
hasEntry = False
|
hasEntry = False
|
||||||
Using conn As SqlConnection = SQL.GetNewOpenConnectionAVISO()
|
Using conn As SqlConnection = SQL.GetNewOpenConnectionAVISO()
|
||||||
Using cmd As New SqlCommand("SELECT * FROM [tblGesamtsicherheit] WHERE gs_gsId=@gs_gsId ", conn)
|
Using cmd As New SqlCommand("SELECT * FROM [tblGesamtsicherheit] WHERE gs_gsId=@gs_gsId AND gs_posNr=@gs_posNr ", conn)
|
||||||
cmd.Parameters.AddWithValue("@gs_gsID", gs_gsId)
|
cmd.Parameters.AddWithValue("@gs_gsID", gs_gsId)
|
||||||
|
cmd.Parameters.AddWithValue("@gs_posNr", gs_posNr)
|
||||||
|
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 Sub LOADGSNR()
|
||||||
|
Try
|
||||||
|
hasEntry = False
|
||||||
|
Using conn As SqlConnection = SQL.GetNewOpenConnectionAVISO()
|
||||||
|
Using cmd As New SqlCommand("SELECT * FROM [tblGesamtsicherheit] WHERE gs_gsNr=@gs_gsNr ", conn)
|
||||||
|
cmd.Parameters.AddWithValue("@gs_gsNr", gs_gsNr)
|
||||||
|
|
||||||
Dim dr = cmd.ExecuteReader()
|
Dim dr = cmd.ExecuteReader()
|
||||||
If dr.Read Then
|
If dr.Read Then
|
||||||
For Each li In getParameterList()
|
For Each li In getParameterList()
|
||||||
@@ -134,7 +170,7 @@ Public Class cSicherheiten
|
|||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
str = str.Substring(0, str.Length - 1) 'wg. ','
|
str = str.Substring(0, str.Length - 1) 'wg. ','
|
||||||
Return (" UPDATE [tblGesamtsicherheit] SET " & str & " WHERE gs_gsId=@gs_gsId ")
|
Return (" UPDATE [tblGesamtsicherheit] SET " & str & " WHERE gs_gsId=@gs_gsId AND gs_posNr=@gs_posNr ")
|
||||||
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
MsgBox("Fehler in der Funktion '" & System.Reflection.MethodInfo.GetCurrentMethod.Name & "'" & vbNewLine & vbNewLine & ex.Message & vbNewLine & vbNewLine & ex.StackTrace)
|
MsgBox("Fehler in der Funktion '" & System.Reflection.MethodInfo.GetCurrentMethod.Name & "'" & vbNewLine & vbNewLine & ex.Message & vbNewLine & vbNewLine & ex.StackTrace)
|
||||||
@@ -165,7 +201,7 @@ Public Class cSicherheiten
|
|||||||
|
|
||||||
|
|
||||||
Public Function Delete()
|
Public Function Delete()
|
||||||
SQL.doSQL("delete from [tblGesamtsicherheit] where gs_gsId = '" & Me.gs_gsId & "'", "AVISO")
|
SQL.doSQL("delete from [tblGesamtsicherheit] where gs_gsId = '" & Me.gs_gsId & "' AND gs_posNr='" & Me.gs_posNr & "'", "AVISO")
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
Reference in New Issue
Block a user