fixed kilo in metals 3
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user