From d0cee438e2148689d9673050adb611b18d0c56ee Mon Sep 17 00:00:00 2001 From: "d.breimaier" Date: Thu, 28 Sep 2023 11:52:59 +0200 Subject: [PATCH] Zeiterfassung --- SDL/frmMain.vb | 6 +- .../frmMitarbeitersuche.Designer.vb | 95 ++++++++++++------- .../frmMitarbeitersuche.vb | 80 +++++++++++----- .../Schnittstellen/TIMAS/cTimasAPI.vb | 2 +- 4 files changed, 121 insertions(+), 62 deletions(-) diff --git a/SDL/frmMain.vb b/SDL/frmMain.vb index 22baaf33..15c7d5d2 100644 --- a/SDL/frmMain.vb +++ b/SDL/frmMain.vb @@ -151,10 +151,8 @@ Public Class frmMain If a = vbYes Then Dim info timas.setTimeEntry(cAllgemein.MITARBEITER, Now, info, "in") - MsgBox(info) - Else - - End If + MsgBox(info) + End If End If End If diff --git a/VERAG_PROG_ALLGEMEIN/Mitarbeiterverzeichnis/frmMitarbeitersuche.Designer.vb b/VERAG_PROG_ALLGEMEIN/Mitarbeiterverzeichnis/frmMitarbeitersuche.Designer.vb index 30149543..3d384760 100644 --- a/VERAG_PROG_ALLGEMEIN/Mitarbeiterverzeichnis/frmMitarbeitersuche.Designer.vb +++ b/VERAG_PROG_ALLGEMEIN/Mitarbeiterverzeichnis/frmMitarbeitersuche.Designer.vb @@ -30,11 +30,14 @@ Partial Class frmMitarbeitersuche Me.PictureBox2 = New System.Windows.Forms.PictureBox() Me.pnlMain = New System.Windows.Forms.Panel() Me.pnl = New System.Windows.Forms.Panel() + Me.pnlZeiten = New System.Windows.Forms.Panel() + Me.Button2 = New System.Windows.Forms.Button() + Me.Button1 = New System.Windows.Forms.Button() + Me.PictureBox9 = New System.Windows.Forms.PictureBox() + Me.lblTimasSaldo = New System.Windows.Forms.Label() Me.lblMAId = New System.Windows.Forms.Label() Me.Label5 = New System.Windows.Forms.Label() Me.btnSettings = New System.Windows.Forms.Button() - Me.PictureBox9 = New System.Windows.Forms.PictureBox() - Me.lblTimasSaldo = New System.Windows.Forms.Label() Me.lblTimasZeiten = New System.Windows.Forms.Label() Me.pnlWohnadresse = New System.Windows.Forms.Panel() Me.lblWohnadresse = New System.Windows.Forms.Label() @@ -59,7 +62,6 @@ 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.pnlZeiten = New System.Windows.Forms.Panel() Me.MyPanel1 = New VERAG_PROG_ALLGEMEIN.MyPanel(Me.components) Me.Panel1 = New System.Windows.Forms.Panel() Me.lblPosition = New System.Windows.Forms.Label() @@ -75,6 +77,7 @@ Partial Class frmMitarbeitersuche CType(Me.PictureBox2, System.ComponentModel.ISupportInitialize).BeginInit() Me.pnlMain.SuspendLayout() Me.pnl.SuspendLayout() + Me.pnlZeiten.SuspendLayout() CType(Me.PictureBox9, System.ComponentModel.ISupportInitialize).BeginInit() Me.pnlWohnadresse.SuspendLayout() CType(Me.PictureBox3, System.ComponentModel.ISupportInitialize).BeginInit() @@ -83,7 +86,6 @@ Partial Class frmMitarbeitersuche CType(Me.pic, System.ComponentModel.ISupportInitialize).BeginInit() Me.pnlGeburtstag.SuspendLayout() CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).BeginInit() - Me.pnlZeiten.SuspendLayout() Me.MyPanel1.SuspendLayout() Me.SuspendLayout() ' @@ -186,6 +188,59 @@ Partial Class frmMitarbeitersuche Me.pnl.Size = New System.Drawing.Size(774, 454) Me.pnl.TabIndex = 24 ' + 'pnlZeiten + ' + Me.pnlZeiten.Controls.Add(Me.Button2) + Me.pnlZeiten.Controls.Add(Me.Button1) + Me.pnlZeiten.Controls.Add(Me.PictureBox9) + Me.pnlZeiten.Controls.Add(Me.lblTimasSaldo) + Me.pnlZeiten.Location = New System.Drawing.Point(8, 393) + Me.pnlZeiten.Name = "pnlZeiten" + Me.pnlZeiten.Size = New System.Drawing.Size(619, 40) + Me.pnlZeiten.TabIndex = 22 + ' + 'Button2 + ' + Me.Button2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom + Me.Button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.Button2.ImageAlign = System.Drawing.ContentAlignment.TopLeft + Me.Button2.Location = New System.Drawing.Point(548, 3) + Me.Button2.Name = "Button2" + Me.Button2.Size = New System.Drawing.Size(68, 35) + Me.Button2.TabIndex = 124 + Me.Button2.Text = "GEHEN" + Me.Button2.UseVisualStyleBackColor = True + ' + 'Button1 + ' + Me.Button1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom + Me.Button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.Button1.ImageAlign = System.Drawing.ContentAlignment.TopLeft + Me.Button1.Location = New System.Drawing.Point(474, 3) + Me.Button1.Name = "Button1" + Me.Button1.Size = New System.Drawing.Size(68, 35) + Me.Button1.TabIndex = 123 + Me.Button1.Text = "KOMMEN" + Me.Button1.UseVisualStyleBackColor = True + ' + 'PictureBox9 + ' + Me.PictureBox9.Image = Global.VERAG_PROG_ALLGEMEIN.My.Resources.Resources.uhr_green + Me.PictureBox9.Location = New System.Drawing.Point(10, 7) + Me.PictureBox9.Name = "PictureBox9" + Me.PictureBox9.Size = New System.Drawing.Size(34, 27) + Me.PictureBox9.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage + Me.PictureBox9.TabIndex = 120 + Me.PictureBox9.TabStop = False + ' + 'lblTimasSaldo + ' + Me.lblTimasSaldo.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!) + Me.lblTimasSaldo.Location = New System.Drawing.Point(50, 7) + Me.lblTimasSaldo.Name = "lblTimasSaldo" + Me.lblTimasSaldo.Size = New System.Drawing.Size(223, 24) + Me.lblTimasSaldo.TabIndex = 30 + ' 'lblMAId ' Me.lblMAId.AutoSize = True @@ -223,25 +278,6 @@ Partial Class frmMitarbeitersuche Me.btnSettings.UseVisualStyleBackColor = True Me.btnSettings.Visible = False ' - 'PictureBox9 - ' - Me.PictureBox9.Image = Global.VERAG_PROG_ALLGEMEIN.My.Resources.Resources.uhr_green - Me.PictureBox9.Location = New System.Drawing.Point(10, 7) - Me.PictureBox9.Name = "PictureBox9" - Me.PictureBox9.Size = New System.Drawing.Size(34, 27) - Me.PictureBox9.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage - Me.PictureBox9.TabIndex = 120 - Me.PictureBox9.TabStop = False - ' - 'lblTimasSaldo - ' - Me.lblTimasSaldo.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!) - Me.lblTimasSaldo.Location = New System.Drawing.Point(50, 7) - Me.lblTimasSaldo.Name = "lblTimasSaldo" - Me.lblTimasSaldo.Size = New System.Drawing.Size(189, 24) - Me.lblTimasSaldo.TabIndex = 30 - Me.lblTimasSaldo.Visible = False - ' 'lblTimasZeiten ' Me.lblTimasZeiten.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!) @@ -479,15 +515,6 @@ Partial Class frmMitarbeitersuche Me.PictureBox1.TabIndex = 13 Me.PictureBox1.TabStop = False ' - 'pnlZeiten - ' - Me.pnlZeiten.Controls.Add(Me.PictureBox9) - Me.pnlZeiten.Controls.Add(Me.lblTimasSaldo) - Me.pnlZeiten.Location = New System.Drawing.Point(8, 393) - Me.pnlZeiten.Name = "pnlZeiten" - Me.pnlZeiten.Size = New System.Drawing.Size(619, 40) - Me.pnlZeiten.TabIndex = 22 - ' 'MyPanel1 ' Me.MyPanel1.BackColor = System.Drawing.Color.FromArgb(CType(CType(250, Byte), Integer), CType(CType(254, Byte), Integer), CType(CType(255, Byte), Integer)) @@ -647,6 +674,7 @@ Partial Class frmMitarbeitersuche Me.pnlMain.ResumeLayout(False) Me.pnl.ResumeLayout(False) Me.pnl.PerformLayout() + Me.pnlZeiten.ResumeLayout(False) CType(Me.PictureBox9, System.ComponentModel.ISupportInitialize).EndInit() Me.pnlWohnadresse.ResumeLayout(False) CType(Me.PictureBox3, System.ComponentModel.ISupportInitialize).EndInit() @@ -656,7 +684,6 @@ Partial Class frmMitarbeitersuche Me.pnlGeburtstag.ResumeLayout(False) Me.pnlGeburtstag.PerformLayout() CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).EndInit() - Me.pnlZeiten.ResumeLayout(False) Me.MyPanel1.ResumeLayout(False) Me.ResumeLayout(False) @@ -709,4 +736,6 @@ Partial Class frmMitarbeitersuche Friend WithEvents lblMAId As Windows.Forms.Label Friend WithEvents Label5 As Windows.Forms.Label Friend WithEvents pnlZeiten As Windows.Forms.Panel + Friend WithEvents Button2 As Windows.Forms.Button + Friend WithEvents Button1 As Windows.Forms.Button End Class diff --git a/VERAG_PROG_ALLGEMEIN/Mitarbeiterverzeichnis/frmMitarbeitersuche.vb b/VERAG_PROG_ALLGEMEIN/Mitarbeiterverzeichnis/frmMitarbeitersuche.vb index 11dd2f9a..26b50663 100644 --- a/VERAG_PROG_ALLGEMEIN/Mitarbeiterverzeichnis/frmMitarbeitersuche.vb +++ b/VERAG_PROG_ALLGEMEIN/Mitarbeiterverzeichnis/frmMitarbeitersuche.vb @@ -1,7 +1,9 @@ Imports System.ComponentModel Imports System.Drawing Imports System.Net +Imports System.Threading Imports System.Windows.Forms +Imports Therefore.API Imports VERAG_PROG_ALLGEMEIN.cCreditSafeAPI Public Class frmMitarbeitersuche @@ -163,31 +165,8 @@ Public Class frmMitarbeitersuche btn.Visible = True btnSettings.Visible = True 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 - Dim dtZeiten As New DataTable - If timas IsNot Nothing Then - timas.getTimeSaldo(MA.mit_timasId, lblTimasSaldo.Text) - If timas.getTimeEntries(MA.mit_timasId, dtZeiten, requestDone) Then - PictureBox9.Image = VERAG_PROG_ALLGEMEIN.My.Resources.Resources.uhr_green - Else - PictureBox9.Image = VERAG_PROG_ALLGEMEIN.My.Resources.Resources.uhr_red - End If - If dtZeiten.Rows.Count > 0 Then - pnlZeiten.Visible = True - Else - pnlZeiten.Visible = False - End If - - End If - - End If - End If + initTimasSaldo() If VERAG_PROG_ALLGEMEIN.cBerechtignunen.CHECK_BERECHTIGUNG_bool("MA_TeamBearbeiten", "SDL") Then If MA.getFirma = VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA Then 'MA derselben Firma bearbeiten @@ -308,4 +287,57 @@ Public Class frmMitarbeitersuche End If End Sub + Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Button1.Click, Button2.Click + Dim art As String + If sender Is Button1 Then + art = "in" + Else + art = "out" + End If + + If VERAG_PROG_ALLGEMEIN.cAllgemein.MITARBEITER.mit_timasId IsNot Nothing Then + Dim timas As New cTimasAPI + Dim a As MsgBoxResult = MsgBox(sender.text & " für " & VERAG_PROG_ALLGEMEIN.cAllgemein.USRKURZNAME & vbNewLine & Now.ToString(), vbYesNo) + If a = vbYes Then + Dim info + timas.setTimeEntry(cAllgemein.MITARBEITER, Now, info, art) + MsgBox(info) + Thread.Sleep(2000) 'warten bis Eintrag in Timas-DB + requestDone = False + initTimasSaldo() + End If + End If + End Sub + + + + Private Sub initTimasSaldo() + + 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 + Dim dtZeiten As New DataTable + If timas IsNot Nothing Then + timas.getTimeSaldo(MA.mit_timasId, lblTimasSaldo.Text) + If timas.getTimeEntries(MA.mit_timasId, dtZeiten, requestDone) Then + PictureBox9.Image = VERAG_PROG_ALLGEMEIN.My.Resources.Resources.uhr_green + Else + PictureBox9.Image = VERAG_PROG_ALLGEMEIN.My.Resources.Resources.uhr_red + End If + + If dtZeiten.Rows.Count > 0 Then + pnlZeiten.Visible = True + Else + pnlZeiten.Visible = False + End If + + End If + + End If + End If + + End Sub End Class \ No newline at end of file diff --git a/VERAG_PROG_ALLGEMEIN/Schnittstellen/TIMAS/cTimasAPI.vb b/VERAG_PROG_ALLGEMEIN/Schnittstellen/TIMAS/cTimasAPI.vb index ae199908..fccd2466 100644 --- a/VERAG_PROG_ALLGEMEIN/Schnittstellen/TIMAS/cTimasAPI.vb +++ b/VERAG_PROG_ALLGEMEIN/Schnittstellen/TIMAS/cTimasAPI.vb @@ -242,7 +242,7 @@ Public Class cTimasAPI success = json.UpdateString("entry", CDate(mitarbeiter.mit_einstiegsdatum).ToString("yyyy-MM-dd")) success = json.UpdateNull("exit") success = json.UpdateString("importSign", "Import from Aviso") - success = json.UpdateString("login", mitarbeiter.mit_AliasAD_Username) + success = json.UpdateString("login", mitarbeiter.mit_username) success = json.UpdateBool("loginActive", 1) success = json.UpdateString("email", mitarbeiter.mit_email) success = json.UpdateString("street", mitarbeiter.mit_strasse)