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 . "';";
     }