Add initial Code
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled

This commit is contained in:
2025-10-20 08:57:51 +02:00
parent d204098d8e
commit 8703e5ff40
449 changed files with 34565 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
*.sqlite*
+33
View File
@@ -0,0 +1,33 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
class ContactFactory extends Factory
{
protected $model = \App\Models\Contact::class;
public function definition()
{
// 30% chance of having an avatar, 70% chance of having null
$hasAvatar = $this->faker->boolean(30);
$avatar = null;
if ($hasAvatar) {
// Generate a random image ID between 1 and 70 (pravatar.cc has 70 default images)
$randomImageId = $this->faker->numberBetween(1, 70);
$avatar = "https://i.pravatar.cc/128?img={$randomImageId}";
}
return [
'first_name' => $this->faker->firstName(),
'last_name' => $this->faker->lastName(),
'email' => $this->faker->unique()->safeEmail(),
'phone' => $this->faker->phoneNumber(),
'position' => $this->faker->jobTitle(),
'is_primary' => $this->faker->boolean(30),
'avatar' => $avatar,
];
}
}
+33
View File
@@ -0,0 +1,33 @@
<?php
namespace Database\Factories;
use App\Models\PaymentTerms;
use Illuminate\Database\Eloquent\Factories\Factory;
class CustomerFactory extends Factory
{
protected $model = \App\Models\Customer::class;
public function definition()
{
return [
'type' => $this->faker->randomElement(['private', 'business']),
'company_name' => $this->faker->company(),
'vat_id' => $this->faker->numerify('DE##########'),
'tax_id' => $this->faker->numerify('DE##########'),
'global_id' => $this->faker->numerify('############'),
'legal_registration_id' => $this->faker->numerify('##########'),
'email' => $this->faker->unique()->safeEmail(),
'phone' => $this->faker->phoneNumber(),
'billing_address' => [
'line_one' => $this->faker->streetAddress(),
'line_two' => '',
'city' => $this->faker->city(),
'postal_code' => $this->faker->postcode(),
'country_code' => 'DE',
],
'payment_terms_id' => PaymentTerms::where('name', 'daysAfterInvoice')->first()->id,
'logo' => null,
];
}
}
+50
View File
@@ -0,0 +1,50 @@
<?php
namespace Database\Factories;
use App\Models\Customer;
use Illuminate\Database\Eloquent\Factories\Factory;
use App\Models\LineItem;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Invoice>
*/
class InvoiceFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
$payment_status = $this->faker->randomElement(['draft', 'issued', 'paid', 'due', 'reminded']);
return [
'nr' => ($payment_status == 'draft') ? null : $this->faker->unique()->numerify('RE-###'),
'invoice_date' => $this->faker->date(),
'due_date' => $this->faker->date(),
'service_start_date' => $this->faker->date(),
'service_end_date' => $this->faker->date(),
'is_recurring' => $this->faker->boolean(30),
'is_partial_service' => $this->faker->boolean(30),
'customer_id' => Customer::factory(),
'payment_status' => $payment_status,
'total_amount' => $this->faker->randomFloat(2, 100, 1000),
'title' => $this->faker->text(50),
'text' => $this->faker->paragraph(),
];
}
/**
* Configure the factory to create related line items after creating an invoice.
*/
public function configure()
{
return $this->afterCreating(function ($invoice) {
LineItem::factory(rand(2, 5))->create([
'invoice_id' => $invoice->id,
]);
});
}
}
+20
View File
@@ -0,0 +1,20 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
class LineItemFactory extends Factory
{
public function definition(): array
{
return [
'position' => $this->faker->numberBetween(1, 10),
'title' => $this->faker->words(3, true),
'description' => $this->faker->sentence(),
'quantity' => $this->faker->numberBetween(1, 10),
'unit' => $this->faker->randomElement(['Stück', 'Stunden', 'Tage', 'pauschal']),
'price' => $this->faker->randomFloat(2, 10, 500),
];
}
}
@@ -0,0 +1,20 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
class PaymentTermsFactory extends Factory
{
protected $model = \App\Models\PaymentTerms::class;
public function definition()
{
return [
'name' => $this->faker->unique()->word(),
'description' => $this->faker->sentence(),
'is_fixed' => $this->faker->boolean(),
'days' => $this->faker->numberBetween(7, 60),
];
}
}
+47
View File
@@ -0,0 +1,47 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
*/
class UserFactory extends Factory
{
/**
* The current password being used by the factory.
*/
protected static ?string $password;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'name' => fake()->name(),
'email' => fake()->unique()->safeEmail(),
'email_verified_at' => now(),
'password' => static::$password ??= Hash::make('password'),
'avatar' => null,
'remember_token' => Str::random(10),
];
}
/**
* Indicate that the model's email address should be unverified.
*/
public function unverified(): static
{
return $this->state(fn (array $attributes) => [
'email_verified_at' => null,
]);
}
}
@@ -0,0 +1,50 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->string('avatar')->nullable();
$table->rememberToken();
$table->timestamps();
});
Schema::create('password_reset_tokens', function (Blueprint $table) {
$table->string('email')->primary();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
Schema::create('sessions', function (Blueprint $table) {
$table->string('id')->primary();
$table->foreignId('user_id')->nullable()->index();
$table->string('ip_address', 45)->nullable();
$table->text('user_agent')->nullable();
$table->longText('payload');
$table->integer('last_activity')->index();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('users');
Schema::dropIfExists('password_reset_tokens');
Schema::dropIfExists('sessions');
}
};
@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('cache', function (Blueprint $table) {
$table->string('key')->primary();
$table->mediumText('value');
$table->integer('expiration');
});
Schema::create('cache_locks', function (Blueprint $table) {
$table->string('key')->primary();
$table->string('owner');
$table->integer('expiration');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('cache');
Schema::dropIfExists('cache_locks');
}
};
@@ -0,0 +1,57 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('jobs', function (Blueprint $table) {
$table->id();
$table->string('queue')->index();
$table->longText('payload');
$table->unsignedTinyInteger('attempts');
$table->unsignedInteger('reserved_at')->nullable();
$table->unsignedInteger('available_at');
$table->unsignedInteger('created_at');
});
Schema::create('job_batches', function (Blueprint $table) {
$table->string('id')->primary();
$table->string('name');
$table->integer('total_jobs');
$table->integer('pending_jobs');
$table->integer('failed_jobs');
$table->longText('failed_job_ids');
$table->mediumText('options')->nullable();
$table->integer('cancelled_at')->nullable();
$table->integer('created_at');
$table->integer('finished_at')->nullable();
});
Schema::create('failed_jobs', function (Blueprint $table) {
$table->id();
$table->string('uuid')->unique();
$table->text('connection');
$table->text('queue');
$table->longText('payload');
$table->longText('exception');
$table->timestamp('failed_at')->useCurrent();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('jobs');
Schema::dropIfExists('job_batches');
Schema::dropIfExists('failed_jobs');
}
};
@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('users', function (Blueprint $table) {
$table->text('two_factor_secret')->after('password')->nullable();
$table->text('two_factor_recovery_codes')->after('two_factor_secret')->nullable();
$table->timestamp('two_factor_confirmed_at')->after('two_factor_recovery_codes')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn([
'two_factor_secret',
'two_factor_recovery_codes',
'two_factor_confirmed_at',
]);
});
}
};
+37
View File
@@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
/**
* Run the migrations.
*/
public function up()
{
Schema::create('customers', function (Blueprint $table) {
$table->id();
$table->enum('type', ['private', 'business']);
$table->string('company_name', 100)->nullable();
$table->string('vat_id', 50)->nullable();
$table->string('tax_id', 50)->nullable(); // Tax identification number
$table->string('global_id', 50)->nullable(); // Global Location Number (GLN)
$table->string('legal_registration_id', 50)->nullable(); // Legal registration ID
$table->string('email', 100)->unique();
$table->string('phone', 20)->nullable();
$table->json('billing_address'); // Structured as per ZUGFeRD standard
$table->integer('payment_terms')->default(14);
$table->enum('status', ['active', 'inactive', 'prospect'])->default('active');
$table->text('notes')->nullable();
$table->timestamps();
// $table->index('email');
});
}
public function down()
{
Schema::dropIfExists('customers');
}
};
@@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
public function up()
{
Schema::create('customers', function (Blueprint $table) {
$table->id();
$table->enum('type', ['private', 'business']);
$table->string('company_name', 100)->nullable();
$table->string('vat_id', 50)->nullable();
$table->string('tax_id', 50)->nullable();
$table->string('global_id', 50)->nullable();
$table->string('legal_registration_id', 50)->nullable();
$table->string('email', 100)->nullable();
$table->string('phone', 20)->nullable();
$table->json('billing_address')->nullable();
$table->foreignId('payment_terms_id')->constrained()->default(3); // Standard-Zahlungsziel: 14 Tage
$table->enum('status', ['active', 'inactive', 'prospect'])->default('active');
$table->text('notes')->nullable();
$table->string('logo')->nullable();
$table->timestamps();
});
}
public function down()
{
Schema::dropIfExists('customers');
}
};
@@ -0,0 +1,52 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
public function up()
{
Schema::create('payment_terms', function (Blueprint $table) {
$table->id();
$table->string('name', 50)->unique();
$table->string('description', 255)->nullable();
$table->boolean('is_fixed')->default(false);
$table->integer('days')->nullable();
$table->timestamps();
});
// Fügen Sie Standard-Zahlungsziele hinzu
DB::table('payment_terms')->insert([
[
'name' => 'prepaid',
'description' => 'Vorkasse',
'is_fixed' => true,
'days' => null,
'created_at' => now(),
'updated_at' => now()
],
[
'name' => 'onReceipt',
'description' => 'Bei Rechnungserhalt',
'is_fixed' => true,
'days' => null,
'created_at' => now(),
'updated_at' => now()
],
[
'name' => 'daysAfterInvoice',
'description' => 'Zahlungsziel in Tagen',
'is_fixed' => false,
'days' => 14,
'created_at' => now(),
'updated_at' => now()
]
]);
}
public function down()
{
Schema::dropIfExists('payment_terms');
}
};
@@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('personal_access_tokens', function (Blueprint $table) {
$table->id();
$table->morphs('tokenable');
$table->text('name');
$table->string('token', 64)->unique();
$table->text('abilities')->nullable();
$table->timestamp('last_used_at')->nullable();
$table->timestamp('expires_at')->nullable()->index();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('personal_access_tokens');
}
};
@@ -0,0 +1,39 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('invoices', function (Blueprint $table) {
$table->id();
$table->string('nr')->unique()->nullable();
$table->date('invoice_date');
$table->date('due_date')->nullable();
$table->date('service_start_date')->nullable();
$table->date('service_end_date')->nullable();
$table->boolean('is_recurring')->default(false);
$table->boolean('is_partial_service')->default(false);
$table->foreignId('customer_id')->constrained()->onDelete('cascade');
$table->string('payment_status')->default('draft');
$table->decimal('total_amount', 10, 2);
$table->text('title')->nullable();
$table->text('text')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('invoices');
}
};
@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('line_items', function (Blueprint $table) {
$table->id();
$table->foreignId('invoice_id')->constrained()->onDelete('cascade');
$table->integer('position')->default(0);
$table->string('title')->nullable();
$table->string('description')->nullable();
$table->integer('quantity')->default(1);
$table->string('unit')->default('Stunden');
$table->decimal('price', 10, 2)->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('line_items');
}
};
@@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up()
{
Schema::create('contacts', function (Blueprint $table) {
$table->id();
$table->foreignId('customer_id')->constrained()->onDelete('cascade');
$table->string('first_name', 50);
$table->string('last_name', 50);
$table->string('email', 100)->nullable();
$table->string('phone', 20)->nullable();
$table->string('position', 100)->nullable();
$table->boolean('is_primary')->default(false);
$table->string('avatar')->nullable();
$table->timestamps();
});
}
public function down()
{
Schema::dropIfExists('contacts');
}
};
@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('invoices', function (Blueprint $table) {
$table->json('billing_data')->nullable()->after('customer_id');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('invoices', function (Blueprint $table) {
$table->dropColumn('billing_data');
});
}
};
@@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('settings', function (Blueprint $table) {
$table->id();
$table->string('invoice_number_format')->default('RE-{number}');
$table->integer('invoice_number_start')->default(1);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('settings');
}
};
+52
View File
@@ -0,0 +1,52 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use App\Models\User;
use App\Models\Customer;
use App\Models\Contact;
use App\Models\Invoice;
use App\Models\LineItem;
class DatabaseSeeder extends Seeder
{
/**
* Seed the application's database.
*/
public function run(): void
{
$this->call([
PaymentTermsSeeder::class,
SettingsTableSeeder::class
]);
User::factory()->create([
'name' => 'Daniel Stock',
'email' => 'daniel.stock@tooloop.de',
'password' => bcrypt('6T0az2JGO5oA'),
]);
// Create customers with contacts
Customer::factory(20)->create()->each(function ($customer) {
// Create a primary contact for each customer
Contact::factory()->create([
'customer_id' => $customer->id,
'is_primary' => true,
]);
// Create additional contacts for each customer
Contact::factory(rand(1, 3))->create([
'customer_id' => $customer->id,
]);
});
// Create invoices
Invoice::factory(20)->create()->each(function ($invoice) {
// Create line items for each invoice
LineItem::factory(rand(5, 10))->create([
'invoice_id' => $invoice->id,
]);
});
}
}
+32
View File
@@ -0,0 +1,32 @@
<?php
namespace Database\Seeders;
use App\Models\PaymentTerms;
use Illuminate\Database\Seeder;
class PaymentTermsSeeder extends Seeder
{
public function run(): void
{
PaymentTerms::create([
'name' => 'prepaid',
'description' => 'Vorkasse',
'is_fixed' => true,
'days' => null
]);
PaymentTerms::create([
'name' => 'onReceipt',
'is_fixed' => true,
'days' => null
]);
PaymentTerms::create([
'name' => 'daysAfterInvoice',
'description' => 'Zahlungsziel in Tagen',
'is_fixed' => false,
'days' => 14
]);
}
}
+30
View File
@@ -0,0 +1,30 @@
#; Gestellt; Fällig; Bezahlt; Gemahnt; Kunde; Betreff; Netto; USt.; Brutto
76; 2023-09-08; FALSCH; WAHR;; Neonpastell; Unterschleißheim; 320,00 €; 60,80 €; 380,80 €
77; 2023-09-08; FALSCH; WAHR;; Neonpastell; Reperatureinsatz Unterschleißheim; 243,75 €; 46,31 €; 290,06 €
78; 2023-09-22; FALSCH; WAHR;; Neonpastell; Bezirk Schwaben; 5650,00 €; 1073,50 €; 6723,50 €
79; 2023-09-13; WAHR; FALSCH;; Weiskind GmbH; KUKA Brand Showroom; 11900,00 €; 2261,00 €; 14161,00 €
84; 2023-12-13; FALSCH; WAHR;; Weiskind GmbH; WAGNER Oktober und November; 8137,50 €; 1546,13 €; 9683,63 €
86; 2023-12-14; FALSCH; WAHR;; Neonpastell; Wartung Stadtentwicklung Unterschleißheim; 386,75 €; 73,48 €; 460,23 €
87; 2024-01-08; FALSCH; WAHR;; Weiskind GmbH; WAGNER Dezember; 3500,00 €; 665,00 €; 4165,00 €
88; 2024-01-22; FALSCH; WAHR;; Neonpastell; Obernzell; 4325,52 €; 821,85 €; 5147,37 €
89; 2024-02-20; FALSCH; WAHR;; Stadt Augsburg; Welterbe Info-Zentrum Update; 350,00 €; 66,50 €; 416,50 €
90; 2024-04-09; FALSCH; WAHR;; Raiffeisen-Volksbank Ries eG; Historische Karte; 4552,50 €; 864,98 €; 5417,48 €
91; 2024-05-13; FALSCH; WAHR;; K&K Marderabwehr; Reminder-App: Fix „Erneuerung per E-Mail“; 175,00 €; 33,25 €; 208,25 €
92; 2024-05-31; FALSCH; WAHR;; Stadt Ichenhausen; Integration Schwabenkarte; 177,50 €; 33,73 €; 211,23 €
93; 2024-05-27; FALSCH; WAHR;; Ev. Dekanat; Digital Signage Annahöfe; 17533,43 €; 3331,35 €; 20864,78 €
94; 2024-08-20; FALSCH; WAHR;; K&K Marderabwehr; Sicherheitsupdate Reminder-App; 1925,00 €; 365,75 €; 2290,75 €
95; 2024-08-29; FALSCH; WAHR;; Stadt Augsburg; Reparatur Audio-Player; 65,63 €; 12,47 €; 78,10 €
96; 2024-11-05; FALSCH; WAHR;; Museum KulturLand Ries; Touchscreen „Gesammelt“; 2906,25 €; 552,19 €; 3458,44 €
97; 2025-01-30; FALSCH; WAHR;; Aquarium Wilhelmshaven; Erneuerung Sensorik Saurier-Röntgen; 4729,96 €; 898,69 €; 5628,65 €
98; 2025-01-30; FALSCH; WAHR;; Aquarium Wilhelmshaven; Update Flugsaurier-Projektion und Verzeichnis Paläoaquarium; 656,25 €; 124,69 €; 780,94 €
99; 2025-02-06; FALSCH; WAHR;; Weiskind GmbH; Kurz und D Consult im Dezember; 2437,50 €; 463,13 €; 2900,63 €
100; 2025-02-25; FALSCH; WAHR;; Valerie Amani; Lichtinstallation Mbuzi 20; 3330,91 €; 632,87 €; 3963,78 €
101; 2025-02-25; FALSCH; WAHR;; Aquarium Wilhelmshaven; Konzeption Kinderstationen; 3000,00 €; 570,00 €; 3570,00 €
102; 2025-03-25; WAHR; FALSCH; 2025-07-21; Neonpastell; Beratung WLAN Ichenhausen; 187,50 €; 35,63 €; 223,13 €
103; 2025-03-25; FALSCH; WAHR;; Stadt Augsburg; Welterbe Update Station 8; 93,75 €; 17,81 €; 111,56 €
104; 2025-04-03; FALSCH; WAHR;; Aquarium Wilhelmshaven; Audiostationen; 7462,72 €; 1417,92 €; 8880,64 €
105; 2025-05-28; WAHR; FALSCH; 2025-07-21; Weiskind GmbH; WAGNER Video; 5250,00 €; 997,50 €; 6247,50 €
106; 2025-06-06; FALSCH; WAHR;; Museum KulturLand Ries; Konfiguration Touchscreen Kaufbeuren; 265,00 €; 50,35 €; 315,35 €
107; 2025-07-01; WAHR; FALSCH;; Weiskind GmbH; KUKA automatica Video; 1125,00 €; 213,75 €; 1338,75 €
109; 2025-07-21; WAHR; FALSCH;; Neonpastell; Wartung Computer „Heimatarchiv“; 574,50 €; 109,16 €; 683,66 €
108; 2025-07-04; WAHR; FALSCH;; Weiskind GmbH; WAGNER Video Mehraufwände; 1500,00 €; 285,00 €; 1785,00 €
1 # Gestellt Fällig Bezahlt Gemahnt Kunde Betreff Netto USt. Brutto
2 76 2023-09-08 FALSCH WAHR Neonpastell Unterschleißheim 320,00 € 60,80 € 380,80 €
3 77 2023-09-08 FALSCH WAHR Neonpastell Reperatureinsatz Unterschleißheim 243,75 € 46,31 € 290,06 €
4 78 2023-09-22 FALSCH WAHR Neonpastell Bezirk Schwaben 5650,00 € 1073,50 € 6723,50 €
5 79 2023-09-13 WAHR FALSCH Weiskind GmbH KUKA Brand Showroom 11900,00 € 2261,00 € 14161,00 €
6 84 2023-12-13 FALSCH WAHR Weiskind GmbH WAGNER Oktober und November 8137,50 € 1546,13 € 9683,63 €
7 86 2023-12-14 FALSCH WAHR Neonpastell Wartung Stadtentwicklung Unterschleißheim 386,75 € 73,48 € 460,23 €
8 87 2024-01-08 FALSCH WAHR Weiskind GmbH WAGNER Dezember 3500,00 € 665,00 € 4165,00 €
9 88 2024-01-22 FALSCH WAHR Neonpastell Obernzell 4325,52 € 821,85 € 5147,37 €
10 89 2024-02-20 FALSCH WAHR Stadt Augsburg Welterbe Info-Zentrum Update 350,00 € 66,50 € 416,50 €
11 90 2024-04-09 FALSCH WAHR Raiffeisen-Volksbank Ries eG Historische Karte 4552,50 € 864,98 € 5417,48 €
12 91 2024-05-13 FALSCH WAHR K&K Marderabwehr Reminder-App: Fix „Erneuerung per E-Mail“ 175,00 € 33,25 € 208,25 €
13 92 2024-05-31 FALSCH WAHR Stadt Ichenhausen Integration Schwabenkarte 177,50 € 33,73 € 211,23 €
14 93 2024-05-27 FALSCH WAHR Ev. Dekanat Digital Signage Annahöfe 17533,43 € 3331,35 € 20864,78 €
15 94 2024-08-20 FALSCH WAHR K&K Marderabwehr Sicherheitsupdate Reminder-App 1925,00 € 365,75 € 2290,75 €
16 95 2024-08-29 FALSCH WAHR Stadt Augsburg Reparatur Audio-Player 65,63 € 12,47 € 78,10 €
17 96 2024-11-05 FALSCH WAHR Museum KulturLand Ries Touchscreen „Gesammelt“ 2906,25 € 552,19 € 3458,44 €
18 97 2025-01-30 FALSCH WAHR Aquarium Wilhelmshaven Erneuerung Sensorik Saurier-Röntgen 4729,96 € 898,69 € 5628,65 €
19 98 2025-01-30 FALSCH WAHR Aquarium Wilhelmshaven Update Flugsaurier-Projektion und Verzeichnis Paläoaquarium 656,25 € 124,69 € 780,94 €
20 99 2025-02-06 FALSCH WAHR Weiskind GmbH Kurz und D Consult im Dezember 2437,50 € 463,13 € 2900,63 €
21 100 2025-02-25 FALSCH WAHR Valerie Amani Lichtinstallation Mbuzi 20 3330,91 € 632,87 € 3963,78 €
22 101 2025-02-25 FALSCH WAHR Aquarium Wilhelmshaven Konzeption Kinderstationen 3000,00 € 570,00 € 3570,00 €
23 102 2025-03-25 WAHR FALSCH 2025-07-21 Neonpastell Beratung WLAN Ichenhausen 187,50 € 35,63 € 223,13 €
24 103 2025-03-25 FALSCH WAHR Stadt Augsburg Welterbe Update Station 8 93,75 € 17,81 € 111,56 €
25 104 2025-04-03 FALSCH WAHR Aquarium Wilhelmshaven Audiostationen 7462,72 € 1417,92 € 8880,64 €
26 105 2025-05-28 WAHR FALSCH 2025-07-21 Weiskind GmbH WAGNER Video 5250,00 € 997,50 € 6247,50 €
27 106 2025-06-06 FALSCH WAHR Museum KulturLand Ries Konfiguration Touchscreen Kaufbeuren 265,00 € 50,35 € 315,35 €
28 107 2025-07-01 WAHR FALSCH Weiskind GmbH KUKA automatica Video 1125,00 € 213,75 € 1338,75 €
29 109 2025-07-21 WAHR FALSCH Neonpastell Wartung Computer „Heimatarchiv“ 574,50 € 109,16 € 683,66 €
30 108 2025-07-04 WAHR FALSCH Weiskind GmbH WAGNER Video Mehraufwände 1500,00 € 285,00 € 1785,00 €
+20
View File
@@ -0,0 +1,20 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use App\Models\Setting;
class SettingsTableSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
Setting::firstOrCreate([], [
'invoice_number_format' => 'RE-{number}',
'invoice_number_start' => 1,
]);
}
}
+142
View File
@@ -0,0 +1,142 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use App\Models\User;
use App\Models\Customer;
use App\Models\Invoice;
use App\Models\Contact;
use Carbon\Carbon;
use App\Models\LineItem;
use Database\Factories\CustomerFactory;
class TooloopSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
$this->call([
SettingsTableSeeder::class,
]);
User::factory()->create([
'name' => 'Daniel Stock',
'email' => 'daniel.stock@tooloop.de',
'password' => bcrypt('6T0az2JGO5oA'),
]);
$csvFilePath = __DIR__ . '/Rechnungen.csv';
if (!file_exists($csvFilePath)) {
$this->command->error("CSV file not found at: $csvFilePath");
return;
}
$csvFile = fopen($csvFilePath, 'r');
if ($csvFile === false) {
$this->command->error("Failed to open CSV file at: $csvFilePath");
return;
}
$header = fgetcsv($csvFile, 1000, ';');
if ($header === false) {
$this->command->error("Failed to read header from CSV file");
fclose($csvFile);
return;
}
// Trim header values
$header = array_map('trim', $header);
$this->command->info("CSV Header: " . implode(', ', $header));
// Create a new instance of the CustomerFactory
$customerFactory = new CustomerFactory();
while (($data = fgetcsv($csvFile, 1000, ';')) !== false) {
// Trim data values
$data = array_map('trim', $data);
$row = array_combine($header, $data);
if ($row === false) {
$this->command->error("Failed to combine header and data");
continue;
}
$this->command->info("Row Data: " . implode(', ', $row));
// Generate a unique email for the customer
$email = strtolower(str_replace(' ', '.', $row['Kunde'])) . '@example.com';
// Generate fake address data using the CustomerFactory
$fakeAddress = $customerFactory->definition()['billing_address'];
// Create or find the customer
$customer = Customer::firstOrCreate(
['company_name' => $row['Kunde']],
[
'type' => 'business',
'vat_id' => '',
'tax_id' => '',
'global_id' => '',
'legal_registration_id' => '',
'email' => $email,
'phone' => '',
'billing_address' => $fakeAddress,
'payment_terms_id' => 3,
'status' => 'active',
'notes' => ''
]
);
// Check if the customer already has contacts
if ($customer->contacts()->count() === 0) {
// Create a primary contact for the customer
Contact::factory()->create([
'customer_id' => $customer->id,
'is_primary' => true,
]);
// Create additional contacts for the customer (1-2 additional contacts)
Contact::factory(rand(1, 2))->create([
'customer_id' => $customer->id,
]);
}
// Parse the date field
$date = Carbon::createFromFormat('Y-m-d', $row['Gestellt'])->format('Y-m-d');
// Calculate the due date as 14 days after the date
$dueDate = Carbon::createFromFormat('Y-m-d', $date)->addDays(14)->format('Y-m-d');
// Create the invoice
$invoice = Invoice::create([
'nr' => 'RE-' . $row['#'],
'invoice_date' => $date,
'due_date' => $dueDate,
'service_start_date' => $date,
'service_end_date' => $date,
'is_recurring' => false,
'is_partial_service' => false,
'customer_id' => $customer->id,
'payment_status' => $row['Bezahlt'] === 'WAHR' ? 'paid' : ($row['Gemahnt'] ? 'reminded' : 'due'),
'total_amount' => floatval(str_replace(['€', ','], ['', '.'], $row['Netto'])),
'title' => $row['Betreff'],
'text' => '',
]);
LineItem::factory(rand(5, 10))->create([
'invoice_id' => $invoice->id,
]);
}
fclose($csvFile);
}
}