This commit is contained in:
2020-05-31 22:26:21 +02:00
parent a40477b387
commit 6e3e35ac70
37 changed files with 2287 additions and 437 deletions

View File

@@ -202,4 +202,93 @@ Public Class cDienstNA
Property dstna_grund As String = ""
Property dstna_info As String = ""
End Class
End Class
Public Class cDienstMitarbAbweichendeWochenstunden
Property dstaw_id As Integer
Property dstaw_dstmaId As Integer
Property dstaw_von As Date
Property dstaw_bis As Date
Property dstaw_std As Integer
Shared Function GET_STD(dstmaId As Integer, datum As Date) As Double
Dim sql As New VERAG_PROG_ALLGEMEIN.SQL
Return sql.getValueTxtBySql("SELECT TOP 1 [dstaw_std] FROM [tblDienstMitarbAbweichendeWochenstunden] where [dstaw_dstmaId]='" & dstmaId & "' and '" & datum.ToShortDateString & "' between dstaw_von and dstaw_bis", "ADMIN",,, -1)
End Function
Shared Function GET_STD_LIST(datum As Date) As List(Of cDienstMitarbAbweichendeWochenstunden)
GET_STD_LIST = New List(Of cDienstMitarbAbweichendeWochenstunden)
Dim sql As New VERAG_PROG_ALLGEMEIN.SQL
Dim dt = sql.loadDgvBySql("SELECT * FROM [tblDienstMitarbAbweichendeWochenstunden]", "ADMIN")
If dt IsNot Nothing Then
For Each r In dt.Rows
Dim ABW As New cDienstMitarbAbweichendeWochenstunden
ABW.dstaw_id = r("dstaw_id")
ABW.dstaw_dstmaId = r("dstaw_dstmaId")
ABW.dstaw_von = r("dstaw_von")
ABW.dstaw_bis = r("dstaw_bis")
ABW.dstaw_std = r("dstaw_std")
GET_STD_LIST.Add(ABW)
Next
End If
' Return sql.getValueTxtBySql("SELECT TOP 1 [dstaw_std] FROM [tblDienstMitarbAbweichendeWochenstunden] where [dstaw_dstmaId]='" & dstmaId & "' and '" & datum.ToShortDateString & "' between dstaw_von and dstaw_bis", "ADMIN",,, -1)
End Function
Shared Function GET_STD(dstmaId As Integer, datumMontag As Date, NormalWochenstunden As Integer, TZTagesStunden As Integer) As Double
GET_STD = 0
Dim abw_bool As Boolean = False
Dim sql As New VERAG_PROG_ALLGEMEIN.SQL
Dim exists = sql.getValueTxtBySql("SELECT count(*) FROM [tblDienstMitarbAbweichendeWochenstunden] where [dstaw_dstmaId]='" & dstmaId & "' and dstaw_bis > '" & datumMontag.ToShortDateString & "' ", "ADMIN",,, -1)
If exists <= 0 Then Return NormalWochenstunden
For i = 0 To 4
Dim abw = sql.getValueTxtBySql("SELECT TOP 1 [dstaw_std] FROM [tblDienstMitarbAbweichendeWochenstunden] where [dstaw_dstmaId]='" & dstmaId & "' and '" & datumMontag.AddDays(i).ToShortDateString & "' between dstaw_von and dstaw_bis", "ADMIN",,, -1)
If abw > 0 Then
GET_STD += abw / 5
abw_bool = True
Else
If False Then 'TZTagesStunden > 0 Then
GET_STD += TZTagesStunden
Else
GET_STD += NormalWochenstunden / 5
End If
End If
Next
If Not abw_bool Then GET_STD = NormalWochenstunden ' Wenn keine Abweicheung, einfach normal belassen...
End Function
Shared Function GET_STD_LIST(STD_LIST As List(Of cDienstMitarbAbweichendeWochenstunden), dstmaId As Integer, datumMontag As Date, NormalWochenstunden As Integer, TZTagesStunden As Integer) As Double
If STD_LIST Is Nothing Then Return NormalWochenstunden
GET_STD_LIST = 0
Dim abw_bool As Boolean = False
For i = 0 To 4
Dim abw = 0
For Each l In STD_LIST
If l.dstaw_dstmaId = dstmaId AndAlso (datumMontag.AddDays(i) >= l.dstaw_von And datumMontag.AddDays(i) <= l.dstaw_bis) Then
abw = l.dstaw_std
End If
Next
If abw > 0 Then
GET_STD_LIST += abw / 5
abw_bool = True
Else
If False Then 'TZTagesStunden > 0 Then
GET_STD_LIST += TZTagesStunden
Else
GET_STD_LIST += NormalWochenstunden / 5
End If
End If
Next
If Not abw_bool Then GET_STD_LIST = NormalWochenstunden ' Wenn keine Abweicheung, einfach normal belassen...
End Function
End Class