aa
This commit is contained in:
@@ -472,57 +472,25 @@ function loadArticleByIdArticle($id, $checkprevendita = false, $checkqtanegativa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function showOrdini()
|
function showOrdini()
|
||||||
{
|
{
|
||||||
$str = "";
|
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
$baseUrl = request()->root();
|
||||||
|
|
||||||
// $str = Schema::getColumnListing('Orderdetails');
|
$orders = Orderdetail::with(['product' => function($query) {
|
||||||
|
$query->select('sku', 'name', 'permalink');
|
||||||
$orders = Orderdetail::orderBy('DataOra', 'desc')
|
}])
|
||||||
|
->select('Codice', 'DataOra', 'IdInternet', 'CodArticoloGM', 'PrezzoLordo', 'Qta', 'PercSconto', 'Descrizione')
|
||||||
|
->orderBy('DataOra', 'desc')
|
||||||
->take(5)
|
->take(5)
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
$sep = "";
|
return view('ordini', compact('orders', 'baseUrl'))->render();
|
||||||
|
|
||||||
$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 = "<a href='" . $product['permalink'] . "' target='_blank'><span style='font-weigth: bold;'>" . $product['name'] . "</span></a>";
|
|
||||||
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 .= '<a href="' . $baseUrl . 'apimacro/public/setordine/' . $order->IdInternet . '/del/" target="_blank">ELIMINA!</a>' . $sep;
|
|
||||||
|
|
||||||
// $str .= getarraystr($product) . "<br>";
|
|
||||||
// $str .= $product;
|
|
||||||
$str .= '<br>';
|
|
||||||
}
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return "Errore: " . $e->getMessage();
|
return "Errore: " . $e->getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $str;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function setOrdine($idinternet, $mode)
|
function setOrdine($idinternet, $mode)
|
||||||
{
|
{
|
||||||
$str = "";
|
$str = "";
|
||||||
|
|||||||
25
resources/views/ordini.blade.php
Normal file
25
resources/views/ordini.blade.php
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
@foreach($orders as $order)
|
||||||
|
@php
|
||||||
|
$product = $order->product;
|
||||||
|
$titolo = $product
|
||||||
|
? "<a href='{$product->permalink}' target='_blank'><span style='font-weight: bold;'>{$product->name}</span></a>"
|
||||||
|
: "";
|
||||||
|
@endphp
|
||||||
|
|
||||||
|
{{ getvalstr("", $order->Codice) }}
|
||||||
|
{{ getvalstr("", $order->DataOra) }}
|
||||||
|
{{ getvalstr("", $titolo) }}
|
||||||
|
{{ getvalstr("Ordine", $order->IdInternet, true) }}
|
||||||
|
{{ getvalstr("Articolo", $order->CodArticoloGM, true) }}
|
||||||
|
{{ getvalstr("Prezzo", $order->PrezzoLordo) }}
|
||||||
|
{{ getvalstr("Quantità", $order->Qta) }}
|
||||||
|
@if($order->PercSconto)
|
||||||
|
{{ getvalstr("Sconto", $order->PercSconto) }}
|
||||||
|
@endif
|
||||||
|
@if($order->Descrizione)
|
||||||
|
{{ getvalstr("Descr", $order->Descrizione) }}
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<a href="{{ $baseUrl }}apimacro/public/setordine/{{ $order->IdInternet }}/del/" target="_blank">ELIMINA!</a>
|
||||||
|
<br>
|
||||||
|
@endforeach
|
||||||
Reference in New Issue
Block a user