protected function getBaseNumber()
    {
        $base = 0;
        $prefix = $this->get_prefix();
        $classname = $this->ClassName;

        // Get the last instance of the current class
        $last = $classname::get()
            ->filter("ClassName", $classname)
            ->sort("Ref", "DESC")
            ->first();

        // If we have a last estimate/invoice, get the ID of the last invoice
        // so we can increment
        if (isset($last)) {
            $base = str_replace($prefix, "", $last->Ref);
            $base = (int)str_replace("-", "", $base);
        }

        // Increment base
        $base++;

        return $base;
    }
protected function getBaseNumber()
    {
        $base = 0;
        $prefix = $this->get_prefix();
        $classname = $this->ClassName;

        // Get the last instance of the current class
        $last = $classname::get()
            ->filter("ClassName", $classname)
            ->sort("Ref", "DESC")
            ->first();

        // If we have a last estimate/invoice, get the ID of the last invoice
        // so we can increment
        if (isset($last)) {
            $base = str_replace($prefix, "", $last->Ref);
            $base = (int)str_replace("-", "", $base);
        }

        // Increment base
        $base++;

        return $base;
    }
protected function getBaseNumber ( ) { $ base = 0 ; $ prefix = $ this -> get_prefix ( ) ; $ classname = $ this -> ClassName ; // Get the last instance of the current class $ last = $ classname :: get ( ) -> filter ( "ClassName" , $ classname ) -> sort ( "Ref" , "DESC" ) -> first ( ) ; // If we have a last estimate/invoice, get the ID of the last invoice // so we can increment if ( isset ( $ last ) ) { $ base = str_replace ( $ prefix , "" , $ last -> Ref ) ; $ base = ( int ) str_replace ( "-" , "" , $ base ) ; } // Increment base $ base ++ ; return $ base ; }
Get a base ID for the last Estimate in the DataBase

@return int
Get a base ID for the last Estimate in the DataBase