public function convertToInvoice()
    {
        $id = $this->ID;
        $this->ClassName = Invoice::class;
        $this->write();

        // Get our new Invoice
        $record = Invoice::get()->byID($id);
        $record->Ref = null;
        $record->Prefix = null;
        $record->StartDate = null;
        $record->EndDate = null;
        $record->write();

        return $record;
    }
public function convertToInvoice()
    {
        $id = $this->ID;
        $this->ClassName = Invoice::class;
        $this->write();

        // Get our new Invoice
        $record = Invoice::get()->byID($id);
        $record->Ref = null;
        $record->Prefix = null;
        $record->StartDate = null;
        $record->EndDate = null;
        $record->write();

        return $record;
    }
public function convertToInvoice ( ) { $ id = $ this -> ID ; $ this -> ClassName = Invoice :: class ; $ this -> write ( ) ; // Get our new Invoice $ record = Invoice :: get ( ) -> byID ( $ id ) ; $ record -> Ref = null ; $ record -> Prefix = null ; $ record -> StartDate = null ; $ record -> EndDate = null ; $ record -> write ( ) ; return $ record ; }
Factory method to convert this estimate to an
order.

This method writes and reloads the object so
we are now working with the new object type

@return Invoice
Factory method to convert this estimate to an order .