Skip to content

demos/overtime.prg — Overtime Tracking demo #46

Description

@DDecoene

Scope

Build the same way demos/crm.prg and demos/INVENTORY.prg are built: single menu-driven .prg, multiple work areas + SET RELATION, seeded on first run, README/CLAUDE.md entries, matching Playwright spec (tests/overtime.spec.ts, mirroring tests/crm.spec.ts / tests/inventory.spec.ts).

This is the showcase app for #43 (TIME type), #44 (WEEK()), and #45 (grid validation) — depends on all three landing first, so the demo has nothing to work around.

Data model (USE DATABASE OVERTIME)

  • EMPLOYEES — EMPID, NAME, SCHEDID
  • SCHEDULEDAYS — SCHEDID, DOW (1-5), TIMEIN, BSTART, BEND, TIMEOUT (all TIME(15)), 5 rows/schedule
  • TIMESHEET — EMPID, WEEKDATE (Monday), DOW, WORKDATE, TIMEIN, BSTART, BEND, TIMEOUT (TIME(15)), WORKEDHOURS (NUM, computed/stored)
  • WEEKSUMMARY — EMPID, WEEKDATE, WEEKNO (from WEEK()), WORKEDHOURS, STANDARDHOURS, OVERTIME — upserted per recalculation
  • LEAVETAKEN — EMPID, LDATE (DATE), HOURS (NUM, quarter-hour increments, validated in the add-leave form), NOTES

Standard hours = sum of the employee's SCHEDULEDAYS durations (not a flat 40 — schedules vary per employee).

Overtime balance = SUM(WEEKSUMMARY.OVERTIME FOR EMPID==x) - SUM(LEAVETAKEN.HOURS FOR EMPID==x), computed live with SUM ... FOR ... TO var (see crm.prg's pipeline summary) — no mutable running-balance field.

Menu

  1. Add Employee
  2. Create/Edit Standard Weekly Schedule (BROWSE on SCHEDULEDAYS, exercises BROWSE per-cell validation hook #45's TIME(15) grid validation)
  3. Open/Prep Week — prompt employee + Monday date, WEEK() shows week number, auto-create the week's 5 TIMESHEET rows pre-filled from SCHEDULEDAYS if missing, then BROWSE for direct editing
  4. Recalculate Week — GO TOP / DO WHILE .NOT. EOF() / SKIP over TIMESHEET, compute WORKEDHOURS = (TIMEOUT-TIMEIN) - (BEND-BSTART), sum for the week, compute STANDARDHOURS, upsert WEEKSUMMARY
  5. Register Leave Taken (date + hours, quarter-hour only)
  6. Overtime Balance (per employee)
  7. Weekly/Overtime Report — REPORT FORM, group by employee, subtotals, grand total (new report def under demos/reports/, same shape as dealsbystage.json / lowstock.json)
  8. Export CSV (COPY TO)
  9. Browse tables (read-only tour)
    Q. Quit

Branch

feature/<name> off release/v1.2.0, PR targets release/v1.2.0. Blocked on #43, #44, #45.

Definition of done

Per CLAUDE.md → Definition of done in full: tests green (vitest + playwright), version/changelog/README/CLAUDE.md updated, screenshots retaken if UI changed, Assistant parity (demo launcher entry, matching crm/inventory).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions