Ejemplo n.º 1
0
 function createBill()
 {
     $bill = new Bill();
     $customer = new Customer();
     $tour = new Tour();
     $bill_product = new Bill_Product();
     $customer_data = $customer->get($this->customer_id);
     if (count($customer_data) == 0) {
         echo "<div class=\"error\">Fehler in Session, bitte neu anmelden</div><br>\n";
         return -1;
     }
     $tour_data = $tour->getByAssistant($customer_data[0][12]);
     $bill_id = $bill->create("", array($this->customer_id, $customer_data[0][12], "", $tour_data[0][2], -2, time()));
     $list = $this->getItems();
     for ($i = 0; $i < count($list); $i++) {
         if ($list[$i][2] > 0) {
             $bill_product->create(array($bill_id, $list[$i][0], $list[$i][2], $list[$i][5], "", 0, 0, time()));
         }
     }
     return 0;
 }
Ejemplo n.º 2
0
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 . "';";
        }