Count billing materials without a billing month in reports
Materials created before billing months existed have no period, so the profitability report left out what they billed. Their month is now the month they were created in, as in the export repository. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
+2
-1
@@ -16,7 +16,8 @@ class EloquentBilledRevenueQueries implements BilledRevenueQueries
|
||||
->join('billing_invoices', 'billing_invoices.id', '=', 'billing_lines.billing_invoice_id')
|
||||
->join('billing_exports', 'billing_exports.id', '=', 'billing_invoices.billing_export_id')
|
||||
->where('billing_exports.status', ExportStatus::Created->value)
|
||||
->whereBetween('billing_exports.period', [$fromMonth, $toMonth])
|
||||
// Materials created before billing months existed have none: their month is the month they were created in, as in the export repository.
|
||||
->whereRaw('COALESCE(billing_exports.period, SUBSTR(billing_exports.created_at, 1, 7)) BETWEEN ? AND ?', [$fromMonth, $toMonth])
|
||||
->groupBy('billing_lines.customer_job_id')
|
||||
->select('billing_lines.customer_job_id')
|
||||
->selectRaw(self::sumOf(LineKind::Hours, 'net_cents').' as hours_cents')
|
||||
|
||||
Reference in New Issue
Block a user