Auto-Create Timesheets from Events
A scheduled ES ERP Server Script that automatically generates employee Draft Timesheets at 18:00 each day, sourced directly from the ES ERP Event Calendar — with overlap merging, billable detection, and full project traceability.
Overview
This script eliminates the daily overhead of manually creating employee timesheets. At 18:00 each evening, it scans the ES ERP Event Calendar for events that occurred during the day, identifies which employees were assigned to those events, and automatically builds a Draft Timesheet for each person — pre-populated with the correct times, task, project, and activity type.
Employees receive a ready-to-review timesheet in their ES ERP inbox. They verify the hours, make any adjustments if needed, and click Submit — ensuring accountability is maintained while removing the administrative burden of manual entry.
⚙️ How It Works
Identify Active Employees
All active Employee records that have a linked ES ERP User account are loaded and indexed by their user email address.
Fetch Today's Events
All non-cancelled Events with a starts_on date matching today are retrieved from the ES ERP Event Calendar.
Resolve Task → Project → Customer
Each event's linked Task is looked up. From the Task, the associated Project is fetched. If the Project has a Customer set, the time log row is automatically marked as billable.
Map Events to Employees via Participants
The Event Participants child table is read for each event. Any participant whose user email matches an active Employee is associated with that event.
Merge Overlapping Events
If an employee has two or more events that overlap in time, they are automatically merged into a single time log row, with descriptions concatenated and the billable flag preserved.
Create Draft Timesheets
One Draft Timesheet is created per employee, containing one time log row per distinct event block. The script is idempotent — if a timesheet for that employee already exists for today, it is skipped.
Employee Reviews & Submits
Timesheets are left in Draft status. Each employee opens their timesheet, verifies the entries, and clicks Submit to finalise their hours for the day.
⚡ Key Features
⏰ Fully Automated Scheduling
Runs via ES ERP Scheduler at 18:00 AWST daily — no manual trigger required. The system timezone is set to Australia/Perth so the cron expression runs in local time.
✅ Idempotent — Safe to Re-run
Checks for existing Draft or Submitted timesheets before creating, preventing duplicates if re-triggered. Each employee receives exactly one timesheet per day.
🔀 Overlap Merging
Concurrent or nested events are automatically merged into a single time log row — ES ERP's overlap validation is never triggered. Descriptions are concatenated with a pipe separator.
🔒 Employee-Controlled Submission
Timesheets are created in Draft status only. Employees review and submit their own timesheets, maintaining accountability and allowing adjustment before finalisation.
💰 Automatic Billable Detection
Time log rows are flagged Is Billable automatically when the linked Project has a Customer assigned — no manual configuration required for billing classification.
🔗 Full Project & Task Traceability
Each time log row is linked to the originating Task and Project via the Event's reference fields — maintaining full project cost visibility and audit trail.
📋 Timesheet Field Mapping
⏰ Schedule Configuration
Daily at 18:00 AWST (Australia/Perth)
The ES ERP System Settings timezone is set to Australia/Perth, so the scheduler runs in local time. No UTC offset adjustment is needed — the cron expression is used exactly as shown.
📥 Installation
📝 Notes & Considerations
Events must have Participants. Events with no entries in the Event Participants table will not generate timesheet rows. Always assign employees as participants when creating calendar events.
Billable flag is project-driven. Assign a Customer to a Project in ES ERP and any timesheet rows derived from events under that project will automatically be marked as billable — no changes to the script are needed.
Events without an End Time default to a 1-hour duration on the timesheet. Employees should set ends_on on their events for accurate hour capture, or adjust the time log before submitting.
Multi-day events that span midnight will generate a time log using the full raw duration. Employees should review and adjust these rows before submitting, particularly for events like vehicle or equipment out-of-service notices that run for several days.
Technical Specifications
Platform
- ✓ ES ERP v15+ Framework
- ✓ ES ERP v15+ Integration
- ✓ Server Script (Scheduler)
- ✓ Projects Module
Schedule
- ✓ Cron: 0 18 * * *
- ✓ Daily at 18:00 AWST
- ✓ Australia/Perth Timezone
- ✓ Supports Anytime Zone
Data Sources
- ✓ Event Calendar
- ✓ Event Participants
- ✓ Employee DocType
- ✓ Task & Project DocTypes
Features
- ✓ Overlap Merging
- ✓ Auto Billable Detection
- ✓ Task/Project Linking
- ✓ Draft Status (Employee Submits)
Eliminate Manual Timesheet Entry
Let your team focus on work, not admin. Auto-Create Timesheets from Events turns your ES ERP calendar into automatic, auditable timesheets — with billable detection and full project traceability.
Auto-Create Timesheets from Events — ES ERP Timesheet Automation for ES ERP Framework
© 2026 Enterprise Systems Australia |
