Beispiel #1
0
 public function faturar()
 {
     $transaction = Yii::app()->db->beginTransaction();
     try {
         Yii::import("application.components.Mailer.Mailer");
         $this->setAttribute('status', 'FATURADO');
         $fatura = new Fatura();
         $fatura->setAttribute('create_date', date('Y-m-d H:i:s', time()));
         $fatura->save();
         $this->setAttribute('fatura_id', $fatura->getPrimaryKey());
         $this->save();
         $mailer = new Mailer('MailerController');
         $mailer->sendInvoiceEmail($this);
         $transaction->commit();
         return true;
     } catch (Exception $e) {
         $transaction->rollback();
     }
     return false;
 }
Beispiel #2
0
 public function alterar(Fatura $fatura)
 {
     $fatura->setUltimaModificacao();
     return $this->faturaRepository->update($fatura);
 }
 public function gera(Fatura $fatura)
 {
     $valor = $fatura->getValorMensal();
     $nf = new NotaFiscal($valor, $this->impostoSobreValor($valor));
     $this->executaAcoes($nf);
 }