fixed kilo in metals 3

This commit is contained in:
2026-06-23 21:28:49 +03:30
parent 6c15ff1830
commit f271df9cd6
2 changed files with 100 additions and 2 deletions
+30 -2
View File
@@ -5,26 +5,54 @@ namespace App\Http\Controllers\Admin;
use App\DB\Te\TableEngine;
use App\Http\Controllers\Controller;
use App\Models\Order;
use App\Services\BalanceReportService;
use Illuminate\Http\Request;
class OrderController extends Controller
{
public function table(Request $request){
$records = Order::with(['customer','transactions']);
$balanceReport = app(BalanceReportService::class);
$records = Order::with([
'customer',
'transactions.product:id,title,unit,metal_id,group_type,amount,trade_by_quantity,direct_price',
]);
TableEngine::create($records, $request->all())
->initSearch(['customer.name'])
->select([
'*',Order::$SELECT_STS_STR
])->export($records);
if (isset($records['rows'])) {
foreach ($records['rows'] as &$row) {
$balanceReport->enrichOrderTableRow($row);
}
unset($row);
}
return response()->json($records);
}
public function singleOrderTable(Request $request){
$records = Order::with(['customer'])->where('type',2);
$balanceReport = app(BalanceReportService::class);
$records = Order::with([
'customer',
'transactions.product:id,title,unit,metal_id,group_type,amount,trade_by_quantity,direct_price',
])->where('type',2);
TableEngine::create($records, $request->all())
->initSearch(['customer.name'])
->select([
'*',Order::$SELECT_STS_STR
])->export($records);
if (isset($records['rows'])) {
foreach ($records['rows'] as &$row) {
$balanceReport->enrichOrderTableRow($row);
}
unset($row);
}
return response()->json($records);
}
}