Files
germantax-e2e-mrg0rexg/packages/functions/src/templates/annual-financials-approval.ts
2026-07-11 09:04:31 +02:00

69 lines
2.9 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { z } from 'zod'
import type { ResolutionTemplate } from './index.js'
import {
baseDocument,
escapeHtml,
formatDateDe,
formatEur,
renderMembers,
} from './shared.js'
const schema = z.object({
fiscalYear: z.string().min(4),
balanceSheetTotal: z.coerce.number().nonnegative(),
netResult: z.coerce.number(),
approvalDate: z.string().min(8),
notes: z.string().optional(),
})
export const annualFinancialsApproval: ResolutionTemplate = {
key: 'annual_financials_approval',
titleDe: 'Feststellung des Jahresabschlusses',
titleEn: 'Annual financial statements approval',
descriptionDe:
'Gesellschafterbeschluss zur Feststellung des Jahresabschlusses gemäß § 46 Nr. 1 GmbHG.',
schema,
fields: [
{ key: 'fiscalYear', labelDe: 'Geschäftsjahr', labelEn: 'Fiscal year', type: 'text', required: true },
{ key: 'balanceSheetTotal', labelDe: 'Bilanzsumme (EUR)', labelEn: 'Balance sheet total (EUR)', type: 'currency', required: true },
{ key: 'netResult', labelDe: 'Jahresergebnis (EUR)', labelEn: 'Net result (EUR)', type: 'currency', required: true },
{ key: 'approvalDate', labelDe: 'Datum der Feststellung', labelEn: 'Approval date', type: 'date', required: true },
{ key: 'notes', labelDe: 'Anmerkungen', labelEn: 'Notes', type: 'textarea' },
],
render: ({ values, company, members, createdBy, date }) => {
const v = schema.parse(values)
const profitOrLoss = v.netResult >= 0 ? 'Jahresüberschuss' : 'Jahresfehlbetrag'
const body = `
<h1>Gesellschafterbeschluss</h1>
<div class="meta">
${escapeHtml(company.name)}${company.registryNo ? `, ${escapeHtml(company.registryNo)}` : ''}<br/>
${company.address ? escapeHtml(company.address) + '<br/>' : ''}
Beschlussdatum: ${escapeHtml(formatDateDe(date))}
</div>
<div class="section">
<h2>Gegenstand des Beschlusses</h2>
<p>Feststellung des Jahresabschlusses für das Geschäftsjahr
<strong>${escapeHtml(v.fiscalYear)}</strong> gemäß § 46 Nr. 1 GmbHG.</p>
</div>
<div class="section">
<h2>Beschluss</h2>
<p>Die Gesellschafter stellen den Jahresabschluss zum
<strong>${escapeHtml(formatDateDe(v.approvalDate))}</strong> fest mit einer
Bilanzsumme von <strong>${escapeHtml(formatEur(v.balanceSheetTotal))}</strong>
und einem ${escapeHtml(profitOrLoss)} von
<strong>${escapeHtml(formatEur(v.netResult))}</strong>.</p>
${v.notes ? `<p><em>${escapeHtml(v.notes)}</em></p>` : ''}
</div>
<div class="section">
<h2>Gesellschafter</h2>
${renderMembers(members)}
</div>
<div class="section signature">
<div class="line">${escapeHtml(createdBy.displayName)}<br/><small>${escapeHtml(createdBy.email)}</small></div>
<div class="line">Ort, Datum</div>
</div>
`
return baseDocument('Beschluss Feststellung Jahresabschluss', body)
},
}