/**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new AdmPersonas();
     //pepito.perez.1234
     // Uncomment the following line if AJAX validation is needed
     $this->performAjaxValidation($model);
     if (isset($_POST['AdmPersonas'])) {
         $model->attributes = $_POST['AdmPersonas'];
         $modelAdmUsuarios = new AdmUsuarios();
         $modelAdmUsuarios->nombre = "{$model->nombreuno}.{$model->apellidouno}." . substr($model->nro_documento, strlen($model->nro_documento) - 4);
         $modelAdmUsuarios->contrasena = md5($_POST['confirmcontrasena']);
         //$modelAdmUsuarios->rol_id = $model->usuario_id;
         $modelAdmUsuarios->rol_id = 3;
         $modelAdmUsuarios->estado = $model->estado_id;
         $modelAdmUsuarios->save();
         $model->usuario_id = $modelAdmUsuarios->id;
         if ($model->save()) {
             $modelAdmAuditores = new AdmAuditores();
             $modelAdmAuditores->persona_id = $model->id;
             $modelAdmAuditores->save();
             $modelAdmAuditoresCoordinadores = new AdmAuditoresCoordinadores();
             $modelAdmAuditoresCoordinadores->auditor_id = $modelAdmAuditores->id;
             $modelAdmAuditoresCoordinadores->coordinador_id = 1;
             $modelAdmAuditoresCoordinadores->save();
             $this->redirect(array('admin'));
         }
     }
     $this->render('create', array('model' => $model));
 }