diff --git a/app/CustomFuncPao.php b/app/CustomFuncPao.php index 4f5d8499..374f21b7 100644 --- a/app/CustomFuncPao.php +++ b/app/CustomFuncPao.php @@ -18,6 +18,7 @@ use Illuminate\Support\Facades\DB; use App\Orderdetail; use App\Services\ProductLogger; use App\Order as AppOrder; +use App\OrderdetailWeb; use App\OrderWeb as AppOrderWeb; use Illuminate\Support\Facades\Schema; @@ -524,6 +525,57 @@ function showOrdini() return $str; } +function showOrdiniWeb() +{ + $str = ""; + + + try { + + // $str = Schema::getColumnListing('Orderdetails'); + + $orders = OrderdetailWeb::orderBy('DataOra', 'desc') + ->take(5) + ->get(); + + $sep = ""; + + $baseUrl = Request::root(); // URL di base (dominio) + + // Show the fields of the orders + foreach ($orders as $order) { + $product = Product::where('sku', $order->CodArticoloGM)->first(); + + if ($product) + $titolo = "" . $product['name'] . ""; + else + $titolo = ""; + + $str .= getvalstr("", $order->Codice) . " "; + $str .= getvalstr("", $order->DataOra); + $str .= getvalstr("", $titolo); + $str .= getvalstr("Ordine", $order->IdInternet, true) . " "; + $str .= getvalstr("Articolo", $order->CodArticoloGM, true); + $str .= getvalstr("Prezzo", $order->PrezzoLordo); + $str .= getvalstr("Quantità", $order->Qta); + if ($order->PercSconto) + $str .= getvalstr("Sconto", $order->PercSconto); + if ($order->Descrizione) + $str .= getvalstr("Descr", $order->Descrizione); + + $str .= 'ELIMINA!' . $sep; + + // $str .= getarraystr($product) . "
"; + // $str .= $product; + $str .= '
'; + } + } catch (\Exception $e) { + return "Errore: " . $e->getMessage(); + } + + return $str; +} + function getStructTable($tableName) { $str = ''; diff --git a/app/OrderdetailWeb.php b/app/OrderdetailWeb.php new file mode 100644 index 00000000..db7e4150 --- /dev/null +++ b/app/OrderdetailWeb.php @@ -0,0 +1,17 @@ +Libri in Prevendita +
diff --git a/routes/web.php b/routes/web.php index 2072dd62..b4a15e4a 100644 --- a/routes/web.php +++ b/routes/web.php @@ -6192,6 +6192,8 @@ Route::get('/handle-article-action-pao/{id}/{action}', function ($id, $action) { return libriInPrevendita(); } elseif ($action == 'showOrdini') { return showOrdini(); + } elseif ($action == 'showOrdiniWeb') { + return showOrdiniWeb(); } elseif ($action == 'setOrdine') { return setOrdine($id, ''); } elseif ($action == 'showDettOrdini') {