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

View file

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

View file

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