Class: ODDB::InvoiceItem

Inherits:
AbstractInvoiceItem show all
Includes:
Persistence
Defined in:
src/model/invoice.rb

Constant Summary

ODBA_SERIALIZABLE =
['@data']

Constants included from Persistence

ODBA_PREDEFINE_SERIALIZABLE

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods included from PersistenceMethods

#checkout, #data_origin, #data_origins, #diff, #nil_if_empty, #parent, #pointer_descr, #structural_ancestors, #undiffable?, #update_values

Methods inherited from AbstractInvoiceItem

#dup, #to_s, #total_brutto, #total_brutto=, #total_netto, #total_netto=, #values, #vat, #ydim_data

Constructor Details

- (InvoiceItem) initialize

A new instance of InvoiceItem



130
131
132
133
# File 'src/model/invoice.rb', line 130

def initialize
  super
  @quantity = 1
end

Class Method Details

+ (Object) expiry_time(duration, time)



127
128
129
# File 'src/model/invoice.rb', line 127

def InvoiceItem.expiry_time(duration, time)
  time + (duration * 24 * 60 * 60)
end

Instance Method Details

- (Boolean) expired?(time = nil)

Returns:

  • (Boolean)


134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'src/model/invoice.rb', line 134

def expired?(time=nil)
  @time.nil? \
    || @expiry_time.nil? or
  begin
    exp = Date.new(@expiry_time.year, @expiry_time.month, @expiry_time.day)
    date = case time
           when Date
             time
           when Time
             Date.new(time.year, time.month, time.day)
           else
             @@today
           end
    date > exp
  end
end

- (Object) init(app)



150
151
152
# File 'src/model/invoice.rb', line 150

def init(app)
  @pointer.append(@oid)
end