A MySQL-based system for tracking employee attendance, calculating working hours, overtime, and generating monthly payroll reports.
This system manages employee attendance records and automatically calculates:
- Daily hours worked
- Late arrivals (after 10:00 AM)
- Overtime hours (hours beyond 8 per day)
- Monthly payroll with overtime compensation
- Attendance Tracking: Daily check-in/check-out records
- Automated Calculations: Hours worked, late days, and overtime computed automatically
- Monthly Summaries: Aggregated statistics per employee per month
- Payroll Generation: Stored procedure to generate monthly payroll reports
- Analytics Views: Pre-built views for daily metrics, monthly summaries, and payroll previews
- departments: Department information
- employees: Employee details with base salary and overtime rates
- attendance: Daily check-in/check-out records
- payroll_monthly: Generated monthly payroll snapshots
- Ensure MySQL 8+ is installed and running
- Execute the SQL files in order:
01_schema.sql - Creates database and tables 02_seed_data.sql - Inserts sample data 03_views.sql - Creates analytical views 04_procedures.sql - Creates payroll generation procedure 05_sample_queries.sql - Example queries - (Optional) Run
99_reset.sqlto drop and recreate the database
CALL sp_generate_payroll('2025-10');SELECT * FROM v_daily_work;SELECT * FROM v_monthly_summary WHERE month_year = '2025-10';SELECT * FROM v_payroll_preview WHERE month_year = '2025-10';- Standard work hours: 8 hours per day
- Late cutoff: 10:00 AM (hour 10 or later)
- Overtime: Hours worked beyond 8 hours per day
- Salary calculation: Base salary + (overtime hours × overtime rate)
- MySQL 8+
- SQL Views
- Stored Procedures