cancelTimeCardEdit Method

Table of Contents

  1. Function
  2. Syntax
  3. Parameters
  4. Return Value
  5. Sample Code
  6. Remarks
  7. Possible Errors
  8. Related Methods

Function

  • Cancels an adjustment previously made to an employee’s time card

Syntax

  • AeXMLBridge.cancelTimeCardEdit(AeEdit);

Parameters

Return Value

  • None

Sample Code C

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
int filekey = 1234;                                                            
// using employee with filekey 1234

TDateRangeEnum dateRange = TDateRangeEnum.drCurrPeriod;
// using the current period
// since TDateRangeEnum is not drCustom, we set these to empty
string minDate = string.Empty;
string maxDate = string.Empty;

TAeEdit[] edits = ws.extractEmployeeEditsByFilekey(filekey, dateRange, minDate, maxDate);
// extract existing edits within date range

if (edits.Length > 0)
// make sure we have an edit to cancel
{
foreach (TAeEdit edit in edits)
{
if (edit.SiteID != -1)
// SiteID field cannot be -1
{
try
{
ws.cancelTimeCardEdit(edits[0]);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
}

Sample Code VB.Net

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Dim filekey As Integer = 1234
' using employee with filekey 1234

Dim dateRange As TDateRangeEnum = TDateRangeEnum.drCurrPeriod
' using the current period

Dim minDate As String = String.Empty
' since TDateRangeEnum is not drCustom, we set these to empty
Dim maxDate As String = String.Empty

Dim edits As TAeEdit() = ws.extractEmployeeEditsByFilekey(filekey, dateRange, minDate, maxDate)
' extract existing edits within date range
If edits.Length > 0 Then
' make sure we have an edit to cancel
For Each edit As TAeEdit In edits
If edit.SiteID <> -1 Then
Try
ws.CancelTimeCardEdit(edits(0))
Catch ex as Exception
MessageBox.Show(ex.Message)
End Try
End If
Next
End If

Remarks

  • The SiteID field within the TAeEdit structure is the only field acted upon. This field contains a unique identifier the system uses to reference the adjustment.
  • When extracting the edits, you must set the TDateRangeEnum parameter to either drCurrPeriod or drPrevPeriod
  • If SiteID value = -1, the adjustment cannot be cancelled

Possible Errors

  • Unable to locate employee with filekey
  • invalid date format

authPeriodTimeCardByIDNum
deleteTimeCardEdit
performTimeCardEdit
unAuthPeriodTimeCardByIDNum

Back to Top