/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function move_store(Request $request) { if (Input::has('next')) { $loc_from = Location::select('name')->where('id', '=', $this->get_in('loc_from'))->value('name'); $loc_to = Location::select('name')->where('id', '=', $this->get_in('loc_to'))->value('name'); Session::put('master', ['no' => $this->get_in('no'), 'date' => $this->get_in('date'), 'loc_to' => $this->get_in('loc_to'), 'loc_from' => $this->get_in('loc_from'), 'loc_to_name' => $loc_to, 'loc_from_name' => $loc_from, 'desc' => $this->get_in('desc')]); } // Session::flash('message', 'You have successfully added warehouse'); return Redirect::to('warehouse_move_items/create'); }
/** * 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); }