Rechnungsdaten - 2. Teil
This commit is contained in:
parent
b294ceeec8
commit
1d7253f903
@ -8,7 +8,6 @@ class HotelModel {
|
|||||||
|
|
||||||
private PDO $db;
|
private PDO $db;
|
||||||
private AnschriftModel $mdlAnschr;
|
private AnschriftModel $mdlAnschr;
|
||||||
|
|
||||||
private $allowedFields = [
|
private $allowedFields = [
|
||||||
'hotelname', 'hotelnummer', 'provsatz', 'rg_hotelname', 'rg_interval',
|
'hotelname', 'hotelnummer', 'provsatz', 'rg_hotelname', 'rg_interval',
|
||||||
'rg_vondatum', 'rg_bisdatum', 'rg_laufdatum', 'rg_ustid', 'rg_ustfrei',
|
'rg_vondatum', 'rg_bisdatum', 'rg_laufdatum', 'rg_ustid', 'rg_ustfrei',
|
||||||
@ -42,6 +41,16 @@ class HotelModel {
|
|||||||
|
|
||||||
public function updateHotel($data) {
|
public function updateHotel($data) {
|
||||||
|
|
||||||
|
$status = $data['status'] ?? 'inaktiv';
|
||||||
|
$data['status'] = $status;
|
||||||
|
|
||||||
|
$intern = $data['intern'] ?? 0;
|
||||||
|
$data['intern'] = $intern;
|
||||||
|
|
||||||
|
$nichtanzeigen = $data['nichtanzeigen'] ?? 0;
|
||||||
|
$data['nichtanzeigen'] = $nichtanzeigen;
|
||||||
|
|
||||||
|
|
||||||
$fieldsToUpdate = array_intersect_key($data, array_flip($this->allowedFields));
|
$fieldsToUpdate = array_intersect_key($data, array_flip($this->allowedFields));
|
||||||
if (empty($fieldsToUpdate)) {
|
if (empty($fieldsToUpdate)) {
|
||||||
return false;
|
return false;
|
||||||
@ -95,14 +104,14 @@ class HotelModel {
|
|||||||
$this->db->beginTransaction();
|
$this->db->beginTransaction();
|
||||||
try {
|
try {
|
||||||
// 1. Anschrift aktualisieren
|
// 1. Anschrift aktualisieren
|
||||||
|
|
||||||
$subid = $this->mdlAnschr->update($data['anschriftid'], $data, false);
|
$subid = $this->mdlAnschr->update($data['anschriftid'], $data, false);
|
||||||
if(empty($subid) == false) {
|
if (empty($subid) == false) {
|
||||||
$data['anschriftid'] = $subid;
|
$data['anschriftid'] = $subid;
|
||||||
}
|
}
|
||||||
// 1.1 Rechungsanschrift aktualisieren
|
// 1.1 Rechungsanschrift aktualisieren
|
||||||
$subidRg = $this->mdlAnschr->update($data['rg_anschriftid'], $data, true);
|
$subidRg = $this->mdlAnschr->update($data['rg_anschriftid'], $data, true);
|
||||||
if(empty($subidRg) == false) {
|
if (empty($subidRg) == false) {
|
||||||
$data['rg_anschriftid'] = $subidRg;
|
$data['rg_anschriftid'] = $subidRg;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,13 +119,11 @@ class HotelModel {
|
|||||||
BankverbindungModel::update($data['bankid'], $data);
|
BankverbindungModel::update($data['bankid'], $data);
|
||||||
|
|
||||||
// 3. Hotel aktualisieren
|
// 3. Hotel aktualisieren
|
||||||
$fieldsToUpdate = array_intersect_key($data, array_flip($this->allowedFields));
|
if ($this->updateHotel($data) == false) {
|
||||||
if (empty($fieldsToUpdate)) {
|
$this->db->rollBack();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->updateHotel($data);
|
|
||||||
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
@ -124,8 +131,4 @@ class HotelModel {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<div class="col-md-2">
|
<div class="col-md-1">
|
||||||
<label for="hotelnummer" class="form-label">Hotelnummer</label>
|
<label for="hotelnummer" class="form-label">Hotelnummer</label>
|
||||||
<input type="number" class="form-control" id="hotelnummer" name="hotelnummer" min="101"
|
<input type="number" class="form-control" id="hotelnummer" name="hotelnummer" min="101"
|
||||||
value="<?= htmlspecialchars($hotel['hotelnummer'] ?? '') ?>" required>
|
value="<?= htmlspecialchars($hotel['hotelnummer'] ?? '') ?>" required>
|
||||||
@ -10,23 +10,31 @@
|
|||||||
<input type="text" class="form-control" id="hotelname" name="hotelname"
|
<input type="text" class="form-control" id="hotelname" name="hotelname"
|
||||||
value="<?= htmlspecialchars($hotel['hotelname'] ?? '') ?>" required>
|
value="<?= htmlspecialchars($hotel['hotelname'] ?? '') ?>" required>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-2">
|
<div class="col-md-1">
|
||||||
<label for="intern" class="form-label">Intern</label>
|
<label for="intern" class="form-label">Intern</label>
|
||||||
<div class="form-check form-switch">
|
<div class="form-check form-switch">
|
||||||
<input class="form-check-input" type="checkbox" id="intern" name="intern"
|
<input class="form-check-input" type="checkbox" id="intern" name="intern" value="1"
|
||||||
<?= ($hotel['intern'] ?? '') === '1' ? 'checked' : '' ?>>
|
<?= ($hotel['intern'] ?? '') === 1 ? 'checked' : '' ?>>
|
||||||
<label class="form-check-label" for="intern">Eigenes Hotel</label>
|
<label class="form-check-label" for="intern">Ja</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-2">
|
<div class="col-md-1">
|
||||||
<label for="status" class="form-label">Status</label>
|
<label for="status" class="form-label">Status</label>
|
||||||
<div class="form-check form-switch">
|
<div class="form-check form-switch">
|
||||||
<input class="form-check-input" type="checkbox" id="status" name="status"
|
<input class="form-check-input" type="checkbox" id="status" name="status" value="aktiv"
|
||||||
<?= ($hotel['status'] ?? '') === 'aktiv' ? 'checked' : '' ?>>
|
<?= ($hotel['status'] ?? '') === 'aktiv' ? 'checked' : '' ?>>
|
||||||
<label class="form-check-label" for="status">Aktiv</label>
|
<label class="form-check-label" for="status">Aktiv</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-2">
|
<div class="col-md-2">
|
||||||
|
<label for="status" class="form-label">Rechnungen</label>
|
||||||
|
<div class="form-check form-switch">
|
||||||
|
<input class="form-check-input" type="checkbox" id="nichtanzeigen" name="nichtanzeigen" value="1"
|
||||||
|
<?= ($hotel['nichtanzeigen'] ?? '') === 1 ? 'checked' : '' ?>>
|
||||||
|
<label class="form-check-label" for="nichtanzeigen">herunterladen</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-3">
|
||||||
<label for="betreuer" class="form-label">Betreuer</label>
|
<label for="betreuer" class="form-label">Betreuer</label>
|
||||||
<select class="form-select" name="betreuer" id="betreuer">
|
<select class="form-select" name="betreuer" id="betreuer">
|
||||||
<?php
|
<?php
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
<h5>Rechnungsanschrift</h5>
|
<h5>Rechnungsanschrift</h5>
|
||||||
<div class="row">
|
<div class="row mb-3">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<label for="land" class="form-label">Abweichender Hotelname</label>
|
<label for="land" class="form-label">Abweichender Hotelname</label>
|
||||||
<input type="text" class="form-control" name="rg_hotelname" value="<?= htmlspecialchars($hotel['rg_hotelname'] ?? '') ?>">
|
<input type="text" class="form-control" name="rg_hotelname" value="<?= htmlspecialchars($hotel['rg_hotelname'] ?? '') ?>">
|
||||||
@ -28,15 +28,15 @@
|
|||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<label for="ansprechpartner" class="form-label">Ansprechpartner</label>
|
<label for="ansprechpartner" class="form-label">Ansprechpartner</label>
|
||||||
<input type="text" class="form-control" name="rgansprechpartner" value="<?= htmlspecialchars($rganschrift['ansprechpartner'] ?? '') ?>">
|
<input type="text" class="form-control" name="rg_ansprechpartner" value="<?= htmlspecialchars($rganschrift['ansprechpartner'] ?? '') ?>">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<label for="telefon" class="form-label">Telefon</label>
|
<label for="telefon" class="form-label">Telefon</label>
|
||||||
<input type="text" class="form-control" name="rgtelefon" value="<?= htmlspecialchars($rganschrift['telefon'] ?? '') ?>">
|
<input type="text" class="form-control" name="rg_telefon" value="<?= htmlspecialchars($rganschrift['telefon'] ?? '') ?>">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<label for="email" class="form-label">E-Mail</label>
|
<label for="email" class="form-label">E-Mail</label>
|
||||||
<input type="email" class="form-control" name="rgemail" value="<?= htmlspecialchars($rganschrift['email'] ?? '') ?>">
|
<input type="email" class="form-control" name="rg_email" value="<?= htmlspecialchars($rganschrift['email'] ?? '') ?>">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<h5>Umsatzsteuer</h5>
|
<h5>Umsatzsteuer</h5>
|
||||||
@ -84,26 +84,35 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h5>Rechnungslauf</h5>
|
<h5>Rechnungslauf</h5>
|
||||||
|
<div class="row align-items-end mb-3">
|
||||||
|
<!-- Rechnungsintervall -->
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label class="form-label d-block">Rechnungsintervall</label>
|
||||||
|
<div class="btn-group w-100" role="group" aria-label="Rechnungsintervall">
|
||||||
|
<input type="radio" class="btn-check" name="rg_interval" id="interval0" value="monatlich" autocomplete="off" <?= ($hotel['rg_interval'] ?? '') == 'monatlich' ? 'checked' : '' ?>>
|
||||||
|
<label class="btn btn-outline-primary" for="interval0">monatlich</label>
|
||||||
|
|
||||||
<!--
|
<input type="radio" class="btn-check" name="rg_interval" id="interval1" value="quartal" autocomplete="off" <?= ($hotel['rg_interval'] ?? '') == 'quartal' ? 'checked' : '' ?>>
|
||||||
<h5>Bankverbindung für Rechnung</h5>
|
<label class="btn btn-outline-primary" for="interval1">pro Quartal</label>
|
||||||
<div class="row mb-3">
|
|
||||||
<div class="col-md-3">
|
<input type="radio" class="btn-check" name="rg_interval" id="interval2" value="taegig14" autocomplete="off" <?= ($hotel['rg_interval'] ?? '') == 'taegig14' ? 'checked' : '' ?>>
|
||||||
<label for="bank" class="form-label">Bank</label>
|
<label class="btn btn-outline-primary" for="interval2">14 tägig</label>
|
||||||
<input type="text" class="form-control" name="bank" value="<?= htmlspecialchars($rgbankverbindung['bank'] ?? '') ?>">
|
|
||||||
|
<input type="radio" class="btn-check" name="rg_interval" id="interval3" value="adhoc" autocomplete="off" <?= ($hotel['rg_interval'] ?? '') == 'adhoc' ? 'checked' : '' ?>>
|
||||||
|
<label class="btn btn-outline-primary" for="interval3">Ad hoc</label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3">
|
|
||||||
<label for="iban" class="form-label">IBAN</label>
|
<div class="col-md-1">
|
||||||
<input type="text" class="form-control" name="iban" value="<?= htmlspecialchars($rgbankverbindung['iban'] ?? '') ?>">
|
<label for="vorzeitig" class="form-label">Rechnungstellung</label>
|
||||||
|
<div class="form-check form-switch">
|
||||||
|
<input class="form-check-input" type="checkbox" id="status" name="status" value="aktiv"
|
||||||
|
<?= ($hotel['status'] ?? '') === 'aktiv' ? 'checked' : '' ?>>
|
||||||
|
<label class="form-check-label" for="status">vorzeitig</label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3">
|
|
||||||
<label for="bic" class="form-label">BIC</label>
|
|
||||||
<input type="text" class="form-control" name="bic" value="<?= htmlspecialchars($rgbankverbindung['bic'] ?? '') ?>">
|
</div>
|
||||||
</div>
|
|
||||||
<div class="col-md-3">
|
|
||||||
<label for="inhaber" class="form-label">Kontoinhaber</label>
|
|
||||||
<input type="text" class="form-control" name="inhaber" value="<?= htmlspecialchars($rgbankverbindung['inhaber'] ?? '') ?>">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
-->
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -30,9 +30,11 @@ $username = $_SESSION['user'] ?? 'Gast';
|
|||||||
<html lang="de">
|
<html lang="de">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title><?= $pageTitle ?? "Seite" ?> | Meine Anwendung</title>
|
<title><?= $pageTitle ?? "Seite" ?> | VWL Support-Tool</title>
|
||||||
<!-- Bootstrap CSS -->
|
<!-- Bootstrap CSS -->
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css">
|
||||||
|
|
||||||
<!-- Bootstrap JS (für Tabs) -->
|
<!-- Bootstrap JS (für Tabs) -->
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
<link href="/assets/css/vwl.css" rel="stylesheet">
|
<link href="/assets/css/vwl.css" rel="stylesheet">
|
||||||
@ -40,7 +42,7 @@ $username = $_SESSION['user'] ?? 'Gast';
|
|||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="bg-primary text-white py-2 px-4 d-flex justify-content-between align-items-center">
|
<div class="bg-primary text-white py-2 px-4 d-flex justify-content-between align-items-center">
|
||||||
<div><strong>Meine Anwendung</strong></div>
|
<div><strong>VWL Support-Tool</strong></div>
|
||||||
<div class="text-center flex-grow-1"><?= htmlspecialchars($pageTitle) ?? '' ?></div>
|
<div class="text-center flex-grow-1"><?= htmlspecialchars($pageTitle) ?? '' ?></div>
|
||||||
<div>Angemeldet als: <?= htmlspecialchars($username) ?></div>
|
<div>Angemeldet als: <?= htmlspecialchars($username) ?></div>
|
||||||
</div>
|
</div>
|
||||||
@ -61,13 +63,31 @@ $username = $_SESSION['user'] ?? 'Gast';
|
|||||||
'einstellungen' => 'Einstellungen',
|
'einstellungen' => 'Einstellungen',
|
||||||
'direct:/logout.php' => 'Logout'
|
'direct:/logout.php' => 'Logout'
|
||||||
];
|
];
|
||||||
|
$icons = [
|
||||||
|
'home' => 'bi-house',
|
||||||
|
'gutscheinsuche' => 'bi-search',
|
||||||
|
'hotels' => 'bi-building',
|
||||||
|
'rechnungen' => 'bi-file-earmark-text',
|
||||||
|
'partner' => 'bi-people',
|
||||||
|
'auswertungen' => 'bi-graph-up',
|
||||||
|
'postversand' => 'bi-envelope',
|
||||||
|
'einzahlungen' => 'bi-cash-coin',
|
||||||
|
'einstellungen' => 'bi-gear',
|
||||||
|
'direct:/logout.php' => 'bi-box-arrow-right'
|
||||||
|
];
|
||||||
foreach ($menu as $key => $value) {
|
foreach ($menu as $key => $value) {
|
||||||
if (str_starts_with($key, 'direct:')) {
|
if (str_starts_with($key, 'direct:')) {
|
||||||
$link = substr($key, 7);
|
$link = substr($key, 7);
|
||||||
|
$iconKey = $key;
|
||||||
} else {
|
} else {
|
||||||
$link = "?page=$key";
|
$link = "?page=$key";
|
||||||
|
$iconKey = $key;
|
||||||
}
|
}
|
||||||
echo "<li class='nav-item'><a class='nav-link' href='$link'>$value</a></li>";
|
|
||||||
|
$iconClass = $icons[$iconKey] ?? 'bi-circle'; // fallback icon
|
||||||
|
echo "<li class='nav-item'>
|
||||||
|
<a class='nav-link' href='$link'><i class='bi $iconClass me-1'></i>$value</a>
|
||||||
|
</li>";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user