Class: YDIM::AutoInvoice

Inherits:
Invoice show all
Defined in:
lib/ydim/odba.rb,
lib/ydim/invoice.rb

Constant Summary collapse

@@year_ptrn =
%r{<year>([^<])*</year>}

Constants inherited from Invoice

Invoice::ODBA_SERIALIZABLE

Instance Attribute Summary collapse

Attributes inherited from Invoice

#currency, #date, #debitor, #deleted, #description, #items, #payment_period, #payment_received, #precision, #suppress_vat, #unique_id

Instance Method Summary collapse

Methods inherited from Invoice

#add_item, #debitor_email, #debitor_id, #debitor_name, #due_date, #empty?, #info, #initialize, #item, #pdf_invoice, #status, sum, #to_pdf

Methods included from ItemId

#next_item_id

Constructor Details

This class inherits a constructor from YDIM::Invoice

Instance Attribute Details

#invoice_intervalObject

Returns the value of attribute invoice_interval.



152
153
154
# File 'lib/ydim/invoice.rb', line 152

def invoice_interval
  @invoice_interval
end

#reminder_bodyObject

Returns the value of attribute reminder_body.



152
153
154
# File 'lib/ydim/invoice.rb', line 152

def reminder_body
  @reminder_body
end

#reminder_subjectObject

Returns the value of attribute reminder_subject.



152
153
154
# File 'lib/ydim/invoice.rb', line 152

def reminder_subject
  @reminder_subject
end

Instance Method Details

#advance(date) ⇒ Object



156
157
158
159
160
161
162
163
164
165
# File 'lib/ydim/invoice.rb', line 156

def advance(date)
  months = @invoice_interval.to_s[/\d+/].to_i
  if @reminder_subject
    @reminder_subject.gsub!(@@year_ptrn) do |match|
      years = months / 12
      match.gsub(%r{\d+}) do |year| (year.to_i + years).to_s end
    end
  end
  @date = date >> months
end

#invoice_keyObject



153
154
155
# File 'lib/ydim/invoice.rb', line 153

def invoice_key
  :autoinvoice
end