| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- <?php
- require_once("DataBase/Bill.php");
- require_once("DataBase/Bill_Product.php");
- require_once("DataBase/Tour.php");
- require_once("DataBase/Assistant.php");
- require_once("DataBase/Product.php");
- require_once("DataBase/Customer.php");
- require_once("DataBase/Price.php");
- require_once("DataBase/Tax.php");
- $db_action = var_get_post("db_action", "");
- $bill = new Bill();
- $tour = new Tour();
- $assistant = new Assistant();
- $bill_product = new Bill_Product();
- $product = new Product();
- $customer = new Customer();
- $price = new Price();
- $tax = new Tax();
- switch($db_action)
- {
- case "new":
- $customer_data = $customer->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;
- }
- ?>
|