Exclude non-billable entries from revenue - #6076
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6076 +/- ##
============================================
+ Coverage 88.70% 88.76% +0.05%
- Complexity 10055 10057 +2
============================================
Files 889 889
Lines 32051 32060 +9
============================================
+ Hits 28432 28459 +27
+ Misses 3619 3601 -18
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This pull request fixes reporting “Revenue” calculations so that non-billable timesheet entries no longer contribute to revenue totals (while duration and internal price continue to include all entries). It updates both on-screen reports and their XLSX exports to consistently use billable-only rate aggregation.
Changes:
- Switched multiple reporting templates (weekly/monthly user and user-list period views, including exports) from
totalRatetobillableRatewhen rendering “Revenue”. - Extended user-report aggregation to track and roll up
billableRatealongside existing duration, total rate, and internal rate totals. - Updated the customer monthly projects reporting query to compute revenue via a conditional SUM that excludes
billable = false, and added regression tests for the corrected behavior.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Controller/Reporting/CustomerMonthlyProjectsControllerTest.php | Adds an integration regression test to ensure customer monthly project revenue excludes non-billable entries. |
| tests/Controller/Reporting/AbstractUsersPeriodControllerTestCase.php | Adds shared regression coverage to ensure “all users” period reports exclude non-billable entries from revenue. |
| tests/Controller/Reporting/AbstractUserPeriodControllerTestCase.php | Adds shared regression coverage to ensure “single user” period reports exclude non-billable entries from revenue. |
| templates/reporting/user_list_period_data.html.twig | Updates user-period total accumulation to use billableRate for revenue totals. |
| templates/reporting/report_user_list.html.twig | Renders revenue using billableRate in the (non-monthly) user list report. |
| templates/reporting/report_user_list_monthly.html.twig | Renders revenue using billableRate in the monthly user list report. |
| templates/reporting/report_user_list_monthly_export.html.twig | Updates XLSX export values to output billableRate for revenue. |
| templates/reporting/report_user_list_export.html.twig | Updates XLSX export values to output billableRate for revenue. |
| templates/reporting/report_by_user_data.html.twig | Updates week/month “by user” report rendering and totals to use billableRate for revenue. |
| src/Reporting/CustomerMonthlyProjects/CustomerMonthlyProjectsRepository.php | Changes revenue aggregation to a conditional SUM excluding non-billable entries. |
| src/Controller/Reporting/AbstractUserReportController.php | Aggregates and propagates billableRate through customer/project/activity rollups for report rendering. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Description
Non-billable timesheet entries were included in values labeled as Revenue, even though the same reports correctly tracked their billable duration separately.
This change uses the existing billable revenue aggregation throughout the single-user and all-user week, month, and year reports, including their XLSX exports. Customer monthly projects now calculates rate with a conditional SQL sum, so project, activity, user, and export totals all exclude entries where
billable = false.Duration and internal price continue to include all entries.
Fixes #5920
Visual comparison
The same report contains one billable entry worth EUR 100 and one non-billable entry worth EUR 40.
Types of changes
Validation
./php-cs-fixer.sh core./phpstan.sh core./phpstan.sh testChecklist
composer code-checkequivalent checks listed above)