Esempio n. 1
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 $id the ID of the model to be loaded
  * @return Deducciones the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Deducciones::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Esempio n. 2
0
 public function actionRecibo($id)
 {
     if (Yii::app()->request->isAjaxRequest) {
         //outputProcessing = true because including css-files ...
         $a = $this->loadModel($id);
         $b = Asignaciones::model()->findByAttributes(array('id' => $a->id_asignacion));
         $c = Deducciones::model()->findByAttributes(array('id' => $a->id_deduccion));
         $this->renderPartial('recibo', array('a' => $a, 'b' => $b, 'c' => $c), false, true);
         date_default_timezone_set('America/Caracas');
         $auditoria = new Auditoria();
         $auditoria->id_user = Yii::app()->user->getId();
         $auditoria->accion = 6;
         $auditoria->modelo = $this->modelo;
         $auditoria->id_registro = $a->id;
         $auditoria->fecha = date("Y-m-d h:i:s");
         $auditoria->save(false);
         //js-code to open the dialog
         if (!empty($_GET['asDialog'])) {
             echo CHtml::script('$("#dlg-address-view").dialog("open")');
         }
         Yii::app()->end();
     } else {
         $this->render('ficha', array('model' => $this->loadModel($id)));
     }
 }