public function readBarcode(Request $request) { $id = Input::get('term'); $results = Item::select('barcode', 'item_name', 'upc_ean_isbn')->where('id', $id)->orWhere('barcode', 'LIKE', '%' . $id . '%')->orWhere('upc_ean_isbn', 'like', '%' . $id . '%')->orWhere('item_name', 'like', '%' . $id . '%')->get(); return Response::json($results); }
public function additems() { //scenario di dalam create transaksi if (Input::has('additems')) { //Get all items in the cart so far... $items = $this->get_cart(); $maxkey = 0; //nilai tertinggi $insertkey = 0; foreach ($items as $item) { //looping index key nya biar bisa nambah banyak if ($maxkey <= $item['line']) { $maxkey = $item['line']; } } $insertkey = $maxkey + 1; // cari id items barang $id = Item::select('id')->where('barcode', '=', $this->get_in('barcode'))->value('id'); //bentukan data session $item = array($insertkey => array('id' => $id, 'barcode' => $this->get_in('barcode'), 'qty' => $this->get_in('qty'), 'line' => $insertkey)); $items += $item; //add items //storing ke session $this->set_cart($items); return redirect('warehouse_move_items/create'); } //end of add items new transaksi //scenario datam detail transaksi }
/** * 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); }