diff --git a/README.md b/README.md index 5888be9..7cf589a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,23 @@ # FSCash Dokumentiere Ausgaben on-the-go als Webapp +& behalte den Überblick über Dein Aktiendepot + +## ToDo + +- [ ] Zusammenfassen von mehreren Einträgen zu einer Aktie +- [ ] Prüfen ob APIKEYS leer sind und ggfs die Aktualisierung ausblenden + +## V.2.0 + +- [X] neue Haupt-Funktion: Aktien zeigt eine Liste mit gespeicherten, zu beobachtenden Aktien +- [X] Die Tabelle errechnet automatisch den aktuellen Gewinn oder Verluststand jeder Aktieneintragung +- [X] neue Aktie hinzufügen mit Kaufdatum und Kaufpreis, wird je Benutzer separat hinterlegt (user_id) +- [X] es KANN eine ISIN oder WKN eingetragen werden +- [X] Beim Abruf von aktuellen Kursdaten muss vorher ein API Key von https://www.alphavantage.co/support/#api-key beantragt werden. +- [X] Suchen von Symbolen passend zur ISIN geht über einen API Key von https://www.openfigi.com/user/signup +- [X] Alternativ kann auch nach dem Aktiennamen bei alphavantage gesucht werden - dafür muss man auf den Namen klicken +- [X] Aktien können geändert und gelöscht werden. ## V.1.2 diff --git a/html/.Trash-1000/files/aktien2.php b/html/.Trash-1000/files/aktien2.php new file mode 100644 index 0000000..0b30fc2 --- /dev/null +++ b/html/.Trash-1000/files/aktien2.php @@ -0,0 +1,132 @@ + 12) { + $month = 1; + $year++; +} + +// Daten abrufen +$sql="SELECT +id, +WKNISIN, +Aktie, +kaufdatum, +kaufpreis, +anzahl, +(kaufpreis * anzahl) AS Kaufsumme +FROM +aktien; +"; + +$stmt = $pdo->prepare($sql); +$stmt->execute([ + 'year' => $year, + 'month' => $month +]); +$entries = $stmt->fetchAll(); +?> + + + + + +FSCash - Dashboard + + + +
+ + + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
IDWKN/ISINAktieKaufdatumKaufpreisAnzahlKaufsumme 
+ + + +
+ + + ++ +
+ + + + diff --git a/html/.Trash-1000/info/aktien2.php.trashinfo b/html/.Trash-1000/info/aktien2.php.trashinfo new file mode 100644 index 0000000..fa68f84 --- /dev/null +++ b/html/.Trash-1000/info/aktien2.php.trashinfo @@ -0,0 +1,3 @@ +[Trash Info] +Path=aktien2.php +DeletionDate=2026-02-16T15:16:44 diff --git a/html/aktien.php b/html/aktien.php new file mode 100644 index 0000000..cb252b6 --- /dev/null +++ b/html/aktien.php @@ -0,0 +1,397 @@ + 12) { + $month = 1; + $year++; +} + +// Daten abrufen +$sql="SELECT +id, +user_id, +WKNISIN, +Symbol, +Aktie, +kaufdatum, +kaufpreis, +anzahl, +kurs, +kursdatum, +(kaufpreis * anzahl) AS Kaufsumme +FROM +aktien +WHERE user_id = :userid; +"; + +$stmt = $pdo->prepare($sql); +$stmt->execute([ + 'userid' => $userid +]); +$entries = $stmt->fetchAll(); +?> + + + + + +FSCash - Dashboard + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + 0) { + $guvClass = 'guv-positive'; +} elseif ($guv < 0) { + $guvClass = 'guv-negative'; +} + +?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
IDISIN/SymbolAktieKaufdatumKaufpreisAnzahlKaufsummeKursGuV 
+
+ +
+ + + + + + + + + + + 0): ?> +
+ + +- + +
+ + 0): ?> + + +
+ + + + + + + +- + + +
+ + + +
Summe: + + +
+ + + +
+ + + ++ +
+ + + + + + + + + + + + + + + diff --git a/html/assets/css/style.css b/html/assets/css/style.css index b191a02..f53fce6 100644 --- a/html/assets/css/style.css +++ b/html/assets/css/style.css @@ -30,6 +30,35 @@ h1 { color: var(--dark-color); } +.kurs-cell { + font-size: 0.85em; + line-height: 1.2em; +} + +.kurs-datum { + font-size: 0.75em; + color: #666; +} + +.guv-positive { + color: #1a7f37; + font-weight: 600; +} + +.guv-negative { + color: #c62828; + font-weight: 600; +} + +.sum-row { + background-color: #f3f3f3; + border-top: 2px solid #999; +} + +.sum-row td { + padding-top: 10px; +} + .debug_hidden { display: none; } @@ -289,6 +318,15 @@ tr:hover { } } +.update { + color: white; + width: 25px; + height: 25px; + vertical-align: middle; + display: inline-block; +} + + /* Button */ .btn-xr { position: fixed; @@ -380,7 +418,7 @@ max-height: 0; } /* Modal */ -.modal { +.modal-l { display: flex; justify-content: center; align-items: center; @@ -393,7 +431,7 @@ max-height: 0; z-index: 1001; } -.modal-content { +.modal-l-content { background: white; padding: 40px; border-radius: var(--border-radius); @@ -405,14 +443,14 @@ max-height: 0; text-align: center; } -.modal-content h2 { +.modal-l-content h2 { font-size: 24px; margin-bottom: 20px; color: var(--primary-color); } -.modal-content input[type="text"], -.modal-content input[type="password"] { +.modal-l-content input[type="text"], +.modal-l-content input[type="password"] { width: 100%; padding: 15px; margin: 10px 0; @@ -423,13 +461,13 @@ max-height: 0; transition: border-color 0.3s ease; } -.modal-content input[type="text"]:focus, -.modal-content input[type="password"]:focus { +.modal-l-content input[type="text"]:focus, +.modal-l-content input[type="password"]:focus { border-color: var(--primary-color); outline: none; } -.modal-content button { +.modal-l-content button { width: 100%; padding: 15px; background-color: var(--primary-color); @@ -474,6 +512,59 @@ input[type="number"] { .modal-content input[type="password"], .modal-content button { font-size: 14px; + width: 100px; } } +/* Modales Fenster 2 */ + +.modal { + display: none; + position: fixed; + z-index: 9999; + inset: 0; + background: rgba(0,0,0,0.5); + justify-content: center; + align-items: center; +} + +.modal-content { + background: #fff; + width: 80%; + height: 80%; + max-width: 1000px; + max-height: 800px; + border-radius: 8px; + display: flex; + flex-direction: column; + padding: 20px; +} + +.modal-body { + flex: 1; + overflow-y: auto; + background: #f8f8f8; + padding: 10px; + font-family: monospace; + font-size: 14px; + border: 1px solid #ddd; +} + +.modal-footer { + text-align: right; + margin-top: 10px; +} + +.btn { + padding: 8px 16px; + background: #333; + color: white; + border: none; + cursor: pointer; + border-radius: 4px; + width: 100px; +} + +.btn:hover { + background: #555; +} diff --git a/html/assets/img/update.png b/html/assets/img/update.png new file mode 100644 index 0000000..dd178c8 Binary files /dev/null and b/html/assets/img/update.png differ diff --git a/html/config.php.sample b/html/config.php.sample index f1d0a10..88c9763 100644 --- a/html/config.php.sample +++ b/html/config.php.sample @@ -12,7 +12,14 @@ $charset = 'utf8mb4'; $selectedCategories = [1, 2, 3]; // Anpassen! Dies sind die Standard-Ketegorien die für rep_person als default angenommen werden. $admin_ids = [1,2]; +$aktien_ids = [1,2]; +// Standard: kein Admin, keine Aktien +$is_admin = "false"; +$is_aktien = "false"; +// API Keys +$alphaApiKey = '98JPDX06439OYCVD'; +$openFigiApiKey = '62d16cf8-457d-41a6-83d0-84b26b8d5e6c'; $dsn = "mysql:host=$host;dbname=$db;charset=$charset"; $options = [ diff --git a/html/dashboard.php b/html/dashboard.php index bb6428d..9079c20 100644 --- a/html/dashboard.php +++ b/html/dashboard.php @@ -14,6 +14,10 @@ error_log($_SESSION['user_id']); if (in_array($_SESSION['user_id'], $admin_ids, true)) { $is_admin = "true"; } +// Prüfen, ob die user_id im Aktien-Array ist +if (in_array($_SESSION['user_id'], $aktien_ids, true)) { + $is_aktien = "true"; +} // Aktuelles Jahr und Monat ermitteln, ggf. aus GET-Parametern $year = isset($_GET['year']) ? (int)$_GET['year'] : (int)date('Y'); @@ -82,6 +86,7 @@ $entries = $stmt->fetchAll();