Business report: week periods and line charts with last-year comparison

- This week and last week periods; weeks start on Redmine's "Start calendars on" day
- Sales and Hours line charts above the bars, same figures and colors, drawn with
  Redmine's bundled Chart.js: a point per day (a week), week (up to ~3 months) or month
- "Compare with last year" toggle adds dashed, faded last-year lines instantly and is
  kept in the URL; days/weeks go back 52 weeks so weekdays line up, months to the same month
- Legend: one entry per figure (hides both years' lines) plus a single "last year" entry

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
This commit is contained in:
Claude committed 2026-10-31 21:58:58 -04:00
1 parent bd29ec2978
commit 8f2cef2bc8
6 files changed
+318 -7

No files matched your search

+4 -1
View File
@@ -17,7 +17,10 @@ class QboReportsController < ApplicationController
def index
@report = RedmineQboBilling::BusinessReport.new(period: params[:period].presence || 'this_year',
from: params[:from], to: params[:to], today: User.current.today)
from: params[:from], to: params[:to], today: User.current.today,
week_start: RedmineQboBilling::BusinessReport.week_start_from_setting(Setting.start_of_week))
# Last year's lines on the charts
@compare = params[:compare] == '1'
# Syncs still running for what the report counts: its figures are incomplete until they finish
@syncing = QboSyncStatus.by_entity(%w[Estimate Invoice Payment]).values.sort_by(&:entity)
end