Cache totals, man-hours and payments; add a business report

- Estimates now keep their total; estimates and invoices keep their man-hours: the quantities of the
  products/services set as "Replaced by imported time" (bundles included; the estimate item codes
  while that setting is blank). Filled in by the webhook and the sync.
- Payment model (QboBaseModel) caching each payment's customer, date, amount and unapplied amount,
  kept current by the webhook, the sync and the Receive payment page.
- Business report (View business reports permission, top menu): estimates written vs. invoices written
  vs. payments received, and estimated hours on estimates and issues vs. invoiced and spent hours, for
  a period, with a month-by-month breakdown.
- Fix two keyword arguments that defaulted to themselves (QboSyncDispatcher.enque_jobs, PdfService),
  which newer Ruby refuses to parse.

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 07:54:28 -04:00
1 parent d07d99109b
commit 062ef9b8b3
20 files changed
+590 -5

No files matched your search

+29 -1
View File
@@ -262,7 +262,7 @@ en:
text_invoice_from_estimate: "Made from estimate #%{number}. The estimate is closed when the invoice is saved."
text_invoice_many_vehicles: "These work orders are for more than one vehicle:"
text_line_bills_time: "Bills a QuickBooks time activity; saving marks the time as billed"
text_replaceable_items: "Products/services that billable time can replace on invoices, e.g. Labor. Only invoice lines with these are offered under Replace these lines when time is imported. Leave empty to offer every line. Ctrl/Cmd-click to pick several."
text_replaceable_items: "Products/services that billable time can replace on invoices, e.g. Labor. Only invoice lines with these are offered under Replace these lines when time is imported. Leave empty to offer every line. They are also the man-hours counted on estimates and invoices for the business report (run a full sync after changing them). Ctrl/Cmd-click to pick several."
text_replace_lines: "Tick the lines the time replaces (e.g. the estimate's labor lines). The time goes where the first ticked line is."
# Issues from estimates (moved from redmine_qbo_calendar)
@@ -311,6 +311,34 @@ en:
label_no_payments: "No payments from this customer in QuickBooks"
label_payment_totals: "Total"
permission_view_payments: "View payments"
# ---- Business report ----
permission_view_business_reports: "View business reports"
label_business_report: "Business report"
label_report_period: "Period"
label_report_period_this_month: "This month"
label_report_period_last_month: "Last month"
label_report_period_this_quarter: "This quarter"
label_report_period_last_quarter: "Last quarter"
label_report_period_this_year: "This year"
label_report_period_last_year: "Last year"
label_report_period_custom: "Custom dates"
label_report_money: "Sales"
label_report_hours: "Hours"
label_report_by_month: "By month"
label_report_estimates_written: "Estimates written"
label_report_invoices_written: "Invoices written"
label_report_payments_received: "Payments received"
label_report_estimate_hours: "Estimated (estimates)"
label_report_issue_hours: "Estimated (issues)"
label_report_invoice_hours: "Invoiced (invoices)"
label_report_spent_hours: "Spent (issues)"
label_report_invoiced_of_estimated: "Invoiced vs. estimated"
label_report_collected_of_invoiced: "Collected vs. invoiced"
label_report_open_balance: "Still owed on these invoices"
label_report_invoiced_of_spent: "Invoiced vs. spent hours"
label_report_spent_of_estimated: "Spent vs. issues' estimated hours"
text_report_needs_sync: "%{count} estimates or invoices in this period don't have their total or hours yet. Run a full sync from QuickBooks to fill them in."
text_report_notes: "Estimates, invoices and payments count by their QuickBooks date; their hours are the quantities of the products/services set as \"Replaced by imported time\" (or the estimate item codes while that's blank). Issues' estimated time counts issues created in the period, without subtasks. Spent time counts time logged in the period."
notice_payment_not_found: "Payment not found in QuickBooks"
notice_payment_saved: "Payment of %{amount} saved in QuickBooks"
text_no_payment_methods: "QuickBooks' payment methods couldn't be read. Check the QuickBooks connection."