edit_form.php 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <?php
  2. $bill_box = new NTKVBox("bill_box", 0, 0, False);
  3. $customer_data = $customer->get($data[0][1]);
  4. $label = new NTKLabel("bill_label", "<b>Rechung: ".$data[0][5]."<br>".$customer_data[0][2]." ".$customer_data[0][3]."</b><br><br>");
  5. $bill_box->add($label);
  6. $bill_list = $bill_product->getByBillId($data[0][0]);
  7. $bill_pos_table = new NTKTable("", count($bill_list)+2, 7, False);
  8. $bill_pos_table->add(new NTKLabel("", "Produktnummer"), 0, 0,100);
  9. $bill_pos_table->add(new NTKLabel("", "Produkt"), 0, 1);
  10. $bill_pos_table->add(new NTKLabel("", "St&uuml;ck"), 0, 2,60);
  11. $bill_pos_table->add(new NTKLabel("", "Anmerkung"), 0, 3, 200);
  12. $bill_pos_table->add(new NTKLabel("", "Rabatt"), 0, 4, 60);
  13. $bill_pos_table->addFormRow("bill_product_form_new", "bill.php", 1, array(array('db_action','position_add'),array('bill_product_id',''),array('bill_id',$data[0][0]),array('action','edit'),array('from_page',$from_page),array('fp_tour_id',$fp_tour_id),array('fp_date',$fp_date)));
  14. $product_id_entry = new NTKEntry("product_id", "");
  15. $product_id_entry->addEvent("onkeyup","parent.frames['action'].location.href='action_product.php?form=bill_product_form_new&entry=product_id&next=amount&search='+this.value;");
  16. $onload .= "document.getElementById('product_id').focus();";
  17. $bill_pos_table->add($product_id_entry, 1, 0, 100);
  18. $bill_pos_table->add(new NTKLabel("", "&nbsp;"), 1, 1);
  19. $bill_pos_table->add(new NTKEntry("amount", ""), 1, 2, 60);
  20. $bill_pos_table->add(new NTKEntry("details", ""), 1, 3, 200);
  21. $bill_pos_table->add(new NTKEntry("rabatt", ""), 1, 4, 60);
  22. $bill_pos_table->add(new NTKButton("", "hinzuf&uuml;gen", "document.forms['bill_product_form_new'].submit();"), 1, 6);
  23. for($i = 0; $i < count($bill_list); $i++)
  24. {
  25. $product_data = $product->get($bill_list[$i][2]);
  26. $bill_pos_table->addFormRow("bill_product_form_".$bill_list[$i][0], "bill.php", $i+2, array(array('db_action','position_edit'),array('bill_product_id',$bill_list[$i][0]),array('bill_id',$bill_list[$i][1]),array('action','edit'),array('price',$bill_list[$i][6]),array('tax',$bill_list[$i][7]),array('from_page',$from_page),array('fp_tour_id',$fp_tour_id),array('fp_date',$fp_date)));
  27. $product_id_entry = new NTKEntry("product_id", $bill_list[$i][2]);
  28. $product_id_entry->addEvent("onkeyup","parent.frames['action'].location.href='action_product.php?form=bill_product_form_".$bill_list[$i][0]."&entry=product_id&next=amount&search='+this.value;");
  29. $bill_pos_table->add($product_id_entry, $i+2, 0, 100);
  30. $bill_pos_table->add(new NTKLabel("", $product_data[0][1]), $i+2, 1);
  31. $bill_pos_table->add(new NTKEntry("amount", $bill_list[$i][3]), $i+2, 2, 60);
  32. $bill_pos_table->add(new NTKEntry("details", $bill_list[$i][4]), $i+2, 3, 200);
  33. $bill_pos_table->add(new NTKEntry("rabatt", $bill_list[$i][5]), $i+2, 4, 60);
  34. $bill_pos_table->add(new NTKButton("", "ok", "document.forms['bill_product_form_".$bill_list[$i][0]."'].submit();"), $i+2, 5);
  35. $bill_pos_table->add(new NTKButton("", "l&ouml;schen", "if(confirm('Wirklich loeschen?')) location.href = 'bill.php?action=edit&bill_id=".$bill_list[$i][1]."&db_action=position_delete&bill_product_id=".$bill_list[$i][0]."&from_page=$from_page&fp_date=$fp_date&fp_tour_id=$fp_tour_id';"), $i+2, 6);
  36. }
  37. $main_box->add($bill_pos_table, -1, -1, "background-color: #dfe7f3; vertical-align: top;");
  38. $table = new NTKTable("table", 5, 4, False);
  39. if($data[0][5] == -1)
  40. {
  41. $number_label = new NTKLabel("", "Rechnungsnummer:");
  42. $table->add($number_label, 0, 0);
  43. $number_entry = new NTKButton("bill_number", "Nummer setzen", "location.href = 'bill.php?db_action=set_number&bill_id=".$data[0][0]."';");
  44. $table->add($number_entry, 0, 1, 150);
  45. }
  46. elseif($data[0][5] == -2)
  47. {
  48. $number_label = new NTKLabel("", "kommt von der Homepage", "color: #00ff00;");
  49. $table->add($number_label, 0, 0);
  50. }
  51. else
  52. {
  53. $number_label = new NTKLabel("", "Rechnungsnummer:");
  54. $table->add($number_label, 0, 0);
  55. $number_entry = new NTKLabel("bill_number", $data[0][5]);
  56. $table->add($number_entry, 0, 1, 150);
  57. }
  58. $date_label = new NTKLabel("", "Datum (2006-01-30):");
  59. $table->add($date_label, 1, 2);
  60. $date_entry = new NTKEntry("date", $data[0][3]);
  61. $table->add($date_entry, 1, 3);
  62. $customer_id_label = new NTKLabel("", "Kundennummer:");
  63. $table->add($customer_id_label, 1, 0);
  64. $customer_id_entry = new NTKEntry("customer_id", $data[0][1]);
  65. $customer_id_entry->addEvent("onkeyup", "parent.frames['action'].location.href='action_customer.php?form=bill_form&entry=customer_id&next=date&search='+this.value;");
  66. $table->add($customer_id_entry, 1, 1);
  67. $tour_id_label = new NTKLabel("", "Tour:");
  68. $table->add($tour_id_label, 2, 2);
  69. $tour_id_entry = new NTKComboBox("tour_id", $tour->get(), $data[0][2]);
  70. $table->add($tour_id_entry, 2, 3);
  71. $assistant_id_label = new NTKLabel("", "Mitarbeiter:");
  72. $table->add($assistant_id_label, 2, 0);
  73. if($data[0][5] == -1)
  74. {
  75. $assistant_id_entry = new NTKComboBox("assistant_id", $assistant->get(), $data[0][4]);
  76. $table->add($assistant_id_entry, 2, 1);
  77. }
  78. else
  79. {
  80. $assistant_id_entry = new NTKLabel("assistant_id", $data[0][4]);
  81. $table->add($assistant_id_entry, 2, 1, 150);
  82. }
  83. $delete_button = new NTKButton("delete", "L&ouml;schen", "if(confirm('Wirklich loeschen?')) location.href = 'bill.php?db_action=delete&bill_id=".$data[0][0]."&from_page=$from_page&fp_date=$fp_date&fp_tour_id=$fp_tour_id';");
  84. $table->add($delete_button, 4, 1);
  85. $cancel_button = new NTKButton("cancel", "Abbrechen", "location.href = 'bill.php';");
  86. $table->add($cancel_button, 4, 2);
  87. if($data[0][5] == -2)
  88. $submit_button = new NTKButton("submit", "Speichern/RechnungsNr. -1", "document.forms['bill_form'].submit();");
  89. else
  90. $submit_button = new NTKButton("submit", "Speichern", "document.forms['bill_form'].submit();");
  91. $table->add($submit_button, 4, 3);
  92. $form = new NTKForm("bill_form", "bill.php", $table);
  93. if($data[0][5] == -2)
  94. $form->addAttribute("bill_number", -1);
  95. else
  96. $form->addAttribute("bill_number", $data[0][5]);
  97. if($data[0][5] != -1)
  98. $form->addAttribute("assistant_id", $data[0][4]);
  99. $form->addAttribute("db_action", "edit");
  100. $form->addAttribute("bill_id", $data[0][0]);
  101. $form->addAttribute("from_page", $from_page);
  102. $form->addAttribute("fp_tour_id", $fp_tour_id);
  103. $form->addAttribute("fp_date", $fp_date);
  104. $main_box->add($form, -1, -1, "background-color: #dfe7f3; vertical-align: middle; align: center;");
  105. ?>