Hinweis Feld hinzugefügt - DBUPDATE !!!

This commit is contained in:
fds2610 2026-01-14 22:39:48 +01:00
parent 01e0281e75
commit c604f9f41d
3 changed files with 11 additions and 4 deletions

View file

@ -87,6 +87,7 @@ $entries = $stmt->fetchAll();
<th>Zahlweise</th>
<th>Betreff</th>
<th>Betrag</th>
<th>Hinweis</th>
</tr>
</thead>
<tbody>
@ -99,6 +100,7 @@ $entries = $stmt->fetchAll();
<td><?= htmlspecialchars($entry['zahlweise'] ?? '') ?></td>
<td><?= htmlspecialchars($entry['subject']) ?></td>
<td class="align-right"><?= htmlspecialchars( number_format($entry['amount'], 2, ',', '.')) ?></td>
<td class="hide-on-mobile"><?= htmlspecialchars($entry['note']) ?></td>
</tr>
<?php endforeach; ?>
</tbody>

View file

@ -44,14 +44,15 @@ if (!empty($_POST)) {
$person = isset($_POST['person']) ? $_POST['person'] : '';
$category = isset($_POST['category']) ? trim($_POST['category']) : '';
$subject = isset($_POST['subject']) ? trim($_POST['subject']) : '';
$note = isset($_POST['note']) ? trim($_POST['note']) : '';
$amount = isset($_POST['amount']) ? (float)$_POST['amount'] : 0.0;
$payment_method = isset($_POST['payment_method']) ? trim($_POST['payment_method']) : '';
$jsonPersonen = json_encode($person);
try {
$stmt = $pdo->prepare("
INSERT INTO entries (date, user_id, person, category, subject, amount, payment_method)
VALUES (:date, :user_id, :person, :category, :subject, :amount, :payment_method)
INSERT INTO entries (date, user_id, person, category, subject, amount, payment_method, note)
VALUES (:date, :user_id, :person, :category, :subject, :amount, :payment_method, :note)
");
$stmt->bindParam(':date', $date);
$stmt->bindParam(':user_id', $user_id);
@ -60,6 +61,7 @@ if (!empty($_POST)) {
$stmt->bindParam(':subject', $subject);
$stmt->bindParam(':amount', $amount);
$stmt->bindParam(':payment_method', $payment_method);
$stmt->bindParam(':note', $note);
ob_start();
$stmt->debugDumpParams();
@ -183,6 +185,10 @@ Daten gespeichert !
<?php endforeach; ?>
</select>
</div>
<!-- Hinweis -->
<div class="form-group">
<input type="text" name="note" placeholder="Hinweis" required>
</div>
<button type="submit" class="btn-xr">Speichern</button>
</form>

View file

@ -1,2 +1 @@
UPDATE entries SET payment_method = '1' WHERE LOWER(payment_method) = 'bar';
alter table entries modify column payment_method int(11);
alter table entries add column note varchar(50);