public function newItem() { $type = Input::get('type'); if ($type == 1) { $ReceivingTemps = new ReceivingTemp(); $ReceivingTemps->item_id = Input::get('item_id'); $ReceivingTemps->cost_price = Input::get('cost_price'); $ReceivingTemps->total_cost = Input::get('total_cost'); $ReceivingTemps->quantity = 1; $ReceivingTemps->save(); return $ReceivingTemps; } else { $itemkits = ItemKitItem::where('item_kit_id', Input::get('item_id'))->get(); foreach ($itemkits as $value) { $item = Item::where('id', $value->item_id)->first(); $ReceivingTemps = new ReceivingTemp(); $ReceivingTemps->item_id = $value->item_id; $ReceivingTemps->cost_price = $item->cost_price; $ReceivingTemps->total_cost = $item->cost_price * $value->quantity; $ReceivingTemps->quantity = $value->quantity; $ReceivingTemps->save(); //return $ReceivingTemps; } return $ReceivingTemps; } }
public function scanitem() { $code = Input::get('mysearch'); $item = Item::where('barcode', $code)->firts(); $SaleTemps = new ItemTemp(); $SaleTemps->item_id = $item->id; $SaleTemps->cost_price = $item->cost_price; $SaleTemps->selling_price = $item->selling_price; $SaleTemps->quantity = Input::get('myquantity'); $SaleTemps->total_cost = $item->cost_price; $SaleTemps->total_selling = $item->selling_price; $SaleTemps->save(); return Redirect::to('sales'); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function items(Request $request) { // Sets the parameters from the get request to the variables. if (Input::get('code')) { $code = Input::get('code'); if (Item::where('barcode', '=', $code)->orWhere('upc_ean_isbn', '=', $code)->exists()) { $items = Item::Where('upc_ean_isbn', '=', $code)->orWhere('barcode', '=', $code)->paginate(15); return view('item.index')->with('item', $items); } else { Alert::error('Whoops, barcode item not found !.'); // echo "<script>alert('Barcode Item not found !');</script>"; } } $items = Item::where('type', 1)->get(); return view('item.index')->with('item', $items); }
public static function item_detailed($group_id, $loc_id) { $barcode = Session::get('items'); foreach ($barcode as $key) { $code = $key->barcode; } if (count($barcode) == 1) { $StockItems = Item::where('fk_cat', $group_id)->where('fk_location', $loc_id)->where('barcode', $code)->get(); } else { $StockItems = Item::where('fk_cat', $group_id)->where('fk_location', $loc_id)->get(); } if (count($StockItems) > 0) { return $StockItems; } else { return $StockItems = array('no' => 'barang kosong'); } }
/** * Show the application dashboard to the user. * * @return Response */ public function index() { $items = Item::where('type', 1)->count(); $item_kits = Item::where('type', 2)->count(); $customers = Customer::count(); $suppliers = Supplier::count(); $receivings = Receiving::count(); $sales = Sale::count(); $employees = User::count(); // passing jam variable $array_hari = array(1 => "Senin", "Selasa", "Rabu", "Kamis", "Jum'at", "Sabtu", "Minggu"); $hari = $array_hari[date("N")]; $tanggal = date("j"); $array_bulan = array(1 => "Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember"); $bulan = $array_bulan[date("n")]; $tahun = date("Y"); $date = "{$tanggal} {$bulan} {$tahun}"; $time = date("H:i:s"); //end jam return view('home')->with('items', $items)->with('item_kits', $item_kits)->with('customers', $customers)->with('suppliers', $suppliers)->with('receivings', $receivings)->with('sales', $sales)->with('employees', $employees)->with('date', $date); }
/** * 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); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $items = Item::where('type', 1)->paginate(15); return view('item.index')->with('item', $items); }