Timas, MDM, etc.

This commit is contained in:
2026-05-04 15:16:25 +02:00
parent 1d4988346e
commit f266a01586
7 changed files with 137 additions and 119 deletions

View File

@@ -1065,7 +1065,7 @@ Public Class cTimasAPI
End Try
End Function
Public Sub getTimeAccounts(ByRef from As Date, ByRef toDate As Date, ByRef employeeNr As Integer, ByRef accountsdt As DataTable, ByRef dt As DataTable)
Public Sub getTimeAccounts(ByRef from As Date, ByRef toDate As Date, ByRef employeeNr As Integer, ByRef accountsdt As DataTable, ByRef dt As DataTable, Optional ByRef employeedt As DataTable = Nothing)
Try
@@ -1084,8 +1084,21 @@ Public Class cTimasAPI
For Each row As DataRow In accountsdt.Rows
id &= row("accountid") & ","
Next
rest.AddQueryParam("accounts", id)
rest.AddQueryParam("employees", employeeNr)
Dim idEmployee As String = ""
If employeedt IsNot Nothing AndAlso employeedt.Rows.Count > 0 Then
For Each row As DataRow In employeedt.Rows
idEmployee &= row("employeeId") & ","
Next
Else
idEmployee = employeeNr
End If
rest.AddQueryParam("employees", idEmployee)
Dim sbResponseBody As String
@@ -1117,6 +1130,7 @@ Public Class cTimasAPI
If dt IsNot Nothing And Not dt.Columns.Contains("accountid") Then
dt.Columns.Add("accountid", GetType(Integer))
dt.Columns.Add("employeeid", GetType(Integer))
dt.Columns.Add("date", GetType(String))
dt.Columns.Add("value", GetType(Double))
dt.Columns.Add("multiplier", GetType(String))
@@ -1133,6 +1147,7 @@ Public Class cTimasAPI
If accounts.StringOf("value") <> "" Then
Dim R As DataRow = dt.NewRow
R("accountid") = accounts.IntOf("accountid")
R("employeeid") = accounts.IntOf("employeeid")
R("date") = accounts.StringOf("date")
Dim timeToDouble = accounts.StringOf("value").Replace("-", "")
Dim ts As TimeSpan = New TimeSpan(Integer.Parse(timeToDouble.Split(":"c)(0)), Integer.Parse(timeToDouble.Split(":"c)(1)), 0)
@@ -1144,6 +1159,8 @@ Public Class cTimasAPI
End While
If dt.Rows.Count = 0 Then Exit Sub
dt.DefaultView.Sort = " accountid asc, date asc"
dt = dt.DefaultView.ToTable()