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:
@@ -198,7 +198,11 @@ export default async function dashboardRoutes(
|
||||
prisma.quotations.count({ where: { status: "ordered" } }),
|
||||
prisma.quotations.count({ where: { status: "invalidated" } }),
|
||||
prisma.quotations.count({
|
||||
where: { created_at: { gte: monthStart, lt: monthEnd } },
|
||||
where: {
|
||||
// Drafts aren't real offers — keep them out of the count.
|
||||
status: { not: "draft" },
|
||||
created_at: { gte: monthStart, lt: monthEnd },
|
||||
},
|
||||
}),
|
||||
]);
|
||||
result.offers = {
|
||||
@@ -246,6 +250,7 @@ export default async function dashboardRoutes(
|
||||
FROM invoices i
|
||||
JOIN invoice_items ii ON i.id = ii.invoice_id
|
||||
WHERE i.issue_date >= ${monthStartStr} AND i.issue_date < ${monthEndStr}
|
||||
AND i.status <> 'draft'
|
||||
GROUP BY i.currency
|
||||
`,
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user