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;
     }
 }
Beispiel #2
0
 public function getCancha(Request $request)
 {
     $cancha = $request->input('term');
     $canchas = Item::all();
     $result = [];
     foreach ($canchas as $sede) {
         if (strpos(Str::lower($sede), $cancha) !== false) {
             $result[] = $sede;
         }
     }
     return $result;
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $items = Item::find($id);
     $items->quantity = $items->quantity + Input::get('in_out_qty');
     $items->save();
     $inventories = new Inventory();
     $inventories->item_id = $id;
     $inventories->user_id = Auth::user()->id;
     $inventories->in_out_qty = Input::get('in_out_qty');
     $inventories->remarks = Input::get('remarks');
     $inventories->save();
     Session::flash('message', 'You have successfully updated item');
     return Redirect::to('inventory/' . $id . '/edit');
 }
 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');
 }
 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');
     }
 }
Beispiel #6
0
 /**
  * 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);
 }
 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
 }
Beispiel #8
0
 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);
 }
Beispiel #9
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $sales = new Sale();
     // $sales->customer_id = Input::get('customer_id');
     Session::put('add_payment', Input::get('add_payment'));
     $sales->customer_id = 1;
     $sales->customer_name = Input::get('customer_name');
     $sales->user_id = Auth::user()->id;
     $sales->payment_type = Input::get('payment_type');
     $sales->comments = Input::get('comments');
     $sales->save();
     // process sale items
     $saleItems = SaleTemp::all();
     foreach ($saleItems as $value) {
         $saleItemsData = new SaleItem();
         $saleItemsData->sale_id = $sales->id;
         $saleItemsData->item_id = $value->item_id;
         $saleItemsData->cost_price = $value->cost_price;
         $saleItemsData->selling_price = $value->selling_price;
         $saleItemsData->quantity = $value->quantity;
         $saleItemsData->total_cost = $value->total_cost;
         $saleItemsData->total_selling = $value->total_selling;
         $saleItemsData->save();
         //process inventory
         $items = Item::find($value->item_id);
         if ($items->type == 1) {
             $inventories = new Inventory();
             $inventories->item_id = $value->item_id;
             $inventories->user_id = Auth::user()->id;
             $inventories->in_out_qty = -$value->quantity;
             $inventories->remarks = 'SL0000' . $sales->id;
             $inventories->save();
             //process item quantity
             $items->quantity = $items->quantity - $value->quantity;
             $items->save();
         } else {
             $itemkits = ItemKitItem::where('item_kit_id', $value->item_id)->get();
             foreach ($itemkits as $item_kit_value) {
                 $inventories = new Inventory();
                 $inventories->item_id = $item_kit_value->item_id;
                 $inventories->user_id = Auth::user()->id;
                 $inventories->in_out_qty = -($item_kit_value->quantity * $value->quantity);
                 $inventories->remarks = 'SL0000' . $sales->id;
                 $inventories->save();
                 //process item quantity
                 $item_quantity = Item::find($item_kit_value->item_id);
                 $item_quantity->quantity = $item_quantity->quantity - $item_kit_value->quantity * $value->quantity;
                 $item_quantity->save();
             }
         }
     }
     //delete all data on SaleTemp model
     SaleTemp::truncate();
     $itemssale = SaleItem::where('sale_id', $saleItemsData->sale_id)->get();
     Session::flash('message', 'You have successfully added sales');
     //return Redirect::to('receivings');
     return view('sale.complete2')->with('sales', $sales)->with('saleItemsData', $saleItemsData)->with('saleItems', $itemssale);
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $items = Item::find($id);
     // process inventory
     $receivingTemps = new ReceivingTemp();
     $inventories->item_id = $id;
     $inventories->quantity = Input::get('quantity');
     $inventories->save();
     Session::flash('message', 'You have successfully add item');
     return Redirect::to('receivings');
 }
 public function stock()
 {
     $this->rem_ses('');
     $invReports = Item::all();
     // $locReports = Location::all();
     // $groupReports = ItemGroup::all();
     // $this->set_cart($invReports);
     // $this->set_group($groupReports);
     // $this->set_location($locReports);
     return view('report.stock_items')->with('invReport', $invReports);
 }
Beispiel #12
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $items = Item::find($id);
     // process inventory
     $inventories = new Inventory();
     $inventories->item_id = $id;
     $inventories->user_id = Auth::user()->id;
     $inventories->in_out_qty = Input::get('quantity') - $items->quantity;
     $inventories->remarks = 'Manual Edit of Quantity';
     $inventories->save();
     // save update
     $items->upc_ean_isbn = Input::get('upc_ean_isbn');
     $items->item_name = Input::get('item_name');
     $items->size = Input::get('size');
     $items->satuan = Input::get('satuan');
     $items->fk_cat = Input::get('fk_cat');
     $items->fk_location = Input::get('fk_location');
     $items->description = Input::get('description');
     $items->cost_price = Input::get('cost_price');
     $items->grocery_price = Input::get('grocery_price');
     $items->selling_price = Input::get('selling_price');
     $items->selling_price2 = Input::get('selling_price2');
     $items->selling_price3 = Input::get('selling_price3');
     $items->qty_min = Input::get('qty_min');
     $items->qty_min_2 = Input::get('qty_min_2');
     $items->qty_min_2 = Input::get('qty_min_3');
     $items->disc_currency = Input::get('disc_currency');
     $items->disc_persen = Input::get('disc_persen');
     $items->quantity = Input::get('quantity');
     $items->save();
     // process avatar
     $image = $request->file('avatar');
     if (!empty($image)) {
         $avatarName = 'item' . $id . '.' . $request->file('avatar')->getClientOriginalExtension();
         $request->file('avatar')->move(base_path() . '/public/images/items/', $avatarName);
         $img = Image::make(base_path() . '/public/images/items/' . $avatarName);
         $img->resize(100, null, function ($constraint) {
             $constraint->aspectRatio();
         });
         $img->save();
         $itemAvatar = Item::find($id);
         $itemAvatar->avatar = $avatarName;
         $itemAvatar->save();
     }
     Session::flash('message', 'You have successfully updated item');
     return Redirect::to('items');
 }