fix(drafts): exclude drafts from VAT/revenue/created aggregations + koncept audit labels
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -268,6 +268,9 @@ export async function getInvoiceStats(queryMonth?: number, queryYear?: number) {
|
||||
const [monthInvoices, awaitingInvoices, overdueInvoices] = await Promise.all([
|
||||
prisma.invoices.findMany({
|
||||
where: {
|
||||
// Drafts are not real financial documents — exclude them so their
|
||||
// VAT/amounts never inflate the monthly stats (vat_month etc.).
|
||||
status: { not: "draft" },
|
||||
issue_date: { gte: monthStart, lte: monthEnd },
|
||||
},
|
||||
include: { invoice_items: true },
|
||||
|
||||
Reference in New Issue
Block a user