public function operacionalfondoAction() { //Obtenemos datos post $lista = $this->request->getPost(); //Variables de BBDD $sid = new Container('base'); $db_name = $sid->offsetGet('dbNombre'); $this->dbAdapter = $this->getServiceLocator()->get($db_name); //Instancias $cuenta = new FondosTable($this->dbAdapter); //Cargamos datos $lista['saldo'] = str_replace('.', '', $lista['saldo']); //Quitamos formato RUT $lista['rut'] = explode("-", $lista['rut']); $lista['dv'] = $lista['rut'][1]; $lista['rut'] = str_replace(".", "", $lista['rut'][0]); // Validamos si existe if ($lista['id_pk'] > 0) { $cuenta->guardarFondo($lista['id_pk'], $lista); $descripcion = "Edición de Fondo Operacional exitosa"; } else { $cuenta->nuevoFondo($lista); $descripcion = "Fondo Operacional ingresado exitosamente al sistema"; } $oper = $cuenta->getFondoOper($this->dbAdapter); $idbanco = $oper[0]['banco']; $saldo = $oper[0]['saldo']; $result = new JsonModel(array('status' => 'ok', 'descripcion' => $descripcion, 'idbanco' => $idbanco, 'saldo' => $saldo)); return $result; }
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; }