Пример #1
0
 public function beforeSave()
 {
     if ($this->isNewRecord) {
         $this->c_estado = '99';
         $this->idusertemp = yii::app()->user->id;
     }
     return parent::beforeSave();
 }
Пример #2
0
 public function beforeSave()
 {
     if ($this->isNewRecord) {
         $this->codigo = $this->Correlativo('codigo', $criteria = null, '547', null);
         if (is_null($this->codigopadre)) {
             $this->codigopadre = '5470000000';
         }
     }
     return parent::beforeSave();
 }
Пример #3
0
 public function beforeSave()
 {
     if ($this->isNewRecord) {
         $this->iduser = Yii::app()->user->id;
         //$this->codestado='10';
     } else {
         //$this->ultimares=" ".strtoupper(trim($this->usuario=Yii::app()->user->name))." ".date("H:i")." :".$this->ultimares;
     }
     $this->colocaimpuestositem();
     ///Inserta o actualiza lois impuestos asigandos al documento
     return parent::beforeSave();
 }
Пример #4
0
 public function beforeSave()
 {
     if ($this->isNewRecord) {
         $this->creadopor = Yii::app()->user->name;
         // $this->creadoel=Yii::app()->user->name;
         // $this->codarea=Numeromaximo::numero($this->model(),'codarea','maximovalor',3);
         //$this->cod_estado='01';
         //$this->c_salida='1';
     } else {
         //$this->ultimares=" ".strtoupper(trim($this->usuario=Yii::app()->user->name))." ".date("H:i")." :".$this->ultimares;
     }
     return parent::beforeSave();
 }
Пример #5
0
 public function beforeSave()
 {
     if ($this->isNewRecord) {
         $criterio = new CDbCriteria();
         $criterio->condition = "codpro=:vcodpro";
         $criterio->params = array(':vcodpro' => $this->codpro);
         $this->codobjeto = str_pad(self::model()->count($criterio) + 1, 3, "0", STR_PAD_LEFT);
         //$this->codobjeto=Numeromaximo::numero($this,'correlativo','maximovalor',3);
     } else {
         //if ($this->cestadovale=='01')
         //$this->numvale=Numeromaximo::numero($this->model(),'correlativo','maximovalor',8,'codcentro');
         //$this->ultimares=" ".strtoupper(trim($this->usuario=Yii::app()->user->name))." ".date("H:i")." :".$this->ultimares;
     }
     return parent::beforeSave();
 }
Пример #6
0
 public function beforeSave()
 {
     if ($this->isNewRecord) {
         $this->creadopor = Yii::app()->user->name;
         // $this->creadoel=Yii::app()->user->name;
         $this->prefijo = '97';
         $this->codocu = '360';
         $this->codestado = '10';
         //creado
         $gg = new Numeromaximo();
         $this->codpro = $gg->numero($this, 'correlativo', 'maximovalor', 4, 'prefijo');
         //  $this->codpro='97'.Numeromaximo::numero($this,'correlativo','maximovalor',4);
         // $this->codpro='97'.Numeromaximo::numero($this->model(),'codpro','maximovalor',4);
         //$this->cod_estado='01';
         //$this->c_salida='1';
     } else {
         //$this->ultimares=" ".strtoupper(trim($this->usuario=Yii::app()->user->name))." ".date("H:i")." :".$this->ultimares;
     }
     return parent::beforeSave();
 }
Пример #7
0
 public function beforeSave()
 {
     if ($this->isNewRecord) {
         $this->idusertemp = Yii::app()->user->id;
         $this->codestado = empty($this->codestado) ? self::ESTADO_PREVIO : $this->codestado;
     } else {
         //$this->ultimares=" ".strtoupper(trim($this->usuario=Yii::app()->user->name))." ".date("H:i")." :".$this->ultimares;
     }
     ///$this->colocaimpuestositem(); //aqui no esto debe de hacerlo el modelo original no el tempral
     $this->descuento = $this->getdescuento();
     //el descuento
     $this->punit = $this->getpreciostock();
     //el valor del stock
     return parent::beforeSave();
 }
Пример #8
0
 public function beforeSave()
 {
     if ($this->isNewRecord) {
         $this->iduser = Yii::app()->user->id;
         $this->fechacreac = date("Y-m-d H:i:s");
         //$gg=new Numeromaximo;
         //$this->codocu=self::DOCUMENTO;
         //$this->codestado=self::ESTADO_PREVIO;
         $this->numero = $this->correlativo(self::CAMPO_DE_NUMERO, null, self::CODIGO_DOCUMENTO, null);
     } else {
         //$this->ultimares=" ".strtoupper(trim($this->usuario=Yii::app()->user->name))." ".date("H:i")." :".$this->ultimares;
     }
     return parent::beforeSave();
 }
Пример #9
0
 public function beforeSave()
 {
     if ($this->isNewRecord) {
         $this->idusertemp = Yii::app()->user->id;
         $this->item = str_pad($this->ocompra->itemmaximo + 1, 3, "0", STR_PAD_LEFT);
         //$this->hidguia=$this->ocompra->idguia;
         //$this->ocompra->itemmaximo;
         if (is_null($this->coddocu)) {
             $this->coddocu = DOCUMENTO;
         }
         $this->estadodetalle = empty($this->estadodetalle) ? ESTADO_PREVIO : $this->estadodetalle;
     } else {
         //$this->ultimares=" ".strtoupper(trim($this->usuario=Yii::app()->user->name))." ".date("H:i")." :".$this->ultimares;
     }
     ///$this->colocaimpuestositem(); //aqui no esto debe de hacerlo el modelo original no el tempral
     return parent::beforeSave();
 }
Пример #10
0
 public function beforeSave()
 {
     if ($this->isNewRecord) {
         $this->creadopor = Yii::app()->user->name;
         //$this->codigo='34343434';
         $this->codocu = '101';
         $this->cestadovale = '99';
         //$this->codobjeto='001';
         //$gg=new Numeromaximo;
         $this->numvale = Numeromaximo::numero($this, 'correlativo', 'maximovalor', 8, 'codcentro');
         $this->fechacre = date("Y-m-d H:i:s");
     } else {
         //if ($this->cestadovale=='01')
         //$this->numvale=Numeromaximo::numero($this->model(),'correlativo','maximovalor',8,'codcentro');
         //$this->ultimares=" ".strtoupper(trim($this->usuario=Yii::app()->user->name))." ".date("H:i")." :".$this->ultimares;
     }
     return parent::beforeSave();
 }
Пример #11
0
 public function beforeSave()
 {
     if ($this->isNewRecord) {
         $this->iduser = yii::app()->user->id;
         $this->codocu = '421';
         $this->codestado = ESTADO_CREADO;
         //$this->fecdoc=date("Y-m-d");	}
         $this->numero = $this->correlativo('numero', $criteria = null, $prefijo = '421', 10);
     }
     return parent::beforeSave();
 }
Пример #12
0
 public function beforeSave()
 {
     if ($this->isNewRecord) {
         $this->iduser = yii::app()->user->id;
     } else {
     }
     return parent::beforeSave();
 }
Пример #13
0
 public function beforeSave()
 {
     if ($this->isNewRecord) {
         $this->iduser = Yii::app()->user->id;
         // $this->creadoel=Yii::app()->user->name;
         //$this->correlativo=Numeromaximo::numero($this->model(),'correlativo','maximovalor',8);
         //$this->fechacre=date('Y-m-d H:i:s');
         //$this->c_salida='1';
     } else {
         //$this->ultimares=" ".strtoupper(trim($this->usuario=Yii::app()->user->name))." ".date("H:i")." :".$this->ultimares;
     }
     return parent::beforeSave();
 }
Пример #14
0
 public function beforeSave()
 {
     if ($this->isNewRecord) {
         $mij = null;
         $this->c_salida = '1';
         $this->codobjeto = '001';
         $this->codocu = '100';
         $this->c_estgui = '99';
         //para que no lo agarre la vista VW-GUIA  HASTA QUE GRABE TODO EL DETALLE
         /****************************************************************
          *	Sacar la direccion
          ****************************************************************/
         $this->sacadireccion();
     } else {
         if ($this->c_estgui == '99') {
             //SI SE TRATA DE UNA GUIA NUEVA COLOCARLE 'PREVIO'
             $this->c_estgui = '10';
         }
         //$this->ultimares=" ".strtoupper(trim($this->usuario=Yii::app()->user->name))." ".date("H:i")." :".$this->ultimares;
     }
     /*********VERIFICANDO LOS CHOFERES****************/
     $mij = Choferes::model()->find("brevete=:vbrevete", array(":vbrevete" => trim($this->c_licon)));
     if (is_null($mij)) {
         //si el brevete no esta registrado pues insertar en nla tabla choferes
         $nuevomodelo = new Choferes();
         $nuevomodelo->nombre = $this->c_trans;
         $nuevomodelo->brevete = $this->c_licon;
         $nuevomodelo->save();
     }
     return parent::beforeSave();
 }
Пример #15
0
 public function beforeSave()
 {
     if ($this->isNewRecord) {
         //$mij=null;
         ///$this->usuario=Yii::app()->user->name;
         $this->c_salida = '0';
         //$command = Yii::app()->db->createCommand(" select nextval('sq_guias') ");
         //$this->n_guia= $command->queryScalar();
         //$this->codocu='101';
         $this->codobjeto = '001';
         $this->codocu = '500';
         $this->c_estgui = '99';
         /****************************************************************
          *	Sacar la direccion
          ****************************************************************/
         $criteria = new CDbCriteria();
         $criteria->addCondition(" c_hcod='" . $this->c_coclig . "' ");
         $row = Direcciones::model()->findall($criteria);
         if (!is_null($row[0])) {
             $this->n_direcformaldes = $row->n_direc;
         }
         $criteria = new CDbCriteria();
         $criteria->addCondition(" c_hcod='" . $this->c_codtra . "' ");
         $row = Direcciones::model()->findall($criteria);
         if (!is_null($row[0])) {
             $this->n_directran = $row->n_direc;
         }
         /*******************************************************************
          *********************************************************************/
         /* SACANDO EL CORRELATIVO
         			/*
         			 *
         			 */
     } else {
         if ($this->c_estgui == '99') {
             //SI SE TRATA DE UNA GUIA NUEVA COLOCARLE 'PREVIO'
             $this->c_estgui = '10';
         }
         if (is_null($this->c_numgui)) {
             $this->c_serie = substr($this->cod_cen, 0, 3);
             $criterio = new CDBcriteria();
             $criterio->addcondition("cod_cen=:vcodcentro and c_salida='0' ");
             $criterio->params = array(":vcodcentro" => $this->cod_cen);
             /*var_dump( $criterio->condition);
             		echo "<br>";*/
             $this->c_numgui = $this->correlativo('c_numgui', $criterio, "");
         }
         //$this->ultimares=" ".strtoupper(trim($this->usuario=Yii::app()->user->name))." ".date("H:i")." :".$this->ultimares;
     }
     /*********VERIFICANDO LOS CHOFERES****************/
     $mij = Choferes::model()->find("brevete=:vbrevete", array(":vbrevete" => trim($this->c_licon)));
     if (is_null($mij)) {
         //si el brevete no esta registrado pues insertar en nla tabla choferes
         $nuevomodelo = new Choferes();
         $nuevomodelo->nombre = $this->c_trans;
         $nuevomodelo->brevete = $this->c_licon;
         $nuevomodelo->save();
     }
     return parent::beforeSave();
 }
Пример #16
0
 public function beforeSave()
 {
     if ($this->isNewRecord) {
         $this->creadopor = Yii::app()->user->name;
         $this->codtrabajador = yii::app()->user->um->getFieldValue(Yii::app()->user->id, 'codtra');
         //$this->codigo='34343434';
         $this->codocu = '101';
         $this->cestadovale = '99';
         //$this->codobjeto='001';
         //$gg=new Numeromaximo;
     } else {
         if ($this->oldAttributes['cestadovale'] != $this->cestadovale and $this->cestadovale == ESTADO_VALE_CREADO) {
             $this->numvale = Numeromaximo::numero($this, 'correlativo', 'maximovalor', 8, 'codcentro');
             $this->fechacre = date("Y-m-d H:i:s");
         }
         //if ($this->cestadovale=='01')
         //$this->numvale=Numeromaximo::numero($this->model(),'correlativo','maximovalor',8,'codcentro');
         //$this->ultimares=" ".strtoupper(trim($this->usuario=Yii::app()->user->name))." ".date("H:i")." :".$this->ultimares;
     }
     return parent::beforeSave();
 }
Пример #17
0
 public function beforeSave()
 {
     if ($this->isNewRecord) {
         //buscano el igv
         //$this->nigv=Igv::model()->findByPk(1)->valor;
         //
         $this->codestado = '99';
         $this->coddocu = '210';
         $this->fecdoc = date("Y-m-d");
         //$this->agregaopcionimpuestos();
         ///$this->usuario=Yii::app()->user->name;
         //	$this->c_salida='1';
         //$command = Yii::app()->db->createCommand(" select nextval('sq_guias') ");
         //$this->n_guia= $command->queryScalar();
         //$this->codestado='99'; //para que no lo agarre la vista VW-GUIA  HASTA QUE GRABE TODO EL DETALLE
     } else {
         if ($this->numcot === null) {
             //$this->codestado=ESTADO_CREADO;
             /* $gg=new Numeromaximo;
                                                          $this->numcot=$gg->numero($this,'correlativ','maximovalor',5,'coddocu');
             
             
             													//$this->numcot=Numeromaximo::numero($this->model(),'numcot','maximovalor',8);
                                                          */
             $this->creadopor = Yii::app()->user->name;
             $this->creadoel = '' . date("Y-m-d H:i:s");
             $this->numcot = $this->correlativo('numcot');
         }
         //$this->ultimares=" ".strtoupper(trim($this->usuario=Yii::app()->user->name))." ".date("H:i")." :".$this->ultimares;
     }
     return parent::beforeSave();
 }
Пример #18
0
 public function beforeSave()
 {
     if ($this->isNewRecord) {
         //$this->estadodetalle='99';
         //$this->coddocu='022';
         // $this->punitdes=$this->punit*($this->docompra_ocompra->descuento);
     }
     //$this->colocaimpuestositem();
     return parent::beforeSave();
 }
Пример #19
0
 public function beforeSave()
 {
     if ($this->isNewRecord) {
         //$command = Yii::app()->db->createCommand(" select nextval('sq_guias') ");
         $this->iduser = Yii::app()->user->id;
         $this->fechacre = date("Y-m-d H:i:s");
         $this->codocu = '560';
         $this->codserv = $this->correlativo('codserv', null, '30', 5);
     } else {
     }
     return parent::beforeSave();
 }