bill.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. require_once("util.php");
  3. require_once("NTK/NTK.php");
  4. ?>
  5. <html>
  6. <head>
  7. <title> Index </title>
  8. <?php
  9. $action = var_get_post("action", "");
  10. $bill_id = var_get_post("bill_id", "");
  11. $from_page = var_get_post("from_page", "");
  12. $fp_tour_id = var_get_post("fp_tour_id", "");
  13. $fp_date = var_get_post("fp_date", "");
  14. include("Modules/Bill/db_action.php");
  15. $main_box = new NTKVBox("main_box", 0, 0, False);
  16. // Toolbar
  17. $page = "bill";
  18. $printfile = "";
  19. if($action == "edit" && $bill_id != "")
  20. $printfile = "print_bill.php?bill_id=".$bill_id;
  21. include("Modules/toolbar.php");
  22. // small Toolbar
  23. include("Modules/Bill/toolbar.php");
  24. // main content
  25. $onload .= "document.getElementById('search_entry').focus();";
  26. if($action == "new")
  27. {
  28. include("Modules/Bill/new_form.php");
  29. }
  30. elseif($action == "edit" && $bill_id != "")
  31. {
  32. $data = $bill->get($bill_id);
  33. $edit_action = var_get_post("edit_action", "");
  34. include("Modules/Bill/edit_form.php");
  35. }
  36. elseif($action == "search" && var_post("search_entry", "") != "")
  37. {
  38. $search = var_post("search_entry", "");
  39. $list_view = new NTKListView("list_view", array('ID', 'Rechnungsnummer', 'Kunde','Tour'), "location.href = 'bill.php?action=edit&bill_id=%0%';");
  40. $results = $bill->get('', array('bill_id', 'bill_number', 'customer.prename', 'bill.tour_id'), "customer.prename LIKE '%$search%' OR bill_number LIKE '%$search%' OR bill.customer_id LIKE'%$search%' OR bill.tour_id LIKE '%$search%'");
  41. if(count($results) == 1)
  42. $onload = "location.href = 'bill.php?action=edit&bill_id=".$results[0][0]."';";
  43. $list_view->addLines($results);
  44. $main_box->add($list_view, -1, -1, "background-color: #dfe7f3; vertical-align: top;");
  45. }
  46. else
  47. {
  48. /* $list_view = new NTKListView("list_view", array('ID', 'Rechnungsnummer','Kunde','Tour'), "location.href = 'bill.php?action=edit&bill_id=%0%';");
  49. $list_view->addLines($bill->get('', array('bill_id', 'bill_number', 'customer.prename', 'bill.tour_id')));
  50. $main_box->add($list_view, -1, -1, "background-color: #dfe7f3; vertical-align: top;");*/
  51. $main_box->add(new NTKSpacer(), -1, -1);
  52. }
  53. // main content
  54. //$main_box->add($spacer, -1, -1, "background-color: #dfe7f3;");
  55. echo getHead();
  56. echo $main_box->getHtml();
  57. ?>
  58. </body>
  59. </html>