Added support for Streamdeck Pedal and updated UI to better fit the Packed UI style
This commit is contained in:
802
pirp/public/settings.php
Normal file
802
pirp/public/settings.php
Normal file
@@ -0,0 +1,802 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../src/config.php';
|
||||
require_once __DIR__ . '/../src/auth.php';
|
||||
require_once __DIR__ . '/../src/db.php';
|
||||
require_once __DIR__ . '/../src/invoice_functions.php';
|
||||
require_once __DIR__ . '/../src/journal_functions.php';
|
||||
require_once __DIR__ . '/../src/icons.php';
|
||||
require_login();
|
||||
|
||||
$settings = get_settings();
|
||||
$msg = '';
|
||||
$error = '';
|
||||
|
||||
// Aktiver Tab
|
||||
$tab = $_GET['tab'] ?? 'allgemein';
|
||||
$journal_sub = $_GET['jsub'] ?? 'jahre';
|
||||
|
||||
// ---- POST-Aktionen ----
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$form = $_POST['form'] ?? '';
|
||||
|
||||
// === ALLGEMEIN TAB ===
|
||||
if ($form === 'allgemein') {
|
||||
$data = [
|
||||
'company_name' => $_POST['company_name'] ?? '',
|
||||
'company_address' => $_POST['company_address'] ?? '',
|
||||
'company_zip' => $_POST['company_zip'] ?? '',
|
||||
'company_city' => $_POST['company_city'] ?? '',
|
||||
'company_country' => $_POST['company_country'] ?? '',
|
||||
'tax_id' => $_POST['tax_id'] ?? '',
|
||||
'vat_mode' => $_POST['vat_mode'] ?? 'klein',
|
||||
'default_vat_rate'=> $_POST['default_vat_rate'] ?? 19.0,
|
||||
'payment_terms' => $_POST['payment_terms'] ?? '',
|
||||
'footer_text' => $_POST['footer_text'] ?? '',
|
||||
'logo_path' => $settings['logo_path'] ?? null,
|
||||
'iban' => $_POST['iban'] ?? '',
|
||||
'phone' => $_POST['phone'] ?? '',
|
||||
'email' => $_POST['email'] ?? '',
|
||||
'website' => $_POST['website'] ?? '',
|
||||
];
|
||||
|
||||
if (!empty($_FILES['logo']['tmp_name'])) {
|
||||
$targetDir = __DIR__ . '/uploads/';
|
||||
if (!is_dir($targetDir)) {
|
||||
mkdir($targetDir, 0775, true);
|
||||
}
|
||||
$targetFile = $targetDir . 'logo.png';
|
||||
if (move_uploaded_file($_FILES['logo']['tmp_name'], $targetFile)) {
|
||||
$data['logo_path'] = 'uploads/logo.png';
|
||||
}
|
||||
}
|
||||
|
||||
save_settings($data);
|
||||
$settings = get_settings();
|
||||
$msg = 'Einstellungen gespeichert.';
|
||||
}
|
||||
|
||||
// === JOURNAL TAB ===
|
||||
// Jahr erstellen
|
||||
if ($form === 'year') {
|
||||
$y = (int)($_POST['year'] ?? 0);
|
||||
if ($y >= 2000 && $y <= 2099) {
|
||||
$existing = get_journal_year_by_year($y);
|
||||
if ($existing) {
|
||||
$error = "Jahr $y existiert bereits.";
|
||||
} else {
|
||||
create_journal_year($y, $_POST['notes'] ?? '');
|
||||
$msg = "Jahr $y erstellt.";
|
||||
}
|
||||
} else {
|
||||
$error = 'Ungültiges Jahr.';
|
||||
}
|
||||
$tab = 'journal';
|
||||
}
|
||||
|
||||
// Jahr öffnen/schließen
|
||||
if ($form === 'toggle_year') {
|
||||
$id = (int)($_POST['id'] ?? 0);
|
||||
if ($id) {
|
||||
toggle_journal_year_closed($id);
|
||||
$msg = 'Jahresstatus geändert.';
|
||||
}
|
||||
$tab = 'journal';
|
||||
}
|
||||
|
||||
// Lieferant speichern
|
||||
if ($form === 'supplier') {
|
||||
$id = !empty($_POST['id']) ? (int)$_POST['id'] : null;
|
||||
$data = [
|
||||
'name' => $_POST['name'] ?? '',
|
||||
'sort_order' => $_POST['sort_order'] ?? 0,
|
||||
'is_active' => isset($_POST['is_active']),
|
||||
];
|
||||
if ($data['name']) {
|
||||
save_journal_supplier($id, $data);
|
||||
$msg = 'Lieferant gespeichert.';
|
||||
} else {
|
||||
$error = 'Name ist Pflichtfeld.';
|
||||
}
|
||||
$tab = 'journal';
|
||||
}
|
||||
|
||||
// Lieferant löschen
|
||||
if ($form === 'delete_supplier') {
|
||||
delete_journal_supplier((int)$_POST['id']);
|
||||
$msg = 'Lieferant gelöscht.';
|
||||
$tab = 'journal';
|
||||
}
|
||||
|
||||
// Wareneingang-Kategorie speichern
|
||||
if ($form === 'rev_cat') {
|
||||
$id = !empty($_POST['id']) ? (int)$_POST['id'] : null;
|
||||
$data = [
|
||||
'name' => $_POST['name'] ?? '',
|
||||
'category_type' => $_POST['category_type'] ?? 'wareneingang',
|
||||
'vat_rate' => $_POST['vat_rate'] ?? 19,
|
||||
'sort_order' => $_POST['sort_order'] ?? 0,
|
||||
'is_active' => isset($_POST['is_active']),
|
||||
];
|
||||
if ($data['name']) {
|
||||
save_journal_revenue_category($id, $data);
|
||||
$msg = 'Kategorie gespeichert.';
|
||||
} else {
|
||||
$error = 'Name ist Pflichtfeld.';
|
||||
}
|
||||
$tab = 'journal';
|
||||
}
|
||||
|
||||
// Wareneingang-/Erlös-Kategorie löschen
|
||||
if ($form === 'delete_rev_cat') {
|
||||
delete_journal_revenue_category((int)$_POST['id']);
|
||||
$msg = 'Kategorie gelöscht.';
|
||||
$tab = 'journal';
|
||||
}
|
||||
|
||||
// Aufwandskategorie speichern
|
||||
if ($form === 'exp_cat') {
|
||||
$id = !empty($_POST['id']) ? (int)$_POST['id'] : null;
|
||||
$data = [
|
||||
'name' => $_POST['name'] ?? '',
|
||||
'side' => $_POST['side'] ?? 'soll',
|
||||
'sort_order' => $_POST['sort_order'] ?? 0,
|
||||
'is_active' => isset($_POST['is_active']),
|
||||
];
|
||||
if ($data['name']) {
|
||||
save_journal_expense_category($id, $data);
|
||||
$msg = 'Aufwandskategorie gespeichert.';
|
||||
} else {
|
||||
$error = 'Name ist Pflichtfeld.';
|
||||
}
|
||||
$tab = 'journal';
|
||||
}
|
||||
|
||||
// Aufwandskategorie löschen
|
||||
if ($form === 'delete_exp_cat') {
|
||||
delete_journal_expense_category((int)$_POST['id']);
|
||||
$msg = 'Aufwandskategorie gelöscht.';
|
||||
$tab = 'journal';
|
||||
}
|
||||
|
||||
// Abzug speichern
|
||||
if ($form === 'ded_cat') {
|
||||
$id = !empty($_POST['id']) ? (int)$_POST['id'] : null;
|
||||
$data = [
|
||||
'name' => $_POST['name'] ?? '',
|
||||
'sort_order' => $_POST['sort_order'] ?? 0,
|
||||
'is_active' => isset($_POST['is_active']),
|
||||
];
|
||||
if ($data['name']) {
|
||||
save_journal_deduction_category($id, $data);
|
||||
$msg = 'Abzug gespeichert.';
|
||||
} else {
|
||||
$error = 'Name ist Pflichtfeld.';
|
||||
}
|
||||
$tab = 'journal';
|
||||
}
|
||||
|
||||
// Abzug löschen
|
||||
if ($form === 'delete_ded_cat') {
|
||||
delete_journal_deduction_category((int)$_POST['id']);
|
||||
$msg = 'Abzug gelöscht.';
|
||||
$tab = 'journal';
|
||||
}
|
||||
|
||||
// Zusammenfassungsposten speichern
|
||||
if ($form === 'summary_item') {
|
||||
$id = !empty($_POST['id']) ? (int)$_POST['id'] : null;
|
||||
$data = [
|
||||
'name' => $_POST['name'] ?? '',
|
||||
'sort_order' => $_POST['sort_order'] ?? 0,
|
||||
'is_active' => isset($_POST['is_active']),
|
||||
];
|
||||
if ($data['name']) {
|
||||
save_journal_summary_item($id, $data);
|
||||
$msg = 'Posten gespeichert.';
|
||||
} else {
|
||||
$error = 'Name ist Pflichtfeld.';
|
||||
}
|
||||
$tab = 'journal';
|
||||
}
|
||||
|
||||
// Zusammenfassungsposten löschen
|
||||
if ($form === 'delete_summary_item') {
|
||||
delete_journal_summary_item((int)$_POST['id']);
|
||||
$msg = 'Posten gelöscht.';
|
||||
$tab = 'journal';
|
||||
}
|
||||
|
||||
// === KONTO TAB ===
|
||||
// Benutzername ändern
|
||||
if ($form === 'change_username') {
|
||||
$new_username = trim($_POST['new_username'] ?? '');
|
||||
if (strlen($new_username) < 3) {
|
||||
$error = 'Benutzername muss mindestens 3 Zeichen haben.';
|
||||
} elseif (!update_username($_SESSION['user_id'], $new_username)) {
|
||||
$error = 'Benutzername existiert bereits.';
|
||||
} else {
|
||||
$msg = 'Benutzername geändert.';
|
||||
}
|
||||
$tab = 'konto';
|
||||
}
|
||||
|
||||
// Passwort ändern
|
||||
if ($form === 'change_password') {
|
||||
$current_pw = $_POST['current_password'] ?? '';
|
||||
$new_pw = $_POST['new_password'] ?? '';
|
||||
$confirm_pw = $_POST['confirm_password'] ?? '';
|
||||
if (strlen($new_pw) < 6) {
|
||||
$error = 'Neues Passwort muss mindestens 6 Zeichen haben.';
|
||||
} elseif ($new_pw !== $confirm_pw) {
|
||||
$error = 'Passwörter stimmen nicht überein.';
|
||||
} elseif (!update_password($_SESSION['user_id'], $current_pw, $new_pw)) {
|
||||
$error = 'Aktuelles Passwort ist falsch.';
|
||||
} else {
|
||||
$msg = 'Passwort geändert.';
|
||||
}
|
||||
$tab = 'konto';
|
||||
}
|
||||
}
|
||||
|
||||
// Journal-Daten laden
|
||||
$years = get_journal_years();
|
||||
$suppliers = get_journal_suppliers();
|
||||
$we_cats = get_journal_revenue_categories('wareneingang');
|
||||
$er_cats = get_journal_revenue_categories('erloese');
|
||||
$exp_cats = get_journal_expense_categories();
|
||||
$ded_cats = get_journal_deduction_categories();
|
||||
$summary_items = get_journal_summary_items();
|
||||
?>
|
||||
<!doctype html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Einstellungen</title>
|
||||
<link rel="stylesheet" href="assets/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<h1>PIRP</h1>
|
||||
<nav>
|
||||
<a href="<?= url_for('index.php') ?>"><?= icon_dashboard() ?>Dashboard</a>
|
||||
<a href="<?= url_for('invoices.php') ?>"><?= icon_invoices() ?>Rechnungen</a>
|
||||
<a href="<?= url_for('customers.php') ?>"><?= icon_customers() ?>Kunden</a>
|
||||
<a href="<?= url_for('expenses.php') ?>"><?= icon_expenses() ?>Ausgaben</a>
|
||||
<a href="<?= url_for('belegarchiv.php') ?>"><?= icon_archive() ?>Belege</a>
|
||||
<a href="<?= url_for('journal.php') ?>"><?= icon_journal() ?>Journal</a>
|
||||
<a href="<?= url_for('euer.php') ?>"><?= icon_euer() ?>EÜR</a>
|
||||
<a href="<?= url_for('settings.php') ?>" class="active"><?= icon_settings() ?>Einstellungen</a>
|
||||
<a href="<?= url_for('logout.php') ?>"><?= icon_logout() ?>Logout (<?= htmlspecialchars($_SESSION['username'] ?? '') ?>)</a>
|
||||
<span class="cmd-k-hint" onclick="document.dispatchEvent(new KeyboardEvent('keydown',{key:'k',ctrlKey:true}))"><kbd>Ctrl+K</kbd></span>
|
||||
</nav>
|
||||
</header>
|
||||
<main>
|
||||
<!-- Tab-Navigation -->
|
||||
<div class="settings-tabs">
|
||||
<a href="<?= url_for('settings.php?tab=allgemein') ?>" class="<?= $tab === 'allgemein' ? 'active' : '' ?>">Allgemein</a>
|
||||
<a href="<?= url_for('settings.php?tab=journal') ?>" class="<?= $tab === 'journal' ? 'active' : '' ?>">Journal</a>
|
||||
<a href="<?= url_for('settings.php?tab=konto') ?>" class="<?= $tab === 'konto' ? 'active' : '' ?>">Konto</a>
|
||||
</div>
|
||||
|
||||
<?php if ($msg): ?><p class="success"><?= htmlspecialchars($msg) ?></p><?php endif; ?>
|
||||
<?php if ($error): ?><p class="error"><?= htmlspecialchars($error) ?></p><?php endif; ?>
|
||||
|
||||
<?php if ($tab === 'allgemein'): ?>
|
||||
<!-- ==================== ALLGEMEIN TAB ==================== -->
|
||||
<section>
|
||||
<h2>Firmeneinstellungen</h2>
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="form" value="allgemein">
|
||||
<label>Firmenname:
|
||||
<input type="text" name="company_name" value="<?= htmlspecialchars($settings['company_name'] ?? '') ?>">
|
||||
</label>
|
||||
|
||||
<label>Adresse (mehrzeilig):
|
||||
<textarea name="company_address" rows="3"><?= htmlspecialchars($settings['company_address'] ?? '') ?></textarea>
|
||||
</label>
|
||||
|
||||
<div class="flex-row">
|
||||
<label>PLZ:
|
||||
<input type="text" name="company_zip" value="<?= htmlspecialchars($settings['company_zip'] ?? '') ?>">
|
||||
</label>
|
||||
<label>Ort:
|
||||
<input type="text" name="company_city" value="<?= htmlspecialchars($settings['company_city'] ?? '') ?>">
|
||||
</label>
|
||||
<label>Land:
|
||||
<input type="text" name="company_country" value="<?= htmlspecialchars($settings['company_country'] ?? '') ?>">
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<label>Steuernummer/USt-IdNr:
|
||||
<input type="text" name="tax_id" value="<?= htmlspecialchars($settings['tax_id'] ?? '') ?>">
|
||||
</label>
|
||||
|
||||
<label>Umsatzsteuer-Modus:
|
||||
<select name="vat_mode">
|
||||
<option value="klein" <?= ($settings['vat_mode'] ?? '') === 'klein' ? 'selected' : '' ?>>Kleinunternehmer</option>
|
||||
<option value="normal" <?= ($settings['vat_mode'] ?? '') === 'normal' ? 'selected' : '' ?>>Normal</option>
|
||||
</select>
|
||||
</label>
|
||||
|
||||
<label>Standard-USt-Satz (%):
|
||||
<input type="number" step="0.01" name="default_vat_rate" value="<?= htmlspecialchars($settings['default_vat_rate'] ?? '19.00') ?>">
|
||||
</label>
|
||||
|
||||
<label>IBAN:
|
||||
<input type="text" name="iban" value="<?= htmlspecialchars($settings['iban'] ?? '') ?>">
|
||||
</label>
|
||||
|
||||
<label>Telefon:
|
||||
<input type="text" name="phone" value="<?= htmlspecialchars($settings['phone'] ?? '') ?>">
|
||||
</label>
|
||||
|
||||
<label>E-Mail:
|
||||
<input type="email" name="email" value="<?= htmlspecialchars($settings['email'] ?? '') ?>">
|
||||
</label>
|
||||
|
||||
<label>Website:
|
||||
<input type="text" name="website" value="<?= htmlspecialchars($settings['website'] ?? '') ?>">
|
||||
</label>
|
||||
|
||||
<label>Zahlungsbedingungen:
|
||||
<textarea name="payment_terms" rows="2"><?= htmlspecialchars($settings['payment_terms'] ?? '') ?></textarea>
|
||||
</label>
|
||||
|
||||
<label>Fußtext:
|
||||
<textarea name="footer_text" rows="2"><?= htmlspecialchars($settings['footer_text'] ?? '') ?></textarea>
|
||||
</label>
|
||||
|
||||
<label>Logo (PNG):
|
||||
<input type="file" name="logo" accept="image/png">
|
||||
</label>
|
||||
<?php if (!empty($settings['logo_path'])): ?>
|
||||
<p>Aktuelles Logo:<br>
|
||||
<img src="<?= htmlspecialchars($settings['logo_path']) ?>" style="max-height:60px;"></p>
|
||||
<?php endif; ?>
|
||||
|
||||
<button type="submit">Speichern</button>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
<?php elseif ($tab === 'journal'): ?>
|
||||
<!-- ==================== JOURNAL TAB ==================== -->
|
||||
|
||||
<!-- Journal Sub-Tabs -->
|
||||
<div class="journal-settings-subtabs">
|
||||
<a href="<?= url_for('settings.php?tab=journal&jsub=jahre') ?>" class="<?= $journal_sub === 'jahre' ? 'active' : '' ?>">Jahre</a>
|
||||
<a href="<?= url_for('settings.php?tab=journal&jsub=einnahmen') ?>" class="<?= $journal_sub === 'einnahmen' ? 'active' : '' ?>">Einnahmen</a>
|
||||
<a href="<?= url_for('settings.php?tab=journal&jsub=ausgaben') ?>" class="<?= $journal_sub === 'ausgaben' ? 'active' : '' ?>">Ausgaben</a>
|
||||
<a href="<?= url_for('settings.php?tab=journal&jsub=stammdaten') ?>" class="<?= $journal_sub === 'stammdaten' ? 'active' : '' ?>">Sonstiges</a>
|
||||
</div>
|
||||
|
||||
<?php if ($journal_sub === 'jahre'): ?>
|
||||
<!-- ========== JAHRE ========== -->
|
||||
<section>
|
||||
<h2>Journal-Jahre</h2>
|
||||
<p class="settings-help">Hier verwalten Sie die Buchungsjahre. Ein geschlossenes Jahr kann nicht mehr bearbeitet werden.</p>
|
||||
<div>
|
||||
<form method="post" class="flex-row" style="margin-bottom:12px;">
|
||||
<input type="hidden" name="form" value="year">
|
||||
<label>Jahr:
|
||||
<input type="number" name="year" value="<?= date('Y') ?>" min="2000" max="2099" required style="max-width:100px;">
|
||||
</label>
|
||||
<label>Notizen:
|
||||
<input type="text" name="notes" value="">
|
||||
</label>
|
||||
<label>
|
||||
<button type="submit">Jahr erstellen</button>
|
||||
</label>
|
||||
</form>
|
||||
<?php if ($years): ?>
|
||||
<table class="list">
|
||||
<thead><tr><th>Jahr</th><th>Status</th><th>Notizen</th><th>Aktion</th></tr></thead>
|
||||
<tbody>
|
||||
<?php foreach ($years as $y): ?>
|
||||
<tr>
|
||||
<td><strong><?= (int)$y['year'] ?></strong></td>
|
||||
<td><?= $y['is_closed'] ? '<span class="badge badge-danger">Geschlossen</span>' : '<span class="badge badge-success">Offen</span>' ?></td>
|
||||
<td><?= htmlspecialchars($y['notes'] ?? '') ?></td>
|
||||
<td>
|
||||
<form method="post" style="display:inline;">
|
||||
<input type="hidden" name="form" value="toggle_year">
|
||||
<input type="hidden" name="id" value="<?= $y['id'] ?>">
|
||||
<button type="submit" class="secondary" style="padding:3px 8px;font-size:10px;">
|
||||
<?= $y['is_closed'] ? 'Öffnen' : 'Schließen' ?>
|
||||
</button>
|
||||
</form>
|
||||
<a href="<?= url_for('journal.php?year_id=' . $y['id']) ?>" style="margin-left:6px;font-size:10px;">Zum Journal</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php else: ?>
|
||||
<p class="info">Noch keine Jahre angelegt. Erstellen Sie ein Jahr, um mit der Buchführung zu beginnen.</p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<?php elseif ($journal_sub === 'einnahmen'): ?>
|
||||
<!-- ========== EINNAHMEN ========== -->
|
||||
|
||||
<!-- Erlös-Kategorien -->
|
||||
<section>
|
||||
<h2>Erlös-Kategorien</h2>
|
||||
<p class="settings-help">Kategorien für Einnahmen/Erlöse (z.B. "Umsatz 7%", "Umsatz 19%"). Diese erscheinen als Spalten im Journal.</p>
|
||||
<div>
|
||||
<form method="post" class="flex-row" style="margin-bottom:12px;">
|
||||
<input type="hidden" name="form" value="rev_cat">
|
||||
<input type="hidden" name="category_type" value="erloese">
|
||||
<label>Name:
|
||||
<input type="text" name="name" required placeholder="z.B. Umsatz 19%">
|
||||
</label>
|
||||
<label>MwSt %:
|
||||
<input type="number" step="0.01" name="vat_rate" value="19" style="max-width:80px;">
|
||||
</label>
|
||||
<label>Sort.:
|
||||
<input type="number" name="sort_order" value="0" style="max-width:60px;">
|
||||
</label>
|
||||
<label>
|
||||
<input type="checkbox" name="is_active" checked> Aktiv
|
||||
</label>
|
||||
<label>
|
||||
<button type="submit">Hinzufügen</button>
|
||||
</label>
|
||||
</form>
|
||||
<?php if ($er_cats): ?>
|
||||
<table class="list">
|
||||
<thead><tr><th>Name</th><th>MwSt</th><th>Sort.</th><th>Aktiv</th><th>Aktion</th></tr></thead>
|
||||
<tbody>
|
||||
<?php foreach ($er_cats as $cat): ?>
|
||||
<tr>
|
||||
<td>
|
||||
<form method="post" style="display:inline;" class="flex-row">
|
||||
<input type="hidden" name="form" value="rev_cat">
|
||||
<input type="hidden" name="id" value="<?= $cat['id'] ?>">
|
||||
<input type="hidden" name="category_type" value="erloese">
|
||||
<input type="text" name="name" value="<?= htmlspecialchars($cat['name']) ?>" style="max-width:150px;">
|
||||
</td>
|
||||
<td><input type="number" step="0.01" name="vat_rate" value="<?= htmlspecialchars($cat['vat_rate']) ?>" style="max-width:70px;"></td>
|
||||
<td><input type="number" name="sort_order" value="<?= (int)$cat['sort_order'] ?>" style="max-width:50px;"></td>
|
||||
<td><input type="checkbox" name="is_active" <?= $cat['is_active'] ? 'checked' : '' ?>></td>
|
||||
<td>
|
||||
<button type="submit" class="secondary" style="padding:3px 8px;font-size:10px;">Speichern</button>
|
||||
</form>
|
||||
<form method="post" style="display:inline;">
|
||||
<input type="hidden" name="form" value="delete_rev_cat">
|
||||
<input type="hidden" name="id" value="<?= $cat['id'] ?>">
|
||||
<button type="submit" class="danger" style="padding:3px 8px;font-size:10px;" onclick="return confirm('Wirklich löschen?');">X</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Wareneingang-Kategorien -->
|
||||
<section>
|
||||
<h2>Wareneingang-Kategorien</h2>
|
||||
<p class="settings-help">Kategorien für Wareneinkauf (z.B. "WE 7%", "WE 19%"). Diese erscheinen als Spalten im Journal.</p>
|
||||
<div>
|
||||
<form method="post" class="flex-row" style="margin-bottom:12px;">
|
||||
<input type="hidden" name="form" value="rev_cat">
|
||||
<input type="hidden" name="category_type" value="wareneingang">
|
||||
<label>Name:
|
||||
<input type="text" name="name" required placeholder="z.B. WE 19%">
|
||||
</label>
|
||||
<label>MwSt %:
|
||||
<input type="number" step="0.01" name="vat_rate" value="19" style="max-width:80px;">
|
||||
</label>
|
||||
<label>Sort.:
|
||||
<input type="number" name="sort_order" value="0" style="max-width:60px;">
|
||||
</label>
|
||||
<label>
|
||||
<input type="checkbox" name="is_active" checked> Aktiv
|
||||
</label>
|
||||
<label>
|
||||
<button type="submit">Hinzufügen</button>
|
||||
</label>
|
||||
</form>
|
||||
<?php if ($we_cats): ?>
|
||||
<table class="list">
|
||||
<thead><tr><th>Name</th><th>MwSt</th><th>Sort.</th><th>Aktiv</th><th>Aktion</th></tr></thead>
|
||||
<tbody>
|
||||
<?php foreach ($we_cats as $cat): ?>
|
||||
<tr>
|
||||
<td>
|
||||
<form method="post" style="display:inline;" class="flex-row">
|
||||
<input type="hidden" name="form" value="rev_cat">
|
||||
<input type="hidden" name="id" value="<?= $cat['id'] ?>">
|
||||
<input type="hidden" name="category_type" value="wareneingang">
|
||||
<input type="text" name="name" value="<?= htmlspecialchars($cat['name']) ?>" style="max-width:150px;">
|
||||
</td>
|
||||
<td><input type="number" step="0.01" name="vat_rate" value="<?= htmlspecialchars($cat['vat_rate']) ?>" style="max-width:70px;"></td>
|
||||
<td><input type="number" name="sort_order" value="<?= (int)$cat['sort_order'] ?>" style="max-width:50px;"></td>
|
||||
<td><input type="checkbox" name="is_active" <?= $cat['is_active'] ? 'checked' : '' ?>></td>
|
||||
<td>
|
||||
<button type="submit" class="secondary" style="padding:3px 8px;font-size:10px;">Speichern</button>
|
||||
</form>
|
||||
<form method="post" style="display:inline;">
|
||||
<input type="hidden" name="form" value="delete_rev_cat">
|
||||
<input type="hidden" name="id" value="<?= $cat['id'] ?>">
|
||||
<button type="submit" class="danger" style="padding:3px 8px;font-size:10px;" onclick="return confirm('Wirklich löschen?');">X</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<?php elseif ($journal_sub === 'ausgaben'): ?>
|
||||
<!-- ========== AUSGABEN / ABZÜGE ========== -->
|
||||
|
||||
<!-- Aufwandskategorien -->
|
||||
<section>
|
||||
<h2>Aufwandskategorien</h2>
|
||||
<p class="settings-help">Kategorien für Betriebsausgaben (z.B. "Miete", "Versicherung", "Telefon"). Diese erscheinen als Spalten im Journal und werden in der EÜR berücksichtigt.</p>
|
||||
<div>
|
||||
<form method="post" class="flex-row" style="margin-bottom:12px;">
|
||||
<input type="hidden" name="form" value="exp_cat">
|
||||
<label>Name:
|
||||
<input type="text" name="name" required placeholder="z.B. Miete">
|
||||
</label>
|
||||
<label>Typ:
|
||||
<select name="side" style="max-width:120px;">
|
||||
<option value="soll">Soll</option>
|
||||
<option value="soll_haben">Soll+Haben</option>
|
||||
</select>
|
||||
</label>
|
||||
<label>Sort.:
|
||||
<input type="number" name="sort_order" value="0" style="max-width:60px;">
|
||||
</label>
|
||||
<label>
|
||||
<input type="checkbox" name="is_active" checked> Aktiv
|
||||
</label>
|
||||
<label>
|
||||
<button type="submit">Hinzufügen</button>
|
||||
</label>
|
||||
</form>
|
||||
<?php if ($exp_cats): ?>
|
||||
<table class="list">
|
||||
<thead><tr><th>Name</th><th>Typ</th><th>Sort.</th><th>Aktiv</th><th>Aktion</th></tr></thead>
|
||||
<tbody>
|
||||
<?php foreach ($exp_cats as $cat): ?>
|
||||
<tr>
|
||||
<td>
|
||||
<form method="post" style="display:inline;" class="flex-row">
|
||||
<input type="hidden" name="form" value="exp_cat">
|
||||
<input type="hidden" name="id" value="<?= $cat['id'] ?>">
|
||||
<input type="text" name="name" value="<?= htmlspecialchars($cat['name']) ?>" style="max-width:150px;">
|
||||
</td>
|
||||
<td>
|
||||
<select name="side" style="max-width:100px;">
|
||||
<option value="soll" <?= $cat['side'] === 'soll' ? 'selected' : '' ?>>Soll</option>
|
||||
<option value="soll_haben" <?= $cat['side'] === 'soll_haben' ? 'selected' : '' ?>>Soll+Haben</option>
|
||||
</select>
|
||||
</td>
|
||||
<td><input type="number" name="sort_order" value="<?= (int)$cat['sort_order'] ?>" style="max-width:50px;"></td>
|
||||
<td><input type="checkbox" name="is_active" <?= $cat['is_active'] ? 'checked' : '' ?>></td>
|
||||
<td>
|
||||
<button type="submit" class="secondary" style="padding:3px 8px;font-size:10px;">Speichern</button>
|
||||
</form>
|
||||
<form method="post" style="display:inline;">
|
||||
<input type="hidden" name="form" value="delete_exp_cat">
|
||||
<input type="hidden" name="id" value="<?= $cat['id'] ?>">
|
||||
<button type="submit" class="danger" style="padding:3px 8px;font-size:10px;" onclick="return confirm('Wirklich löschen?');">X</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Abzüge -->
|
||||
<section>
|
||||
<h2>Abzüge</h2>
|
||||
<p class="settings-help">Abzugskategorien (z.B. "Skonto", "Lotto"). Diese erscheinen als Haben-Spalten im Journal und werden in der EÜR berücksichtigt.</p>
|
||||
<div>
|
||||
<form method="post" class="flex-row" style="margin-bottom:12px;">
|
||||
<input type="hidden" name="form" value="ded_cat">
|
||||
<label>Name:
|
||||
<input type="text" name="name" required placeholder="z.B. Skonto">
|
||||
</label>
|
||||
<label>Sort.:
|
||||
<input type="number" name="sort_order" value="0" style="max-width:60px;">
|
||||
</label>
|
||||
<label>
|
||||
<input type="checkbox" name="is_active" checked> Aktiv
|
||||
</label>
|
||||
<label>
|
||||
<button type="submit">Hinzufügen</button>
|
||||
</label>
|
||||
</form>
|
||||
<?php if ($ded_cats): ?>
|
||||
<table class="list">
|
||||
<thead><tr><th>Name</th><th>Sort.</th><th>Aktiv</th><th>Aktion</th></tr></thead>
|
||||
<tbody>
|
||||
<?php foreach ($ded_cats as $cat): ?>
|
||||
<tr>
|
||||
<td>
|
||||
<form method="post" style="display:inline;" class="flex-row">
|
||||
<input type="hidden" name="form" value="ded_cat">
|
||||
<input type="hidden" name="id" value="<?= $cat['id'] ?>">
|
||||
<input type="text" name="name" value="<?= htmlspecialchars($cat['name']) ?>" style="max-width:200px;">
|
||||
</td>
|
||||
<td><input type="number" name="sort_order" value="<?= (int)$cat['sort_order'] ?>" style="max-width:50px;"></td>
|
||||
<td><input type="checkbox" name="is_active" <?= $cat['is_active'] ? 'checked' : '' ?>></td>
|
||||
<td>
|
||||
<button type="submit" class="secondary" style="padding:3px 8px;font-size:10px;">Speichern</button>
|
||||
</form>
|
||||
<form method="post" style="display:inline;">
|
||||
<input type="hidden" name="form" value="delete_ded_cat">
|
||||
<input type="hidden" name="id" value="<?= $cat['id'] ?>">
|
||||
<button type="submit" class="danger" style="padding:3px 8px;font-size:10px;" onclick="return confirm('Wirklich löschen?');">X</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<?php elseif ($journal_sub === 'stammdaten'): ?>
|
||||
<!-- ========== STAMMDATEN ========== -->
|
||||
|
||||
<!-- Lieferanten -->
|
||||
<section>
|
||||
<h2>Lieferanten</h2>
|
||||
<p class="settings-help">Lieferanten können bei Buchungen ausgewählt werden, um die Zuordnung zu erleichtern.</p>
|
||||
<div>
|
||||
<form method="post" class="flex-row" style="margin-bottom:12px;">
|
||||
<input type="hidden" name="form" value="supplier">
|
||||
<label>Name:
|
||||
<input type="text" name="name" required placeholder="z.B. Metro">
|
||||
</label>
|
||||
<label>Sort.:
|
||||
<input type="number" name="sort_order" value="0" style="max-width:60px;">
|
||||
</label>
|
||||
<label>
|
||||
<input type="checkbox" name="is_active" checked> Aktiv
|
||||
</label>
|
||||
<label>
|
||||
<button type="submit">Hinzufügen</button>
|
||||
</label>
|
||||
</form>
|
||||
<?php if ($suppliers): ?>
|
||||
<table class="list">
|
||||
<thead><tr><th>Name</th><th>Sort.</th><th>Aktiv</th><th>Aktion</th></tr></thead>
|
||||
<tbody>
|
||||
<?php foreach ($suppliers as $sup): ?>
|
||||
<tr>
|
||||
<td>
|
||||
<form method="post" style="display:inline;" class="flex-row">
|
||||
<input type="hidden" name="form" value="supplier">
|
||||
<input type="hidden" name="id" value="<?= $sup['id'] ?>">
|
||||
<input type="text" name="name" value="<?= htmlspecialchars($sup['name']) ?>" style="max-width:200px;">
|
||||
</td>
|
||||
<td><input type="number" name="sort_order" value="<?= (int)$sup['sort_order'] ?>" style="max-width:50px;"></td>
|
||||
<td><input type="checkbox" name="is_active" <?= $sup['is_active'] ? 'checked' : '' ?>></td>
|
||||
<td>
|
||||
<button type="submit" class="secondary" style="padding:3px 8px;font-size:10px;">Speichern</button>
|
||||
</form>
|
||||
<form method="post" style="display:inline;">
|
||||
<input type="hidden" name="form" value="delete_supplier">
|
||||
<input type="hidden" name="id" value="<?= $sup['id'] ?>">
|
||||
<button type="submit" class="danger" style="padding:3px 8px;font-size:10px;" onclick="return confirm('Wirklich löschen?');">X</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Umsatz-Zusammenfassungsposten -->
|
||||
<section>
|
||||
<h2>Umsatz-Zusammenfassungsposten</h2>
|
||||
<p class="settings-help">Zusätzliche Posten für die monatliche Umsatzübersicht im Journal (z.B. "Reinigung", "RMV").</p>
|
||||
<div>
|
||||
<form method="post" class="flex-row" style="margin-bottom:12px;">
|
||||
<input type="hidden" name="form" value="summary_item">
|
||||
<label>Name:
|
||||
<input type="text" name="name" required placeholder="z.B. Reinigung">
|
||||
</label>
|
||||
<label>Sort.:
|
||||
<input type="number" name="sort_order" value="0" style="max-width:60px;">
|
||||
</label>
|
||||
<label>
|
||||
<input type="checkbox" name="is_active" checked> Aktiv
|
||||
</label>
|
||||
<label>
|
||||
<button type="submit">Hinzufügen</button>
|
||||
</label>
|
||||
</form>
|
||||
<?php if ($summary_items): ?>
|
||||
<table class="list">
|
||||
<thead><tr><th>Name</th><th>Sort.</th><th>Aktiv</th><th>Aktion</th></tr></thead>
|
||||
<tbody>
|
||||
<?php foreach ($summary_items as $item): ?>
|
||||
<tr>
|
||||
<td>
|
||||
<form method="post" style="display:inline;" class="flex-row">
|
||||
<input type="hidden" name="form" value="summary_item">
|
||||
<input type="hidden" name="id" value="<?= $item['id'] ?>">
|
||||
<input type="text" name="name" value="<?= htmlspecialchars($item['name']) ?>" style="max-width:200px;">
|
||||
</td>
|
||||
<td><input type="number" name="sort_order" value="<?= (int)$item['sort_order'] ?>" style="max-width:50px;"></td>
|
||||
<td><input type="checkbox" name="is_active" <?= $item['is_active'] ? 'checked' : '' ?>></td>
|
||||
<td>
|
||||
<button type="submit" class="secondary" style="padding:3px 8px;font-size:10px;">Speichern</button>
|
||||
</form>
|
||||
<form method="post" style="display:inline;">
|
||||
<input type="hidden" name="form" value="delete_summary_item">
|
||||
<input type="hidden" name="id" value="<?= $item['id'] ?>">
|
||||
<button type="submit" class="danger" style="padding:3px 8px;font-size:10px;" onclick="return confirm('Wirklich löschen?');">X</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php elseif ($tab === 'konto'): ?>
|
||||
<!-- ==================== KONTO TAB ==================== -->
|
||||
<?php $current_user = get_logged_in_user(); ?>
|
||||
|
||||
<section>
|
||||
<h2>Benutzername ändern</h2>
|
||||
<div>
|
||||
<form method="post">
|
||||
<input type="hidden" name="form" value="change_username">
|
||||
<label>Aktueller Benutzername:
|
||||
<input type="text" value="<?= htmlspecialchars($current_user['username'] ?? '') ?>" disabled>
|
||||
</label>
|
||||
<label>Neuer Benutzername:
|
||||
<input type="text" name="new_username" required minlength="3" style="max-width:300px;">
|
||||
</label>
|
||||
<button type="submit">Benutzername ändern</button>
|
||||
</form>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>Passwort ändern</h2>
|
||||
<div>
|
||||
<form method="post">
|
||||
<input type="hidden" name="form" value="change_password">
|
||||
<label>Aktuelles Passwort:
|
||||
<input type="password" name="current_password" required style="max-width:300px;">
|
||||
</label>
|
||||
<label>Neues Passwort:
|
||||
<input type="password" name="new_password" required minlength="6" style="max-width:300px;">
|
||||
</label>
|
||||
<label>Neues Passwort bestätigen:
|
||||
<input type="password" name="confirm_password" required minlength="6" style="max-width:300px;">
|
||||
</label>
|
||||
<button type="submit">Passwort ändern</button>
|
||||
</form>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<?php endif; ?>
|
||||
</main>
|
||||
<script src="assets/command-palette.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user