feat: add option to exclude year-end closing entries in SIE export and related reports (#567)

This commit is contained in:
Mattsson
2026-05-25 17:51:54 +02:00
committed by GitHub
parent aeadc8bb1d
commit 0087b7be3f
10 changed files with 57 additions and 6 deletions
+2
View File
@@ -10,6 +10,7 @@ export const GET = withRouteContext(
const { searchParams } = new URL(request.url)
const periodId = searchParams.get('period_id')
const excludeClosing = searchParams.get('exclude_closing') === 'true'
if (!periodId) {
return errorResponseFromCode('REPORT_PERIOD_REQUIRED', log, { requestId })
@@ -32,6 +33,7 @@ export const GET = withRouteContext(
fiscal_period_id: periodId,
company_name: company.company_name || 'Unknown',
org_number: company.org_number,
exclude_year_end_closing: excludeClosing,
})
return new NextResponse(sieContent, {
@@ -53,6 +53,8 @@ export const GET = withApiV1<{ params: Promise<{ companyId: string }> }>(
})
if (!period.ok) return period.response
const excludeClosing = new URL(request.url).searchParams.get('exclude_closing') === 'true'
const { data: company, error: companyErr } = await ctx.supabase
.from('company_settings')
.select('company_name, org_number')
@@ -71,6 +73,7 @@ export const GET = withApiV1<{ params: Promise<{ companyId: string }> }>(
fiscal_period_id: period.period.id,
company_name: (company as { company_name: string | null }).company_name || 'Unknown',
org_number: (company as { org_number: string | null }).org_number,
exclude_year_end_closing: excludeClosing,
}),
{ log: ctx.log, requestId: ctx.requestId, reportName: 'sie-export' },
)