コード例 #1
0
ファイル: Igv.php プロジェクト: hipogea/zega
 public function getIgv()
 {
     $this->_valor = Igv::model()->findByAttributes(array('activo' => '1', 'tipo' => '01'));
     if (is_null($this->_valor)) {
         throw new CHttpException(500, 'No se ha definido el impuesto general a las ventas ');
     } else {
         if ($this->_valor > 1) {
             $this->_valor = round($this->_valor / 100, 2);
         }
     }
     return $this->_valor;
 }
コード例 #2
0
ファイル: Coti.php プロジェクト: hipogea/zega
 public function beforeSave()
 {
     if ($this->isNewRecord) {
         //buscano el igv
         $this->nigv = Igv::model()->findByPk(1)->valor;
         //
         $this->codestado = '99';
         $this->coddocu = '110';
         $this->fecdoc = date("Y-m-d");
     } else {
         if ($this->codestado == '99') {
             $this->codestado = '10';
             $this->numcot = Numeromaximo::numero($this->model(), 'numcot', 'maximovalor', 8);
             //ahora el hijo
             $command = Yii::app()->db->createCommand("update dcotmateriales set estadodetalle='10'  where hidguia =" . $this->idguia . " ");
             $command->execute();
         }
         $command = Yii::app()->db->createCommand("update dcotmateriales set estadodetalle='10'  where hidguia =" . $this->idguia . " and  estadodetalle ='99' ");
         $command->execute();
     }
     //$this->ultimares=" ".strtoupper(trim($this->usuario=Yii::app()->user->name))." ".date("H:i")." :".$this->ultimares;
     return parent::beforeSave();
 }
コード例 #3
0
ファイル: IgvController.php プロジェクト: hipogea/zega
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return Igv the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Igv::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }