This commit is contained in:
paoloar77
2024-07-22 11:37:56 +02:00
parent 9df0e3a51b
commit 550712acb6
4 changed files with 72 additions and 0 deletions

View File

@@ -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 = "<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 . '/setordine/' . $order->IdInternet . '/del/" target="_blank">ELIMINA!</a>' . $sep;
// $str .= getarraystr($product) . "<br>";
// $str .= $product;
$str .= '<br>';
}
} catch (\Exception $e) {
return "Errore: " . $e->getMessage();
}
return $str;
}
function getStructTable($tableName)
{
$str = '';

17
app/OrderdetailWeb.php Normal file
View File

@@ -0,0 +1,17 @@
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class OrderdetailWeb extends Model
{
//protected $connection = 'mysql_test';
protected $connection = 'sqlsrv_test';
protected $table = 'T_WEB_Ordini';
public $timestamps = false;
}

View File

@@ -54,6 +54,7 @@
<button type="button" data-action="inprevendita">Libri in Prevendita</button>
<button type="button" data-action="showOrdini">Mostra Ordini</button>
<button type="button" data-action="showOrdiniWeb">Mostra Ordini Web</button>
<button type="button" data-action="showDettOrdini">Dettaglio Ordini</button>
</form>
<div id="result"></div>

View File

@@ -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') {