Example #1
0
 public function seguroAction()
 {
     //Conectamos a BBDD
     $sid = new Container('base');
     $db_name = $sid->offsetGet('dbNombre');
     $id_db = $sid->offsetGet('id_db');
     $this->dbAdapter = $this->getServiceLocator()->get($db_name);
     //Tablas y formularios
     $seg = new SeguroTable($this->dbAdapter);
     $fon = new FondosTable($this->dbAdapter);
     $cob = new CobroTable($this->dbAdapter);
     $tegr = new TipoEgresoTable($this->dbAdapter);
     $prov = new ProveedorTable($this->dbAdapter);
     $form = new SeguroForm("form");
     //Obtenemos Datos
     $seguros = $seg->getDatos();
     $fondo = $fon->getFondoOper();
     $tipo_egreso = $tegr->getTipoNombre("Seguros y Otros");
     $proveedores = $prov->getProveedoresCombo($this->dbAdapter);
     //Cargamos form con datos para el egreso
     $form->get('origen')->setAttribute('value', $fondo[0]['id']);
     $form->get('id_tipo_egreso')->setAttribute('value', $tipo_egreso[0]['id']);
     $form->get('id_proveedor')->setAttribute('options', $proveedores);
     //Construimos tabla de Seguros
     $tabla = "";
     $ruta = '/files/db/' . $id_db . '/admin/infocom/seguro/';
     for ($i = 0; $i < count($seguros); $i++) {
         if ($seguros[$i]['estado'] == '1') {
             $estado = "Activo";
         } else {
             $estado = "Finalizado";
         }
         $pf = strtotime($seguros[$i]['vigenciafin']);
         $mostrarF = date("d-M-Y", $pf);
         $prox_cuota = $cob->getCobroIdEgreso($seguros[$i]['id_egreso']);
         $tabla = $tabla . "<tr>\r\n                            <td align='left'>" . $seguros[$i]['poliza'] . "</td>\r\n                            <td align='left'>" . $seguros[$i]['riesgo'] . "</td>\r\n                            <td align='left'>\$ " . number_format($seguros[$i]['valor_prima'], "0", ".", ".") . "</td>\r\n                            <td align='left'>" . $prox_cuota[0]['cuota'] . "/" . $seguros[$i]['cuotas'] . "</td>\r\n                            <td align='left'>" . $mostrarF . "</td>\r\n                            <td align='left'>" . $estado . "</td>\r\n                            <td align='left'><a target='_blank' href='" . $ruta . $seguros[$i]['url_poliza'] . "'><i class='fa fa-file'></i></td>\r\n                            </tr>";
     }
     $result = new JsonModel(array('status' => 'ok', 'tabla' => $tabla));
     $result->setTerminal(true);
     return $result;
 }
Example #2
0
 public function detalleproveedorAction()
 {
     //Conectamos con BBDD
     $sid = new Container('base');
     $db_name = $sid->offsetGet('dbNombre');
     $this->dbAdapter = $this->getServiceLocator()->get($db_name);
     //Instancias
     $prv = new ProveedorTable($this->dbAdapter);
     $tps = new TipoServicioTable($this->dbAdapter);
     $vpr = new VProveedorTable($this->dbAdapter);
     //Obtenemos id de Proveedor
     $data = $this->getRequest()->getPost();
     //Consultamos Proveedor y sus servicios en BBDD
     $prov = $prv->getProveedoresId($data['id']);
     $serv = $tps->getServicioId($prov[0]['id_servicio']);
     $vpro = $vpr->getProveedoresId($prov[0]['id']);
     $prov[0]['servicio'] = $serv[0]['nombre'];
     $prov[0]['categoria'] = $serv[0]['categoria'];
     $prov['0']['rut'] = number_format($prov['0']['rut'], -3, "", ".") . "-" . ucfirst($prov['0']['dv']);
     $prov['0']['monto'] = $vpro[0]['monto'];
     $prov['0']['fecha'] = date("d-m-Y", strtotime($vpro[0]['ultimopago']));
     $result = new JsonModel($prov);
     return $result;
 }
 public function editaractivoAction()
 {
     //Conectamos con BBDD
     $sid = new Container('base');
     $db_name = $sid->offsetGet('dbNombre');
     $this->dbAdapter = $this->getServiceLocator()->get($db_name);
     //Obtenemos datos POST
     $data = $this->getRequest()->getPost();
     //Instancias
     $invt = new InventarioTable($this->dbAdapter);
     $fond = new FondosTable($this->dbAdapter);
     $prov = new ProveedorTable($this->dbAdapter);
     $form = new ActivoForm("form");
     if ($data['id_pk'] > 0) {
         //Guardamos en BBDD
         $invt->editarActivo($data['id_pk'], $data);
         //Retornamos a la vista
         $descripcion = 'Cambios guardados exitosamente';
         $result = new JsonModel(array('status' => 'ok', 'descripcion' => $descripcion));
         $result->setTerminal(true);
         return $result;
     }
     //Obtenemos activo con id
     $activo = $invt->getActivoId($data['id']);
     //Obtenemos datos de combos
     $fondo = $fond->getFondoId($activo[0]['id_fondo']);
     $combo = array($fondo[0]['id'] => $fondo[0]['nombre']);
     //Cargamos combo proveedor
     if ($activo[0]['area_responsable'] == "proveedor") {
         $proveedores = $prov->getProveedoresCombo($this->dbAdapter);
         $form->get('responsable')->setAttribute('options', $proveedores);
         $value = array_search($activo[0]['responsable'], $proveedores);
         $form->get('responsable')->setAttribute('value', $value);
     }
     //Cargamos codigo interno del inventario
     $activo[0]['codigo_interno'] = "10" . $activo[0]['id'] * 2;
     //Cargamos formulario
     $form->get('id_pk')->setAttribute('value', $activo[0]['id']);
     $form->get('nombre')->setAttribute('value', $activo[0]['nombre']);
     $form->get('id_fondo')->setAttribute('options', $combo);
     $form->get('valor')->setAttribute('value', $activo[0]['valor']);
     $form->get('cantidad')->setAttribute('value', $activo[0]['cantidad']);
     $form->get('area_responsable')->setAttribute('value', $activo[0]['area_responsable']);
     $form->get('estado')->setAttribute('value', $activo[0]['estado']);
     $form->get('factura')->setAttribute('value', $activo[0]['factura']);
     $form->get('fecha')->setAttribute('value', $activo[0]['fecha']);
     $form->get('send')->setAttribute('value', "Editar activo");
     $form->get('marca')->setAttribute('value', $activo[0]['marca']);
     $form->get('modelo')->setAttribute('value', $activo[0]['modelo']);
     $form->get('nmro_serie')->setAttribute('value', $activo[0]['nmro_serie']);
     $form->get('ubicacion')->setAttribute('value', $activo[0]['ubicacion']);
     $form->get('observacion')->setAttribute('value', $activo[0]['observacion']);
     //Retornamos a la vista
     $result = new ViewModel(array('form' => $form, 'activo' => $activo));
     $result->setTerminal(true);
     return $result;
 }