src/Model/Invoice.php
public function setCancelled($iInvoiceId): bool
    {
        $oNow    = Factory::factory('DateTime');
        $bResult = $this->update(
            $iInvoiceId,
            [
                'state'       => self::STATE_CANCELLED,
                'written_off' => $oNow->format('Y-m-d H:i:s'),
            ]
        );

        if ($bResult) {
            $this->triggerEvent(
                Events::INVOICE_CANCELLED,
                [$this->getInvoiceForEvent($iInvoiceId)]
            );
        }

        return $bResult;
    }
public function setCancelled($iInvoiceId): bool
    {
        $oNow    = Factory::factory('DateTime');
        $bResult = $this->update(
            $iInvoiceId,
            [
                'state'       => self::STATE_CANCELLED,
                'written_off' => $oNow->format('Y-m-d H:i:s'),
            ]
        );

        if ($bResult) {
            $this->triggerEvent(
                Events::INVOICE_CANCELLED,
                [$this->getInvoiceForEvent($iInvoiceId)]
            );
        }

        return $bResult;
    }
public function setCancelled ( $ iInvoiceId ) : bool { $ oNow = Factory :: factory ( 'DateTime' ) ; $ bResult = $ this -> update ( $ iInvoiceId , [ 'state' => self :: STATE_CANCELLED , 'written_off' => $ oNow -> format ( 'Y-m-d H:i:s' ) , ] ) ; if ( $ bResult ) { $ this -> triggerEvent ( Events :: INVOICE_CANCELLED , [ $ this -> getInvoiceForEvent ( $ iInvoiceId ) ] ) ; } return $ bResult ; }
Set an invoice as cancelled

@param  int $iInvoiceId The Invoice to query

@return bool
@throws ModelException
@throws FactoryException
Set an invoice as cancelled