module Billing class InvoiceNumber def self.next_for(club) year = Date.current.year count = club.billing_invoices.where("number LIKE ?", "%#{year}%").count + 1 "#{year}/#{count}" end end end