MItarbeiteruebersicht - Zeiterfassung
This commit is contained in:
@@ -22,13 +22,11 @@ Partial Class frmMitarbeitersuche
|
||||
'Das Bearbeiten mit dem Code-Editor ist nicht möglich.
|
||||
<System.Diagnostics.DebuggerStepThrough()>
|
||||
Private Sub InitializeComponent()
|
||||
Me.components = New System.ComponentModel.Container()
|
||||
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmMitarbeitersuche))
|
||||
Me.pnlSrch = New System.Windows.Forms.Panel()
|
||||
Me.Button4 = New System.Windows.Forms.Button()
|
||||
Me.btnClose = New System.Windows.Forms.Button()
|
||||
Me.PictureBox2 = New System.Windows.Forms.PictureBox()
|
||||
Me.sbMitarbeiter = New VERAG_PROG_ALLGEMEIN.MySearchBox()
|
||||
Me.pnlMain = New System.Windows.Forms.Panel()
|
||||
Me.pnl = New System.Windows.Forms.Panel()
|
||||
Me.btnSettings = New System.Windows.Forms.Button()
|
||||
@@ -55,7 +53,10 @@ Partial Class frmMitarbeitersuche
|
||||
Me.pnlGeburtstag = New System.Windows.Forms.Panel()
|
||||
Me.lblGeburtstag = New System.Windows.Forms.Label()
|
||||
Me.PictureBox1 = New System.Windows.Forms.PictureBox()
|
||||
Me.MyPanel1 = New VERAG_PROG_ALLGEMEIN.MyPanel(Me.components)
|
||||
Me.Panel1 = New System.Windows.Forms.Panel()
|
||||
Me.lblTimasZeiten = New System.Windows.Forms.Label()
|
||||
Me.lblTimasSaldo = New System.Windows.Forms.Label()
|
||||
Me.MyPanel1 = New VERAG_PROG_ALLGEMEIN.MyPanel()
|
||||
Me.lblPosition = New System.Windows.Forms.Label()
|
||||
Me.Label8 = New System.Windows.Forms.Label()
|
||||
Me.Label2 = New System.Windows.Forms.Label()
|
||||
@@ -64,7 +65,7 @@ Partial Class frmMitarbeitersuche
|
||||
Me.lblFirma = New System.Windows.Forms.Label()
|
||||
Me.Label4 = New System.Windows.Forms.Label()
|
||||
Me.Label3 = New System.Windows.Forms.Label()
|
||||
Me.Panel1 = New System.Windows.Forms.Panel()
|
||||
Me.sbMitarbeiter = New VERAG_PROG_ALLGEMEIN.MySearchBox()
|
||||
Me.pnlSrch.SuspendLayout()
|
||||
CType(Me.PictureBox2, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
Me.pnlMain.SuspendLayout()
|
||||
@@ -134,32 +135,6 @@ Partial Class frmMitarbeitersuche
|
||||
Me.PictureBox2.TabIndex = 18
|
||||
Me.PictureBox2.TabStop = False
|
||||
'
|
||||
'sbMitarbeiter
|
||||
'
|
||||
Me.sbMitarbeiter._allowFreitext = False
|
||||
Me.sbMitarbeiter._AllowSetValue = False
|
||||
Me.sbMitarbeiter._allowSpaceAsSplitter = True
|
||||
Me.sbMitarbeiter._autoSizeGross = False
|
||||
Me.sbMitarbeiter._hideIfListEmpty = True
|
||||
Me.sbMitarbeiter._value = Nothing
|
||||
Me.sbMitarbeiter.conn_art = "FMZOLL"
|
||||
Me.sbMitarbeiter.dgvpos = "LEFT"
|
||||
Me.sbMitarbeiter.DISPLAY_PARAM = Nothing
|
||||
Me.sbMitarbeiter.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.0!)
|
||||
Me.sbMitarbeiter.INVISIBLE_COLUMNS = Nothing
|
||||
Me.sbMitarbeiter.key_visible = False
|
||||
Me.sbMitarbeiter.KEYPARAM = Nothing
|
||||
Me.sbMitarbeiter.Location = New System.Drawing.Point(45, 11)
|
||||
Me.sbMitarbeiter.Name = "sbMitarbeiter"
|
||||
Me.sbMitarbeiter.searchActive = True
|
||||
Me.sbMitarbeiter.Size = New System.Drawing.Size(582, 29)
|
||||
Me.sbMitarbeiter.SQL_ORDER_BY = Nothing
|
||||
Me.sbMitarbeiter.SQL_SELECT = Nothing
|
||||
Me.sbMitarbeiter.SQL_WHERE = Nothing
|
||||
Me.sbMitarbeiter.SQL_WhereParamList = Nothing
|
||||
Me.sbMitarbeiter.TabIndex = 0
|
||||
Me.sbMitarbeiter.usrcntl = Nothing
|
||||
'
|
||||
'pnlMain
|
||||
'
|
||||
Me.pnlMain.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
|
||||
@@ -173,7 +148,9 @@ Partial Class frmMitarbeitersuche
|
||||
'pnl
|
||||
'
|
||||
Me.pnl.BackColor = System.Drawing.Color.FromArgb(CType(CType(250, Byte), Integer), CType(CType(254, Byte), Integer), CType(CType(255, Byte), Integer))
|
||||
Me.pnl.Controls.Add(Me.lblTimasSaldo)
|
||||
Me.pnl.Controls.Add(Me.btnSettings)
|
||||
Me.pnl.Controls.Add(Me.lblTimasZeiten)
|
||||
Me.pnl.Controls.Add(Me.pnlWohnadresse)
|
||||
Me.pnl.Controls.Add(Me.lblSpitzname)
|
||||
Me.pnl.Controls.Add(Me.Panel4)
|
||||
@@ -406,7 +383,7 @@ Partial Class frmMitarbeitersuche
|
||||
Me.lblName.Font = New System.Drawing.Font("Microsoft Sans Serif", 22.0!)
|
||||
Me.lblName.Location = New System.Drawing.Point(12, 38)
|
||||
Me.lblName.Name = "lblName"
|
||||
Me.lblName.Size = New System.Drawing.Size(695, 52)
|
||||
Me.lblName.Size = New System.Drawing.Size(629, 52)
|
||||
Me.lblName.TabIndex = 1
|
||||
Me.lblName.Text = "Max Mustermann"
|
||||
Me.lblName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
|
||||
@@ -441,6 +418,32 @@ Partial Class frmMitarbeitersuche
|
||||
Me.PictureBox1.TabIndex = 13
|
||||
Me.PictureBox1.TabStop = False
|
||||
'
|
||||
'Panel1
|
||||
'
|
||||
Me.Panel1.BackColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(54, Byte), Integer), CType(CType(128, Byte), Integer))
|
||||
Me.Panel1.Location = New System.Drawing.Point(214, 230)
|
||||
Me.Panel1.Name = "Panel1"
|
||||
Me.Panel1.Size = New System.Drawing.Size(553, 1)
|
||||
Me.Panel1.TabIndex = 29
|
||||
'
|
||||
'lblTimasZeiten
|
||||
'
|
||||
Me.lblTimasZeiten.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!)
|
||||
Me.lblTimasZeiten.Location = New System.Drawing.Point(203, 396)
|
||||
Me.lblTimasZeiten.Name = "lblTimasZeiten"
|
||||
Me.lblTimasZeiten.Size = New System.Drawing.Size(563, 25)
|
||||
Me.lblTimasZeiten.TabIndex = 12
|
||||
Me.lblTimasZeiten.Visible = False
|
||||
'
|
||||
'lblTimasSaldo
|
||||
'
|
||||
Me.lblTimasSaldo.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!)
|
||||
Me.lblTimasSaldo.Location = New System.Drawing.Point(6, 396)
|
||||
Me.lblTimasSaldo.Name = "lblTimasSaldo"
|
||||
Me.lblTimasSaldo.Size = New System.Drawing.Size(196, 24)
|
||||
Me.lblTimasSaldo.TabIndex = 30
|
||||
Me.lblTimasSaldo.Visible = False
|
||||
'
|
||||
'MyPanel1
|
||||
'
|
||||
Me.MyPanel1.BackColor = System.Drawing.Color.FromArgb(CType(CType(250, Byte), Integer), CType(CType(254, Byte), Integer), CType(CType(255, Byte), Integer))
|
||||
@@ -545,13 +548,31 @@ Partial Class frmMitarbeitersuche
|
||||
Me.Label3.Text = "Niederlassung:"
|
||||
Me.Label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
|
||||
'
|
||||
'Panel1
|
||||
'sbMitarbeiter
|
||||
'
|
||||
Me.Panel1.BackColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(54, Byte), Integer), CType(CType(128, Byte), Integer))
|
||||
Me.Panel1.Location = New System.Drawing.Point(214, 230)
|
||||
Me.Panel1.Name = "Panel1"
|
||||
Me.Panel1.Size = New System.Drawing.Size(553, 1)
|
||||
Me.Panel1.TabIndex = 29
|
||||
Me.sbMitarbeiter._allowFreitext = False
|
||||
Me.sbMitarbeiter._AllowSetValue = False
|
||||
Me.sbMitarbeiter._allowSpaceAsSplitter = True
|
||||
Me.sbMitarbeiter._autoSizeGross = False
|
||||
Me.sbMitarbeiter._hideIfListEmpty = True
|
||||
Me.sbMitarbeiter._value = Nothing
|
||||
Me.sbMitarbeiter.conn_art = "FMZOLL"
|
||||
Me.sbMitarbeiter.dgvpos = "LEFT"
|
||||
Me.sbMitarbeiter.DISPLAY_PARAM = Nothing
|
||||
Me.sbMitarbeiter.Font = New System.Drawing.Font("Microsoft Sans Serif", 14.0!)
|
||||
Me.sbMitarbeiter.INVISIBLE_COLUMNS = Nothing
|
||||
Me.sbMitarbeiter.key_visible = False
|
||||
Me.sbMitarbeiter.KEYPARAM = Nothing
|
||||
Me.sbMitarbeiter.Location = New System.Drawing.Point(45, 11)
|
||||
Me.sbMitarbeiter.Name = "sbMitarbeiter"
|
||||
Me.sbMitarbeiter.searchActive = True
|
||||
Me.sbMitarbeiter.Size = New System.Drawing.Size(582, 29)
|
||||
Me.sbMitarbeiter.SQL_ORDER_BY = Nothing
|
||||
Me.sbMitarbeiter.SQL_SELECT = Nothing
|
||||
Me.sbMitarbeiter.SQL_WHERE = Nothing
|
||||
Me.sbMitarbeiter.SQL_WhereParamList = Nothing
|
||||
Me.sbMitarbeiter.TabIndex = 0
|
||||
Me.sbMitarbeiter.usrcntl = Nothing
|
||||
'
|
||||
'frmMitarbeitersuche
|
||||
'
|
||||
@@ -626,4 +647,6 @@ Partial Class frmMitarbeitersuche
|
||||
Friend WithEvents Label8 As Windows.Forms.Label
|
||||
Friend WithEvents Panel1 As Windows.Forms.Panel
|
||||
Friend WithEvents btnSettings As Windows.Forms.Button
|
||||
Friend WithEvents lblTimasZeiten As Windows.Forms.Label
|
||||
Friend WithEvents lblTimasSaldo As Windows.Forms.Label
|
||||
End Class
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
Imports System.ComponentModel
|
||||
Imports System.Drawing
|
||||
Imports System.Net
|
||||
Imports VERAG_PROG_ALLGEMEIN.cCreditSafeAPI
|
||||
|
||||
Public Class frmMitarbeitersuche
|
||||
Dim mit_id As Integer = -1
|
||||
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
|
||||
Dim requestDone As Boolean = False
|
||||
Sub New()
|
||||
|
||||
' Dieser Aufruf ist für den Designer erforderlich.
|
||||
@@ -57,6 +60,8 @@ Public Class frmMitarbeitersuche
|
||||
Sub initMA()
|
||||
btn.Visible = False
|
||||
pnl.Visible = False
|
||||
lblTimasZeiten.Visible = False
|
||||
lblTimasSaldo.Visible = False
|
||||
Panel1.Visible = False
|
||||
btnSettings.Visible = False
|
||||
Dim MA As cMitarbeiter = Nothing
|
||||
@@ -152,6 +157,10 @@ Public Class frmMitarbeitersuche
|
||||
End If
|
||||
If VERAG_PROG_ALLGEMEIN.cAllgemein.USRID = MA.mit_id Then
|
||||
btn.Visible = True
|
||||
'Eintrag für Zeitübersicht
|
||||
lblTimasZeiten.Visible = True
|
||||
lblTimasSaldo.Visible = True
|
||||
If Not requestDone Then getTime(MA.mit_timasId)
|
||||
End If
|
||||
|
||||
If VERAG_PROG_ALLGEMEIN.cBerechtignunen.CHECK_BERECHTIGUNG_bool("MA_TeamBearbeiten", "SDL") Then
|
||||
@@ -208,4 +217,164 @@ Public Class frmMitarbeitersuche
|
||||
initMA()
|
||||
End Sub
|
||||
|
||||
Private Sub getTime(maid)
|
||||
Try
|
||||
Dim returnText As String = ""
|
||||
lblTimasZeiten.Text = ""
|
||||
|
||||
If maid Is Nothing Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
VERAG_PROG_ALLGEMEIN.cChilkat_Helper.UnlockCilkat()
|
||||
Dim rest As New Chilkat.Rest
|
||||
Dim API_STRING As String
|
||||
|
||||
|
||||
API_STRING = "https://zeit.verag.ag"
|
||||
|
||||
Dim success As Boolean
|
||||
|
||||
rest.VerboseLogging = True
|
||||
Dim bTls As Boolean = True
|
||||
Dim port As Integer = 443
|
||||
Dim bAutoReconnect As Boolean = True
|
||||
success = rest.Connect(API_STRING, port, bTls, bAutoReconnect)
|
||||
If (success <> True) Then
|
||||
Debug.WriteLine("ConnectFailReason: " & rest.ConnectFailReason)
|
||||
Debug.WriteLine(rest.LastErrorText)
|
||||
'lblTimas.Text = rest.LastErrorText
|
||||
|
||||
End If
|
||||
|
||||
success = rest.SetAuthBasic("admin", "BmWr501956")
|
||||
|
||||
If (success <> True) Then
|
||||
Debug.WriteLine("BAFailReason: " & rest.ConnectFailReason)
|
||||
Debug.WriteLine(rest.LastErrorText)
|
||||
'lblTimas.Text = rest.LastErrorText
|
||||
|
||||
End If
|
||||
|
||||
|
||||
Dim responseJson As String = rest.FullRequestNoBody("GET", "/rest/web-api/employees/" & maid & "/balance")
|
||||
If (rest.LastMethodSuccess <> True) Then
|
||||
Debug.WriteLine(rest.LastErrorText)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If (rest.ResponseStatusCode <> 200) Then
|
||||
Debug.WriteLine(rest.ResponseHeader)
|
||||
'lblTimas.Text = rest.ResponseStatusCode & " " & rest.ResponseStatusText
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Debug.WriteLine(responseJson)
|
||||
|
||||
|
||||
Dim json As New Chilkat.JsonObject
|
||||
success = json.Load(responseJson)
|
||||
If (success <> True) Then
|
||||
Debug.WriteLine(json.LastErrorText)
|
||||
End If
|
||||
|
||||
Debug.WriteLine(json)
|
||||
|
||||
'"overallBalance" 101580,
|
||||
'"dailyBalance": -17340,
|
||||
'"monthlyBalance": -328380,
|
||||
'"actualTimeOfDay": 4260,
|
||||
|
||||
|
||||
Dim saldo = json.StringOf("dailyBalanceYesterday") 'Tagessaldo (gestern) in Sekunden
|
||||
|
||||
If saldo IsNot Nothing Then
|
||||
Dim saldoAsDouble = CDbl(saldo)
|
||||
saldoAsDouble = Math.Round(saldoAsDouble / 3600, 2)
|
||||
returnText = "Saldo Vortag: " & saldoAsDouble & "h"
|
||||
End If
|
||||
lblTimasSaldo.Text = returnText
|
||||
|
||||
|
||||
Dim yesterdayMidnight As DateTime
|
||||
yesterdayMidnight = Today().AddDays(-1)
|
||||
rest.AddQueryParam("id", maid)
|
||||
rest.AddQueryParam("from", yesterdayMidnight.ToString("yyyy-MM-ddThh:mm:ss"))
|
||||
rest.AddQueryParam("to", Now().ToString("yyyy-MM-ddThh:mm:ss"))
|
||||
|
||||
|
||||
|
||||
Dim Response As String
|
||||
Response = rest.FullRequestNoBody("GET", "/rest/web-api/employees/" & maid & "/bookings")
|
||||
If (rest.LastMethodSuccess <> True) Then
|
||||
Debug.WriteLine(rest.LastErrorText)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If (rest.ResponseStatusCode <> 200) Then
|
||||
Debug.WriteLine(rest.ResponseHeader)
|
||||
'rest.ResponseStatusCode & " " & rest.ResponseStatusText
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Debug.WriteLine(Response)
|
||||
Dim jsonArray As New Chilkat.JsonArray
|
||||
success = jsonArray.Load(Response)
|
||||
If (success <> True) Then
|
||||
Debug.WriteLine(jsonArray.LastErrorText)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
|
||||
If jsonArray.Size = -1 Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim dt As New DataTable
|
||||
dt.Columns.Add("statusid", GetType(Integer))
|
||||
dt.Columns.Add("stamp", GetType(DateTime))
|
||||
dt.Columns.Add("type", GetType(String))
|
||||
|
||||
|
||||
|
||||
Dim j As Integer = 0
|
||||
While j < jsonArray.Size
|
||||
|
||||
Dim timeEntry As Chilkat.JsonObject = jsonArray.ObjectAt(j)
|
||||
|
||||
If IsDate(timeEntry.StringOf("stamp")) Then
|
||||
If CDate(timeEntry.StringOf("stamp")) >= Today() Then
|
||||
|
||||
|
||||
Dim R As DataRow = dt.NewRow
|
||||
R("statusid") = timeEntry.StringOf("statusid")
|
||||
R("stamp") = timeEntry.StringOf("stamp")
|
||||
R("type") = timeEntry.StringOf("type")
|
||||
dt.Rows.Add(R)
|
||||
|
||||
lblTimasZeiten.Text &= " " & IIf(timeEntry.StringOf("type") = "in", "+", " - ") & CDate(timeEntry.StringOf("stamp")).ToString("hh:mm:ss")
|
||||
If jsonArray.Size - 1 = j Then
|
||||
lblTimasZeiten.Text &= " Status: " & IIf(timeEntry.StringOf("type") = "in", "Anwesend", "Abwesend")
|
||||
End If
|
||||
|
||||
End If
|
||||
End If
|
||||
j = j + 1
|
||||
End While
|
||||
|
||||
|
||||
|
||||
requestDone = True
|
||||
rest.ClearAllQueryParams()
|
||||
|
||||
Catch ex As WebException
|
||||
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
||||
End Try
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user