Time Clock - Basic Time Tracking

Rules

###Show Time Clock Screen

Name: TC_Show TimeClock Screen
Event Name: Automation Command Executed
Constraints:
Execute Rule if: Matches
Automation Command Name Equals TC_Show Timeclock

TC_Show Timeclock Screen
Constraint: (none)


###Load Entity

Name: TC_Load Employee Entity
Event Name: Automation Command Executed
Constraints:
Execute Rule if: Matches
Automation Command Name Equals TC_LoadEntity

TC_LoadEntityBySearch
Constraint: (none)
entityTypeName: Employees
searchValue: [:CommandValue]

TC_ExecAMC
Constraint: (none)
AMCname: TC_Punch


###Time Clock Punch (ask)

Name: TC_Punch (ask)
Event Name: Automation Command Executed
Constraints:
Execute Rule if: Matches
Automation Command Name Equals TC_Punch

TC_Punch (ask)
Constraint: (none)
Question: Select a TimeClock Action for {ENTITY NAME}:
Buttons: Clock In=PunchIn:Orange;Gray,Clock Out=PunchOut:White;Gray,Cancel=Cancel:Red;Gray
AMCname: TC_Update Entity State
BGcolor: DarkBlue


###Update Entity State

Name: TC_Update Entity State
Event Name: Automation Command Executed
Constraints:
Execute Rule if: Matches All
Automation Command Name Equals TC_Update Entity State
Command Value Not Equals Cancel
Command Value Not Equals {ENTITY STATE:TCStatus}

TC_UpdateEntityState
Constraint: (none)
newState: [:CommandValue]

TC_Update Program Setting
Constraint: (none)
SettingName: TCStatus {ENTITY NAME}
SettingValue: [=('[:CommandValue]'=='PunchIn' ? 'Clocked In' : 'Clocked Out')]

TC_ExecAMC
Constraint: (none)
AMCname: TC_Show Timeclock


###Log Entity State

Name: TC_LogEntityState
Event Name: Entity State Updated
Constraints:
Execute Rule if: Matches
Entity Type Name Equals Employees
State Name Equals TCStatus
State Not Equals Cancel

TC_LogEntityState
Constraint: (none)
logName: TimeClock
entityId: [:EntityId]
SGroupName: [:StateName]
StateBeg: [:StartState]
SDateBeg: [:StartStateDate]
StateEnd: [:EndState]
SDateEnd: [:EndStateDate]
SCustomData: ManualPunch~{SETTING:HolidayFlag}
Async: False

1 Like