get(var_post("customer_id", "")); if(count($customer_data) > 0) { $tour_data = $tour->getByAssistant($customer_data[0][12]); if(count($tour_data) > 0) { $bill_id = $bill->create(var_post("bill_id", ""), array(var_post("customer_id", ""), $customer_data[0][12], var_post("date", ""), $tour_data[0][2], -1, 0)); } else { $bill_id = $bill->create(var_post("bill_id", ""), array(var_post("customer_id", ""), $customer_data[0][12], var_post("date", ""), 1, -1, 0)); } } else $bill_id = $bill->create(var_post("bill_id", ""), array(var_post("customer_id", ""), '', var_post("date", ""), var_post("assistant_id", "1"), -1, 0)); $action = "edit"; break; case "edit": $bill->update(var_post("bill_id", ""), array(var_post("customer_id", ""), var_post("tour_id", ""), var_post("date", ""), var_post("assistant_id", ""), var_post("bill_number", ""))); if($fp_tour_id != "") $onload .= "location.href = 'tour.php?action=list_tour&tour_id=".$fp_tour_id."&date=".$fp_date."';"; break; case "set_number": $bill->setNumber(var_get("bill_id", "")); $bill_product->fix(var_get("bill_id", "")); global $onload; $onload .= "window.open('print_bill.php?bill_id=".var_get("bill_id", "")."', '', '');"; break; case "delete": $bill->delete(var_get("bill_id", "")); if($fp_tour_id != "") $onload .= "location.href = 'tour.php?action=list_tour&tour_id=".$fp_tour_id."&date=".$fp_date."';"; break; case "position_add": $bill_data = $bill->get(var_post("bill_id", "")); /* autoset anmerkung vom produkt, wenn nichts als anmerkung gegeben */ $details = var_post("details", ""); if($details == "") { $product_data = $product->get(var_post("product_id", "")); $details = $product_data[0][8]; } if($bill_data[0][5] == -1) $bill_product->create(array(var_post("bill_id", ""), var_post("product_id", ""), var_post("amount", ""), $details, var_post("rabatt", ""), 0, 0)); else { $customer_data = $customer->get($bill_data[0][1]); $price_data = $price->getPrice($customer_data[0][11], var_post("product_id", "")); $product_data = $product->get(var_post("product_id", "")); $tax_data = $tax->get($product_data[0][4]); $bill_product->create(array(var_post("bill_id", ""), var_post("product_id", ""), var_post("amount", ""), $details, var_post("rabatt", ""), $price_data[0][3], $tax_data[0][2])); } break; case "position_delete": $bill_product->delete(var_get("bill_product_id", "")); break; case "position_edit": $bill_product->update(var_post("bill_product_id", ""), array(var_post("bill_id", ""), var_post("product_id", ""), var_post("amount", ""), var_post("details", ""), var_post("rabatt", ""), var_post("price", ""), var_post("tax", ""))); break; } ?>