function orders_delete($start_data) { global $tpl; $id = (int) $start_data['id']; $ord = new order($id); if (!$ord->data['deleted'] && $ord->data['printed'] && $ord->data['dishid'] != SERVICE_ID) { if ($err = print_ticket($id, true)) { return $err; } } if (CONF_DEBUG_DONT_DELETE) { return 0; } // was as follows, but it's better to never delete an order if the table is still open if ($ord->data['dishid'] != SERVICE_ID) { $start_data['deleted'] = 1; $start_data['paid'] = 1; $start_data['suspend'] = 0; $start_data['printed'] = '0000-00-00 00:00:00'; $start_data['price'] = 0; $err = orders_update($start_data); } else { // insert all the modules interfaces for order creation here toplist_delete($ord->data['dishid'], $ord->data['quantity']); if (class_exists('stock_object')) { $stock = new stock_object(); $stock->silent = true; $stock->remove_from_waiter($id, 0); } $err = $ord->delete(); } unset($ord); return $err; }
$handle->bindParam(':comment', $prenote->cotizationNumber); $handle->bindValue(':type_description', 'Venta'); $handle->bindParam(':workstation', $prenote->terminal); $handle->bindParam(':customer_id', $prenote->customerUUID); $handle->bindValue(':id', '0', PDO::PARAM_INT); $handle->bindParam(':store_id', $prenote->store_id, PDO::PARAM_INT); $handle->execute(); save_products($link, $prenote_uuid, $prenote->product, $prenote->id_employee, $lastUpdate); $link->commit(); $prenote->folio = $code; $saved = true; } else { $terminalCode = ord($prenote->terminal); generate_barcode(false, $prenote->folio, $terminalCode); $saved = true; } for ($i = 0; $i < $print_times; $i++) { $isPrinted = print_ticket($prenote); } if ($isPrinted == true) { unlink($prenote->folio . ".png"); unlink($prenote->folio . ".pdf"); $printed = true; } echo json_encode(array($saved, $printed, $prenote)); } } catch (PDOException $ex) { error_log($ex->getMessage()); //print($ex->getMessage()); echo json_encode(array($saved, $printed, $prenote)); }