Files
germantax-e2e-mrg0tpl9/packages/functions/src/templates/annual-budget-approval.ts
2026-07-11 09:06:18 +02:00

61 lines
2.3 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),
totalBudget: z.coerce.number().nonnegative(),
notes: z.string().optional(),
})
export const annualBudgetApproval: ResolutionTemplate = {
key: 'annual_budget_approval',
titleDe: 'Beschluss zur Genehmigung des Jahresbudgets',
titleEn: 'Annual budget approval',
descriptionDe:
'Gesellschafterbeschluss zur Feststellung und Genehmigung des Jahresbudgets der Gesellschaft.',
schema,
fields: [
{ key: 'fiscalYear', labelDe: 'Geschäftsjahr', labelEn: 'Fiscal year', type: 'text', required: true },
{ key: 'totalBudget', labelDe: 'Gesamtbudget (EUR)', labelEn: 'Total budget (EUR)', type: 'currency', required: true },
{ key: 'notes', labelDe: 'Anmerkungen', labelEn: 'Notes', type: 'textarea' },
],
render: ({ values, company, members, createdBy, date }) => {
const v = schema.parse(values)
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>Genehmigung des Jahresbudgets für das Geschäftsjahr <strong>${escapeHtml(v.fiscalYear)}</strong>.</p>
</div>
<div class="section">
<h2>Beschluss</h2>
<p>Die Gesellschafter beschließen einstimmig, das Jahresbudget in Höhe von
<strong>${escapeHtml(formatEur(v.totalBudget))}</strong> für das Geschäftsjahr
${escapeHtml(v.fiscalYear)} festzustellen und zu genehmigen.</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 Jahresbudget', body)
},
}