protected function GenerateResponse() { try { $this->response = EmpresasController::Detalles(isset($_POST['id_empresa']) ? $_POST['id_empresa'] : null); } catch (Exception $e) { //Logger::error($e); throw new ApiException($this->error_dispatcher->invalidDatabaseOperation($e->getMessage())); } }
<?php define("BYPASS_INSTANCE_CHECK", false); require_once "../../../server/bootstrap.php"; $page = new GerenciaTabPage(); // Requerir parametros $page->requireParam("eid", "GET", "Esta empresa no existe."); $empresa = EmpresasController::Detalles($_GET["eid"]); $page->addComponent("<div class=\"POS Boton OK\" onclick=\"editarEmpresa();\">Guardar Cambios</div> ó <a href=\"empresas.ver.php?eid=" . $_GET["eid"] . "\" style = \"margin-left:12px;\">Descartar</a> <div class=\"POS Boton\" onclick=\"\" style=\"float:right;\">Vista Previa de Documentos</div>"); $html = "<table style = \"margin-top:10px;\">" . "\t<tr>" . "\t\t<td>" . "\t\t\t<img id = \"img_logo\" width=\"100\" height=\"93\" title=\"\" alt=\"\" src=\"" . urldecode($empresa["detalles"]->logo) . "\" /><br />" . "\t\t\t<input type=\"file\" id=\"file_logo\"name=\"pic\" size=\"40\" onChange=\"cambiarLogo(this);\">" . "\t\t</td>" . "\t\t<td>" . "\t\t\t<h1>Empresa</h1><br />" . "\t\t\t<input type = \"text\" id = \"razon_social\" placeholder=\"Razon Social\" style = \"width:200px; height:25px;\" value = \"" . $empresa["detalles"]->getRazonSocial() . "\"/><br />" . "\t\t\t<input type = \"text\" id = \"rfc\" placeholder=\"RFC\" style = \"width:200px; height:25px; margin-top:10px;\" value = \"" . $empresa["detalles"]->getRfc() . "\"/><br />" . "\t\t</td>" . "\t</tr>" . "</table>" . "<script>" . "\tvar cambiarLogo = function (evt)" . "\t{" . "\t\tvar file = document.getElementById('file_logo');" . "\t\tvar f = file.files[0];" . "\t\tif (!f.type.match('image.*')) {" . "\t\t\tfile.value = '';" . "\t\t\talert('solo se permiten imagenes');" . "\t\t\treturn;" . "\t\t}" . "\t\tvar max_size = 32768;" . "\t\tif(f.size > max_size){" . "\t\t\talert('HTML form max file size (' + (max_size / 1024) + ' kb) exceeded');" . "\t\t\treturn;" . "\t\t}" . "\t\tvar reader = new FileReader();" . "\t\treader.readAsDataURL(f);" . "\t\treader.onload = cambiarImagenLogo(f);" . "\t};" . "\tvar cambiarImagenLogo = function (archivoImagen)" . "\t{" . "\t\treturn function(e) {" . "\t\t\tvar nodoImagen = document.getElementById('img_logo');" . "\t\t\tnodoImagen.src = e.target.result;" . "\t\t\tnodoImagen.title = escape(archivoImagen.name);" . "\t\t};" . "\t};" . "</script>"; $page->addComponent($html); /* * Tab Informacion */ $page->nextTab("Informacion"); $page->addComponent(new TitleComponent("Dirección", 2)); $direccion_form = new DAOFormComponent(DireccionDAO::getByPK($empresa["detalles"]->direccion->getIdDireccion())); $direccion_form->hideField(array("id_direccion", "ultima_modificacion", "id_usuario_ultima_modificacion")); $direccion_form->createComboBoxJoin("id_ciudad", "nombre", CiudadDAO::getAll(), $empresa["detalles"]->direccion->getIdCiudad()); $direccion_form->renameField(array("id_ciudad" => "ciudad")); $direccion_form->addField("sitio_web", "Sitio Web", "text", $empresa["detalles"]->direccion_web); $page->addComponent($direccion_form); $page->addComponent(new TitleComponent("Cuentas Bancarias", 2)); $tabla_cuentas_bancarias = new TableComponent(array("numero_cuenta" => "Numero de cuenta", "nombre_banco" => "Nombre del banco", "propietario_cuenta" => "Propietario cuenta"), array()); $tabla_cuentas_bancarias->addNoData("No hay ninguna cuenta bancaria registrada. <a href='#'>¿ Desea agregar un elemento?.</a>"); $page->addComponent($tabla_cuentas_bancarias); $page->addComponent(new TitleComponent("Configuracion de formatos", 2)); $configuracion_formatos = new FormComponent(); $configuracion_formatos->addField("pie_pagina", "Pie de Pagina", "text", ""); $configuracion_formatos->addField("formato_papel", "Formato de Papel", "text", ""); $page->addComponent($configuracion_formatos);