Example #1
0
 public function RegistrarMuestra($idCliente, $nombre, $marca, $identificacion, $cant_muestra, $presentacion, $observaciones)
 {
     $resultado = array('valor' => 1, 'message' => 'Servicio Registrado correctamente.');
     $muestra = new Muestra();
     $muestra->idCliente = $idCliente;
     $muestra->nombre = $nombre;
     $muestra->marca = $marca;
     $muestra->identificacion = $identificacion;
     $muestra->Cant_Muestra = $cant_muestra;
     $muestra->presentacion = $presentacion;
     $muestra->observaciones = $observaciones;
     if (!$muestra->save()) {
         $resultado = array('valor' => 0, 'message' => 'No hemos podido Registrar el servicio, intentelo nuevamente');
     }
 }
Example #2
0
 public function actionAjaxRegistrarMuestra()
 {
     $nombre = $_POST['nombre'];
     $idCliente = $_POST['idCliente'];
     $respuesta = Muestra::model()->RegistrarMuestra($nombre, $idCliente);
     header('Content-Type: application/json; charset="UTF-8"');
     Util::renderJSON(array('success' => $respuesta, 'idGenerado' => Yii::app()->db->getLastInsertID('Muestra')));
 }
 public function post()
 {
     $this->data = $this->param();
     foreach ($this->data as $ms) {
         $muestra = new Muestra();
         $muestra->tomamuestra_fecha = $ms['fechatoma'];
         $muestra->tomamuestra_hora = $ms['horatoma'];
         $muestra->recepcionmuestra_fecha = $ms['fecharecepcion'];
         $muestra->recepcionmuestra_hora = $ms['horarecepcion'];
         $muestra->tipomatrizanalizada_id = $ms['tipomatriz'];
         $muestra->tipomuestra_id = $ms['tipomuestra'];
         $muestra->codigomuestra = $ms['codigomuestra'];
         $muestra->lugartomamuestra_id = $ms['lugarmuestra'];
         $muestra->formato_id = $ms['formato_id'];
         $muestra->save();
     }
 }
Example #4
0
 public function actionAjaxRegistrarMuestra()
 {
     $idCliente = $_POST['idCliente'];
     $nombre = $_POST['nombre'];
     $marca = $_POST['marca'];
     $identificacion = $_POST['identificacion'];
     $cant_muestra = $_POST['cant_muestra'];
     $presentacion = $_POST['presentacion'];
     $observaciones = $_POST['observaciones'];
     $respuesta = Muestra::model()->RegistrarMuestra($idCliente, $nombre, $marca, $identificacion, $cant_muestra, $presentacion, $observaciones);
     header('Content-Type: application/json; charset="UTF-8"');
     Util::renderJSON(array('success' => $respuesta, 'idGenerado' => Yii::app()->db->getLastInsertID('Muestra')));
 }
Example #5
0
 public function actionAjaxActualizarMuestra()
 {
     $idMuestra = $_POST['idMuestra'];
     $idCliente = $_POST['idCliente'];
     $codigo = $_POST['codigo'];
     $nombre = $_POST['nombre'];
     $cant_muestra = $_POST['cant_muestra'];
     $peso_volumen = $_POST['peso_volumen'];
     $metodocliente = $_POST['metodocliente'];
     $presentacion = $_POST['presentacion'];
     $observaciones = $_POST['observaciones'];
     $respuesta = Muestra::model()->ActualizarMuestra($idMuestra, $idCliente, $codigo, $nombre, $cant_muestra, $peso_volumen, $metodocliente, $presentacion, $observaciones);
     Util::renderJSON(array('success' => $respuesta));
 }
 public function destacar()
 {
     //Aca se manda a la funcion editarItem de la clase Item
     //y se queda con la respuesta para redirigir cual sea el caso
     $respuesta = Muestra::destacar(Input::all());
     /*
      if ($respuesta['error'] == true) {
      return Redirect::to('admin/producto')->withErrors($respuesta['mensaje'])->withInput();
      } else {
      return Redirect::to('admin/producto')->with('mensaje', $respuesta['mensaje']);
      }
     * 
     */
     if ($respuesta['error'] == true) {
         return Redirect::to('admin/' . $this->folder_name)->withErrors($respuesta['mensaje'])->withInput();
     } else {
         if (Input::get('continue') == "home") {
             return Redirect::to('/')->with('mensaje', $respuesta['mensaje']);
         } else {
             $menu = $respuesta['data']->item()->seccionItem()->menuSeccion()->url;
             $ancla = '#' . $respuesta['data']->item()->seccionItem()->estado . $respuesta['data']->item()->seccionItem()->id;
             return Redirect::to('/' . $menu)->with('mensaje', $respuesta['mensaje'])->with('ancla', $ancla);
         }
     }
 }
 public function descarga($clave)
 {
     $config = new ExporterConfig();
     $exporter = new Exporter($config);
     //indicador
     $indicador = Indicador::where('clave', '=', $clave)->first();
     $muestras = Muestra::where('id_indicador', '=', $indicador->id)->orderBy('anio', 'DESC')->orderBy('mes', 'ASC')->get();
     $salida = array();
     $salida[] = $this->encabezado_csv($indicador->frecuencia_muestreo);
     //recorrer las muestras
     foreach ($muestras as $muestra) {
         //decide que hacer
         switch ($indicador->frecuencia_muestreo) {
             case 0:
                 $salida[] = array($muestra->anio, $muestra->valor);
                 break;
             case 1:
                 $salida[] = array($muestra->anio, $muestra->mes, $muestra->valor);
                 break;
             case 2:
                 $val = $muestra->mes;
                 $val = $val - 300;
                 $salida[] = array($muestra->anio, $val, $muestra->valor);
                 break;
             case 3:
                 $salida[] = array($muestra->anio, $muestra->mes - 600, $muestra->valor);
                 break;
             case 4:
                 $salida[] = array($muestra->anio, $muestra->mes, $muestra->dia, $muestra->valor);
                 break;
         }
     }
     //el header
     header('Content-type: text/csv');
     header('Content-disposition: attachment;filename=' . $clave . '.csv');
     //exportar
     $exporter->export('php://output', $salida);
 }
Example #8
0
 public function lang()
 {
     $lang = Idioma::where('codigo', App::getLocale())->where('estado', 'A')->first();
     $muestra = Muestra::join('muestra_lang', 'muestra_lang.muestra_id', '=', 'muestra.id')->where('muestra_lang.lang_id', $lang->id)->where('muestra.id', $this->id)->first();
     if (is_null($muestra)) {
         echo "Por null";
         $lang = Idioma::where('codigo', 'es')->where('estado', 'A')->first();
         $muestra = Muestra::join('muestra_lang', 'muestra_lang.muestra_id', '=', 'muestra.id')->where('muestra_lang.lang_id', $lang->id)->where('muestra.id', $this->id)->first();
     }
     return $muestra;
 }
Example #9
0
 function grabarMuestra()
 {
     View::template(null);
     $muestra = new Muestra();
     $muestra->tomamuestra_fecha = $_POST['tomamuestra_fecha'];
     $muestra->tomamuestra_hora = $_POST['tomamuestra_hora'];
     $muestra->recepcionmuestra_fecha = $_POST['recepcionmuestra_fecha'];
     $muestra->recepcionmuestra_hora = $_POST['recepcionmuestra_hora'];
     $muestra->tipomatrizanalizada_id = $_POST['tipomatrizanalizada_id'];
     $muestra->tipomuestra_id = $_POST['tipomuestra_id'];
     $muestra->codigomuestra = $_POST['codigomuestra'];
     $muestra->lugartomamuestra_id = $_POST['lugarmuestra_id'];
     $muestra->formato_id = $_POST['formato_id'];
     if ($muestra->save()) {
         $res = array('estado' => 'exito');
     } else {
         $res = array('estado' => 'fracaso');
     }
     $this->res_ = json_encode($res);
 }
Example #10
0
 public function modificar($id)
 {
     $formato = new Formato();
     $muestra = new Muestra();
     $tipoEnsayo = new Tipoensayo();
     $identMuestra = array();
     $this->user = Load::model('usuario')->find(Session::get('usuario_id'));
     $this->formato = $formato->find_first("id={$id}");
     if ($this->formato->estado == 0 && $this->user->tipousuario_id == 1) {
         Router::redirect("home/seltipoensayo/{$id}");
     } else {
         $this->muestras = $muestra->CargarMuestrasXFormatoId($id);
         $this->acidez = $tipoEnsayo->CargarAcidez();
         $this->alcalinidadRangoBajo = $tipoEnsayo->CargarAlcalinidadRangoBajo();
         $this->alcalinidad = $tipoEnsayo->CargarAlcalinidad();
         $this->durezaTotal = $tipoEnsayo->CargarDurezaTotal();
         $this->durezaCalcica = $tipoEnsayo->CargarDurezaCalcica();
         $this->varios = $tipoEnsayo->CargarVarios();
         $this->cloruros = $tipoEnsayo->CargarCloruros();
         $this->microbiologia = $tipoEnsayo->CargarMicrobiologia();
         $this->identMuestra = $this->genIndicadores($this->muestras);
     }
     // $formato      = new Formato();
     // $muestra      = new Muestra();
     // $tipoEnsayo   = new Tipoensayo();
     // $identMuestra = array();
     // $this->formato              = $formato->find_first("id=$id");
     // $this->muestras             = $muestra->CargarMuestrasXFormatoId($id);
     // $this->acidez               = $tipoEnsayo->CargarAcidez();
     // $this->alcalinidadRangoBajo = $tipoEnsayo->CargarAlcalinidadRangoBajo();
     // $this->alcalinidad          = $tipoEnsayo->CargarAlcalinidad();
     // $this->durezaTotal          = $tipoEnsayo->CargarDurezaTotal();
     // $this->durezaCalcica        = $tipoEnsayo->CargarDurezaCalcica();
     // $this->varios               = $tipoEnsayo->CargarVarios();
     // $this->cloruros             = $tipoEnsayo->CargarCloruros();
     // $this->microbiologia        = $tipoEnsayo->CargarMicrobiologia();
     // $this->identMuestra         = $this->genIndicadores($this->muestras);
     set_time_limit(0);
 }
Example #11
0
 public function muestra()
 {
     return Muestra::where('item_id', $this->id)->first();
 }