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
+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);
}
}