*/ /* Sample routes */ Route::get('f**k', function () { return (new ProductionItem())->getUnsoldItems(); return Carbon::now()->addDays(2); return $item = ProductionItem::where('production_id', '=', '215')->where('item_id', '=', '10037')->where('status', '=', "pending")->first()->id; return ReportsController::generateSalesByRange(); return View::make('hello'); return Auth::user()->username; return PDF::loadView('items.barcodes')->setPaper('a6')->setOrientation('landscape')->setWarnings(false)->stream('barcodes.pdf'); }); Route::get('tt', function () { return Session::get('REGISTER'); $item = Item::all(); return PDF::loadView('items.barcodes')->setPaper('a6')->setOrientation('landscape')->setWarnings(false)->stream('barcodes.pdf'); $prod = new ProductionItem(); $pending = $prod->getPendingItems(); $prod_items = $prod->getCurrentProductionsItemId(); // return $pending[0]->remaining; foreach ($pending as $item) { print $item->item_id . " "; if (in_array($item->item_id, $prod_items)) { return "pending"; exit; } return "not pending"; exit; } $invoiceInfo = ['customer' => 'Raymund Santillan', 'total' => 'Php 150.00']; PDF::loadView('registrar.invoice', $invoiceInfo)->setPaper('a6')->setOrientation('landscape')->setWarnings(false)->stream('myfile.pdf'); $invoiceInfo = ['customer' => 'Raymund Santillan', 'total' => 'Php 150.00'];
Route::filter('isProductionOpen', function () { if (Session::has('REGISTER') && Session::get('PRODUCTION') == 'CLOSE') { return "Production is closed for this moment."; } }); Route::filter('checkProductionsList', function () { //check if there are existing items to be baked $count = ProductionItem::where('status', '=', 'pending')->count(); if ($count > 0) { //redirect to the baking stage return Redirect::route('productions.billing')->with('flash_message', 'You have a pending items to be processed.')->with('flash_type', 'alert alert-info'); } }); Route::filter('isThereItemToBeCooked', function () { //check if there are pending items to be cooked $count = ProductionItem::where('status', '=', 'pending')->count(); if ($count < 1) { //no items to be cooked, so back to productions return Redirect::route('productions.produce')->with('flash_message', 'There are no items to be cooked. Please select here.')->with('flash_type', 'alert alert-info'); } }); /* |-------------------------------------------------------------------------- | Guest Filter |-------------------------------------------------------------------------- | | The "guest" filter is the counterpart of the authentication filters as | it simply checks that the current user is not logged in. A redirect | response will be issued if they are, which you may freely change. | */
/** * Remove item from billing */ public function removeItemFromBilling($item_id) { $production_id = Session::get('production_id'); $remove = ProductionItem::where('production_id', '=', $production_id)->where('item_id', '=', $item_id)->delete(); return Response::json(['response' => '200', 'msg' => 'Success']); }
/** * Close the store transactions */ public function closeStore() { $production_item = new ProductionItem(); Session::put("STORE", "CLOSE"); Session::put("REGISTER", "CLOSE"); Session::put("PRODUCTION", "CLOSE"); //save the unsold items for the day $items = $production_item->saveUnsoldItems(); //update the item status to unsold // $update = // return $items; return Response::json(['response' => '200', 'msg' => 'Success']); }