feature_gesamtsicherheiten
This commit is contained in:
@@ -5,6 +5,7 @@ Public Class cGesamtsicherheitsPositionen
|
||||
|
||||
Property gsp_gspPosId As Integer
|
||||
Property gsp_gsId As Object = Nothing
|
||||
Property gsp_gsNr As Object = Nothing
|
||||
Property gsp_warenwert As Object = Nothing
|
||||
Property gsp_sicherheitsbetrag 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)
|
||||
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_gsNr", gsp_gsNr))
|
||||
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_freitext", gsp_freitext))
|
||||
|
||||
@@ -171,12 +171,22 @@ Public Class cGesamtsicherheitsReferenz
|
||||
|
||||
Public Function CalcSaldo() As String
|
||||
Dim SaldoString As String =
|
||||
"select SUM(
|
||||
"select
|
||||
|
||||
(select SUM(
|
||||
case
|
||||
when gs_art = 'Open' then (gs_sicherheitsbetrag * -1)
|
||||
when gs_art = 'Close' then gs_sicherheitsbetrag
|
||||
end) as SicherheitsSaldo
|
||||
from [tblGesamtsicherheit] Where gs_standort = '" & gsr_standort & "'"
|
||||
end)
|
||||
|
||||
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 mrn As Double = 0
|
||||
|
||||
@@ -21,22 +21,28 @@ Public Class cSicherheiten
|
||||
Property gs_LKWKZ As String
|
||||
Property gs_atr As String = ""
|
||||
Property gs_warenort As String
|
||||
Property gs_warenwertFix As Object
|
||||
Property gs_sicherheitsbetragFix As Object
|
||||
Property gs_zollsatz As Object
|
||||
Property gs_avisoId As Integer
|
||||
|
||||
Public hasEntry = False
|
||||
|
||||
Dim SQL As New SQL
|
||||
|
||||
Sub New(gs_gsID)
|
||||
Sub New(gs_gsID, gs_posNr)
|
||||
Me.gs_gsId = gs_gsID
|
||||
Me.gs_posNr = gs_posNr
|
||||
LOAD()
|
||||
End Sub
|
||||
|
||||
Sub New(gs_gsNr)
|
||||
Me.gs_gsNr = gs_gsNr
|
||||
LOADGSNR()
|
||||
End Sub
|
||||
|
||||
Sub New()
|
||||
|
||||
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("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_atr", gs_atr))
|
||||
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_avisoId", gs_avisoId))
|
||||
|
||||
Return list
|
||||
End Function
|
||||
@@ -69,7 +74,7 @@ Public Class cSicherheiten
|
||||
Public Function SAVE() As Boolean
|
||||
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 " &
|
||||
" Else " &
|
||||
" BEGIN " & getInsertCmd() & " END " &
|
||||
@@ -81,7 +86,7 @@ Public Class cSicherheiten
|
||||
Public Function SAVEOBJECT() As Integer
|
||||
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 " &
|
||||
" Else " &
|
||||
" BEGIN " & getInsertCmd() & " END " &
|
||||
@@ -97,8 +102,39 @@ Public Class cSicherheiten
|
||||
Try
|
||||
hasEntry = False
|
||||
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_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()
|
||||
If dr.Read Then
|
||||
For Each li In getParameterList()
|
||||
@@ -134,7 +170,7 @@ Public Class cSicherheiten
|
||||
End If
|
||||
Next
|
||||
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
|
||||
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()
|
||||
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 Class
|
||||
|
||||
Reference in New Issue
Block a user