function index_delete() { $models = json_decode($this->delete('models')); foreach ($models as $value) { $obj = new Bill(null, $this->entity); $obj->get_by_id($value->id); $data["results"][] = array("data" => $value, "status" => $obj->delete()); } $data["count"] = count($data["results"]); //Response data $this->response($data, 200); }
<?php # controllers/deletebill.php # Logic Auth::kickout_non_admin('/'); $bill = new Bill(); $bill->load(Route::param('id')); $bill->delete(); $accounts = new Accounts_Collection(); $accounts->where('bill_id', $bill->id); $accounts->get(); foreach ($accounts->items as $account) { $account->delete(); } # Redirect URL::redirect('/admin');
$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 {