function actualiza() { $data = $_REQUEST['Opciones']; $id = $_REQUEST['idOpciones']; $a = new Opciones(); $exito = $a->actualizaOpciones($data, "idopciones=" . $id); $ruta['ruta'] = "/opciones/listado"; $this->view->show("ruteador.phtml", $ruta); }
function AsignarxRol() { if (!isset($_REQUEST['idRol'])) { $idRol = 0; } else { $idRol = $_REQUEST['idRol']; } $data['idRol'] = $idRol; $Opciones = new Opciones(); $data['Listado'] = $Opciones->ListadoOpciones(); $rol = new Rol(); $dataRol = $rol->RolCombo(); $data['Rol'] = $dataRol; $OpcRol = new OpcionesRol(); $data['dataRol'] = $OpcRol->OpcionesListaxId($idRol); $this->view->show("/seguridad/AsignarOpcionRol.phtml", $data); }
/** * Displays a particular model. * @param integer $id the ID of the model to be displayed */ public function actionView($id) { /* $this->render('view',array( 'model'=>$this->loadModel($id), )); */ $opcion = Opciones::model()->findAll("`encuestas_IdEncuesta` = {$id}"); $this->render('view', array('opcion' => $opcion, 'model' => $this->loadModel($id))); }
/** * Adds an object to the instance pool. * * Propel keeps cached copies of objects in an instance pool when they are retrieved * from the database. In some cases -- especially when you override doSelect*() * methods in your stub classes -- you may need to explicitly add objects * to the cache in order to ensure that the same objects are always returned by doSelect*() * and retrieveByPK*() calls. * * @param Opciones $value A Opciones object. * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). */ public static function addInstanceToPool(Opciones $obj, $key = null) { if (Propel::isInstancePoolingEnabled()) { if ($key === null) { $key = (string) $obj->getId(); } // if key === null self::$instances[$key] = $obj; } }
/** * Declares an association between this object and a Opciones object. * * @param Opciones $v * @return Intensidades The current object (for fluent API support) * @throws PropelException */ public function setOpciones(Opciones $v = null) { if ($v === null) { $this->setOpcionesId(NULL); } else { $this->setOpcionesId($v->getId()); } $this->aOpciones = $v; // Add binding for other direction of this n:n relationship. // If this object has already been added to the Opciones object, it will not be re-added. if ($v !== null) { $v->addIntensidades($this); } return $this; }
<?php $pass = Opciones::where('nombre', 'pass_mail')->get(array('valor')); return array('driver' => 'smtp', 'host' => 'smtp.1and1.es', 'port' => 587, 'from' => array('address' => '*****@*****.**', 'name' => 'Qdental Admin'), 'encryption' => 'tls', 'username' => '*****@*****.**', 'password' => $pass[0]['valor'], 'sendmail' => '/usr/sbin/sendmail -bs', 'pretend' => false);
$numero_aleatorio = rand(1, 500); $publicidades = Publicidades::model()->findAll("`idPublicidad` = {$numero_aleatorio}"); if ($publicidades == Null) { $i--; } else { foreach ($publicidades as $data) { if ($i == 2) { ?> <div style="position: static; margin-top: 5px; background-color: white"> <p> <?php $encuesta = Encuestas::model()->findAll(array('order' => 'idEncuesta DESC', 'limit' => 1)); foreach ($encuesta as $dataE) { echo $dataE->pregunta; $_SESSION['idEncuesta'] = $dataE->idEncuesta; $opciones = Opciones::model()->findAll(array('order' => 'idOpcion DESC', 'condition' => "`encuestas_idEncuesta` = {$dataE->idEncuesta}")); ?> <ul><?php foreach ($opciones as $dataO) { ?> <li><?php echo $dataO->opcion; if (!isset($_SESSION)) { session_start(); } else { if (!isset($_SESSION['vot'])) { $_SESSION['vot'] = 0; echo CHtml::button('+', array('submit' => 'index.php?r=opciones/update&id=' . $dataO->idOpcion, 'style' => "position: absolute; right: 15px;")); } else { if ($_SESSION['vot'] == 1) { echo " - Votos: ";
public function listado_gf() { $validator = Validator::make(Input::all(), Guardias::$rules); if ($validator->passes()) { $profesional = Profesional::find(Input::get('profesional')); $sede = Sedes::find(Input::get('sede')); $fecha_inicio = explode('/', Input::get('fecha_inicio')); $fecha_inicio = $fecha_inicio[2] . "-" . $fecha_inicio[1] . "-" . $fecha_inicio[0]; $fecha_fin = explode('/', Input::get('fecha_fin')); $fecha_fin = $fecha_fin[2] . "-" . $fecha_fin[1] . "-" . $fecha_fin[0]; $guardias = Guardias::whereBetween('fecha_guardia', array($fecha_inicio, $fecha_fin))->where('sede_id', $sede->id)->where('profesional_id', $profesional->id)->select(DB::raw("DATE_FORMAT(fecha_guardia, '%d/%m/%Y') as fecha"), DB::raw("DATE_FORMAT(fecha_guardia, '%w') as dow"))->get(); $opciones = Opciones::where('nombre', 'guardia_finde')->orWhere('nombre', 'guardia_laborable')->lists('valor', 'nombre'); var_dump($opciones); $suma = 0; foreach ($guardias as $guardia) { if ($guardia->dow != 0) { $guardia->euros = number_format($opciones['guardia_laborable'], 2, ',', '.'); } else { $guardia->euros = number_format($opciones['guardia_finde'], 2, ',', '.'); } $suma = number_format($suma + $guardia->euros, 2, ',', '.'); } //var_dump($guardias);die; return View::make('guardias.listado_gf')->with('guardias', $guardias)->with('profesional', $profesional)->with('sede', $sede)->with('fecha_inicio', $fecha_inicio)->with('fecha_fin', $fecha_fin)->with('opciones', $opciones)->with('suma', $suma); } else { return Redirect::to('guardia/listado')->with('message', '<h3 style="color: red"> Debe de indicar una fecha de inicio y de fin válidas.</h3>')->withErrors($validator)->withInput(); } }
private function _imprimirPresupuesto($numerohistoria, $id) { $presupuesto = Presupuestos::leftJoin('profesionales', 'profesionales.id', '=', 'presupuestos.profesional_id')->select('presupuestos.*', DB::raw("DATE_FORMAT(presupuestos.created_at, '%d/%m/%Y') as creado"), 'profesionales.nombre as p_n', 'profesionales.apellido1 as p_a1', 'profesionales.apellido2 as p_a2')->find($id); $paciente = Pacientes::where('numerohistoria', $numerohistoria)->firstOrFail(); $tratamientos = $presupuesto->tratamientos()->get(array('presupuestos_tratamientos.*', 'tratamientos.nombre', 'tratamientos.imagen', 'tratamientos.tipostratamientos_id')); $companias_list = Companias::lists('nombre', 'id'); $total = 0; $sede = Sedes::find($presupuesto->sede_id); $todaslaspiezas = array(); $todaslaspiezas['muestraOdontograma'] = false; for ($i = 11; $i <= 18; $i++) { $todaslaspiezas[$i] = "/imagenes/piezas/{$i}.jpg"; } for ($i = 21; $i <= 28; $i++) { $todaslaspiezas[$i] = "/imagenes/piezas/{$i}.jpg"; } for ($i = 31; $i <= 38; $i++) { $todaslaspiezas[$i] = "/imagenes/piezas/{$i}.jpg"; } for ($i = 41; $i <= 48; $i++) { $todaslaspiezas[$i] = "/imagenes/piezas/{$i}.jpg"; } foreach ($tratamientos as $t) { $t->precio_unidad = $t->precio_final / $t->unidades; if ($t->tipodescuento == 'P') { $descuento = $t->descuento * $t->precio_final / 100; if ($descuento > 0) { $descuentotext = number_format($t->descuento, 2, ',', '.') . ' %'; } else { $descuentotext = ''; } } else { $descuento = $t->descuento; if ($descuento > 0) { $descuentotext = number_format($t->descuento, 2, ',', '.') . ' €'; } else { $descuentotext = ''; } } $t->precio_final -= $descuento; $t->descuento_text = $descuentotext; $t->compania_text = $companias_list[$t->compania_id]; if (!in_array($t->imagen, array('c', 'i', 'en', 'em', 'ex'))) { $todaslaspiezas['muestraOdontograma'] = true; $todaslaspiezas['custom'] = $t->imagen; } elseif ($t->piezas !== null) { $this->_marcaPiezas($t->piezas, $t->imagen, $todaslaspiezas); $todaslaspiezas['muestraOdontograma'] = true; } $total += $t->precio_final; } $total = number_format($total, 2, ',', '.'); $validez = Opciones::where('nombre', 'validez_presupuesto_meses')->select('valor')->first(); return array('presupuesto' => $presupuesto, 'tratamientos' => $tratamientos, 'total' => $total, 'paciente' => $paciente, 'HTTP_HOST' => Request::server("HTTP_HOST"), 'todaslaspiezas' => $todaslaspiezas, 'sede' => $sede, 'validez' => $validez); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $opcion = Opciones::find($id); $opcion->delete(); return Redirect::action('OpcionesController@index')->with('message', 'Opción eliminada'); }
public function store_ayudantia() { $paciente_id = Input::get('paciente_id'); $historial = new Historial_clinico(); $historial->tratamiento_id = Input::get('tratamiento_id'); $historial->profesional_id = Input::get('profesional_id'); $historial->paciente_id = $paciente_id; $historial->fecha_realizacion = Input::get('fecha_realizacion'); $historial->ayudantia = 1; $historial->presupuesto_tratamiento_id = Input::get('presupuestotratamiento_id', 0); $ayudantia = Opciones::find('1'); $ayudantia = $ayudantia->valor; $historial->precio = Input::get('precio') - Input::get('precio') * (100 - $ayudantia) / 100; if ($historial->precio == 0) { $historial->pendiente_de_cobro = 0; } else { $historial->pendiente_de_cobro = 1; } $historial->id_hist_ayudantia = Input::get('id_hist_ayudantia'); $historial->coste_lab = Input::get('coste_lab', 0); $presupuesto_id = Input::get('presupuesto_id', false); if ($presupuesto_id) { // Marcar el tratamiento como realizado en el presupuesto $presupuesto = Presupuestos::where('id', $presupuesto_id)->where('aceptado', 1)->firstOrFail(); $presupuesto->tratamientos2()->updateExistingPivot($historial->presupuesto_tratamiento_id, array('estado' => 1)); } $historial->save(); //Ponemos el valor de ayudantia_aplicada que es la id de la linea de historial_clinico que tiene la ayudantia $poner_ayudantia_aplicada = Historial_clinico::find(Input::get('id_hist_ayudantia')); $poner_ayudantia_aplicada->ayudantia_aplicada = $historial->id; $poner_ayudantia_aplicada->update(); // // $paciente = Pacientes::where('id', $paciente_id)->firstOrFail(); // $paciente->saldo = $paciente->saldo - Input::get('precio'); // $paciente->update(); return Redirect::action('Historial_clinicoController@show', $paciente_id); }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model = Opciones::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'La página solicitada no existe.'); } return $model; }