get($data[0][1]); $label = new NTKLabel("bill_label", "Rechung: ".$data[0][5]."
".$customer_data[0][2]." ".$customer_data[0][3]."


"); $bill_box->add($label); $bill_list = $bill_product->getByBillId($data[0][0]); $bill_pos_table = new NTKTable("", count($bill_list)+2, 7, False); $bill_pos_table->add(new NTKLabel("", "Produktnummer"), 0, 0,100); $bill_pos_table->add(new NTKLabel("", "Produkt"), 0, 1); $bill_pos_table->add(new NTKLabel("", "Stück"), 0, 2,60); $bill_pos_table->add(new NTKLabel("", "Anmerkung"), 0, 3, 200); $bill_pos_table->add(new NTKLabel("", "Rabatt"), 0, 4, 60); $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))); $product_id_entry = new NTKEntry("product_id", ""); $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;"); $onload .= "document.getElementById('product_id').focus();"; $bill_pos_table->add($product_id_entry, 1, 0, 100); $bill_pos_table->add(new NTKLabel("", " "), 1, 1); $bill_pos_table->add(new NTKEntry("amount", 0), 1, 2, 60); $bill_pos_table->add(new NTKEntry("details", ""), 1, 3, 200); $bill_pos_table->add(new NTKEntry("rabatt", 0), 1, 4, 60); $bill_pos_table->add(new NTKButton("", "hinzufügen", "document.forms['bill_product_form_new'].submit();"), 1, 6); for($i = 0; $i < count($bill_list); $i++) { $product_data = $product->get($bill_list[$i][2]); $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))); $product_id_entry = new NTKEntry("product_id", $bill_list[$i][2]); $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;"); $bill_pos_table->add($product_id_entry, $i+2, 0, 100); $bill_pos_table->add(new NTKLabel("", $product_data[0][1]), $i+2, 1); $bill_pos_table->add(new NTKEntry("amount", $bill_list[$i][3]), $i+2, 2, 60); $bill_pos_table->add(new NTKEntry("details", $bill_list[$i][4]), $i+2, 3, 200); $bill_pos_table->add(new NTKEntry("rabatt", $bill_list[$i][5]), $i+2, 4, 60); $bill_pos_table->add(new NTKButton("", "ok", "document.forms['bill_product_form_".$bill_list[$i][0]."'].submit();"), $i+2, 5); $bill_pos_table->add(new NTKButton("", "lö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); } $main_box->add($bill_pos_table, -1, -1, "background-color: #dfe7f3; vertical-align: top;"); $table = new NTKTable("table", 5, 4, False); if($data[0][5] == -1) { $number_label = new NTKLabel("", "Rechnungsnummer:"); $table->add($number_label, 0, 0); $number_entry = new NTKButton("bill_number", "Nummer setzen", "location.href = 'bill.php?db_action=set_number&bill_id=".$data[0][0]."';"); $table->add($number_entry, 0, 1, 150); } elseif($data[0][5] == -2) { $number_label = new NTKLabel("", "kommt von der Homepage", "color: #00ff00;"); $table->add($number_label, 0, 0); } else { $number_label = new NTKLabel("", "Rechnungsnummer:"); $table->add($number_label, 0, 0); $number_entry = new NTKLabel("bill_number", $data[0][5]); $table->add($number_entry, 0, 1, 150); } $date_label = new NTKLabel("", "Datum (2006-01-30):"); $table->add($date_label, 1, 2); $date_entry = new NTKEntry("date", $data[0][3]); $table->add($date_entry, 1, 3); $customer_id_label = new NTKLabel("", "Kundennummer:"); $table->add($customer_id_label, 1, 0); $customer_id_entry = new NTKEntry("customer_id", $data[0][1]); $customer_id_entry->addEvent("onkeyup", "parent.frames['action'].location.href='action_customer.php?form=bill_form&entry=customer_id&next=date&search='+this.value;"); $table->add($customer_id_entry, 1, 1); $tour_id_label = new NTKLabel("", "Tour:"); $table->add($tour_id_label, 2, 2); $tour_id_entry = new NTKComboBox("tour_id", $tour->get(), $data[0][2]); $table->add($tour_id_entry, 2, 3); $assistant_id_label = new NTKLabel("", "Mitarbeiter:"); $table->add($assistant_id_label, 2, 0); if($data[0][5] == -1) { $assistant_id_entry = new NTKComboBox("assistant_id", $assistant->get(), $data[0][4]); $table->add($assistant_id_entry, 2, 1); } else { $assistant_id_entry = new NTKLabel("assistant_id", $data[0][4]); $table->add($assistant_id_entry, 2, 1, 150); } $delete_button = new NTKButton("delete", "Lö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';"); $table->add($delete_button, 4, 1); $cancel_button = new NTKButton("cancel", "Abbrechen", "location.href = 'bill.php';"); $table->add($cancel_button, 4, 2); if($data[0][5] == -2) $submit_button = new NTKButton("submit", "Speichern/RechnungsNr. -1", "document.forms['bill_form'].submit();"); else $submit_button = new NTKButton("submit", "Speichern", "document.forms['bill_form'].submit();"); $table->add($submit_button, 4, 3); $form = new NTKForm("bill_form", "bill.php", $table); if($data[0][5] == -2) $form->addAttribute("bill_number", -1); else $form->addAttribute("bill_number", $data[0][5]); if($data[0][5] != -1) $form->addAttribute("assistant_id", $data[0][4]); $form->addAttribute("db_action", "edit"); $form->addAttribute("bill_id", $data[0][0]); $form->addAttribute("from_page", $from_page); $form->addAttribute("fp_tour_id", $fp_tour_id); $form->addAttribute("fp_date", $fp_date); $main_box->add($form, -1, -1, "background-color: #dfe7f3; vertical-align: middle; align: center;"); ?>