public function actionModificadetalle($id)
 {
     $model = Tempalkardex::Model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(500, 'No se encontro ningun documento Kardex para estos datos :' . $id);
     }
     // Uncomment the following line if AJAX validation is needed
     //$this->performAjaxValidation($model);
     $model->setScenario($model->codmov . "_SCN");
     if (isset($_POST['Tempalkardex'])) {
         $model->attributes = $_POST['Tempalkardex'];
         //$model->setScenario('salidareserva');
         // echo "cantidad ".$model->cant;
         // yii::app()->end();
         if ($model->save()) {
             if (!empty($_GET['asDialog'])) {
                 /*echo "cantidad ".$model->cant;
                 	 yii::app()->end();*/
                 //Close the dialog, reset the iframe and update the grid
                 echo CHtml::script("window.parent.\$('#cru-dialogdetalle').dialog('close');\n\t\t\t\t\t\t\t\t\t\t\t\t\t                    window.parent.\$('#cru-detalle').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' => $model->hidvale));
 }