Exemplo n.º 1
0
 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create()
 {
     $groups = ['' => '-- Please select a group !'] + ItemGroup::lists('name', 'id')->toArray();
     $locations = Location::lists('name', 'id')->toArray();
     // $locations = ['' => '-- Please select a location !'] + Location::lists('name', 'id')->toArray();
     $satuans = Satuan::lists('name', 'id');
     return view('item.create')->with('satuan', $satuans)->with('location', $locations)->with('group', $groups);
 }
Exemplo n.º 2
0
 public function readGroup(Request $request)
 {
     $id = Input::get('term');
     $results = ItemGroup::where('code', 'LIKE', '%' . $id . '%')->orWhere('name', 'like', '%' . $id . '%')->orWhere('desc', 'like', '%' . $id . '%')->get();
     return Response::json($results);
 }
Exemplo n.º 3
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     try {
         $ItemGroups = ItemGroup::find($id);
         $ItemGroups->delete();
         // redirect
         Session::flash('message', 'You have successfully deleted item group');
         return Redirect::to('item_group');
     } catch (\Illuminate\Database\QueryException $e) {
         Session::flash('message', 'Integrity constraint violation: You Cannot delete a parent row');
         Session::flash('alert-class', 'alert-danger');
         return Redirect::to('item_group');
     }
 }
 /**
  * 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);
 }