/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $this->rem_ses(''); $locations = Location::all(); return view('location.index')->with('location', $locations); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function search() { // ok if (Input::get('option_group') === 'all' and Input::get('option_items') === 'items') { $code = Input::get('code'); $invReports = Item::where('barcode', '=', $code)->get(); $loc_id = Item::select('fk_location')->where('barcode', '=', $code)->value('fk_location'); $group_id = Item::select('fk_cat')->where('barcode', '=', $code)->value('fk_cat'); $locReports = Location::where('id', '=', $loc_id)->get(); $groupReports = ItemGroup::where('id', '=', $group_id)->get(); // $this->set_cart($invReports); // return view('report.stock_items')->with('invReport',$invReports); $this->set_cart($invReports); $this->set_group($groupReports); $this->set_location($locReports); $items = Session::get('items'); $group = Session::get('group'); $location = Session::get('location'); return PDF::loadView('report/pdf', array('items' => $items, 'group' => $group, 'location' => $location))->setPaper('a4')->setOrientation('landscape')->setWarnings(false)->save(public_path() . '/pdf/' . 'laporan_stok_barang.pdf')->stream('Laporan Stok Barang.pdf'); } elseif (Input::get('option_group') === 'all' and Input::get('option_items') === 'item_group') { $loc_cat = ItemGroup::select('id')->where('code', '=', Input::get('group'))->value('id'); $groupReports = ItemGroup::where('code', '=', Input::get('group'))->get(); $locReports = Location::all(); $invReports = Item::where('fk_cat', '=', $loc_cat)->get(); // $this->set_cart($invReports); // return view('report.stock_items')->with('invReport',$invReports); $this->set_cart($invReports); $this->set_group($groupReports); $this->set_location($locReports); $items = Session::get('items'); $group = Session::get('group'); $location = Session::get('location'); return PDF::loadView('report/pdf', array('items' => $items, 'group' => $group, 'location' => $location))->setPaper('a4')->setOrientation('landscape')->setWarnings(false)->save(public_path() . '/pdf/' . 'laporan_stok_barang.pdf')->stream('Laporan Stok Barang.pdf'); } elseif (Input::get('option_group') === 'location' and Input::get('option_items') === 'all') { $locReports = Location::where('code', '=', Input::get('location'))->get(); $loc_id = Location::select('id')->where('code', '=', Input::get('location'))->value('id'); $invReports = Item::where('fk_location', '=', $loc_id)->get(); $groupReports = ItemGroup::all(); // $this->set_cart($invReports); // return view('report.stock_items')->with('invReport',$invReports); $this->set_cart($invReports); $this->set_group($groupReports); $this->set_location($locReports); $items = Session::get('items'); $group = Session::get('group'); $location = Session::get('location'); return PDF::loadView('report/pdf', array('items' => $items, 'group' => $group, 'location' => $location))->setPaper('a4')->setOrientation('landscape')->setWarnings(false)->save(public_path() . '/pdf/' . 'laporan_stok_barang.pdf')->stream('Laporan Stok Barang.pdf'); } elseif (Input::get('option_group') === 'location' and Input::get('option_items') === 'item_group') { $locReports = Location::where('code', '=', Input::get('location'))->get(); $groupReports = ItemGroup::where('code', '=', Input::get('group'))->get(); $loc_id = Location::select('id')->where('code', '=', Input::get('location'))->value('id'); $loc_cat = ItemGroup::select('id')->where('code', '=', Input::get('group'))->value('id'); $invReports = Item::where('fk_location', '=', $loc_id, 'AND')->where('fk_cat', '=', $loc_cat)->get(); $this->set_cart($invReports); $this->set_group($groupReports); $this->set_location($locReports); $items = Session::get('items'); $group = Session::get('group'); $location = Session::get('location'); return PDF::loadView('report/pdf', array('items' => $items, 'group' => $group, 'location' => $location))->setPaper('a4')->setOrientation('landscape')->setWarnings(false)->save(public_path() . '/pdf/' . 'laporan_stok_barang.pdf')->stream('Laporan Stok Barang.pdf'); // return view('report.stock_items')->with('invReport',$invReports); } elseif (Input::get('option_group') === 'location' and Input::get('option_items') === 'items') { $code = Input::get('code'); $locReports = Location::where('code', '=', Input::get('location'))->get(); $loc_id = Location::select('id')->where('code', '=', Input::get('location'))->value('id'); $invReports = Item::where('fk_location', '=', $loc_id)->where('barcode', '=', $code)->get(); $group_id = Item::where('fk_location', '=', $loc_id)->where('barcode', '=', $code)->value('fk_cat'); $groupReports = ItemGroup::where('id', '=', $group_id)->get(); // return view('report.stock_items')->with('invReport',$invReports); $this->set_cart($invReports); $this->set_group($groupReports); $this->set_location($locReports); $items = Session::get('items'); $group = Session::get('group'); $location = Session::get('location'); return PDF::loadView('report/pdf', array('items' => $items, 'group' => $group, 'location' => $location))->setPaper('a4')->setOrientation('landscape')->setWarnings(false)->save(public_path() . '/pdf/' . 'laporan_stok_barang.pdf')->stream('Laporan Stok Barang.pdf'); } $invReports = Item::all(); $locReports = Location::all(); $groupReports = ItemGroup::all(); $this->set_cart($invReports); $this->set_group($groupReports); $this->set_location($locReports); $items = Session::get('items'); $group = Session::get('group'); $location = Session::get('location'); return PDF::loadView('report/pdf', array('items' => $items, 'group' => $group, 'location' => $location))->setPaper('a4')->setOrientation('landscape')->setWarnings(false)->save(public_path() . '/pdf/' . 'laporan_stok_barang.pdf')->stream('Laporan Stok Barang.pdf'); return view('report.stock_items')->with('invReport', $invReports); }