示例#1
1
文件: Clap.php 项目: laugharn/clap
 function __construct()
 {
     $this->loader = new FileLoader(new Filesystem(), 'lang');
     $this->translator = new Translator($this->loader, 'en');
     $this->request = Request::createFromGlobals();
     $this->validator = $this->initializeValidator();
 }
 public function __call($target, $arguments)
 {
     $symfonyRoutes = $this->symfonyRoutesManager->getConvertedRoutes();
     foreach ($symfonyRoutes as $route) {
         $current = $route['symfony_controller'] . ':' . $route['symfony_action'];
         if ($current == $target) {
             if (strstr($target, '.') !== false) {
                 //Route as a service, dispatch from container.
                 $controllersService = $this->symfonyContainer->getSymfonyService($route['symfony_controller']);
                 $actionMethodName = $route['symfony_action'];
                 $params = Request::createFromGlobals();
                 //@TODO: params passing should be fixed blemba...
                 /** @var Response $response */
                 $response = $controllersService->{$actionMethodName}($this->convertRequest(), 'fos.Router.setData');
                 if ($response instanceof Response) {
                     $content = $response->getContent();
                 } else {
                     $content = $response;
                 }
                 return $content;
             }
             $actionMethodName = $route["symfony_action"];
             $controllerClass = $route["symfony_controller"];
             $controllerObj = new $controllerClass();
             $controllerObj->setContainer($this->symfonyContainer->getContainer());
             $response = $controllerObj->{$actionMethodName}(Request::createFromGlobals());
             return $response;
         }
     }
 }
 public function exportExcel($report)
 {
     $input = Request::createFromGlobals();
     $objPHPExcel = $this->createExcelFile($report);
     $records = $this->getResults();
     // Write header line
     $headerRow = 7;
     $headerCol = 0;
     $objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($headerCol++, $headerRow, 'ID');
     $objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($headerCol++, $headerRow, 'Nombre');
     $objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($headerCol++, $headerRow, 'Duración establecida');
     $objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($headerCol++, $headerRow, 'Horas no laborables');
     $objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($headerCol++, $headerRow, 'Horas laborables');
     $objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($headerCol++, $headerRow, 'Total');
     // Escribir líneas
     $recordRow = 8;
     foreach ($records as $record) {
         $status = $record->time['status'] == 'ok' ? 'A tiempo' : 'Atrasada';
         $recordCol = 0;
         $objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($recordCol++, $recordRow, $record->step_id);
         $objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($recordCol++, $recordRow, $record->step_name);
         $objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($recordCol++, $recordRow, $record->time_hours);
         $objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($recordCol++, $recordRow, $record->elapsed_time['non-work']);
         $objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($recordCol++, $recordRow, $record->elapsed_time['work']);
         $objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($recordCol++, $recordRow, $record->elapsed_time['total']);
         $recordRow++;
     }
     // Set autosize on 50 columns (should be enough)
     $nCols = 50;
     foreach (range(0, $nCols) as $col) {
         $objPHPExcel->getActiveSheet()->getColumnDimensionByColumn($col)->setAutoSize(true);
     }
     return $this->writeExcelFile($objPHPExcel);
 }
 public function exportExcel($report)
 {
     $input = Request::createFromGlobals();
     $objPHPExcel = $this->createExcelFile($report);
     $records = $this->getResults();
     // Write header line
     $headerRow = 7;
     $headerCol = 0;
     $objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($headerCol++, $headerRow, 'Periodo BPCS');
     $objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($headerCol++, $headerRow, 'Fecha de inicio');
     $objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($headerCol++, $headerRow, 'Fecha de fin');
     $objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($headerCol++, $headerRow, 'Cantidad');
     $objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($headerCol++, $headerRow, 'Monto');
     // Escribir líneas
     $recordRow = 8;
     foreach ($records as $record) {
         $recordCol = 0;
         $objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($recordCol++, $recordRow, $record->name);
         $objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($recordCol++, $recordRow, $record->start);
         $objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($recordCol++, $recordRow, $record->end);
         $objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($recordCol++, $recordRow, $record->cantidad);
         $objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($recordCol++, $recordRow, $record->monto);
         $recordRow++;
     }
     // Set autosize on 50 columns (should be enough)
     $nCols = 50;
     foreach (range(0, $nCols) as $col) {
         $objPHPExcel->getActiveSheet()->getColumnDimensionByColumn($col)->setAutoSize(true);
     }
     return $this->writeExcelFile($objPHPExcel);
 }
 public function removeRole()
 {
     $input = Request::createFromGlobals();
     $users = Rol::find($input->rol)->users()->get();
     $users->each(function ($user) use($input) {
         $user->clases()->attach($input->clase);
     });
 }
 public static function make()
 {
     if (is_null(self::$instance)) {
         $request = \Illuminate\Http\Request::createFromGlobals();
         self::$instance = new static($request);
     }
     return self::$instance;
 }
 public function getDocumento($id = '')
 {
     $input = Request::createFromGlobals();
     if ($id == '') {
         $id = $input->id;
     }
     return Documento::with(['lineas.lineas_distribucion', 'lineas_distribucion', 'recepciones_efectivas.ordencompra.clase'])->find($id);
 }
示例#8
0
 /**
  * Start Application
  *
  * @return bool
  */
 public function startApplication()
 {
     $this->router = $this['router'];
     require __DIR__ . '/../../../app/routes.php';
     $request = Request::createFromGlobals();
     $response = $this->router->dispatch($request);
     $response->send();
     return true;
 }
示例#9
0
 /**
  * Create a new Illuminate application instance.
  *
  * @return void
  */
 public function __construct()
 {
     $this['request'] = Request::createFromGlobals();
     // The exception handler class takes care of determining which of the bound
     // exception handler Closures should be called for a given exception and
     // gets the response from them. We'll bind it here to allow overrides.
     $this->register(new ExceptionServiceProvider($this));
     $this->register(new RoutingServiceProvider($this));
 }
示例#10
0
 public function start()
 {
     require __DIR__ . '/../routes.php';
     try {
         $request = Request::createFromGlobals();
         $response = $this->router->dispatch($request);
         $response->send();
     } catch (\Exception $e) {
         header("Location: " . $e->getMessage());
         exit;
     }
 }
示例#11
0
 /**
  * Bind the core classes to the container.
  */
 protected function bindCoreClasses()
 {
     // Bind request
     $this->app->bindIf('request', function () {
         return Request::createFromGlobals();
     });
     // Bind config
     $this->app->bindIf('config', function ($app) {
         return new Repository(['cache' => ['default' => 'file', 'stores' => ['file' => ['driver' => 'file', 'path' => $app['path.storage']]]]]);
     }, true);
     // Bind cache
     $this->app->bindIf('cache', function ($app) {
         return new CacheManager($app);
     });
 }
示例#12
0
 public function addObservacion()
 {
     $input = Request::createFromGlobals();
     $record = AccionObservacion::create($input->all());
     // Notificar usuario creador
     $accion = Accion::with('observaciones')->find($input->accion_id);
     $user = User::find($accion->observaciones[0]->responsable);
     $observacion = $record;
     $html = view('Reclamos.Emails.new_action_comment', compact('user', 'accion', 'observacion'));
     echo '<pre>';
     print_r($html);
     echo '</pre>';
     die;
     MailController::sendGeneralMail([["email" => $user->user_email]], "Nuevo comentario en acción correctiva/preventiva", $html);
 }
示例#13
0
 public function storeMaterialOficina()
 {
     $input = Request::createFromGlobals();
     // Validaciones para materiales de oficina
     // Revisar que el código no se repita entre los otros materiales de oficina
     $tmp_record = Producto::where('codigo', $input->codigo)->whereHas('clases', function ($query) use($input) {
         return $query->where('id_clase', 11);
         // Clase para materiales de oficina
     })->first();
     if ($tmp_record) {
         return new AjaxResponse('error', 'Ese código de producto ya existe');
     }
     $record = Producto::create(['origen' => 'oficina', 'codigo' => $input->codigo, 'nombre' => $input->nombre, 'precio_promedio' => 0, 'dias_promedio' => 0, 'meses_inventario' => 0, 'stock_minimo' => 0, 'stock_maximo' => 0, 'stock_actual' => 0, 'stock_transito' => 0, 'consumo_promedio' => 0, 'unidad' => $input->unidad, 'sugerido' => 0]);
     $record->clases()->attach(11);
     // Clase para materiales de oficina
     return new AjaxResponse('success', '', $record);
 }
示例#14
0
 public static function bootstrap($errorCallbacks)
 {
     // Only bootstrap once.
     if (static::$bootstrapped) {
         return;
     }
     // Load helper functions.
     require_once __DIR__ . '/../../../illuminate/support/Illuminate/Support/helpers.php';
     // Directories.
     $basePath = str_finish(realpath(__DIR__ . '/..'), '/');
     $controllersDirectory = $basePath . 'Controllers';
     $modelsDirectory = $basePath . 'Models';
     // Register the autoloader and add directories.
     ClassLoader::register();
     ClassLoader::addDirectories(array($controllersDirectory, $modelsDirectory));
     // Instantiate the container.
     $app = new Container();
     static::$container = $app;
     // Tell facade about the application instance.
     Facade::setFacadeApplication($app);
     // Register application instance with container
     $app['app'] = $app;
     // Set environment.
     $app['env'] = 'production';
     // Enable HTTP Method Override.
     Request::enableHttpMethodParameterOverride();
     // Create the request.
     $app['request'] = Request::createFromGlobals();
     // Register services.
     with(new EventServiceProvider($app))->register();
     with(new RoutingServiceProvider($app))->register();
     // Register aliases.
     foreach (static::$aliases as $alias => $class) {
         class_alias($class, $alias);
     }
     // Load the routes file if it exists.
     if (file_exists($basePath . 'routes.php')) {
         require_once $basePath . 'routes.php';
     }
     // Dispatch on shutdown.
     register_shutdown_function('Seytar\\Routing\\Router::dispatch', $errorCallbacks);
     // Mark bootstrapped.
     static::$bootstrapped = true;
 }
 /**
  * Bind the core classes
  */
 public function bindCoreClasses()
 {
     $this->app->bindIf('request', function () {
         return HttpRequest::createFromGlobals();
     }, true);
     $this->app->bindIf('config', function () {
         $fileloader = new FileLoader(new Filesystem(), __DIR__ . '/../config');
         return new Config($fileloader, 'config');
     }, true);
     $this->app->bindIf('cache', function () {
         $fileStore = new FileStore(new Filesystem(), __DIR__ . '/../../cache');
         return new Cache($fileStore);
     });
     $this->app->bindIf('session', function () {
         return new Session();
     }, true);
     // Register config file
     $this->app['config']->package('anahkiasen/flickering', __DIR__ . '/../config');
 }
示例#16
0
 /**
  * Bind the core classes to the container
  */
 protected function bindCoreClasses()
 {
     // Bind request
     $this->app->bindIf('request', function () {
         return Request::createFromGlobals();
     });
     // Bind config
     $this->app->bindIf('config', function ($app) {
         $fileloader = new ConfigLoader($app['files'], __DIR__ . '/../');
         $config = new Repository($fileloader, 'config');
         $config->set('cache.driver', 'file');
         $config->set('cache.path', __DIR__ . '/../../cache');
         return $config;
     }, true);
     // Bind cache
     $this->app->bindIf('cache', function ($app) {
         return new CacheManager($app);
     });
 }
 /**
  * Bind the core classes
  *
  * @param  Container $app
  *
  * @return Container
  */
 public function bindCoreClasses(Container $app)
 {
     if ($app->bound('events')) {
         return $app;
     }
     $app->bindIf('request', function ($app) {
         return Request::createFromGlobals();
     });
     $app->bindIf('url', function ($app) {
         $routes = new RouteCollection();
         return new UrlGenerator($routes, $app['request']);
     });
     $app->bindIf('html', function ($app) {
         return new HtmlBuilder($app['url']);
     });
     $app->bindIf('path.public', function () {
         return realpath(__DIR__ . '/../../');
     });
     return $app;
 }
示例#18
0
 public function boot()
 {
     $this->bindService('log', \Monolog\Logger::class, function ($this) {
         $log = new \Monolog\Logger($this->getName());
         $log->pushHandler(new \Monolog\Handler\StreamHandler($this['log_file'], \Monolog\Logger::DEBUG));
         return $log;
     });
     $this->bindAliased('request', \Illuminate\Http\Request::class, function ($this) {
         return \Illuminate\Http\Request::createFromGlobals();
     });
     $this->bindAliased('guzzle', \GuzzleHttp\Client::class, function ($app) {
         $client = new \GuzzleHttp\Client();
         $client->getEmitter()->attach($app->make(\IpnForwarder\Guzzle\GuzzleSubscriber::class));
         return $client;
     });
     $this->bindService('paypal', \PayPal\Ipn\Listener::class);
     $this->bindService('urls', \IpnForwarder\UrlCollection::class);
     $this->bindService('ipnForwarder', \IpnForwarder\Forwarder::class);
     $this->bindService('ipnProcessor', \IpnForwarder\Processor::class);
 }
 public function ingresarRequisicion()
 {
     $input = Request::createFromGlobals();
     // Agrupar las líneas por proveedor
     $requisicionesPorProveedor = [];
     foreach ($input->requisicion['lineas'] as $linea) {
         $requisicionesPorProveedor[$linea['proveedor']][] = $linea;
     }
     // Crear una requisición por proveedor
     foreach ($requisicionesPorProveedor as $id_proveedor => $lineas_proveedor) {
         $loggedUser = User::with('area')->find($_SESSION['user_id']);
         $cabecera = ['id_clase' => $input->clase['id'], 'id_solicitante' => $loggedUser->user_id, 'fecha_estimada_fin' => $input->requisicion['fecha_estimada_fin'], 'observaciones' => $input->requisicion['observaciones'], 'descripcion' => 'Requisición - ' . $loggedUser->user_name . ' - ' . $input->clase['nombre'], 'id_proveedor' => $id_proveedor, 'id_cc' => $loggedUser->area->area_id, 'nombre_cc' => $loggedUser->area->area_name];
         $lineas = [];
         foreach ($lineas_proveedor as $linea_proveedor) {
             $lineas[] = ['id_producto' => $linea_proveedor['producto']['id'], 'observacion_creador' => $linea_proveedor['observacion'], 'cantidad' => $linea_proveedor['cantidad'], 'papel_cara' => $linea_proveedor['papel_cara'], 'papel_laminas' => $linea_proveedor['papel_laminas']];
         }
         $datos_requisicion[] = ['cabecera' => $cabecera, 'lineas' => $lineas];
     }
     self::ingresarRequisicionesYSolicitudes($datos_requisicion);
 }
 public function exportExcel($report)
 {
     $input = Request::createFromGlobals();
     $objPHPExcel = $this->createExcelFile($report);
     $records = $this->getResults();
     // Write header line
     $headerRow = 7;
     $headerCol = 0;
     $objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($headerCol++, $headerRow, 'Reclamo');
     $objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($headerCol++, $headerRow, 'Cliente');
     $objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($headerCol++, $headerRow, 'Región');
     $objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($headerCol++, $headerRow, 'Clase');
     $objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($headerCol++, $headerRow, 'Decisión');
     $objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($headerCol++, $headerRow, 'NC / ND');
     $objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($headerCol++, $headerRow, 'Número');
     $objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($headerCol++, $headerRow, 'Fecha');
     $objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($headerCol++, $headerRow, 'Monto');
     // Escribir líneas
     $recordRow = 8;
     foreach ($records as $region) {
         foreach ($region['data'] as $record) {
             $recordCol = 0;
             $objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($recordCol++, $recordRow, $record['reclamo']);
             $objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($recordCol++, $recordRow, $record['cliente']);
             $objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($recordCol++, $recordRow, $region['name']);
             $objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($recordCol++, $recordRow, $record['clase']);
             $objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($recordCol++, $recordRow, $record['decision']);
             $objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($recordCol++, $recordRow, $record['nc_tipo']);
             $objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($recordCol++, $recordRow, $record['nc_numero']);
             $objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($recordCol++, $recordRow, $record['nc_fecha']);
             $objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($recordCol++, $recordRow, $record['nc_monto']);
             $recordRow++;
         }
     }
     // Set autosize on 50 columns (should be enough)
     $nCols = 50;
     foreach (range(0, $nCols) as $col) {
         $objPHPExcel->getActiveSheet()->getColumnDimensionByColumn($col)->setAutoSize(true);
     }
     return $this->writeExcelFile($objPHPExcel);
 }
 /**
  * Bind the core classes
  *
  * @param  Container $app
  *
  * @return Container
  */
 public function bindCoreClasses(Container $app)
 {
     if ($app->bound('events')) {
         return $app;
     }
     $app->bindIf('files', 'Illuminate\\Filesystem\\Filesystem');
     $app->bindIf('request', function () {
         return Request::createFromGlobals();
     });
     $app->bindIf('config', function ($app) {
         $fileloader = new FileLoader($app['files'], __DIR__ . '/../config');
         return new Repository($fileloader, 'config');
     }, true);
     $app->bindIf('cache', function ($app) {
         return new FileStore($app['Filesystem'], __DIR__ . '/../../public');
     });
     $app->bindIf('url', function ($app) {
         $routeCollection = new RouteCollection();
         return new UrlGenerator($routeCollection, $app['request']);
     });
     return $app;
 }
示例#22
0
 public function getTableData()
 {
     $input = Request::createFromGlobals();
     $returnData = [];
     // Get all records
     $records = Producto::where('id', '>', 0);
     if ($input->clase != '') {
         $records->whereHas('clases', function ($query) use($input) {
             $query->where('id_clase', $input->clase);
         });
     }
     $returnData['total'] = $records->count();
     // Filter results
     if ($input->searchString != '') {
         $records->where(function ($query) use($input) {
             $query->where('codigo', 'LIKE', '%' . $input->searchString . '%')->orWhere('nombre', 'LIKE', '%' . $input->searchString . '%');
         });
     }
     $returnData['filtered'] = $records->count();
     // Get the actual data with limits
     $records->skip($input->displayStart)->take($input->recordsPerPage)->orderBy('codigo');
     $returnData['records'] = $records->get();
     return $returnData;
 }
 public function getHistoricoPrecioProducto()
 {
     $input = Request::createFromGlobals();
     $graphArray = [];
     $graphArray['chart']['type'] = 'spline';
     $graphArray['title']['text'] = 'Historial de precios';
     $graphArray['xAxis']['type'] = 'datetime';
     $graphArray['xAxis']['dateTimeLabelFormats']['month'] = '%e. %b';
     $graphArray['xAxis']['dateTimeLabelFormats']['year'] = '%b';
     $graphArray['xAxis']['title']['text'] = 'Fecha';
     $graphArray['yAxis']['title']['text'] = 'Precio';
     $graphArray['yAxis']['min'] = 0;
     $graphArray['yAxis']['plotLines'] = [['value' => Producto::getPrecioPromedio($input->producto, $input->proveedor), 'dashStyle' => 'shortdash', 'color' => 'red', 'width' => 2, 'label' => ['text' => 'Precio promedio']]];
     // Build data for series
     $serie = [];
     $graphData = [];
     $precios = ProductoPrecio::where('id_proveedor', $input->proveedor)->where('id_producto', $input->producto)->orderBy('fecha')->get();
     foreach ($precios as $precio) {
         $graphData[] = [strtotime($precio->fecha) * 1000, $precio->precio];
     }
     $serie = ['name' => 'Precio', 'data' => $graphData];
     $graphArray['series'][] = $serie;
     return $graphArray;
 }
 /**
  * Consolida las requisiciones correspondientes y mueve las solicitudes en EF
  * @return Array
  */
 public function consolidarRequisiciones()
 {
     $returnArray = array('status' => true, 'message' => '');
     $input = Request::createFromGlobals();
     $requestCore = new \RequestCore();
     $flow = $_SESSION['user_flow'];
     $step = FlowSettings::get($_SESSION['user_flow'], 'ADQ_STEP_CONSOLIDATION');
     $requisiciones = Requisicion::getRequisicionesParaConsolidar();
     $ordenescompra = OrdenCompra::getOrdenesCompraParaConsolidar();
     // Tomar la tarea actual, si no está completada salir
     foreach ($requisiciones as $requisicion) {
         if ($requisicion->asignada_totalmente == 0) {
             $returnArray['status'] = false;
             $returnArray['message'] = 'La requisición ' . $requisicion->id . ' no se encuentra asignada por completo. No se puede continuar';
             return $returnArray;
         }
     }
     // Cambiar estado de las ordenes de compra cuyas requisiciones estén totalmente asignadas
     foreach ($ordenescompra as $ordencompra) {
         $ordencompra->estado = 'C';
         $ordencompra->save();
     }
     foreach ($requisiciones as $requisicion) {
         // Solo completar tareas de requisiciones asignadas totalmente
         if ($requisicion->asignada_totalmente == 1) {
             // Cambiar estado a 'C' (Consolidada)
             $requisicion->estado = 'C';
             $requisicion->save();
             $task = $requisicion->ef_request->open_tasks[0];
             // Completar tareas diferentes a la actual
             // (No se completa la actual porque EF lo hace por default)
             if ($task->task_id != $input->task_id) {
                 $requestCore->completeTask($task->task_request, $task->task_id, $input->flow_id, $input->step_id, $input->user_id, 'Requisición consolidada por el usuario ' . $_SESSION['user_id'], 'next');
             }
         }
     }
     return $returnArray;
 }
示例#25
0
 /**
  * Creates a new request with values from PHP's super globals.
  *
  * @return \Symfony\Component\HttpFoundation\Request A new request
  * @static 
  */
 public static function createFromGlobals()
 {
     //Method inherited from \Symfony\Component\HttpFoundation\Request
     return \Illuminate\Http\Request::createFromGlobals();
 }
示例#26
0
 /**
  * Read Input into $this->input according to jquery.dataTables.js version
  */
 public function __construct()
 {
     $request = Request::createFromGlobals();
     $this->setData($this->processData($request->input()));
     return $this;
 }
示例#27
0
 /**
  * Get the current request instance.
  *
  * @return \Symfony\Component\HttpFoundation\Request
  */
 public function getRequest()
 {
     return $this->request ?: Request::createFromGlobals();
 }
示例#28
0
 /**
  * Create Illuminage's IoC Container
  *
  * @param Container $container A base Container to bind onto
  *
  * @return Container
  */
 protected function createContainer($container = null)
 {
     $app = $container ?: new Container();
     $me = $this;
     // System classes ---------------------------------------------- /
     $app->bindIf('Filesystem', 'Illuminate\\Filesystem\\Filesystem');
     $app->bindIf('request', function () {
         return Request::createFromGlobals();
     });
     // Core classes ------------------------------------------------ /
     $app->bindIf('config', function ($app) {
         $fileloader = new FileLoader($app['Filesystem'], __DIR__ . '/../../');
         return new Repository($fileloader, 'src/config');
     });
     $app->bindIf('cache', function ($app) {
         return new FileStore($app['Filesystem'], __DIR__ . '/../../public');
     });
     $app->bindIf('url', function ($app) {
         $routeCollection = new RouteCollection();
         return new UrlGenerator($routeCollection, $app['request']);
     });
     // Illuminage classes ------------------------------------------ /
     $app->bindIf('imagine', function ($app) use($me) {
         $engine = $me->getOption('image_engine');
         $imagine = "\\Imagine\\{$engine}\\Imagine";
         return new $imagine();
     });
     $app->bindIf('illuminage.processor', function ($app) {
         return new ImageProcessor($app['imagine']);
     });
     $app->bindIf('illuminage.cache', function () use($me) {
         return new Cache($me);
     });
     return $app;
 }
示例#29
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $input = Request::createFromGlobals();
     $record = Requisicion::find($id)->update($input->all());
     return new AjaxResponse('success', '', $record);
 }
 public function procesarArchivo()
 {
     $cotizacion = [];
     $input = Request::createFromGlobals();
     $objPHPExcel = \PHPExcel_IOFactory::createReader('Excel2007')->load($input->archivo);
     $token = $objPHPExcel->setActiveSheetIndex(0)->getCell('B2')->getValue();
     $tokenArray = $this->parseToken($token);
     if ($tokenArray['status'] == true) {
         $cotizacion = Cotizacion::with(['lineas.linea_ordencompra.producto', 'lineas.linea_ordencompra.linea_requisicion.requisicion', 'contacto.proveedor'])->find($tokenArray['token_array'][0]);
         $id_origen = $cotizacion->ordencompra->id_origen;
         // Tomar valores de cabecera
         $cotizacion->forma_pago = $objPHPExcel->setActiveSheetIndex(0)->getCell('B12')->getValue();
         $cotizacion->plazo_pago = $objPHPExcel->setActiveSheetIndex(0)->getCell('B13')->getValue();
         $cotizacion->tiempo_entrega = $objPHPExcel->setActiveSheetIndex(0)->getCell('B14')->getValue();
         $cotizacion->moneda = $objPHPExcel->setActiveSheetIndex(0)->getCell('B15')->getValue();
         switch ($id_origen) {
             case '4':
                 // Comerciales
                 $cotizacion->com_terminos_entrega = $objPHPExcel->setActiveSheetIndex(0)->getCell('B16')->getValue();
                 $cotizacion->com_forma_embarque = $objPHPExcel->setActiveSheetIndex(0)->getCell('B17')->getValue();
                 break;
         }
         // Tomar valores de líneas
         $recordRow = 7;
         while ($objPHPExcel->setActiveSheetIndex(0)->getCell('D' . $recordRow)->getValue() != '') {
             foreach ($cotizacion->lineas as &$linea) {
                 if ($linea->id == $objPHPExcel->setActiveSheetIndex(0)->getCell('D' . $recordRow)->getValue()) {
                     $linea->observacion = $objPHPExcel->setActiveSheetIndex(0)->getCell('G' . $recordRow)->getValue();
                     $linea->codigo_alternativo = $objPHPExcel->setActiveSheetIndex(0)->getCell('H' . $recordRow)->getValue();
                     $linea->cantidad = $objPHPExcel->setActiveSheetIndex(0)->getCell('I' . $recordRow)->getValue();
                     $linea->valor = $objPHPExcel->setActiveSheetIndex(0)->getCell('J' . $recordRow)->getValue();
                     $linea->porcentaje_descuento = $objPHPExcel->setActiveSheetIndex(0)->getCell('K' . $recordRow)->getValue();
                     switch ($id_origen) {
                         case '4':
                             // Comerciales
                             $linea->com_peso = $objPHPExcel->setActiveSheetIndex(0)->getCell('L' . $recordRow)->getValue();
                             $linea->com_partida = $objPHPExcel->setActiveSheetIndex(0)->getCell('M' . $recordRow)->getValue();
                             break;
                     }
                 }
             }
             $recordRow++;
         }
     }
     return ['status' => $tokenArray['status'], 'message' => $tokenArray['message'], 'cotizacion' => $cotizacion];
 }