public function initcontrolsAction()
 {
     try {
         $EntityManagerPlugin = $this->EntityManagerPlugin();
         $GrupoPrecioCabBO = new GrupoPrecioCabBO();
         $ProductoBO = new ProductoBO();
         $ColorVentasBO = new ColorVentasBO();
         $GrupoPrecioCabBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $ProductoBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $ColorVentasBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $SesionUsuarioPlugin = $this->SesionUsuarioPlugin();
         $SesionUsuarioPlugin->isLoginAdmin();
         $body = $this->getRequest()->getContent();
         $json = json_decode($body, true);
         $opcion = $json['opcion'];
         switch ($opcion) {
             case 'panel-precio':
                 $grupo_dispo_1er_elemento = $json['grupo_dispo_1er_elemento'];
                 $producto_1er_elemento = $json['producto_1er_elemento'];
                 $color_ventas_1er_elemento = $json['color_ventas_1er_elemento'];
                 $tipo_precio_1er_elemento = '';
                 $grupo_precio_cab_id = null;
                 $producto_id = null;
                 $variedad_id = null;
                 $grado_id = null;
                 $color_ventas_id = null;
                 $grupo_precio_opciones = $GrupoPrecioCabBO->getComboGrupoPrecio($grupo_precio_cab_id, $grupo_dispo_1er_elemento);
                 $producto_opciones = $ProductoBO->getComboProductoId($producto_id, $producto_1er_elemento);
                 $tipo_precio_opciones = $GrupoPrecioCabBO->getComboTipoPrecio('', $tipo_precio_1er_elemento);
                 $color_ventas_opciones = $ColorVentasBO->getCombo($color_ventas_id, $color_ventas_1er_elemento);
                 //$variedad_opciones		= $VariedadBO->getCombo($variedad_id);
                 $response = new \stdClass();
                 $response->grupo_precio_opciones = $grupo_precio_opciones;
                 $response->tipo_precio_opciones = $tipo_precio_opciones;
                 $response->color_ventas_opciones = $color_ventas_opciones;
                 $response->respuesta_code = 'OK';
                 break;
         }
         //end switch
         $json = new JsonModel(get_object_vars($response));
         return $json;
     } catch (\Exception $e) {
         $excepcion_msg = utf8_encode($this->ExcepcionPlugin()->getMessageFormat($e));
         $response = $this->getResponse();
         $response->setStatusCode(500);
         $response->setContent($excepcion_msg);
         return $response;
     }
 }
 public function listadodataAction()
 {
     try {
         $EntityManagerPlugin = $this->EntityManagerPlugin();
         $ColorVentasBO = new ColorVentasBO();
         $ColorVentasBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $SesionUsuarioPlugin = $this->SesionUsuarioPlugin();
         $SesionUsuarioPlugin->isLoginAdmin();
         $request = $this->getRequest();
         $page = $request->getQuery('page');
         $limit = $request->getQuery('rows');
         $sidx = $request->getQuery('sidx', 1);
         $sord = $request->getQuery('sord', "");
         $ColorVentasBO->setPage($page);
         $ColorVentasBO->setLimit($limit);
         $ColorVentasBO->setSidx($sidx);
         $ColorVentasBO->setSord($sord);
         $condiciones = array();
         $result = $ColorVentasBO->listado($condiciones);
         $response = new \stdClass();
         $i = 0;
         foreach ($result as $row) {
             //$row['variedad'] = trim($row['variedad']);
             $row2['id'] = $row['id'];
             $row2['nombre'] = trim($row['nombre']);
             $row2['estado'] = trim($row['estado']);
             $response->rows[$i] = $row2;
             $i++;
         }
         //end foreach
         $tot_reg = $i;
         //$response->total 	= ceil($tot_reg/$limit);
         $response->page = $page;
         $response->records = $tot_reg;
         $json = new JsonModel(get_object_vars($response));
         return $json;
     } catch (\Exception $e) {
         $excepcion_msg = utf8_encode($this->ExcepcionPlugin()->getMessageFormat($e));
         $response = $this->getResponse();
         $response->setStatusCode(500);
         $response->setContent($excepcion_msg);
         return $response;
     }
 }
 public function initcontrolsAction()
 {
     try {
         $EntityManagerPlugin = $this->EntityManagerPlugin();
         $SesionUsuarioPlugin = $this->SesionUsuarioPlugin();
         if ($SesionUsuarioPlugin->isLoginAdmin() == false && $SesionUsuarioPlugin->isPerfil(\Application\Constants\Perfil::ID_DISPO) == false) {
             exit;
         }
         //end if
         $body = $this->getRequest()->getContent();
         $json = json_decode($body, true);
         $opcion = $json['opcion'];
         switch ($opcion) {
             case 'panel-grupo-clientes':
             case 'panel-control-disponibilidad':
                 $GrupoDispoCabBO = new GrupoDispoCabBO();
                 $ColorVentasBO = new ColorVentasBO();
                 $CalidadVariedadBO = new CalidadVariedadBO();
                 $GrupoDispoCabBO->setEntityManager($EntityManagerPlugin->getEntityManager());
                 $ColorVentasBO->setEntityManager($EntityManagerPlugin->getEntityManager());
                 $CalidadVariedadBO->setEntityManager($EntityManagerPlugin->getEntityManager());
                 $grupo_dispo_1er_elemento = $json['grupo_dispo_1er_elemento'];
                 $color_ventas_1er_elemento = $json['color_ventas_1er_elemento'];
                 $calidad_variedad_1er_elemento = $json['calidad_variedad_1er_elemento'];
                 $grupo_dispo_cab_id = null;
                 $color_ventas_id = null;
                 $calidad_variedad_id = null;
                 $grupo_dispo_opciones = $GrupoDispoCabBO->getComboGrupoDispo($grupo_dispo_cab_id, $grupo_dispo_1er_elemento);
                 $color_ventas_opciones = $ColorVentasBO->getCombo($color_ventas_id, $color_ventas_1er_elemento);
                 $calidad_variedad_opciones = $CalidadVariedadBO->getComboCalidadVariedad($calidad_variedad_id, $calidad_variedad_1er_elemento);
                 $response = new \stdClass();
                 $response->grupo_dispo_opciones = $grupo_dispo_opciones;
                 $response->color_ventas_opciones = $color_ventas_opciones;
                 $response->calidad_variedad_opciones = $calidad_variedad_opciones;
                 $response->respuesta_code = 'OK';
                 break;
                 /*				case 'panel-control-mantenimiento':
                 					$InventarioBO		= new InventarioBO();					
                 					$CalidadBO			= new CalidadBO();
                 					
                 					$InventarioBO->setEntityManager($EntityManagerPlugin->getEntityManager());
                 					$CalidadBO->setEntityManager($EntityManagerPlugin->getEntityManager());
                 					
                 					$inventario_1er_elemento	= $json['inventario_1er_elemento'];
                 					$inventario_id				= null;
                 					$calidad_1er_elemento	= $json['calidad_1er_elemento'];
                 					$calidad_id				= null;
                 					
                 					$inventario_opciones  	= $InventarioBO->getCombo($inventario_id, $inventario_1er_elemento);
                 					$calidad_opciones 	 	= $CalidadBO->getComboCalidad($calidad_id, $calidad_1er_elemento);
                 					
                 					$response = new \stdClass();
                 					$response->inventario_opciones		= $inventario_opciones;
                 					$response->calidad_opciones			= $calidad_opciones;
                 					$response->respuesta_code 			= 'OK';
                 					break;
                 */
         }
         //end switch
         $json = new JsonModel(get_object_vars($response));
         return $json;
     } catch (\Exception $e) {
         $excepcion_msg = utf8_encode($this->ExcepcionPlugin()->getMessageFormat($e));
         $response = $this->getResponse();
         $response->setStatusCode(500);
         $response->setContent($excepcion_msg);
         return $response;
     }
 }
 public function grabardataAction()
 {
     try {
         $SesionUsuarioPlugin = $this->SesionUsuarioPlugin();
         $usuario_id = $SesionUsuarioPlugin->getUsuarioId();
         $EntityManagerPlugin = $this->EntityManagerPlugin();
         $VariedadData = new VariedadData();
         $VariedadBO = new VariedadBO();
         $ObtentorBO = new ObtentorBO();
         $ColoresBO = new ColoresBO();
         $CalidadVariedadBO = new CalidadVariedadBO();
         $TamanoBunchBO = new TamanoBunchBO();
         $ColorVentasBO = new ColorVentasBO();
         $VariedadBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $ColoresBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $CalidadVariedadBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $ObtentorBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $TamanoBunchBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $ColorVentasBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $respuesta = $SesionUsuarioPlugin->isLoginAdmin();
         if ($respuesta == false) {
             return false;
         }
         $body = $this->getRequest()->getContent();
         $json = json_decode($body, true);
         $accion = $json['accion'];
         //I, M
         $VariedadData->setId($json['id']);
         $VariedadData->setNombre($json['nombre']);
         $VariedadData->setNombreTecnico($json['nombre_tecnico']);
         $VariedadData->setCalidadVariedadId($json['calidad_variedad_id']);
         $VariedadData->setColor($json['color']);
         $VariedadData->setColor2($json['color2']);
         $VariedadData->setGrupoColorId($json['grupo_color_id']);
         $VariedadData->setColorBase($json['colorbase']);
         $VariedadData->setSolido($json['solido']);
         $VariedadData->setEsReal($json['es_real']);
         $VariedadData->setEstProductoEspecial($json['est_producto_especial']);
         $VariedadData->setMensaje($json['mensaje']);
         $VariedadData->setCultivada($json['cultivada']);
         $VariedadData->setCicloProd($json['ciclo_prod']);
         $VariedadData->setObtentorId($json['obtentor_id']);
         $VariedadData->setColorVentasId($json['color_ventas_id']);
         $VariedadData->setUrlFicha($json['url_ficha']);
         $VariedadData->setTamanoBunchId($json['tamano_bunch_id']);
         $VariedadData->setEstado($json['estado']);
         switch ($accion) {
             case 'I':
                 $VariedadData->setUsuarioIngId($usuario_id);
                 $VariedadData->setProductoId('ROS');
                 $result = $VariedadBO->ingresar($VariedadData);
                 break;
             case 'M':
                 $VariedadData->setUsuarioModId($usuario_id);
                 $result = $VariedadBO->modificar($VariedadData);
                 break;
             default:
                 $result['validacion_code'] = 'ERROR';
                 $result['respuesta_mensaje'] = 'ACCESO NO VALIDO';
                 break;
         }
         //end switch
         //Se consulta el registro siempre y cuando el validacion_code sea OK
         if ($result['validacion_code'] == 'OK') {
         } else {
             $row = null;
         }
         //end if
         //Retorna la informacion resultante por JSON
         $row = null;
         $response = new \stdClass();
         $response->respuesta_code = 'OK';
         $response->validacion_code = $result['validacion_code'];
         $response->respuesta_mensaje = $result['respuesta_mensaje'];
         if ($row) {
             $response->row = $row;
             $response->cbo_estado = \Application\Classes\ComboGeneral::getComboEstado($row['estado'], "");
             $response->cbo_color_base = $ColoresBO->getCombo($row['colorbase'], "<Seleccione>");
         } else {
             $response->row = null;
             $response->cbo_estado = '';
             $response->cbo_color_base = '';
         }
         //end if
         $json = new JsonModel(get_object_vars($response));
         return $json;
         //false
     } catch (\Exception $e) {
         $excepcion_msg = utf8_encode($this->ExcepcionPlugin()->getMessageFormat($e));
         $response = $this->getResponse();
         $response->setStatusCode(500);
         $response->setContent($excepcion_msg);
         return $response;
     }
 }
 function exportarexcelOLDAction()
 {
     try {
         $viewModel = new ViewModel();
         $EntityManagerPlugin = $this->EntityManagerPlugin();
         $DispoBO = new DispoBO();
         $InventarioBO = new InventarioBO();
         $CalidadBO = new CalidadBO();
         $ProveedorBO = new ProveedorBO();
         $ColorVentasBO = new ColorVentasBO();
         $CalidadVariedadBO = new CalidadVariedadBO();
         $DispoBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $InventarioBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $CalidadBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $ProveedorBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $ColorVentasBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $CalidadVariedadBO->setEntityManager($EntityManagerPlugin->getEntityManager());
         $SesionUsuarioPlugin = $this->SesionUsuarioPlugin();
         $SesionUsuarioPlugin->isLoginAdmin();
         $request = $this->getRequest();
         $inventario_id = $request->getQuery('inventario_id', "");
         $proveedor_id = $request->getQuery('proveedor_id', "");
         $clasifica = $request->getQuery('clasifica', "");
         $color_ventas_id = $request->getQuery('color_ventas_id', "");
         $calidad_variedad_id = $request->getQuery('calidad_variedad_id', "");
         $nro_tallos = $request->getQuery('nro_tallos', "");
         /*			$InventarioData 		= $InventarioBO->consultar($inventario_id, Application\Constants\ResultType::OBJETO);
         			$CalidadData			= $CalidadBO->consultarPorClasificaFox($clasifica, Application\Constants\ResultType::OBJETO);
         			$ProveedorData			= $ProveedorBO->consultar($proveedor_id, Application\Constants\ResultType::OBJETO);
         			$ColorVentasData 		= $ColorVentasBO->consultar($color_ventas_id, Application\Constants\ResultType::OBJETO);			
         			$CalidadVariedadData 	= $CalidadVariedadBO->consultar($calidad_variedad_id, Application\Constants\ResultType::OBJETO);
         */
         $condiciones = array("inventario_id" => $inventario_id, "proveedor_id" => $proveedor_id, "clasifica" => $clasifica, "color_ventas_id" => $color_ventas_id, "calidad_variedad_id" => $calidad_variedad_id, "nro_tallos" => $nro_tallos);
         $result = $DispoBO->listado($condiciones);
         $totales['40'] = 0;
         $totales['50'] = 0;
         $totales['60'] = 0;
         $totales['70'] = 0;
         $totales['80'] = 0;
         $totales['90'] = 0;
         $totales['100'] = 0;
         $totales['110'] = 0;
         $totales['total'] = 0;
         foreach ($result as &$row) {
             $row['variedad'] = trim($row['variedad']);
             $row['total'] = $row['40'] + $row['50'] + $row['60'] + $row['70'] + $row['80'] + $row['90'] + $row['100'] + $row['110'];
             //Array de Totales
             $totales['40'] = $totales['40'] + $row['40'];
             $totales['50'] = $totales['50'] + $row['50'];
             $totales['60'] = $totales['60'] + $row['60'];
             $totales['70'] = $totales['70'] + $row['70'];
             $totales['80'] = $totales['80'] + $row['80'];
             $totales['90'] = $totales['90'] + $row['90'];
             $totales['100'] = $totales['100'] + $row['100'];
             $totales['110'] = $totales['110'] + $row['110'];
             $totales['total'] = $totales['total'] + $row['total'];
         }
         //end foreach
         $viewModel->result = $result;
         $viewModel->totales = $totales;
         /*			$viewModel->inventario_nombre 	= $InventarioData->getNombre();
         			$viewModel->calidad_nombre		= $CalidadData->getNombre();
         */
         //echo("<pre>");var_dump($result);echo("</pre>");exit;
         $viewModel->setTerminal(true);
         //$this->layout('layout/mobile');
         $viewModel->setTemplate('dispo/disponibilidad/exportalexcel.phtml');
         return $viewModel;
     } catch (\Exception $e) {
         $excepcion_msg = utf8_encode($this->ExcepcionPlugin()->getMessageFormat($e));
         $response = $this->getResponse();
         $response->setStatusCode(500);
         $response->setContent($excepcion_msg);
         return $response;
     }
 }
 /**
  *
  * @param array $condiciones (criterio_busqueda, busqueda_color , busqueda_estado)
  */
 public function generarExcel($condiciones)
 {
     set_time_limit(0);
     ini_set('memory_limit', '-1');
     $ColorVentasBO = new ColorVentasBO();
     $VariedadDAO = new VariedadDAO();
     $ColorVentasBO->setEntityManager($this->getEntityManager());
     $VariedadDAO->setEntityManager($this->getEntityManager());
     //----------------Se configura las Etiquetas de Seleccion-----------------
     $texto_criterio_busqueda = 'TODOS';
     $texto_color = 'TODOS';
     $texto_estado = 'TODOS';
     if (!empty($condiciones['criterio_busqueda'])) {
         $texto_criterio_busqueda = $condiciones['criterio_busqueda'];
     }
     //end if
     switch ($condiciones['busqueda_estado']) {
         case 'A':
             $texto_estado = 'ACTIVO';
             break;
         case 'I':
             $texto_estado = 'INACTIVO';
             break;
     }
     //end switch
     if (!empty($condiciones['busqueda_color'])) {
         //$ColorVentasData 		= $ColorVentasBO->consultar($condiciones['busqueda_color']);
         $texto_color = $condiciones['busqueda_color'];
     }
     //end if
     //----------------Se inicia la configuracion del PHPExcel-----------------
     $PHPExcelApp = new PHPExcelApp();
     $objPHPExcel = new \PHPExcel();
     // Set document properties
     $PHPExcelApp->setUserName('');
     $PHPExcelApp->setMetaDataDocument($objPHPExcel);
     $objPHPExcel->setActiveSheetIndex(0);
     //Configura el tamaño del Papel
     $objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(\PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE);
     $objPHPExcel->getActiveSheet()->getPageSetup()->setPaperSize(\PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4);
     //Se establece la escala de la pagina
     $objPHPExcel->getActiveSheet()->getPageSetup()->setFitToWidth(1);
     $objPHPExcel->getActiveSheet()->getPageSetup()->setFitToHeight(0);
     //Se establece los margenes de la pagina
     $objPHPExcel->getActiveSheet()->getPageMargins()->setTop(0.1);
     $objPHPExcel->getActiveSheet()->getPageMargins()->setRight(0.1);
     $objPHPExcel->getActiveSheet()->getPageMargins()->setLeft(0.1);
     $objPHPExcel->getActiveSheet()->getPageMargins()->setBottom(0.1);
     //------------------------------Registra la cabecera--------------------------------
     $row = 1;
     $col_ini = $PHPExcelApp->getNameFromNumber(0);
     $col_fin = $PHPExcelApp->getNameFromNumber(11);
     $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(0, 1, "LISTADO DE VARIEDADES");
     $objPHPExcel->getActiveSheet()->mergeCells($col_ini . $row . ':' . $col_fin . $row);
     $objPHPExcel->getActiveSheet()->getStyle($col_ini . $row . ':' . $col_fin . $row)->applyFromArray($PHPExcelApp->getStyleArray($PHPExcelApp::STYLE_ARRAY_NEGRILLA));
     $objPHPExcel->getActiveSheet()->getStyle($col_ini . $row . ':' . $col_fin . $row)->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     //------------------------------Registra criterios linea 1--------------------------
     $row = 2;
     $col_ini = $PHPExcelApp->getNameFromNumber(0);
     $col_fin = $PHPExcelApp->getNameFromNumber(11);
     $objRichText = new \PHPExcel_RichText();
     $objRichText->createText('');
     $objCriterio = $objRichText->createTextRun('  Criterio: ');
     $objCriterio->getFont()->setBold(true);
     $objCriterio->getFont()->setColor(new \PHPExcel_Style_Color(\PHPExcel_Style_Color::COLOR_DARKGREEN));
     $objRichText->createText($texto_criterio_busqueda);
     $objColor = $objRichText->createTextRun('    Color Ventas: ');
     $objColor->getFont()->setBold(true);
     $objColor->getFont()->setColor(new \PHPExcel_Style_Color(\PHPExcel_Style_Color::COLOR_DARKGREEN));
     $objRichText->createText($texto_color);
     $objEstado = $objRichText->createTextRun('   Estado: ');
     $objEstado->getFont()->setBold(true);
     $objEstado->getFont()->setColor(new \PHPExcel_Style_Color(\PHPExcel_Style_Color::COLOR_DARKGREEN));
     $objRichText->createText($texto_estado);
     $objPHPExcel->getActiveSheet()->getCell($col_ini . $row)->setValue($objRichText);
     $objPHPExcel->getActiveSheet()->mergeCells($col_ini . $row . ':' . $col_fin . $row);
     //------------------------------ Registro de Fecha de Generacion --------------------------------
     $row = 3;
     $col_ini = $PHPExcelApp->getNameFromNumber(0);
     $col_fin = $PHPExcelApp->getNameFromNumber(11);
     //$etiqueta = "";
     $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(0, $row, "Generado: " . \Application\Classes\Fecha::getFechaHoraActualServidor());
     $objPHPExcel->getActiveSheet()->mergeCells($col_ini . $row . ':' . $col_fin . $row);
     $objPHPExcel->getActiveSheet()->getStyle($col_ini . $row)->applyFromArray($PHPExcelApp->getStyleArray($PHPExcelApp::STYLE_ARRAY_NEGRILLA));
     $objPHPExcel->getActiveSheet()->getStyle($col_ini . $row)->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
     //-------------------------ESTABLECE TITULO DE COLUMNAS----------------------------
     $row = $row + 1;
     $row_detalle_ini = $row;
     $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(0, $row, "Nro");
     $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(1, $row, "Codigo");
     $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(2, $row, "Variedad");
     $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(3, $row, "Link");
     $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(4, $row, "Calidad");
     $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(5, $row, "Obtentor");
     $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(6, $row, "Bunch");
     $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(7, $row, "Color Base");
     $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(8, $row, "Color Venta");
     $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(9, $row, "Solido");
     $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(10, $row, "Real");
     $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(11, $row, "Estado");
     //-------------------------ESTABLECE ANCHO DE COLUMNAS----------------------------
     $objPHPExcel->getActiveSheet()->getColumnDimensionByColumn(0)->setAutoSize(true);
     $objPHPExcel->getActiveSheet()->getColumnDimensionByColumn(1)->setAutoSize(true);
     $objPHPExcel->getActiveSheet()->getColumnDimensionByColumn(2)->setWidth(25);
     $objPHPExcel->getActiveSheet()->getColumnDimensionByColumn(3)->setWidth(6);
     $objPHPExcel->getActiveSheet()->getColumnDimensionByColumn(4)->setAutoSize(true);
     $objPHPExcel->getActiveSheet()->getColumnDimensionByColumn(5)->setAutoSize(true);
     $objPHPExcel->getActiveSheet()->getColumnDimensionByColumn(6)->setAutoSize(true);
     $objPHPExcel->getActiveSheet()->getColumnDimensionByColumn(7)->setAutoSize(true);
     $objPHPExcel->getActiveSheet()->getColumnDimensionByColumn(8)->setWidth(11);
     $objPHPExcel->getActiveSheet()->getColumnDimensionByColumn(9)->setWidth(6);
     $objPHPExcel->getActiveSheet()->getColumnDimensionByColumn(10)->setWidth(6);
     $objPHPExcel->getActiveSheet()->getColumnDimensionByColumn(11)->setWidth(7);
     $objPHPExcel->getActiveSheet()->getStyle($col_ini . $row . ':' . $col_fin . $row)->applyFromArray($PHPExcelApp->getStyleArray($PHPExcelApp::STYLE_ARRAY_NEGRILLA));
     $objPHPExcel_getActiveSheet = $objPHPExcel->getActiveSheet();
     $result = $this->listadoExcel($condiciones);
     $cont_linea = 0;
     foreach ($result as $reg) {
         $cont_linea++;
         $row = $row + 1;
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(0, $row, $cont_linea);
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(0, $row, $cont_linea);
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(1, $row, $reg['id']);
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(2, $row, $reg['nombre']);
         if (!empty($reg['url_ficha'])) {
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(3, $row, 'FOTO');
             $objPHPExcel->getActiveSheet()->getCell('D' . $row)->getHyperlink()->setUrl($reg['url_ficha']);
         } else {
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(3, $row, '');
         }
         //end if
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(4, $row, $reg['calidad']);
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(5, $row, $reg['nombre_obtentor']);
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(6, $row, $reg['nombre_bunch']);
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(7, $row, $reg['color_base']);
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(8, $row, $reg['color_venta']);
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(9, $row, $reg['solido']);
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(10, $row, $reg['es_real']);
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(11, $row, $reg['estado']);
     }
     //end foreach
     //$objPHPExcel->getActiveSheet()->getStyle($col_ini.$row.':'.$col_fin.$row)->applyFromArray($PHPExcelApp->getStyleArray($PHPExcelApp::STYLE_ARRAY_NEGRILLA));
     //Margenes
     $col_ini = $PHPExcelApp->getNameFromNumber(0);
     $col_fin = $PHPExcelApp->getNameFromNumber(11);
     $objPHPExcel->getActiveSheet()->getStyle($col_ini . $row_detalle_ini . ":" . $col_fin . $row)->applyFromArray($PHPExcelApp->getStyleArray($PHPExcelApp::STYLE_ARRAY_BORDE_TODO));
     // Rename worksheet
     $objPHPExcel->getActiveSheet()->setTitle('Listado Variedades');
     $PHPExcelApp->save($objPHPExcel, $PHPExcelApp::FORMAT_EXCEL_2007, "Listado_Variedades.xlsx");
 }