require_once "DataBase/Bill.php"; require_once "DataBase/Assistant.php"; require_once "DataBase/Bill_Product.php"; $db_action = var_get_post("db_action", ""); $tour = new Tour(); $bill = new Bill(); $assistant = new Assistant(); switch ($db_action) { case "new": $tour->create(array(var_post("name", ""), var_post("assistant_id", ""))); break; case "edit": $tour->update(var_post("tour_id", ""), array(var_post("name", ""), var_post("assistant_id", ""))); break; case "delete": $tour->delete(var_get("tour_id", "")); break; case "tour_to_bill": $tour = new Tour(); $tmp = $tour->get(var_get("tour_id", "")); $tour_data = $tmp[0]; $bill = new Bill(); $new_bill_id = $bill->create('', array(var_post("customer_id", ""), var_post("tour_id", ""), var_post("date", ""), var_post("assistant_id", ""), -1, 0)); $bill_product = new Bill_Product(); $product = new Product(); $product_data = $product->get(); $result = $bill_product->getTourZusammenfassung(var_post("current_tour_id", ""), var_post("date", "")); for ($i = 0; $i < count($result); $i++) { $bill_product->create(array($new_bill_id, $result[$i][0], $result[$i][2], '', '', '', '')); } break;