Exemplo n.º 1
0
 public function getdptoAction()
 {
     /*$sid = new Container('base');
          $db_name = $sid->offsetGet('dbNombre');
          $id_db = $sid->offsetGet('id_db');
          $this->dbAdapter=$this->getServiceLocator()->get($db_name);
      
          //Obtenemos datos POST
          $lista = $this->request->getPost();
          $dpto = new UnidadTable($this->dbAdapter);
          $unidad = $dpto->getIdUnidad($lista['dpto']);
          
            
          $result = new ViewModel(array('unidad'=>$unidad));
          $result->setTerminal(true);
          return $result*/
     $status = "nok";
     $error = "";
     $msj = "";
     $sid = new Container('base');
     $db_name = $sid->offsetGet('dbNombre');
     //$id_db = $sid->offsetGet('id_db');
     $this->dbAdapter = $this->getServiceLocator()->get($db_name);
     $id_usuario = $sid->offsetGet('id_usuario');
     $parametro = $this->request->getPost();
     if (isset($id_usuario) && !empty($parametro['dpto'])) {
         $dpto = new UnidadTable($this->dbAdapter);
         $lista = $dpto->getListarDptoByNombre($this->dbAdapter, $parametro['dpto']);
         $nombre = "";
         $titular = "";
         $contacto = "";
         $condicion = "";
         $tabla = "";
         if (count($lista) > 0) {
             $status = "ok";
             $tabla = "<table class='table table-hover'><thead><tr><th>Nombres</th><th>Contacto</th><th></th></tr></thead><tbody>";
             $nombre = $lista[0]['dpto'];
             for ($i = 0; $i < count($lista); $i++) {
                 if ($lista[$i]['titular'] == "1") {
                     $titular = isset($lista[$i]['nombre']) ? $lista[$i]['nombre'] : "";
                     if (isset($lista[$i]['condicion'])) {
                         $condicion = $lista[$i]['condicion'] == "A" ? "Arrendatario" : "Copropetario";
                     }
                     $contacto = isset($lista[$i]['contacto']) ? $lista[$i]['contacto'] : "";
                 } else {
                     $tabla = $tabla . "<tr><td>" . $lista[$i]['nombre'] . "</td><td>" . $lista[$i]['contacto'] . "</td><td>" . $lista[$i]['condicion'] . "</td></tr>";
                 }
             }
             $tabla = $tabla . "</tbody></table>";
         } else {
             $status = "nok";
             $error = "No hay informacion para el departamento: " . $parametro['dpto'];
         }
     } else {
         $error = "La sesion ha finalizado, vuelve a conectarse al sistema";
     }
     $datos = array('status' => $status, 'error' => $error, 'message' => $msj, 'nombre' => $nombre, 'titular' => $titular, 'contacto' => $contacto, 'condicion' => $condicion, 'tabla' => $tabla);
     $result = new JsonModel($datos);
     return $result;
 }
Exemplo n.º 2
0
 public function nuevoAction()
 {
     $this->layout('layout/conserje');
     $this->layout()->reclamo = "active";
     $this->layout()->reclamonuevo = "active";
     //$this->dbAdapter=$this->getServiceLocator()->get('Zend\Db\Adapter');
     $sid = new Container('base');
     $db_name = $sid->offsetGet('dbNombre');
     $id_db = $sid->offsetGet('id_db');
     $this->dbAdapter = $this->getServiceLocator()->get($db_name);
     $reclamo = new ReclamoTable($this->dbAdapter);
     //id =0 [Insertar  Reclamo]
     // id > 0 [Actualizar Reclamo]
     $id = (int) $this->params()->fromRoute('id', 0);
     if ($this->getRequest()->isPost()) {
         $lista = $this->request->getPost();
         //valor fijo, debe ser dinamico o recuperado de la sesion
         $lista['id_usuario'] = '1';
         $id_pk = (int) $lista['id_pk'];
         //Inserta o Actualizar Reclamo
         if ($id_pk > 0) {
             $reclamo->actualizarReclamo($id_pk, $lista);
         } else {
             $reclamo->nuevoReclamo($lista);
         }
         return $this->forward()->dispatch('Conserje\\Controller\\Reclamo', array('action' => 'respuesta'));
         //return $this->redirect()->toUrl($this->getRequest()->getBaseUrl().'/conserje/reclamo/consultar');
     } else {
         $form = new ReclamoForm("form");
         //cargamos el combobox de dpto
         $sid = new Container('base');
         $usuario_id = $sid->offsetGet('id_usuario');
         $dpto = new UnidadTable($this->dbAdapter);
         $nmrodpto = $dpto->getDptoUsuario($usuario_id);
         $form->get('id_dpto')->setAttribute('value', $nmrodpto['0']['nombre']);
         //cargamod el combobox de tipo asunto
         $asunto = new TipoAsuntoTable($this->dbAdapter);
         $form->get('id_tipo_asunto')->setAttribute('options', $asunto->getDatosActivos());
         if ($id > 0) {
             $titulo = "Actualizar Reclamo";
             $recuperaDatos = $reclamo->getReclamos($this->dbAdapter, $id);
             $form->get('id_pk')->setAttribute('value', $id);
             $form->get('id_dpto')->setAttribute('value', $recuperaDatos[0]['id_unidad']);
             $form->get('id_tipo_asunto')->setAttribute('value', $recuperaDatos[0]['id_tipo_asunto']);
             $form->get('receptor')->setAttribute('value', $recuperaDatos[0]['receptor']);
             $form->get('descripcion')->setAttribute('value', $recuperaDatos[0]['descripcion']);
         } else {
             $titulo = "Nuevo Reclamo";
         }
     }
     $valores = array('form' => $form, 'url' => $this->getRequest()->getBaseUrl(), "titulo" => $titulo);
     return new ViewModel($valores);
 }
Exemplo n.º 3
0
 public function circularAction()
 {
     //Conectamos a BBDD
     $sid = new Container('base');
     $db_name = $sid->offsetGet('dbNombre');
     $this->dbAdapter = $this->getServiceLocator()->get($db_name);
     //Instancias
     $dpto = new UnidadTable($this->dbAdapter);
     $form = new NotificacionForm("form");
     //Obtenemos combo dptos
     $dptos = $dpto->getDatosActivos();
     //Cargamos dptos en formulario
     $form->get('id_unidad')->setAttribute('options', $dptos);
     $this->layout('layout/comite');
     return new ViewModel(array('form' => $form));
 }
Exemplo n.º 4
0
 public function notificarAction()
 {
     //Conectamos a BBDD
     $sid = new Container('base');
     $db_name = $sid->offsetGet('dbNombre');
     $remitente = "Comit�";
     $this->dbAdapter = $this->getServiceLocator()->get($db_name);
     //Obtenemos datos POST
     $post = $this->request->getPost();
     if (isset($post['destino'])) {
         //Validamos si es mensaje directo a Dpto
         if (isset($post['dpto'])) {
             //Consultamos datos del dpto
             $dptoMail = new UnidadTable($this->dbAdapter);
             $lista = $dptoMail->getVerResidentesActivos($this->dbAdapter, $post['id_unidad']);
             $htmlMarkup = \HtmlCorreo::htmlMensajeDirecto($lista[0]['nombre'], $remitente, $post['textbody']);
             $html = new MimePart($htmlMarkup);
             $html->type = "text/html";
             $body = new MimeMessage();
             $body->setParts(array($html));
             $message = new Message();
             $message->addTo($lista[0]['correo'])->addFrom('*****@*****.**', 'Notificacion becheck')->setSubject($post['asunto'])->setBody($body);
             $transport = new SendmailTransport();
             $transport->send($message);
             //Retornamos a la vista
             $result = new JsonModel(array('status' => 'ok', 'descripcion' => 'Se ha enviado correctamente un correo'));
             //$result->setTerminal(true);
             return $result;
         }
         $result = new JsonModel(array('status' => 'ok', 'descripcion' => $post));
         $result->setTerminal(true);
         return $result;
     }
     //Instancias
     $dpto = new UnidadTable($this->dbAdapter);
     $form = new NotificacionForm("form");
     //Obtenemos combo dptos
     $dptos = $dpto->getDatosActivos();
     //Cargamos dptos en formulario
     $form->get('id_unidad')->setAttribute('options', $dptos);
     $this->layout('layout/comite');
     return new ViewModel(array('form' => $form));
 }
Exemplo n.º 5
0
 public function enviarAction()
 {
     //Obtenemos datos POST
     $post = $this->request->getPost();
     //Conectamos a BBDD
     $sid = new Container('base');
     $remitente = "Conserje";
     $db_name = $sid->offsetGet('dbNombre');
     $this->dbAdapter = $this->getServiceLocator()->get($db_name);
     //Tablas
     $dptoMail = new UnidadTable($this->dbAdapter);
     //Validamos destinatario
     if (isset($post['dpto'])) {
         //Consultamos datos del dpto
         $lista = $dptoMail->getVerResidentesActivos($this->dbAdapter, $post['id_unidad']);
     } else {
         //Consultamos datos del dpto
         $lista = $dptoMail->getVerResidentesActivos($this->dbAdapter, $post['id_unidad']);
     }
     //Armamos EMAIL
     $htmlMarkup = \HtmlCorreo::htmlMensajeDirecto($lista[0]['nombre'], $remitente, $post['textbody']);
     $html = new MimePart($htmlMarkup);
     $html->type = "text/html";
     $body = new MimeMessage();
     $body->setParts(array($html));
     $message = new Message();
     $message->addTo($lista[0]['correo'])->addFrom('*****@*****.**', 'Notificación becheck')->setSubject($post['asunto'])->setBody($body);
     $transport = new SmtpTransport();
     $options = new SmtpOptions(array('name' => 'smtp.gmail.com', 'host' => 'smtp.gmail.com', 'port' => '587', 'connection_class' => 'login', 'connection_config' => array('username' => '*****@*****.**', 'password' => 'xofita123', 'ssl' => 'tls')));
     $transport->setOptions($options);
     $transport->send($message);
     //Retornamos a la vista
     $result = new JsonModel(array('status' => 'ok', 'descripcion' => 'Se ha enviado correctamente un correo'));
     //$result->setTerminal(true);
     return $result;
 }
Exemplo n.º 6
0
 public function modalabonoAction()
 {
     //Obtenemos Datos POST
     $data = $this->request->getPost();
     //Variables BBDD
     $sid = new Container('base');
     $db_name = $sid->offsetGet('dbNombre');
     $this->dbAdapter = $this->getServiceLocator()->get($db_name);
     //Instancias
     $uni = new UnidadTable($this->dbAdapter);
     $ban = new ListaBancoTable($this->dbAdapter);
     $form = new AbonoForm("form");
     //Consultamos info de unidad
     $unidad = $uni->getDatosId($data['id_unidad']);
     $bancos = $ban->getDatos();
     //Cargamos Formulario
     $form->get('nombre_unidad')->setAttribute('value', $unidad[0]['nombre']);
     $form->get('id_unidad')->setAttribute('value', $unidad[0]['id']);
     $form->get('banco_abono')->setAttribute('options', $bancos);
     //Retornamos a la vista
     $result = new ViewModel(array("form" => $form));
     $result->setTerminal(true);
     return $result;
 }
Exemplo n.º 7
0
 public function importarAction()
 {
     //Instancias
     $sid = new Container('base');
     //Obtenemos datos de sesion
     $id_db = $sid->offsetGet('id_db');
     $modulo = $sid->offsetGet('modulo');
     $db_name = $sid->offsetGet('dbNombre');
     //Obtenemos FLAG
     $flag = $_POST['flag'];
     //Conectamos a BBDD Condominio
     $this->dbAdapter = $this->getServiceLocator()->get($db_name);
     //Instancias
     $bode = new BodegaTable($this->dbAdapter);
     $esta = new EstacionamientoTable($this->dbAdapter);
     $unid = new UnidadTable($this->dbAdapter);
     //Definimos ruta DEBE EXISTIR PREVIAMENTE
     $ruta = $_SERVER['DOCUMENT_ROOT'] . '/files/db/' . $id_db . '/' . $modulo[0]['url'] . '/' . $flag;
     //Obtenemos y guardamos File
     $file = $this->params()->fromFiles();
     $adapterFile = new \Zend\File\Transfer\Adapter\Http();
     $adapterFile->setDestination($ruta);
     $adapterFile->receive($file['file-0']['name']);
     //Buscamos el file
     $inputFileName = $ruta . "/" . $file['file-0']['name'];
     //Llamamos Clase PHPExcel
     $objReader = \PHPExcel_IOFactory::createReader('Excel2007');
     $objReader->setReadDataOnly(TRUE);
     $objPHPExcel = $objReader->load($inputFileName);
     //Obtenemos Hoja de trabajo
     $objWorksheet = $objPHPExcel->getActiveSheet();
     // Obtenemos los rangos de celdas de planilla excel
     $highestRow = $objWorksheet->getHighestRow();
     // e.g. 10
     $highestColumn = $objWorksheet->getHighestColumn();
     // e.g 'F'
     $highestColumnIndex = \PHPExcel_Cell::columnIndexFromString($highestColumn) - 1;
     // e.g. 5
     //Cargamos Indices segun flag
     if ($flag == "unidades") {
         $indices = array('nombre', 'piso', 'tipo', 'mts', 'alicuota', 'habitaciones', 'banos', 'estado', 'descripcion');
     }
     if ($flag == "bodegas") {
         $indices = array('nombre', 'piso', 'mts', 'alicuota', 'estado', 'descripcion');
     }
     if ($flag == "estacionamientos") {
         $indices = array('nombre', 'piso', 'tipo', 'mts', 'alicuota', 'estado', 'descripcion');
     }
     if ($flag == "propietarios") {
         $indices = array('nombre', 'piso', 'tipo', 'mts', 'alicuota', 'estado', 'descripcion');
     }
     //Recorremos excel
     for ($row = 3; $row <= $highestRow; ++$row) {
         for ($col = 0; $col <= $highestColumnIndex; ++$col) {
             $lista[$row][$col] = $objWorksheet->getCellByColumnAndRow($col, $row)->getValue();
         }
         //Agregamos indices a array
         error_reporting(E_ERROR);
         $data = array_combine($indices, $lista[$row]);
         if (!$data) {
             $result = new JsonModel(array('status' => 'error', 'descripcion' => "ERROR! Archivo no corresponde a " . ucfirst($flag)));
             $result->setTerminal(true);
             return $result;
         }
         //Insertamos en BBDD
         $data['user_create'] = $sid->offsetGet('id_usuario');
         //Validamos a que tabla insertamos
         if ($flag == "unidades") {
             $unid->nuevaUnidad($data);
         }
         if ($flag == "bodegas") {
             $bode->nuevaBodega($data);
         }
         if ($flag == "estacionamientos") {
             $esta->nuevoEstacionamiento($data);
         }
         ++$cont;
     }
     //Preparamos excel de propietarios
     if ($flag == "unidades") {
         //Indicamos ruta
         $inputFileName = $_SERVER['DOCUMENT_ROOT'] . '/files/db/' . $id_db . '/' . $modulo[0]['url'] . '/copropietarios/Copropietarios.xlsx';
         //Copiamos planilla
         copy($_SERVER['DOCUMENT_ROOT'] . '/files/Copropietarios.xlsx', $inputFileName);
         //Llamamos Clase PHPExcel
         $objPHPexcel = \PHPExcel_IOFactory::load($inputFileName);
         //Obtenemos Hoja de trabajo
         $objWorksheet = $objPHPexcel->getActiveSheet();
         //Obtenemos unidades
         $unidades = $unid->getUnidades();
         //Insertamos valores en celdas
         for ($i = 3; $i < count($unidades) + 3; $i++) {
             $objWorksheet->setCellValue("A" . $i, $unidades[$i - 3]['nombre']);
         }
         //Escribimos nuevamente la planilla
         $objWriter = \PHPExcel_IOFactory::createWriter($objPHPexcel, 'Excel2007');
         $objWriter->save($inputFileName);
     }
     //Devolvemos a la vista
     $descripcion = "Se han ingresado " . $cont . " " . ucfirst($flag) . " al sistema.";
     $result = new JsonModel(array('status' => 'ok', 'descripcion' => $descripcion));
     $result->setTerminal(true);
     return $result;
 }
Exemplo n.º 8
0
 public function registrarAction()
 {
     $sid = new Container('base');
     $id_usuario = $sid->offsetGet('id_usuario');
     $id_db = $sid->offsetGet('id_db');
     $status = "";
     $error = "";
     if (isset($id_usuario)) {
         $fechaCompleta = SysFnc::FechaActualYmdHms();
         $v = $this->request->getPost();
         if (isset($v['id_persona_remite']) && (int) $v['id_persona_remite'] > 0) {
             $db_name = $sid->offsetGet('dbNombre');
             $this->dbAdapter = $this->getServiceLocator()->get($db_name);
             $encomienda = new EncomiendaTable($this->dbAdapter);
             $File = $this->params()->fromFiles('fileData');
             $adapterFile = new \Zend\File\Transfer\Adapter\Http();
             $adapterFile->setDestination($_SERVER['DOCUMENT_ROOT'] . '/files/db/' . $id_db . '/conserje/encomienda');
             $adapterFile->receive($File['name']);
             $nombreArchivoEnc = isset($File['name']) ? $File['name'] : "";
             $datos = array('id_unidad' => $v['id_unidad'], 'id_persona_remite' => $v['id_persona_remite'], 'detalle' => $v['detalle'], 'fecha_ingreso' => $fechaCompleta, 'date_update' => $fechaCompleta, 'user_create' => $id_usuario, 'foto' => $nombreArchivoEnc);
             $idEnc = $encomienda->nuevaEncomienda($datos);
             //Enviar Correo
             $dptoMail = new UnidadTable($this->dbAdapter);
             $lista = $dptoMail->getVerResidentesActivos($this->dbAdapter, $v['id_unidad']);
             for ($i = 0; $i < count($lista); $i++) {
                 if (isset($lista[$i]['correo'])) {
                     $pos = strpos($lista[$i]['correo'], "@");
                     if ($pos == false) {
                     } else {
                         $nombre = $lista[$i]['nombre'];
                         $remitente = $v['remitente'];
                         $descp = "";
                         if ($nombreArchivoEnc == "") {
                             $descp = "No presenta fotografia";
                             $filepath = "";
                         } else {
                             $filepath = 'http://becheck.cl/files/db/' . $id_db . '/conserje/encomienda/' . $nombreArchivoEnc;
                         }
                         //  $htmlMarkup=\HtmlCorreo::htmlEncomienda($nombre,$remitente,$filepath);
                         $htmlMarkup = \HtmlCorreo::htmlconfreserva();
                         $html = new MimePart($htmlMarkup);
                         $html->type = "text/html";
                         $body = new MimeMessage();
                         $body->setParts(array($html));
                         $message = new Message();
                         $message->addTo($lista[$i]['correo'])->addFrom('*****@*****.**', 'Sistema be check')->setSubject('Aviso de Encomienda Recepcionada')->setBody($body);
                         $transport = new SendmailTransport();
                         $transport->send($message);
                         sleep(2);
                         //enviamos correo
                     }
                 }
             }
             //Fin Enviar Correo
             $status = "ok";
         } else {
             $status = "nok";
             $error = "el identificador del remitente no encontrado";
         }
     } else {
         $status = "nok";
         $error = "usuario no encontrado";
     }
     return new JsonModel(array('status' => $status, 'error' => $error));
 }
Exemplo n.º 9
0
 public function verdptoAction()
 {
     $variable = $this->request->getPost();
     $sid = new Container('base');
     $db_name = $sid->offsetGet('dbNombre');
     $this->dbAdapter = $this->getServiceLocator()->get($db_name);
     $dpto = new UnidadTable($this->dbAdapter);
     $lista = $dpto->getVerDpto($this->dbAdapter, $variable['idUnidad']);
     $nombreD1 = "";
     $titularD1 = "";
     $contactoD1 = "";
     $condicionD1 = "";
     $tablaD1 = "";
     $status = "ok";
     if (count($lista) > 0) {
         $tablaD1 = "<table class='table table-hover'><thead><tr><th>Nombres</th><th>Contacto</th><th></th></tr></thead><tbody>";
         $nombreD1 = $lista[0]['dpto'];
         for ($i = 0; $i < count($lista); $i++) {
             if ($lista[$i]['titular'] == "1") {
                 $titularD1 = isset($lista[$i]['nombre']) ? $lista[$i]['nombre'] : "";
                 if (isset($lista[$i]['condicion'])) {
                     $condicionD1 = $lista[$i]['condicion'] == "A" ? "Arrendatario" : "Copropetario";
                 }
                 $contactoD1 = isset($lista[$i]['contacto']) ? $lista[$i]['contacto'] : "";
             } else {
                 $tablaD1 = $tablaD1 . "<tr><td>" . $lista[$i]['nombre'] . "</td><td>" . $lista[$i]['contacto'] . "</td><td>" . $lista[$i]['condicion'] . "</td></tr>";
             }
         }
         $tablaD1 = $tablaD1 . "</tbody></table>";
     }
     return new JsonModel(array('status' => $status, 'nombreD1' => $nombreD1, 'titularD1' => $titularD1, 'contactoD1' => $contactoD1, 'condicionD1' => $condicionD1, 'tablaD1' => $tablaD1));
 }
Exemplo n.º 10
0
 private function sendMailConfirmacion($id_unidad, $id_uth, $dia, $estado)
 {
     $sid = new Container('base');
     $db_name = $sid->offsetGet('dbNombre');
     $this->dbAdapter = $this->getServiceLocator()->get($db_name);
     $dptoMail = new UnidadTable($this->dbAdapter);
     $lista = $dptoMail->getVerResidentesActivos($this->dbAdapter, $id_unidad);
     $rsvQuincho = new RsvQuinchoTable($this->dbAdapter);
     $valoresRsv = $rsvQuincho->mostrarHorarioNombreQuincho($this->dbAdapter, $id_uth);
     for ($i = 0; $i < count($lista); $i++) {
         if (isset($lista[$i]['correo'])) {
             $pos = strpos($lista[$i]['correo'], "@");
             if ($pos == false) {
             } else {
                 $nombre = $lista[$i]['nombre'];
                 $dpto = $lista[$i]['dpto'];
                 //  $htmlMarkup=\HtmlCorreo::htmlEncomienda($nombre,$remitente,$filepath);
                 $htmlMarkup = \HtmlCorreo::htmlconfreserva($nombre, $dpto, $valoresRsv[0]['nombre'], $dia, $valoresRsv[0]['inicio'] . ' a ' . $valoresRsv[0]['fin'], $estado);
                 $html = new MimePart($htmlMarkup);
                 $html->type = "text/html";
                 $body = new MimeMessage();
                 $body->setParts(array($html));
                 $message = new Message();
                 $message->addTo($lista[$i]['correo'])->addFrom('*****@*****.**', 'Sistema be check')->setSubject('Aviso de Reserva de Quincho')->setBody($body);
                 $transport = new SendmailTransport();
                 $transport->send($message);
                 sleep(2);
                 //enviamos correo
             }
         }
     }
 }