tour.php 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <?php
  2. require_once("util.php");
  3. require_once("NTK/NTK.php");
  4. require_once("../DataBase/Tour.php");
  5. require_once("../DataBase/Assistant.php");
  6. ?>
  7. <html>
  8. <head>
  9. <title> Index </title>
  10. <?php
  11. include("Modules/Tour/db_action.php");
  12. $main_box = new NTKVBox("main_box", 0, 0, False);
  13. $action = var_get_post("action", "");
  14. $tour_id = var_get_post("tour_id", "");
  15. $datum = var_get_post("date", "");
  16. // Toolbar
  17. $page = "tour";
  18. $printfile = "";
  19. if($action == "list_tour")
  20. $printfile = "print_tour.php?tour_id=".$tour_id."&date=".$datum;
  21. include("Modules/toolbar.php");
  22. // small Toolbar
  23. include("Modules/Tour/toolbar.php");
  24. // main content
  25. if($action == "new")
  26. {
  27. include("Modules/Tour/new_form.php");
  28. }
  29. elseif($action == "edit" && $tour_id != "")
  30. {
  31. $data = $tour->get($tour_id);
  32. include("Modules/Tour/edit_form.php");
  33. }
  34. elseif($action == "search" && var_post("search_entry", "") != "")
  35. {
  36. $search = var_post("search_entry", "");
  37. $list_view = new NTKListView("list_view", array('Tournummer','Bezeichner'), "location.href = 'tour.php?action=edit&tour_id=%0%';");
  38. $list_view->addLines($tour->get('', array('tour_id', 'name'), "tour_id LIKE '%$search%' OR name LIKE'%$search%'"));
  39. $main_box->add($list_view, -1, -1, "background-color: #dfe7f3; vertical-align: top;");
  40. }
  41. elseif($action == "list_tour")
  42. {
  43. $assistant = new Assistant();
  44. $tour = new Tour();
  45. $bill_box = new NTKHBox("bill_box", 0, 0);
  46. $bill_box->add(new NTKLabel("", "<b>Tournummer: ".$tour_id." - Datum: ".$datum."</b>"), False, False, "background-color: #dfe7f3;");
  47. $bill_box->add(new NTKLabel("", "Kundennummer:"), 150);
  48. $bill_box->add(new NTKEntry("customer_id", ""), 120);
  49. $bill_box->add(new NTKLabel("", "Mitarbeiter:"), 120);
  50. $bill_box->add(new NTKComboBox("assistant_id", $assistant->get()), 120);
  51. $bill_box->add(new NTKLabel("", "Tour:"), 80);
  52. $bill_box->add(new NTKComboBox("tour_id", $tour->get()), 120);
  53. $bill_box->add(new NTKButton("bill_button", "Erstelle Rechnung", "document.forms['bill_form'].submit();"), 200);
  54. $bill_form = new NTKForm("bill_form", "tour.php", $bill_box);
  55. $bill_form->addAttribute("db_action", "tour_to_bill");
  56. $bill_form->addAttribute("date", $datum);
  57. $bill_form->addAttribute("current_tour_id", $tour_id);
  58. $main_box->add($bill_form, 0, 0, "background-color: #dfe7f3; vertical-align: top;");
  59. $list_view = new NTKListView("list_view", array('Rechnungsnummer','Kunde'), "location.href = 'bill.php?from_page=tour&fp_tour_id=$tour_id&fp_date=".$datum."&action=edit&bill_id=%0%';");
  60. $list_view->addLines($bill->get('', array('bill_id', 'bill.customer_id'), "bill.tour_id='$tour_id' AND date='".$datum."'"));
  61. $main_box->add($list_view, -1, -1, "background-color: #dfe7f3; vertical-align: top;");
  62. }
  63. else
  64. {
  65. $list_view = new NTKListView("list_view", array('Tournummer','Bezeichner'), "location.href = 'tour.php?action=edit&tour_id=%0%';");
  66. $list_view->addLines($tour->get('', array('tour_id', 'name')));
  67. $main_box->add($list_view, -1, -1, "background-color: #dfe7f3; vertical-align: top;");
  68. }
  69. // main content
  70. $main_box->add($spacer, -1, -1, "background-color: #dfe7f3;");
  71. echo getHead();
  72. echo $main_box->getHtml();
  73. ?>
  74. </body>
  75. </html>