<table class="table table-striped" id="stocks"> <thead> <tr> <th>Bezeichnung</th> <th>Kurs</th> <th>Kürzel</th> <th>+/-</th> <th>%</th> <th>Datum</th> </tr> </thead> <tbody class="list"> <?php $result = multiRowQuery("SELECT * FROM stocks WHERE price > 0 AND name <> '' ORDER BY name ASC;"); while ($row = $result->fetch_assoc()) { ?> <tr onclick="toggleTable($(this));"> <td class="bezeichnung"><?php echo $row["name"]; ?> </td> <td class="preis"><?php echo $row["price"]; ?> €</td> <td class="shortcut"><?php echo $row["shortcut"]; ?>
<div class="table-responsive"> <table class="table table-striped" id="taskHistory"> <thead> <tr> <th>Datum</th> <th>Stück</th> <th>Bezeichnung</th> <th>Auftragsart</th> <th>Abr.-betrag</th> </tr> </thead> <tbody> <?php $result = multiRowQuery("SELECT * FROM history WHERE depotID = '" . $_SESSION['depot'] . "' ORDER BY date DESC;"); while ($row = $result->fetch_assoc()) { ?> <tr> <td><?php echo datum($row["date"]); ?> </td> <td><?php echo $row["menge"]; ?> </td> <td><?php echo getNameFromStockID($row["stocksID"]); ?>
?> </div> <?php } ?> <div class="well well-lg"> <form method="post" action="index.php?p=sell"> <div class="form-group"> <label for="aktie">Wertpapier</label> <select class="form-control" id="aktie" name="aktie"> <?php $res = multiRowQuery("SELECT trade.stockID as id, (SELECT stocks.name FROM stocks WHERE stocks.id = trade.stockID) as name,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttrade.menge as menge, (SELECT price FROM stocks WHERE stocks.id = trade.stockID) as price \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM trade WHERE depotID = '" . $_SESSION['depot'] . "';"); while ($row = $res->fetch_assoc()) { echo '<option value="' . $row["id"] . '" menge="' . $row["menge"] . '" price="' . round($row["price"], 2) . '" >' . $row["name"] . ' ( ' . round($row["price"], 3) . ' € )</option>'; } ?> </select> </div> <div class="form-group"> <label for="menge">Stückzahl <span id="calc"></span></label> <input type="number" class="form-control" id="menge" name="menge" required=""> </div> <div class="form-group"> <label for="type">Limit</label>
<table id="friendTable" class="table table-striped"> <thead> <tr> <th>Name</th> <th>DepotID</th> <th>Gewinn</th> <th></th> </tr> </thead> <tbody> <?php //abfrage für freunde $abfrage = "SELECT \n`depot`.id as id, \n`depot`.name as name, \n(SELECT SUM(`trade`.menge) FROM `trade` WHERE `depotID` = `depot`.id) as menge, \n`depot`.pos sPos,\n`depot`.guthaben as guthaben\n\nFROM `depot`, `friends`\nWHERE (((`friends`.`depotID1` = `depot`.id AND `friends`.`depotID2` = '" . $_SESSION['depot'] . "') OR (`friends`.`depotID2` = `depot`.id AND `friends`.`depotID1` = '" . $_SESSION['depot'] . "')) AND `friends`.confirmed = '1') ;"; $result = multiRowQuery($abfrage); $i = 1; $werte = array(); while ($row = $result->fetch_assoc()) { $debotWert = singleRowQuery("SELECT wert FROM depotStats WHERE depotID = '" . $row["id"] . "' ORDER BY date DESC LIMIT 0,1;"); $gewinn = round($debotWert[0] - 50000, 2); if ($row["menge"] == "") { $row["menge"] = 0; } //alle freunde in array schreiben $werte[$i]["name"] = $row["name"]; $werte[$i]["id"] = $row["id"]; $werte[$i]["menge"] = $row["menge"]; $werte[$i]["sPos"] = $row["sPos"]; $werte[$i]["gewinn"] = $gewinn; $i++;
<div class="table-responsive"> <table class="table table-striped" id="myStocks"> <thead> <tr> <th>Wertpapier</th> <th>Stück</th> <th>Kurswert*</th> <th>Kaufwert*</th> <th>Gewinn/Verlust</th> <th>Tendenz</th> </tr> </thead> <tbody> <?php $result = multiRowQuery("SELECT * FROM trade WHERE depotID = '" . $_SESSION['depot'] . "' ORDER BY date ASC;"); while ($row = $result->fetch_assoc()) { $name = singleRowQuery("SELECT name FROM stocks WHERE id = '" . $row["stockID"] . "'; "); $name = $name[0]; $diff = date_diff(date_create($row["date"]), date_create(date("m.d.y"))); $dateDiff = $diff->format('%a'); if ($dateDiff == 0) { $dateDiff++; } $kurswert = aktKurs($row["stockID"]) * $row["menge"]; $diffW = round($kurswert - $row["startGeld"], 2); $tendenz = round($diffW / ($row["startGeld"] * 0.01), 2); ?> <tr> <td><?php
radius: 2, states: { hover: { enabled: true } } } } }, series: [{ color: '#428BCA', name: 'Gewinn', data: [ <?php $res = multiRowQuery("SELECT wert, date FROM depotStats WHERE depotID = '" . $_SESSION['depot'] . "' ORDER BY date; "); while ($row = $res->fetch_assoc()) { $date = strtotime($row["date"]); $date = strtotime('-1 month', $date); $date = date("Y, m, d, H, i", $date); echo "[Date.UTC(" . $date . ")," . ($row["wert"] - 50000) . "],"; } ?> ], }] }); }); </script> <?php
function depotInfo($id) { //Gewinn berechnen und Anzahl der Aktien $depot = singleRowQuery("select guthaben, pos from depot WHERE id = '" . $id . "'"); $guthaben = $depot[0]; $rang = $depot[1]; //Depotname herausfinden $depotName = singleRowQuery("SELECT name FROM depot WHERE id = " . $_SESSION['depot']); $depotName = $depotName[0]; $alleAktien = 0; //wert von allen gekauften aktien $anzahlAktien = 0; //anzahl der Aktien $result = multiRowQuery("SELECT * FROM trade WHERE depotID = '" . $id . "' ORDER BY date ASC;"); while ($row = $result->fetch_assoc()) { $alleAktien = aktKurs($row["stockID"]) * $row["menge"] + $alleAktien; $anzahlAktien = $row["menge"] + $anzahlAktien; } $gewinn = round($guthaben + $alleAktien - 50000, 2); //letzes datum der statistik abufen $lastUpdateDate = singleRowQuery("SELECT date FROM `depotStats` ORDER BY date DESC LIMIT 0,1"); $lastUpdateDate = $lastUpdateDate[0]; //zum array hinzufügen $return["name"] = $depotName . " ( Ich )"; $return["id"] = $id; $return["menge"] = $anzahlAktien; $return["pos"] = $rang; $return["gewinn"] = $gewinn; $return["guthaben"] = $guthaben; $return["aktienWert"] = $alleAktien; return $return; }
$res = multiRowQuery("SELECT id FROM depot"); //Rang berechnung while ($row = $res->fetch_assoc()) { //für jedes depot $rang = singleRowQuery("SELECT count(`id`) as `pos` FROM `depotStats` \n\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `wert` >= (SELECT wert FROM `depotStats` WHERE HOUR(`date`) = HOUR('" . $updateDate . "') AND DAY(`date`) = DAY('" . $updateDate . "') AND MONTH(`date`) = MONTH('" . $updateDate . "')\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND YEAR(`date`) = YEAR('" . $updateDate . "') AND `depotID` = '" . $row["id"] . "' ) AND HOUR(`date`) = HOUR('" . $updateDate . "')\n\t\t\t\t\t\t\t \t\t\t\t\t\tAND DAY(`date`) = DAY('" . $updateDate . "') AND MONTH(`date`) = MONTH('" . $updateDate . "') AND YEAR(`date`) = YEAR('" . $updateDate . "') ; "); $rang = $rang[0]; mysqlQuery("UPDATE `depot` SET `pos` = '" . $rang . "' WHERE `id` = '" . $row["id"] . "'; "); } } //close if hourly //------------------------------- // Nur Täglich ausführen //------------------------------- if (intval(date("H")) == $_config["dailyUpdateHour"] and intval(date("i")) >= $_config["hourlyUpdateMin"] - 1 and intval(date("i")) < $_config["hourlyUpdateMin"] + 2) { //Strafgeld $res = multiRowQuery("SELECT id,guthaben FROM depot WHERE confirmed = '1';"); while ($row = $res->fetch_assoc()) { //für jedes depot $count = singleRowQuery("SELECT COUNT(id) FROM trade WHERE depotID = '" . $row["id"] . "'; "); $count = $count[0]; if ($count == 0) { $strafe = $row["guthaben"] * 2.0E-5; mysqlQuery("UPDATE `depot` SET `guthaben`= `guthaben` - '" . $strafe . "' WHERE `id` = '" . $row["id"] . "';"); } } unset($res); //alte freundschaftsanfragen $res = multiRowQuerry("SELECT * FROM friends"); while ($row = $res->fetch_assoc()) { $diff = date_diff(date_create($row["date"]), date_create(date("m.d.y"))); $diff_days = $diff->format('%a');
<div class="table-responsive"> <table class="table table-striped" id="myStocks"> <thead> <tr> <th>ID</th> <th>WP-Name</th> <th>DepotName</th> <th>DepotID</th> <th>Datum</th> <th></th> </tr> </thead> <tbody> <?php $res = multiRowQuery("SELECT id,wert,(SELECT name FROM depot WHERE depot.id = suggestions.depotID) as depotName, depotID, date FROM suggestions WHERE type = 'wertpapier'; "); while ($row = $res->fetch_assoc()) { ?> <tr id="sugg<?php echo $row["id"]; ?> "> <td><?php echo $row["id"]; ?> </td> <td><?php echo $row["wert"]; ?> </td> <td><?php
echo $error; ?> </div> <?php } ?> <div class="well well-lg"> <form method="post" action="index.php?p=buy"> <div class="form-group"> <label for="aktie">Wertpapier</label> <select class="form-control" id="aktie" name="aktie"> <?php $res = multiRowQuery("SELECT name,id,price FROM stocks WHERE price > 0 AND name <> '' ORDER BY name ASC;"); while ($row = $res->fetch_assoc()) { echo '<option value="' . $row["id"] . '" price="' . $row["price"] . '">' . $row["name"] . ' ( ' . $row["price"] . ' € )</option>'; } ?> </select> </div> <div class="form-group"> <label for="menge">Stückzahl <span id="calc"></span></label> <input type="number" class="form-control" id="menge" name="menge" required=""> </div> <div class="form-group"> <label for="type">Limit</label>