-- PAYADJ3 verification
SELECT ws.user_id, COALESCE(u.staff_code,u.employee_code) staff_id, COALESCE(u.full_name,CONCAT(u.first_name,' ',u.last_name)) staff_name, ws.session_date, COUNT(*) sessions, SUM(CASE WHEN ws.clock_out_time IS NULL THEN TIMESTAMPDIFF(MINUTE,ws.clock_in_time,NOW()) ELSE TIMESTAMPDIFF(MINUTE,ws.clock_in_time,ws.clock_out_time) END) span_minutes FROM work_sessions ws JOIN users u ON u.id=ws.user_id WHERE ws.session_date BETWEEN '2026-04-01' AND CURDATE() GROUP BY ws.user_id, staff_id, staff_name, ws.session_date ORDER BY ws.session_date DESC;
SELECT * FROM payroll_adjustments ORDER BY id DESC LIMIT 50;
