neu
This commit is contained in:
@@ -17,27 +17,80 @@ Public Class cGeschaeftsjahr
|
||||
Me.Geschäftsjahr = Geschäftsjahr
|
||||
LOAD(Mandant, Niederlassung, Benutzer, Geschäftsjahr)
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Public Function INCREASE_BELEG() As Integer
|
||||
|
||||
If LfdBelegNr > 0 Then
|
||||
LfdBelegNr += 1
|
||||
|
||||
'-------Falls Nr schon existiert (geleichzeitige Buchung)
|
||||
Dim cnt_ = 0
|
||||
While EXISTS_BelegNr(LfdBelegNr)
|
||||
If cnt_ > 10 Then Exit While
|
||||
LfdBelegNr += 1
|
||||
cnt_ += 1
|
||||
End While
|
||||
'-------
|
||||
|
||||
|
||||
SAVE()
|
||||
Return LfdBelegNr
|
||||
Else
|
||||
LfdBelegNr = 1
|
||||
SAVE()
|
||||
Return LfdBelegNr
|
||||
End If
|
||||
SAVE()
|
||||
Return LfdBelegNr
|
||||
|
||||
|
||||
End Function
|
||||
|
||||
'Public Function INCREASE_BELEG() As Integer
|
||||
' If LfdBelegNr > 0 Then
|
||||
' LfdBelegNr += 1
|
||||
' Else
|
||||
' LfdBelegNr = 1
|
||||
' End If
|
||||
|
||||
' Return LfdBelegNr
|
||||
'End Function
|
||||
'Public Function INCREASE_JOURNAL() As Integer
|
||||
' If LfdJournalNr > 0 Then
|
||||
' LfdJournalNr += 1
|
||||
' Else
|
||||
' LfdJournalNr = 1
|
||||
' End If
|
||||
' SAVE()
|
||||
' Return LfdJournalNr
|
||||
'End Function
|
||||
|
||||
|
||||
Public Function INCREASE_JOURNAL() As Integer
|
||||
If LfdJournalNr > 0 Then
|
||||
LfdJournalNr += 1
|
||||
|
||||
'-------Falls Nr schon existiert (geleichzeitige Buchung)
|
||||
Dim cnt_ = 0
|
||||
While EXISTS_JournalNr(LfdJournalNr)
|
||||
If cnt_ > 10 Then Exit While
|
||||
LfdJournalNr += 1
|
||||
cnt_ += 1
|
||||
End While
|
||||
'-------
|
||||
|
||||
|
||||
SAVE()
|
||||
Return LfdJournalNr
|
||||
Else
|
||||
LfdJournalNr = 1
|
||||
SAVE()
|
||||
Return LfdJournalNr
|
||||
End If
|
||||
SAVE()
|
||||
Return LfdJournalNr
|
||||
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
Public Function SAVE() As Boolean 'obj As Object, tablename As String, where As String) As Boolean
|
||||
Dim list As List(Of VERAG_PROG_ALLGEMEIN.MyListItem2) = getParameterList()
|
||||
|
||||
@@ -78,6 +131,57 @@ Public Class cGeschaeftsjahr
|
||||
' Return Nothing
|
||||
End Sub
|
||||
|
||||
Public Function EXISTS_BelegNr(LfdBelegNr As Integer) As Boolean
|
||||
Try
|
||||
Using conn As SqlConnection = cSqlDb.GetNewOpenConnectionFMZOLL()
|
||||
Using cmd As New SqlCommand("SELECT count(*) as COUNT FROM tblGeschäftsjahr WHERE [Mandant]=@Mandant AND Niederlassung=@Niederlassung AND Benutzer=@Benutzer AND Geschäftsjahr=@Geschäftsjahr AND LfdBelegNr=@LfdBelegNr ", conn)
|
||||
cmd.Parameters.AddWithValue("@Mandant", Mandant)
|
||||
cmd.Parameters.AddWithValue("@Niederlassung", Niederlassung)
|
||||
cmd.Parameters.AddWithValue("@Benutzer", Benutzer)
|
||||
cmd.Parameters.AddWithValue("@Geschäftsjahr", Geschäftsjahr)
|
||||
cmd.Parameters.AddWithValue("@LfdBelegNr", LfdBelegNr)
|
||||
|
||||
Dim dr = cmd.ExecuteReader()
|
||||
If dr.Read Then
|
||||
If cSqlDb.checkNullInteger(dr.Item("COUNT")) > 0 Then Return True
|
||||
End If
|
||||
dr.Close()
|
||||
End Using
|
||||
End Using
|
||||
|
||||
Return False
|
||||
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 Nothing
|
||||
End Function
|
||||
|
||||
|
||||
Public Function EXISTS_JournalNr(LfdJournalNr As Integer) As Boolean
|
||||
Try
|
||||
Using conn As SqlConnection = cSqlDb.GetNewOpenConnectionFMZOLL()
|
||||
Using cmd As New SqlCommand("SELECT count(*) as COUNT FROM tblGeschäftsjahr WHERE [Mandant]=@Mandant AND Niederlassung=@Niederlassung AND Benutzer=@Benutzer AND Geschäftsjahr=@Geschäftsjahr AND LfdJournalNr=@LfdJournalNr ", conn)
|
||||
cmd.Parameters.AddWithValue("@Mandant", Mandant)
|
||||
cmd.Parameters.AddWithValue("@Niederlassung", Niederlassung)
|
||||
cmd.Parameters.AddWithValue("@Benutzer", Benutzer)
|
||||
cmd.Parameters.AddWithValue("@Geschäftsjahr", Geschäftsjahr)
|
||||
cmd.Parameters.AddWithValue("@LfdJournalNr", LfdJournalNr)
|
||||
|
||||
Dim dr = cmd.ExecuteReader()
|
||||
If dr.Read Then
|
||||
If cSqlDb.checkNullInteger(dr.Item("COUNT")) > 0 Then Return True
|
||||
End If
|
||||
dr.Close()
|
||||
End Using
|
||||
End Using
|
||||
|
||||
Return False
|
||||
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 Nothing
|
||||
End Function
|
||||
|
||||
|
||||
Function getParameterList() As List(Of VERAG_PROG_ALLGEMEIN.MyListItem2)
|
||||
Dim list As New List(Of VERAG_PROG_ALLGEMEIN.MyListItem2)
|
||||
|
||||
Reference in New Issue
Block a user