コード例 #1
0
ファイル: OficioSaliente.php プロジェクト: jonatanian/TT
 public function nuevoOficioSaliente($inputs, $IdOficio)
 {
     DB::transaction(function () use($inputs, $IdOficio) {
         $oficio = new OficioSaliente();
         $oficio->IdOficioSaliente = $inputs['IdOficio'];
         $oficio->Destinatario = $inputs['Destinatario'];
         $oficio->Correspondencia_Id = $IdOficio;
         $oficio->Usuario_Id = Auth::id();
         $oficio->Dependencia = $inputs['DependenciaE'];
         $oficio->AreaDestinada = $inputs['AreaE'];
         $oficio->save();
     });
     $Id = DB::table('oficio_saliente')->max('IdConsecutivo');
     //Inicialización de las observaciones
     DB::transaction(function () use($inputs, $Id) {
         $oficio = new OficioSaliente();
         $oficioObservacion = new Observaciones();
         $oficioObservacion->Oficio_Saliente_Id = $Id;
         $oficioObservacion->Observacion_Usuario_Id = $oficio->getIdRevisor($Id, $inputs['TipoDeOficio']);
         //Auth::id();
         $oficioObservacion->save();
     });
     $oficio = new OficioSaliente();
     if (!$oficio->getIdRevisor($Id, $inputs['TipoDeOficio'])) {
         DB::transaction(function () use($inputs, $IdOficio) {
             $oficioU = Correspondencia::find($IdOficio);
             $oficioU->Estatus_Id = 404;
             $oficioU->save();
         });
     }
     $Id = DB::table('oficio_saliente')->max('IdConsecutivo');
     return $Id;
 }
コード例 #2
0
ファイル: Observaciones.php プロジェクト: jonatanian/TT
 public function nuevaCorreccionObservacion($inputs)
 {
     $Correspondencia = Correspondencia::find($inputs['IdCorrespondencia']);
     if ($Correspondencia->getIdCaracter() == 1) {
         DB::transaction(function () use($inputs) {
             $oficio = new OficioSaliente();
             $oficioU = Observaciones::find($inputs['IdObservaciones']);
             $oficioU->Oficio_Saliente_Id = $inputs['IdConsecutivo'];
             $oficioU->Observacion_Usuario_Id = $oficio->getIdRevisor($inputs['IdConsecutivo'], 1);
             //Usuario que va a corregir
             $oficioU->DescripcionObservaciones = $inputs['Observacion'];
             $oficioU->save();
         });
     } else {
         DB::transaction(function () use($inputs) {
             $oficio = new OficioSaliente();
             $oficioU = Observaciones::find($inputs['IdObservaciones']);
             $oficioU->Oficio_Saliente_Id = $inputs['IdConsecutivo'];
             $oficioU->Observacion_Usuario_Id = $oficio->getIdRevisor($inputs['IdConsecutivo'], $Correspondencia->getIdCaracter());
             //Usuario que va a corregir
             $oficioU->DescripcionObservaciones = $inputs['Observacion'];
             $oficioU->save();
         });
     }
     /*DB::transaction(function () use ($inputs, $path){
     			$oficioU = Correspondencia::find($inputs['IdCorrespondencia']);
     			$oficioU->URLPDF = $path;
     			$oficioU->save();
     		});*/
     DB::transaction(function () use($inputs) {
         $oficioU = Correspondencia::find($inputs['IdCorrespondencia']);
         $oficioU->Estatus_Id = 401;
         $oficioU->save();
     });
 }
コード例 #3
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate($idobservacion)
 {
     $model = new Observacionesdetalle();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Observacionesdetalle'])) {
         $model->attributes = $_POST['Observacionesdetalle'];
         $model->hidobservaciones = $idobservacion;
         $model->usuario = Yii::app()->user->name;
         $model->fecha = date("d-m-Y H:i:s");
         if ($model->save()) {
             $modeloinventario = Observaciones::model()->findByPk($idobservacion);
         }
         if (!$this->enviamail($modeloinventario, $model->comentario)) {
             echo "fallo";
             yii::app()->end();
         }
         $model->refresh();
         if (!empty($_GET['asDialog'])) {
             //Close the dialog, reset the iframe and update the grid
             echo CHtml::script("window.parent.\$('#cru-dialog1').dialog('close');\n\t\t\t\t\t\t\t\t\t\t\t\t\t                    window.parent.\$('#cru-frame1').attr('src','');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\twindow.parent.\$.fn.yiiGridView.update('{$_GET['gridId']}');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t");
             Yii::app()->end();
         }
         $this->render('Confirma', array('id' => $model->id));
         Yii::app()->end();
         //$this->redirect(array('view','id'=>$model->id));
     }
     $this->layout = '//layouts/iframe';
     $this->render('create', array('model' => $model, 'idobservacion' => $idobservacion));
 }
コード例 #4
0
 /**
  * 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 = Observaciones::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'El enlace o direccion solicitado no existe');
     }
     return $model;
 }
コード例 #5
0
 public function iescmpl_observacionesCorreccionRegistrar()
 {
     /*$file = Input::file('DocPDF');
     			if($file == NULL){
     				Session::flash('msgf','Debe subir un archivo en formato PDF.');
     				return Redirect::action('OficiosController@iescmpl_salientes')->withInput();
     			}
     			
     			$fileExt = Input::file('DocPDF')->getClientOriginalExtension();
     			if($fileExt != 'pdf' or $fileExt == NULL){
     				Session::flash('msgf','Debe subir un archivo en formato PDF.');
     				return Redirect::action('OficiosController@iescmpl_salientes')->withInput();
     			}
     			
     			$url_docpdf = $file->getClientOriginalName();
     
     			if(!preg_match('/^[\x20-\x7e]*$/',$url_docpdf)){
     				Session::flash('msgf','El nombre del archivo PDF no puede contener los caracteres /^[\-]*$');
     				return Redirect::action('OficiosController@iescmpl_salientes')->withInput();
     			}
     			
     			$path = 'oficios\\salientes\\'.$url_docpdf;
     			$destinoPath = public_path().'\\oficios\\salientes\\';
     			
     			$subir = $file->move($destinoPath,$url_docpdf);*/
     $datos = Input::all();
     $observacion = new Observaciones();
     $observacion->nuevaCorreccionObservacion($datos);
     return Redirect::action('OficiosController@iescmpl_salientes');
 }