/**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     DB::statement('SET FOREIGN_KEY_CHECKS=0;');
     DB::table('customers')->truncate();
     DB::table('areas')->truncate();
     DB::table('premises')->truncate();
     DB::table('stores')->truncate();
     $reader = ReaderFactory::create(Type::XLSX);
     // for XLSX files
     $filePath = 'database/seeds/seed_files/Store Mapping.xlsx';
     $reader->open($filePath);
     foreach ($reader->getSheetIterator() as $sheet) {
         if ($sheet->getName() == 'Sheet1') {
             $rowcnt = 0;
             foreach ($sheet->getRowIterator() as $row) {
                 if ($rowcnt > 1) {
                     if (!is_null($row[0])) {
                         $customer = Customer::firstOrCreate(['customer_code' => $row[8], 'customer' => strtoupper($row[9])]);
                         $area = Area::firstOrCreate(['area_code' => $row[2], 'area' => strtoupper($row[3])]);
                         $premise = Premise::firstOrCreate(['premise_code' => $row[4], 'premise' => strtoupper($row[5])]);
                         Store::firstOrCreate(['customer_id' => $customer->id, 'area_id' => $area->id, 'premise_id' => $premise->id, 'store_code' => strtoupper($row[0]), 'store' => strtoupper($row[1])]);
                     }
                 }
                 $rowcnt++;
             }
         }
     }
     $reader->close();
     DB::statement('SET FOREIGN_KEY_CHECKS=1;');
     Model::reguard();
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $validator = Validator::make($request->all(), ['name' => 'required']);
     if ($validator->fails()) {
         return redirect()->back()->withErrors($validator);
     }
     //add new area
     $area = new Area();
     $area->name = $request->input('name');
     $area->save();
     return redirect()->back()->withSuccess('area toegevoegd');
 }
예제 #3
0
 public function edit($id)
 {
     $request = Request::with(['equipment', 'area', 'location', 'category', 'uploads', 'approvers', 'status', 'actions' => function ($query) {
         $query->orderBy('created_at', 'desc');
     }, 'actions.submitted', 'comments.author' => function ($query) {
         $query->orderBy('created_at', 'asc');
     }])->find($id);
     if (is_null($request)) {
         return view('security.not-found');
     }
     $data['request'] = $request;
     $data['areas'] = Area::all(['id', 'name']);
     $data['organizations'] = Organization::all();
     $data['categories'] = Category::all(['id', 'name']);
     $data['locations'] = Location::all(['id', 'name']);
     $data['approvers'] = Approval::getRecent($id);
     $data['hasApproved'] = Approval::hasApproved($id)->exists();
     if ($request->Status->name == 'Approved') {
         return view('request.view', $data);
     }
     if ($request->submitted_by != Auth::User()->id && !Auth::User()->hasRole(['administrator', 'approver'])) {
         return view('security.401');
     }
     return view('request.edit', $data);
 }
예제 #4
0
 /**
  * Handle the event.
  *
  * @param  MadeCheckout  $event
  * @return void
  */
 public function handle(MadeCheckout $event)
 {
     $user = $event->user;
     $checkout = $event->checkout;
     $total = $checkout->total;
     $area = Area::findorfail($checkout->area_id);
     // send sms
     $textlocal = new Textlocal('*****@*****.**', '0d756599c39b32baab966c65f4a1b050975394e5');
     $numbers = [$user->mobile];
     $sender = 'TROLIN';
     $message = 'Thankyou for your purchase in Trolleyin. Your order of value ' . $total . ' has been confirmed. You Order id is ' . $checkout->id;
     $response = $textlocal->sendSms($numbers, $message, $sender);
     //admin sms
     $admin = Sentinel::findRoleBySlug('admin');
     $admins = $admin->users()->get();
     $admin_numbers = [];
     foreach ($admins as $admin) {
         if (strlen($admin->mobile) == 10) {
             array_push($admin_numbers, $admin->mobile);
         }
     }
     //dd($admins);
     $sender = 'TROLIN';
     $message = 'OrderNo ' . $checkout->id . '. Total ' . $total . ' Area ' . $area->area_name . '. CMobile ' . $user->mobile;
     $response = $textlocal->sendSms($admin_numbers, $message, $sender);
 }
예제 #5
0
 public function update($id)
 {
     $territory = Territory::findOrFail($id);
     $areas = Area::all();
     $dataView = ['territory' => $territory, 'areas' => $areas];
     return view('admin.territory.edit', $dataView);
 }
 public function stores()
 {
     $accounts = Account::all();
     $data = array();
     foreach ($accounts as $account) {
         $customers = Customer::where('account_id', $account->id)->get();
         $account_children = array();
         foreach ($customers as $customer) {
             $areas = Area::where('customer_id', $customer->id)->get();
             $customer_children = array();
             foreach ($areas as $area) {
                 $regions = Region::where('area_id', $area->id)->get();
                 $area_children = array();
                 foreach ($regions as $region) {
                     $distributors = Distributor::where('region_id', $region->id)->get();
                     $region_children = array();
                     foreach ($distributors as $distributor) {
                         $stores = Store::where('distributor_id', $distributor->id)->get();
                         $distributor_children = array();
                         foreach ($stores as $store) {
                             $distributor_children[] = array('title' => $store->store, 'key' => $account->id . "." . $customer->id . "." . $area->id . "." . $region->id . "." . $distributor->id . "." . $store->id);
                         }
                         $region_children[] = array('select' => true, 'title' => $distributor->distributor, 'isFolder' => true, 'key' => $account->id . "." . $customer->id . "." . $area->id . "." . $region->id . "." . $distributor->id, 'children' => $distributor_children);
                     }
                     $area_children[] = array('select' => true, 'title' => $region->region, 'isFolder' => true, 'key' => $account->id . "." . $customer->id . "." . $area->id . "." . $region->id, 'children' => $region_children);
                 }
                 $customer_children[] = array('select' => true, 'title' => $area->area, 'isFolder' => true, 'key' => $account->id . "." . $customer->id . "." . $area->id, 'children' => $area_children);
             }
             $account_children[] = array('select' => true, 'title' => $customer->customer, 'isFolder' => true, 'key' => $account->id . "." . $customer->id, 'children' => $customer_children);
         }
         $data[] = array('title' => $account->account, 'isFolder' => true, 'key' => $account->id, 'children' => $account_children);
     }
     return response()->json($data);
 }
예제 #7
0
 public function getAllArea()
 {
     // 全部地下城信息取得
     // $areas = Area::
     // return Response::json(Area::all());
     return Response::json(Area::where('status', '1')->get());
 }
예제 #8
0
 public function areaporAplicativo()
 {
     $area = Area::all();
     //->lists('id','nombre_area');
     $mensaje = "";
     return view('persona.create_Aplicativo_area', compact('mensaje', 'area'));
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     foreach (\App\Area::all() as $are) {
         $are->position = preg_replace("/[\\n\\r\\s]+/", "", $are->position);
         $are->save();
     }
 }
예제 #10
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Area::create(['nombre' => 'Sistemas', 'descripcion' => 'Sistemas', 'responsable' => 'Juan Perez Gamboa']);
     Area::create(['nombre' => 'Contabilidad', 'descripcion' => 'Contabilidad', 'responsable' => 'Luis Chavez ']);
     Area::create(['nombre' => 'Finanzas', 'descripcion' => 'Finanzas', 'responsable' => 'Armando Quiroz']);
     Area::create(['nombre' => 'Recursos Humanos', 'descripcion' => 'Recursos Humanos', 'responsable' => 'Jason Grace']);
 }
예제 #11
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('locations')->truncate();
     Location::create(['name' => 'Phase 1, Level 1']);
     Location::create(['name' => 'Phase 1, Level 2']);
     Location::create(['name' => 'Phase 1, Level 3']);
     Location::create(['name' => 'Phase 2, Level 1']);
     Location::create(['name' => 'Phase 2, Level 2']);
     Location::create(['name' => 'Phase 2, Level 3']);
     Location::create(['name' => 'Phase 3, Level 1']);
     Location::create(['name' => 'Phase 3, Level 2']);
     Location::create(['name' => 'Phase 3, Level 3']);
     DB::table('areas')->truncate();
     Area::create(['name' => 'AME']);
     Area::create(['name' => 'M&W']);
     Area::create(['name' => 'Ramp']);
     Area::create(['name' => 'SCI']);
     Area::create(['name' => 'Tool Install']);
     DB::table('categories')->truncate();
     Category::create(['name' => 'Spec Gas']);
     Category::create(['name' => 'Electrical']);
     Category::create(['name' => 'Base Build']);
     Category::create(['name' => 'Design Request']);
     Category::create(['name' => 'Layout Optimization']);
     Category::create(['name' => 'Safety']);
     DB::table('status')->truncate();
     Status::create(['name' => 'New', 'slug' => 'new']);
     Status::create(['name' => 'Open/Needs Further Review', 'slug' => 'open-needs-further-review']);
     Status::create(['name' => 'Waiting for Approval', 'slug' => 'waiting-for-approval']);
     Status::create(['name' => 'Rejected', 'slug' => 'rejected']);
     Status::create(['name' => 'Approved', 'slug' => 'approved']);
 }
예제 #12
0
 public function getRegister()
 {
     $presupuestos = DB::table('areas')->join('presupuestos', 'areas.id', '=', 'presupuestos.area')->select('*')->get();
     $areas = Area::all();
     //dd($operaciones);
     return view('presupuestos.registrar')->with(compact(['presupuestos', 'areas']));
 }
예제 #13
0
 public function create()
 {
     $area = Area::lists('name', 'id');
     $typeOfProperty = TypeOfProperty::lists('type', 'id');
     $numberOfRooms = NumberOfRooms::lists('number', 'id');
     $city = City::lists('city', 'id');
     return view('announcements.create', compact('area', 'typeOfProperty', 'numberOfRooms', 'city'));
 }
예제 #14
0
 public function index(GetIssueOfAreaRequest $request)
 {
     $areaID = $request->input('areaID');
     $role = $request->input('role');
     $area = Area::findOrFail($areaID);
     $issues = Issue::where('areaID', $areaID)->available()->get();
     return view('_partials.issues.lists', compact('issues', 'area', 'role'))->render();
 }
예제 #15
0
 public function listItems($id)
 {
     //
     $checkout = Checkout::with('user', 'orders', 'orders.product')->findOrFail($id);
     $area = Area::findOrFail($checkout->area_id);
     //dd($checkout);
     return view('admin.order.item', compact('checkout', 'area'));
 }
예제 #16
0
 public function update($id)
 {
     $territory = Territory::findOrFail($id);
     $areas = Area::all();
     $MRs = Employee::where('level_id', 7)->active()->get();
     $dataView = ['territory' => $territory, 'areas' => $areas, 'MRs' => $MRs];
     return view('admin.territory.edit', $dataView);
 }
예제 #17
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['area' => 'required|max:100|unique_with:areas, customer = customer_id', 'customer' => 'required|not_in:0']);
     \DB::beginTransaction();
     try {
         $area = new Area();
         $area->customer_id = $request->customer;
         $area->area = $request->area;
         $area->save();
         \DB::commit();
         Session::flash('flash_message', 'Area successfully added!');
         return redirect()->route("area.index");
     } catch (Exception $e) {
         DB::rollBack();
         return redirect()->back();
     }
 }
예제 #18
0
 public function show(Request $request)
 {
     debug($request->session());
     $areas = Area::with(['personas' => function ($q) {
         $q->where('destacado', 0);
     }])->get();
     $destacados = People::where('destacado', 1)->get();
     return view('consejo', ['tab' => 'consejo'])->with('areas', $areas)->with('destacados', $destacados);
 }
예제 #19
0
 public function getLowerById()
 {
     $id = Input::get('id');
     $area = Area::where('preid', $id)->get();
     if (count($area) == 0) {
         return json_encode(array('result' => false));
     } else {
         return json_encode(array('result' => true, 'area' => $area));
     }
 }
예제 #20
0
 public function showAreas(Request $request)
 {
     $json['results'] = [];
     $q = $request->input('q');
     $results = Area::where('name', 'LIKE', "%{$q}%")->take(10)->lists('name', 'id');
     foreach ($results as $key => $value) {
         $json['results'][] = array('id' => $key, 'text' => $value);
     }
     return json_encode($json);
 }
예제 #21
0
 public function doDelete($id)
 {
     $area = Area::findOrFail($id);
     try {
         $area->delete();
         return redirect()->back()->with('message', 'Area has been deleted successfully !');
     } catch (ParseException $ex) {
         echo 'Failed to create new meal , with error message: ' . $ex->getMessage();
     }
 }
예제 #22
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     //
     $users = User::select('id')->get();
     $products = Product::select('id')->get();
     $categories = Category::select('id')->get();
     $areas = Area::select('id')->get();
     $orders = Order::select('id')->get();
     return view('admin.dashboard', compact('users', 'products', 'categories', 'areas', 'orders'));
 }
예제 #23
0
 /**
  * 地下城进入首页
  */
 public function index()
 {
     // 取得全部可进入的区域
     $lstAreas = Area::all();
     foreach ($lstAreas as $objArea) {
         // 取得该Area的全部地下城
         $lstDungeons = Dungeon::where("area_id", $objArea->id)->get();
         foreach ($lstDungeons as $objDungeon) {
             echo "<a href='dungeon/entry?player_id={$this->_intPlayerId}&device_id={$this->_strDeviceId}&area_id={$objArea->id}&dungeon_id={$objDungeon->id}'>进入[{$objArea->name_cn}][{$objDungeon->name_cn}]</a>";
             echo "<br />";
         }
     }
 }
예제 #24
0
 public function edit($entity)
 {
     parent::edit($entity);
     $this->edit = \DataEdit::source(new \App\People());
     $this->edit->label('Persona');
     $this->edit->text('nombre', 'Nombre')->rule('required');
     $this->edit->add('area_id', 'Area', 'select')->rule('required')->options(\App\Area::lists('nombre', 'id')->all());
     $this->edit->checkbox('destacado', 'Destacado');
     $this->edit->text('sueldo', 'Sueldo ($)')->rule('required');
     $this->edit->text('aporte', 'Aporte ($)')->rule('required');
     $this->edit->add('foto', 'Foto', 'image')->move('media/fotos/')->preview(80, 80);
     return $this->returnEditView();
 }
예제 #25
0
 public function getJefe($area_id)
 {
     $Area = Area::find($area_id);
     $data = $Area->JefeArea;
     foreach ($data as $a) {
         $empleado = $a['Empleados_id'];
     }
     if (count($data) > 0) {
         $result = DB::select(DB::raw("Select noDocumento,nombres,apellidos from empleados\n                        WHERE  id = '{$empleado}'"));
         return $result;
     } else {
         return 0;
     }
 }
예제 #26
0
 /**
  * Handle the event.
  *
  * @param  OrderDelivered  $event
  * @return void
  */
 public function handle(OrderDelivered $event)
 {
     //
     $user = $event->user;
     $checkout = $event->checkout;
     $total = $checkout->total;
     $area = Area::findorfail($checkout->area_id);
     // send sms
     $textlocal = new Textlocal('*****@*****.**', '0d756599c39b32baab966c65f4a1b050975394e5');
     $numbers = [$user->mobile];
     $sender = 'TROLIN';
     $message = 'Your Trolleyin order-no ' . $checkout->id . ' of value Rs. ' . $total . ' has been delivered. Thank you for your purchase.';
     //dd($message);
     $response = $textlocal->sendSms($numbers, $message, $sender);
 }
예제 #27
0
 /**
  * Bind data to the view.
  *
  * @param  View  $view
  * @return void
  */
 public function compose(View $view)
 {
     $categories = Category::with('children', 'products')->where('parent_id', '=', 0)->orderBy('did')->get();
     $hotpros_id = Salesstats::groupBy('product_id')->take(16)->get();
     $hotpros_id = $hotpros_id->lists('product_id');
     $hotpros = Product::with('images')->has('images')->has('prices')->wherein('id', $hotpros_id)->take(16)->get();
     $globals = DB::table('globalsettings')->get();
     $dts = DB::table('deliverytimes')->where('active', true)->get();
     foreach ($dts as $dt) {
         $dt->start = Carbon::parse($dt->start)->format('h:ia');
         $dt->stop = Carbon::parse($dt->stop)->format('h:ia');
     }
     $settings = [];
     foreach ($globals as $global) {
         $name = $global->name;
         $value = $global->value;
         $settings[$name] = $value;
     }
     $offers = Offer::with(['categories', 'categories.products' => function ($q) {
         $q->has('images');
     }, 'brands', 'brands.products' => function ($q) {
         $q->has('images');
     }, 'products' => function ($q) {
         $q->has('images');
     }, 'products.images', 'products.prices'])->where('active', true)->where('start', '<=', Carbon::today()->toDateString())->where('end', '>=', Carbon::today()->toDateString())->take(16)->get();
     //dd($offers);
     $feedbacks = Feedback::with('user')->take(8)->get();
     if ($user = Sentinel::check()) {
         $user = User::findorfail($user->id);
         $flashes = Flashtext::where('active', '1')->get();
         $areas = Area::where('deliverable', '1')->get();
         $viewpros_id = Viewstats::where('user_id', $user->id)->take(16)->get();
         //dd($viewpros_id);
         $viewpros_id = $viewpros_id->lists('product_id');
         $viewpros = Product::with('images')->has('images')->has('prices')->wherein('id', $viewpros_id)->take(16)->get();
         $view->with(['user' => $user, 'flashes' => $flashes, 'areas' => $areas, 'hotpros' => $hotpros, 'viewpros' => $viewpros, 'offers' => $offers, 'settings' => $settings, 'dts' => $dts, 'feedbacks' => $feedbacks, 'categories' => $categories]);
     } else {
         $flashes = Flashtext::where('active', '1')->get();
         $areas = Area::where('deliverable', '1')->get();
         $viewpros_id = Viewstats::where('user_id', 0)->take(16)->get();
         $viewpros_id = $viewpros_id->lists('product_id');
         $viewpros = Product::with('images')->has('images')->has('prices')->wherein('id', $viewpros_id)->take(16)->get();
         $view->with(['flashes' => $flashes, 'areas' => $areas, 'hotpros' => $hotpros, 'viewpros' => $viewpros, 'offers' => $offers, 'settings' => $settings, 'dts' => $dts, 'feedbacks' => $feedbacks, 'categories' => $categories]);
     }
 }
예제 #28
0
 public function postGCFinancieroGrafica(Request $request)
 {
     $area = $request->area;
     $anual = $request->anual;
     $valorproc = DB::table('presupuestos')->select('presupuesto')->where('area', '=', $area)->where('anual', '=', $anual)->get();
     $valortotal = DB::table('presupuestos')->select('real')->where('area', '=', $area)->where('anual', '=', $anual)->get();
     //dd( $valortotal[0]->real );
     //dd( $valorproc[0]->presupuesto );
     $res = $valortotal[0]->real / $valorproc[0]->presupuesto;
     //dd($res);
     $areaNombre = Area::find($area);
     $anualTotal = DB::table('presupuestos')->select('anual')->where('area', '=', $area)->get();
     //dd($anualTotal[0]->anual);
     $presupuestos = DB::table('presupuestos')->select('presupuesto')->where('area', '=', $area)->get();
     $reales = DB::table('presupuestos')->select('real')->where('area', '=', $area)->get();
     //dd($reales);
     return view('indicadores.gestion-calidad.grafica-financiero')->with(compact(['reales', 'presupuestos', 'res', 'anual', 'areaNombre', 'anualTotal']));
 }
 public function dashboard()
 {
     $today = Carbon::today('Europe/Brussels');
     $now = Carbon::now('Europe/Brussels');
     $clients = Client::where('leavetime', '=', null)->get();
     $clientsWithTable = collect([]);
     foreach ($clients as $client) {
         if ($client->table != null) {
             $clientsWithTable->push($client);
         }
     }
     foreach ($clientsWithTable as $client) {
         if (count($client->orders) > 0) {
             $order = $client->orders()->where('endtime', '=', null)->first();
             if ($order) {
                 $client->wait_time = $now->diffInMinutes(Carbon::createFromFormat('Y-m-d H:i:s', $order->starttime));
             }
         }
     }
     $areas = ['' => 'Gebieden'] + Area::orderby('name', 'ASC')->lists('name', 'id')->all();
     $locations = Location::with('table')->with('decoration')->get();
     return View::make('dashboard')->with('today', $today)->with('clientsWithTable', $clientsWithTable)->with('areas', $areas)->with('locations', $locations);
 }
예제 #30
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $areas = Area::getAreasWithWaitingIssues();
     return view('index', compact('areas'));
 }