Пример #1
0
 /**
  * Display a listing of the resource.
  * GET /reports
  *
  * @return Response
  */
 public function index()
 {
     // return Carbon\Carbon::createFromDate(2015,21,22)->addYears(9);
     $sales_per_month = $this->sale->salesPerMonth();
     // return $sales_per_month;
     $items = $this->sale->topThreebestSellersName();
     $amounts = $this->sale->topThreebestSellersAmount();
     $items_by_sales = $this->sale->getItemsBySales();
     $data = $this->sale->bestSellersThisWeek();
     //get all the cashiers
     $cashiers = User::lists('username', 'username');
     $ingredients = Ingredient::lists('name', 'id');
     // return $data;
     return View::make('reports.reports')->with('title', 'Reports Module')->with('sales', $sales_per_month)->with('items', $items)->with('amounts', $amounts)->with('sales_items', $items_by_sales)->with('cashiers', $cashiers)->with('ingredients', $ingredients);
     // ->with('amount',$amount);
     // ->with('value',$amount);
 }
Пример #2
0
 public function updateProductionUnits()
 {
     //equivalent in grams
     $equivalents = Input::get('prod_units');
     //unit ids
     $unit_id = Input::get('unit_id');
     //ingredient id
     $ing_id = Input::get('ing_id');
     //update the item
     $prod_unit = new ProductionUnit();
     //check for redundunt unit types
     $ing_units = $prod_unit->getIngredientUnits($ing_id);
     // for($i = 0; $i < count($unit_id); $i++){
     // 	if(in_array($unit_id[$i], $ing_units)){
     // 		return Response::json(['response' => 300,'msg' => 'Unit already exists.']);
     // 	}
     // }
     $prod_unit->updateProductionUnits($ing_id, $equivalents, $unit_id);
     //redirect to the view
     $ingredients = Ingredient::lists('name', 'id');
     return Redirect::to('/settings')->with('title', 'Settings')->with('flash_message', 'Changes has been saved.')->with('flash_type', 'alert alert-success')->with('ingredients', $ingredients);
 }