/**
  * Delete existing invoice from database
  *
  * @param void
  * @return boolean
  */
 function delete()
 {
     db_begin_work();
     $delete = parent::delete();
     if ($delete && !is_error($delete)) {
         InvoiceItems::deleteByInvoice($this);
         InvoicePayments::deleteByInvoice($this);
         db_commit();
         return true;
     } else {
         db_rollback();
         return $delete;
     }
     // if
 }
Example #2
0
 public function setAmounts()
 {
     parent::setAmounts();
     $this->setPaidAmount($this->calculate('paid_amount'));
     return $this;
 }