public function actionWrite()
 {
     parent::actionWrite();
     if (isset($_POST['Grheader'])) {
         if ((int) $_POST['Grheader']['grheaderid'] > 0) {
             $model = $this->loadModel($_POST['Grheader']['grheaderid']);
             $model->poheaderid = $_POST['Grheader']['poheaderid'];
             $model->giheaderid = $_POST['Grheader']['giheaderid'];
             $model->grdate = $_POST['Grheader']['grdate'];
             $model->headernote = $_POST['Grheader']['headernote'];
         } else {
             $model = new Grheader();
             $model->attributes = $_POST['Grheader'];
         }
         try {
             if ($model->save()) {
                 $this->DeleteLock($this->menuname, $_POST['Grheader']['grheaderid']);
                 $this->GetSMessage('scoinsertsuccess');
             } else {
                 $this->GetMessage($model->getErrors());
             }
         } catch (Exception $e) {
             $this->GetMessage($e->getMessage());
         }
     }
 }