Ejemplo n.º 1
0
 public function getDelete($item_id)
 {
     $task = Item::findOrFail($item_id);
     if ($task->user_id == Auth::user()->id) {
         $task->delete();
     }
     return Redirect::route('home');
 }
Ejemplo n.º 2
0
 public function postIndex()
 {
     $id = Input::get('id');
     $item = Item::findOrFail($id);
     if ($item->onwer_id == Auth::user()->id) {
         $item->mark();
     }
     return Redirect::route('home');
 }
Ejemplo n.º 3
0
 /**
  * Store a newly created stock in storage.
  *
  * @return Response
  */
 public function store()
 {
     $validator = Validator::make($data = Input::all(), Stock::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $item_id = Input::get('item');
     $location_id = Input::get('location');
     $item = Item::findOrFail($item_id);
     $location = Location::find($location_id);
     $quantity = Input::get('quantity');
     $date = Input::get('date');
     Stock::addStock($item, $location, $quantity, $date);
     return Redirect::route('stocks.index')->withFlashMessage('stock has been successfully updated!');
 }
Ejemplo n.º 4
0
 /**
  * Update the specified item in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $item = Item::findOrFail($id);
     $validator = Validator::make($data = Input::all(), Item::$rules, Item::$messages);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $item->name = Input::get('name');
     $item->description = Input::get('description');
     $item->purchase_price = Input::get('pprice');
     $item->selling_price = Input::get('sprice');
     $item->sku = Input::get('sku');
     $item->tag_id = Input::get('tag');
     $item->reorder_level = Input::get('reorder');
     $item->update();
     return Redirect::route('items.index')->withFlashMessage('Item successfully updated!');
 }
Ejemplo n.º 5
0
 /**
  * Store a newly created order in storage.
  *
  * @return Response
  */
 public function store()
 {
     $validation = array('customer' => 'required', 'date' => 'required');
     $validator = Validator::make(Input::all(), $validation);
     if ($validator->fails()) {
         return Redirect::to('orders/create')->withErrors($validator);
     } else {
         $postorder = Input::all();
         $data = array('customer' => $postorder['customer'], 'date' => $postorder['date'], 'total_amount' => $postorder['total_amount'], 'discount' => $postorder['discount'], 'payable_amount' => $postorder['payable_amount'], 'payment' => $postorder['payment'], 'balance' => $postorder['balance']);
         $id = DB::table('orders')->insertGetId($data);
         for ($i = 0; $i < count($postorder['product_id']); $i++) {
             $data_detail = array('product_id' => $postorder['product_id'][$i], 'item' => $postorder['item'][$i], 'quantity' => $postorder['quantity'][$i], 'price' => $postorder['price'][$i], 'amount_charged' => $postorder['amount_charged'][$i], 'Order_id' => $id);
             DB::table('order_details')->insert($data_detail);
             $date = $postorder['date'];
             $location = Location::findOrFail($postorder['location']);
             foreach ($data_detail as $item) {
                 $it = Item::findOrFail($postorder['item'][$i]);
                 $quantity = $postorder['quantity'][$i];
                 Stock::removeStock($it, $location, $quantity, $date);
             }
         }
         return Redirect::route('orders.index')->with('success', 'Item Successfully Added');
     }
 }
 public function getItem($id)
 {
     $item = Item::findOrFail($id);
     dd("called");
     return Redirect::route('employees.index', compact('item'));
 }
Ejemplo n.º 7
0
 /**
  * Display the specified resource.
  * GET /items/{id}
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     return Item::findOrFail($id);
 }
Ejemplo n.º 8
0
    //$orderitems = Session::get('erppurchase');
    $erporder = Session::get('erporder');
    $orderitems = Session::get('quotationitems');
    $total = Input::all();
    // $client = Client: :findorfail(array_get($erporder, 'client'));
    // print_r($total);
    $order = new Erporder();
    $order->order_number = array_get($erporder, 'order_number');
    $order->client()->associate(array_get($erporder, 'client'));
    $order->date = date('Y-m-d', strtotime(array_get($erporder, 'date')));
    $order->status = 'new';
    //$order->discount_amount = array_get($total, 'discount');
    $order->type = 'quotations';
    $order->save();
    foreach ($orderitems as $item) {
        $itm = Item::findOrFail($item['itemid']);
        $ord = Erporder::findOrFail($order->id);
        $orderitem = new Erporderitem();
        $orderitem->erporder()->associate($ord);
        $orderitem->item()->associate($itm);
        $orderitem->price = $item['price'];
        $orderitem->quantity = $item['quantity'];
        //s$orderitem->duration = $item['duration'];
        $orderitem->save();
    }
    //Session::flush('orderitems');
    //Session::flush('erporder');
    return Redirect::to('quotationorders');
});
Route::get('erporders/cancel/{id}', function ($id) {
    $order = Erporder::findorfail($id);
Ejemplo n.º 9
0
 /**
  * Update the specified item in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $item = Item::findOrFail($id);
     $validator = Validator::make($data = Input::all(), Item::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $item->update($data);
     return Redirect::route('admin.items.index');
 }