<?php $id = $_GET["id"]; require "../menu.php"; $db = new ArticoliDb(".."); $result = $db->query("SELECT * FROM oggettiordinati WHERE id_ordine='{$id}'"); echo '<table class="table"> <thead> <tr> <th>Oggetto</th> <th>Taglia</th> <th>Quantità</th> </tr> </thead> <tbody>'; while ($row = $result->fetchArray()) { echo "<tr>"; echo "<td>" . $row[1] . "</td>"; echo "<td>" . $row[2] . "</td>"; echo "<td>" . $row[3] . "</td>"; echo "</tr>"; } echo "\t</tbody>\n </table>";
<?php //ordini (id INTEGER PRIMARY KEY UNIQUE, data INT, nome TEXT, email TEXT, branca TEXT, telefono INT, totale REAL, pagamento TEXT, saldato INT, consegnato INT) require "../menu.php"; require "../mail_config.php"; $db = new ArticoliDb(".."); $orderedItems = $db->getAllOrderItem(); $ordiniInSospeso = $db->query("SELECT * FROM ordini WHERE saldato = 0 AND consegnato = 0 ORDER BY id"); $ordiniDaConsegnare = $db->query("SELECT * FROM ordini WHERE saldato = 1 AND consegnato = 0 ORDER by id"); ?> <script> function a_onClick(obj) { $orderId = obj.attr('id'); console.log($orderId) $("#TitoloModale").html("Dettagli ordine #".concat($orderId)); $.ajax( {url: "getItems.php?id=".concat($orderId), success: function(result){ $("#tabella").html(result); } } ); $('#modale').modal('show'); } </script> </head> <div class="container"> <h2>Ordini Da Saldare</h2> <p>Ordini in sospeso in attesa di essere saldati</p>
<?php //ordini (id INTEGER PRIMARY KEY UNIQUE, data INT, nome TEXT, email TEXT, branca TEXT, telefono INT, totale REAL, pagamento TEXT, saldato INT, consegnato INT) require "../menu.php"; require "../mail_config.php"; $db = new ArticoliDb(".."); $orderedItems = $db->getAllOrderItem(); $ordiniConclusi = $db->query("SELECT * FROM ordini WHERE saldato = 1 AND consegnato = 1 ORDER BY id"); ?> <div class="container"> <h2>Ordini già consegnati</h2> <p>Ordini conclusi che possono essere rimossi dalla base</p> <table class="table table-striped"> <thead> <tr> <th>ID</th> <th>Data</th> <th>Nome</th> <th>eMail</th> <th>Branca</th> <th>Telefono</th> <th>Totale</th> <th>Pagamento</th> <th></th> </tr> </thead> <tbody> <form action="deleteOrders.php" method="POST"> <?php while ($row = $ordiniConclusi->fetchArray()) { ?>
Query: <input type="text" name="item2"><br/> <input type="submit" name="submit2" value="INVIA"/> </form> <?php if (isset($_POST["submit"])) { $taglie = explode(",", $_POST["taglie"]); $db->addItem($_POST["item"], str_replace(",", ".", $_POST["prezzo"]), str_replace("'", "%27", $_POST["descrizione"]), $taglie); echo $_POST["item"] . " aggiunto correttamente"; } if (isset($_POST["submit1"])) { $db->removeItem($_POST["item1"]); echo $_POST["item1"] . " rimosso correttamente"; } if (isset($_POST["submit2"])) { $result = $db->query($_POST["item2"]); echo "<table>"; while ($row = $result->fetchArray()) { echo "<tr>"; for ($i = 0; $i < count($row) / 2; $i++) { if ($row[$i] == "") { echo "<td>-</td>"; } else { echo "<td>| " . $row[$i] . " </td>"; } } echo "</tr>"; } echo "</table>"; } ?>
<?php require "../menu.php"; $db = new ArticoliDb(".."); $result = $db->query("SELECT oggetto, taglia, sum(quantity) FROM oggettiordinati, ordini WHERE ordini.id = oggettiordinati.id_ordine AND ordini.saldato=1 AND ordini.consegnato=0 GROUP BY oggetto, taglia"); echo '<table class="table"> <thead> <tr> <th>Oggetto</th> <th>Taglia</th> <th>Quantità</th> </tr> </thead> <tbody>'; while ($row = $result->fetchArray()) { echo "<tr>"; echo "<td>" . $row[0] . "</td>"; echo "<td>" . $row[1] . "</td>"; echo "<td>" . $row[2] . "</td>"; echo "</tr>"; } echo "\t</tbody>\n\t</table>";