Tax excpetion texts

This commit is contained in:
2026-08-11 14:54:33 +02:00
parent 09f9767eb7
commit 5031d3bde0
5 changed files with 179 additions and 33 deletions
@@ -0,0 +1,81 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
/**
* Schärft die Befreiungsgründe: paragraphenbasierte Slugs, präzise Zitate (§ 4 Nr. 25 Buchst. a bzw.
* Nr. 22 Buchst. a), neuer Grund § 4 Nr. 24 (Jugendherbergen) und eine feste Anzeige-Reihenfolge.
* Slug-Renames kaskadieren über die FKs (ON UPDATE CASCADE) auf tenants/events.
*/
return new class extends Migration {
public function up(): void
{
Schema::table('tax_exemption_reasons', function (Blueprint $table) {
$table->unsignedSmallInteger('sort_order')->default(0);
});
// § 19 nur Slug + Sortierung
DB::table('tax_exemption_reasons')->where('slug', 'small_business')->update([
'slug' => 'ustg_19',
'sort_order' => 10,
]);
// § 4 Nr. 25 Buchst. a präzises Zitat (Durchführung kultureller/sportlicher Veranstaltungen)
DB::table('tax_exemption_reasons')->where('slug', 'youth_welfare')->update([
'slug' => 'ustg_4_25a',
'name' => 'Jugendhilfe Veranstaltungen (§ 4 Nr. 25 Buchst. a UStG)',
'invoice_text' => 'Die Leistung ist gemäß § 4 Nr. 25 Buchst. a UStG von der Umsatzsteuer befreit.',
'sort_order' => 30,
]);
// § 4 Nr. 22 Buchst. a korrekt benannt, ans Ende (vor Freitext)
DB::table('tax_exemption_reasons')->where('slug', 'education')->update([
'slug' => 'ustg_4_22a',
'name' => 'Vorträge/Kurse (§ 4 Nr. 22 Buchst. a UStG)',
'invoice_text' => 'Die Leistung ist gemäß § 4 Nr. 22 Buchst. a UStG von der Umsatzsteuer befreit.',
'sort_order' => 40,
]);
// Freitext ans Ende
DB::table('tax_exemption_reasons')->where('slug', 'custom')->update([
'sort_order' => 50,
]);
// § 4 Nr. 24 (Jugendherbergen) neu
$now = now();
DB::table('tax_exemption_reasons')->insertOrIgnore([
[
'slug' => 'ustg_4_24',
'name' => 'Jugendherbergen (§ 4 Nr. 24 UStG)',
'invoice_text' => 'Die Leistung ist gemäß § 4 Nr. 24 UStG von der Umsatzsteuer befreit.',
'requires_note' => false,
'sort_order' => 20,
'created_at' => $now,
'updated_at' => $now,
],
]);
}
public function down(): void
{
DB::table('tax_exemption_reasons')->where('slug', 'ustg_4_24')->delete();
DB::table('tax_exemption_reasons')->where('slug', 'ustg_19')->update(['slug' => 'small_business']);
DB::table('tax_exemption_reasons')->where('slug', 'ustg_4_25a')->update([
'slug' => 'youth_welfare',
'name' => 'Kinder- und Jugendhilfe (§ 4 Nr. 25 UStG)',
'invoice_text' => 'Die Leistung ist gemäß § 4 Nr. 25 UStG von der Umsatzsteuer befreit.',
]);
DB::table('tax_exemption_reasons')->where('slug', 'ustg_4_22a')->update([
'slug' => 'education',
'name' => 'Bildungs-/Kursleistung (§ 4 Nr. 22a UStG)',
'invoice_text' => 'Die Leistung ist gemäß § 4 Nr. 22 Buchst. a UStG von der Umsatzsteuer befreit.',
]);
Schema::table('tax_exemption_reasons', function (Blueprint $table) {
$table->dropColumn('sort_order');
});
}
};
@@ -0,0 +1,20 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
/**
* Setzt den Standard-Befreiungsgrund neuer Tenants auf Jugendhilfe (§ 4 Nr. 25 Buchst. a). Der Wert
* existiert in tax_exemption_reasons, der FK bleibt gültig. Bestehende Zeilen bleiben unverändert.
*/
return new class extends Migration {
public function up(): void
{
DB::statement("ALTER TABLE tenants ALTER COLUMN tax_exemption_reason SET DEFAULT 'ustg_4_25a'");
}
public function down(): void
{
DB::statement('ALTER TABLE tenants ALTER COLUMN tax_exemption_reason DROP DEFAULT');
}
};