Example #1
0
 public function actionCreadetalle($idcabeza)
 {
     $modelocabeza = Cajachica::model()->findByPk($_GET['idcabeza']);
     //VERIFICANDO QUE NO EXCEDA EL % DE TOLERNACIA
     if (is_null($modelocabeza)) {
         throw new CHttpException(500, 'No existe esta solicitud con este ID    ' . $_GET['idcabeza'] . '    ');
     }
     $model = new Dcajachica();
     $model->valorespordefecto($this->documento);
     $model->{$this->campoestado} = ESTADO_CREADO;
     $model->coddocu = $this->documentohijo;
     // Uncomment the following line if AJAX validation is needed
     //$this->performAjaxValidation($model);
     if (isset($_POST['Dcajachica'])) {
         $model->attributes = $_POST['Dcajachica'];
         if ($model->save()) {
             if (!empty($_GET['asDialog'])) {
                 //Close the dialog, reset the iframe and update the grid
                 echo CHtml::script("window.parent.\$('#cru-dialog3').dialog('close');\n\t\t\t\t\t\t\t\t\t\t\t\t\t                    window.parent.\$('#cru-frame3').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('detalle-grid');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t");
                 Yii::app()->end();
             }
         }
     }
     // if (!empty($_GET['asDialog']))
     $this->layout = '//layouts/iframe';
     $this->render('_form_detalle', array('model' => $model, 'idcabeza' => $idcabeza));
 }