Esempio n. 1
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Despacho();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Despacho'])) {
         $model->attributes = $_POST['Despacho'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
Esempio n. 2
0
 public static function insertadespacho($id, $punto, $respon)
 {
     $despachito = Despacho::model()->find("hidkardex=" . $id . " and vigente='1' ");
     if (is_null($despachito)) {
         $modelo = new Despacho();
         $modelo->hidkardex = $id;
         $modelo->hidpunto = $punto;
         $modelo->fechacreac = date("Y-m-d H:i:s");
         $modelo->responsable = $respon;
         $modelo->iduser = Yii::app()->user->id;
         $modelo->vigente = '1';
         $modelo->save();
     }
 }