public function sales(Request $request) { $customers = customer::all(); $loadMain = loadMain::where('status', 'ACTIVE')->where('vehicle_id', $request->input('id'))->first(); $id = $loadMain->id; $products = DB::select(DB::raw("Select A.*,\n (Select CONCAT((Select C.product_name FROM `products` C where C.id = X.pro_id),'-',X.sub_name)\n as name FROM `sub_products` X where X.id = A.sub_product_id) as sub_name,\n (Select B.price From `sub_products` B where B.id = A.sub_product_id ) as price\n\n from `load_items` A where A.load_main_id = '{$id}'")); return view('Sales.sales')->with('customers', $customers)->with('products', $products)->with('loadid', $id); }
public function history_view(Request $request) { $id = $request->input('id'); $loadMain = loadMain::find($id); $vehicle = vehicle::find($loadMain->vehicle_id); $loadItems = DB::select(DB::raw("Select A.*,\n (SELECT CONCAT( (SELECT C.product_name FROM `products` C where C.id = B.pro_id), '-',B.sub_name) FROM `sub_products` B where B.id = A.sub_product_id) as pro_name\n from `load_items` A where A.load_main_id ='{$id}'")); return view('LoadUnload.historyview')->with('vehicle', $vehicle)->with('loadMain', $loadMain)->with('loadItems', $loadItems); }