Punch Editor for Timeclock

#Rules

##NV Show Punch Editor Screen [Automation Command Executed] (Rule)##

Rule Name: NV Show Punch Editor Screen
Event Name: Automation Command Executed
Rule Tags: punchEditor
Custom Constraint List (1):
Execute Rule if: Matches
Automation Command NameEqualsNV PunchEditor

##Actions (8):##

PE Update Setting Global

Constraint: (none)

SettingName: PEEntity
SettingValue: {REPORT SQL DETAILS:SELECT TOP 1 esi.[Name] as [EntityName] FROM [dbo].[EntityScreenItems] esi JOIN [EntityScreens] es on es.[Id]=esi.[EntityScreenId] JOIN [Entities] e on e.[Id]=esi.[EntityId] JOIN [EntityTypes] et on et.[Id]=e.[EntityTypeId] WHERE et.[Name]='Employees' AND es.[Name]='Punch Editor' ORDER BY esi.[SortOrder]:F.EntityName}
PE Update Setting Global

Constraint: ‘[:CommandValue]’ != ‘’

SettingName: PEEntity
SettingValue: [:CommandValue]
PE Update Setting Local

Constraint: (none)

SettingName: PEDateFilterBEG
SettingValue: [='{DATE:yyyy-MM}'+'-01']
PE Update Setting Local

Constraint: (none)

SettingName: PEDateFilterEND
SettingValue: [=ADM('{DATE:yyyy-MM}'+'-01',1)]
PE Update Setting Local

Constraint: (none)

SettingName: PEDateFilterEND
SettingValue: [='{:PEDateFilterEND}'.substr(0,10)]
PE ExecAMC

Constraint: (none)

AMCname: PE Unload Entities and Load Selected Entity
AMCvalue:
AMCdelay:
NV Show Punch Editor Screen

Constraint: (none)

PE Update Report Widget

Constraint: (none)

parms: Employee,{SETTING:PEEntity},{SETTING:PEDateFilterBEG},{SETTING:PEDateFilterEND}
dateFilter:

##Mappings##

Mappings
Terminal User Role Department Ticket Type
*Admin**

##PE Set Punch Entity [Automation Command Executed] (Rule)##

Rule Name: PE Set Punch Entity
Event Name: Automation Command Executed
Rule Tags: punchEditor
Custom Constraint List (1):
Execute Rule if: Matches
Automation Command NameEqualsPE Set Punch Entity

##Actions (4):##

PE Update Setting Global

Constraint: (none)

SettingName: PEEntity
SettingValue: [:CommandValue]
PE ExecAMC

Constraint: (none)

AMCname: PE Unload Entities and Load Selected Entity
AMCvalue:
AMCdelay:
NV Show Punch Editor Screen

Constraint: (none)

PE Update Report Widget

Constraint: (none)

parms: Employee,{SETTING:PEEntity},{SETTING:PEDateFilterBEG},{SETTING:PEDateFilterEND}
dateFilter:

##Mappings##

Mappings
Terminal User Role Department Ticket Type
****

##PE Unload Entities and Load Selected Entity [Automation Command Executed] (Rule)##

Rule Name: PE Unload Entities and Load Selected Entity
Event Name: Automation Command Executed
Rule Tags: punchEditor
Custom Constraint List (1):
Execute Rule if: Matches
Automation Command NameEqualsPE Unload Entities and Load Selected Entity

##Actions (2):##

PE Exec Script

Constraint: (none)

function: ent.UpdateEntityState('Employees','','TCReport','Unloaded')
command:
runinbackground: False
PE Exec Script

Constraint: (none)

function: ent.UpdateEntityState('Employees','{SETTING:PEEntity}','TCReport','Loaded')
command:
runinbackground: False

##Mappings##

Mappings
Terminal User Role Department Ticket Type
*Admin**

##PE Edit [Automation Command Executed] (Rule)##

Rule Name: PE Edit
Event Name: Automation Command Executed
Rule Tags: punchEditor
Custom Constraint List (1):
Execute Rule if: Matches
Automation Command NameEqualsPE Edit

##Actions (8):##

PE Update Setting Global

Constraint: (none)

SettingName: PErowID
SettingValue: {:PErowID}
PE Update Setting Global

Constraint: (none)

SettingName: PEnewStart
SettingValue:
PE Update Setting Global

Constraint: (none)

SettingName: PEnewEnd
SettingValue:
PE Update Setting Global

Constraint: (none)

SettingName: PEnewStart
SettingValue: [?Enter new Start;;{SETTING:PEstart}]
PE Update Setting Global

Constraint: (none)

SettingName: PEnewEnd
SettingValue: [?Enter new End;;{SETTING:PEend}]
PE Update Setting Global

Constraint: (none)

SettingName: PEduration
SettingValue: {CALL:datefunc.datediff('{SETTING:PEnewStart}','{SETTING:PEnewEnd}','s')}
PE Ask Question

Constraint: (none)

question:
Editing Time Clock Punch Data for {SETTING:PEEntity} ...ID    : {SETTING:PErowID}Start : {SETTING:PEnewStart}End   : {SETTING:PEnewEnd}Hours : {SETTING:PEduration}Do you want to Commit these changes?
buttons: Yes=y:Green;Gray,No=n:Red;Gray
AMCname: PE Edit Commit
color: Black
NV Show Punch Editor Screen

Constraint: (none)

##Mappings##

Mappings
Terminal User Role Department Ticket Type
*Admin**

##PE Edit Commit [Automation Command Executed] (Rule)##

Rule Name: PE Edit Commit
Event Name: Automation Command Executed
Rule Tags: punchEditor
Custom Constraint List (2):
Execute Rule if: Matches
Automation Command NameEqualsPE Edit Commit
Command ValueEqualsy

##Actions (4):##

PE Update Setting Global

Constraint: (none)

SettingName: PEQuery
SettingValue: UPDATE [EntityStateLogs] SET [StartStateDate]='{SETTING:PEnewStart}' WHERE [Id]={SETTING:PErowID}
PE Exec Script

Constraint: ‘{SETTING:PEnewStart}’!=‘’

function: db.updaterow('PEQuery')
command:
runinbackground:
PE Update Setting Global

Constraint: (none)

SettingName: PEQuery
SettingValue: UPDATE [EntityStateLogs] SET [EndStateDate]='{SETTING:PEnewEnd}' WHERE [Id]={SETTING:PErowID}
PE Exec Script

Constraint: ‘{SETTING:PEnewEnd}’!=‘’

function: db.updaterow('PEQuery')
command:
runinbackground:

##Mappings##

Mappings
Terminal User Role Department Ticket Type
*Admin**