Repository für MDT5/2 Praktikum
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

HtmlPage.html 3.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <html>
  2. <head>
  3. <meta http-equiv="content-type" content="text/html; charset=utf-8">
  4. <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
  5. <title>Joorgportal</title>
  6. <!-- Bootstrap -->
  7. <link href="../includes/bootstrap/css/bootstrap.min.css" rel="stylesheet">
  8. <script type="text/javascript" src="../data/kaufort.json"></script>
  9. <script type="text/javascript" src="get.js"></script>
  10. </head>
  11. <body>
  12. <h3>Einkaufsliste</h3>
  13. <form name="auswahl" method="GET" action="einkaufsliste.html">
  14. <a href="../index.html" class="btn btn-primary btn-sm active" role="button">Menü</a>
  15. <a href="import.html" class="btn btn-primary btn-sm active" role="button">Import</a>
  16. <a href="showjson.html" class="btn btn-primary btn-sm active" role="button">showjson</a>
  17. <script type="text/javascript">
  18. var einkaufsliste = JSON.parse(localStorage.getItem("einkaufsliste"));
  19. var AnzDaten = einkaufsliste.daten.length + 1;
  20. document.write('<a href="update.html?id=' + AnzDaten + '" class="btn btn-primary btn-sm active" role="button">Einfügen</a> ');
  21. document.write('<label>Kaufort: </label>');
  22. document.write('<select name="kaufort">');
  23. kaufort.daten.forEach(function (entry) {
  24. sfldbez = entry.fldbez;
  25. lfldbez = liste['kaufort'];
  26. if (sfldbez == lfldbez) {
  27. document.write(' <option selected>' + sfldbez + '</option>');
  28. } else {
  29. document.write(' <option>' + sfldbez + '</option>');
  30. }
  31. });
  32. document.write('</select>');
  33. </script>
  34. <input type="submit" value="Go!">
  35. </form>
  36. <table class="table">
  37. <th>Bezeichnung</th>
  38. <th>Kaufort</th>
  39. <th>Anz</th>
  40. <th>E-Preis</th>
  41. <th>G-Preis</th>
  42. <script type="text/javascript">
  43. //var mydata = JSON.parse(stadtbezirk);
  44. var sumpreis = 0;
  45. var id = 0;
  46. einkaufsliste.daten.forEach(function (entry) {
  47. id = id + 1;
  48. sfldbez = entry.fldBez;
  49. sfldkaufort = entry.fldOrt;
  50. lfldbez = liste['kaufort'];
  51. lweiter = false;
  52. if (sfldkaufort == lfldbez) {
  53. lweiter = true;
  54. }
  55. if (lfldbez == "(ohne)") {
  56. lweiter = true;
  57. }
  58. if (!lfldbez) {
  59. lweiter = true;
  60. }
  61. if (lweiter) {
  62. sAnz = Number(entry.fldAnz);
  63. //sfldpreis=entry.fldPreis;
  64. sfldpreis = Number(entry.fldPreis);
  65. gespreis = sfldpreis * sAnz;
  66. sumpreis = sumpreis + gespreis;
  67. document.write("<tr><td>" + sfldbez + "</td><td>" + sfldkaufort + "</td><td>" + sAnz + "</td><td>" + sfldpreis.toFixed(2) + "</td><td align='right'>" + gespreis.toFixed(2) + "</td>");
  68. document.write("<td><a href='update.html?id=" + id + "' class='btn btn-primary btn-sm active' role='button'>U</a></td>");
  69. document.write("<td><a href='delete.html?id=" + id + "' class='btn btn-primary btn-sm active' role='button'>D</a></td></tr>");
  70. }
  71. });
  72. document.write("<tr><td></td><td></td><td></td><td></td><td align='right'>" + sumpreis.toFixed(2) + "</td></tr>");
  73. // document.write("len="+einkaufsliste.daten.length);
  74. </script>
  75. </table>
  76. </body>
  77. </html>