Class: ODDB::AbstractInvoiceItem

Inherits:
Object
  • Object
show all
Defined in:
src/model/invoice.rb

Direct Known Subclasses

InvoiceItem

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (AbstractInvoiceItem) initialize

A new instance of AbstractInvoiceItem



65
66
67
68
69
# File 'src/model/invoice.rb', line 65

def initialize
  @quantity = 1.0
  @duration = 1
  @data = {}
end

Instance Attribute Details

- (Object) data

Returns the value of attribute data



62
63
64
# File 'src/model/invoice.rb', line 62

def data
  @data
end

- (Object) duration

Returns the value of attribute duration



62
63
64
# File 'src/model/invoice.rb', line 62

def duration
  @duration
end

- (Object) expiry_time

Returns the value of attribute expiry_time



62
63
64
# File 'src/model/invoice.rb', line 62

def expiry_time
  @expiry_time
end

- (Object) item_pointer

Returns the value of attribute item_pointer



62
63
64
# File 'src/model/invoice.rb', line 62

def item_pointer
  @item_pointer
end

- (Object) price

Returns the value of attribute price



62
63
64
# File 'src/model/invoice.rb', line 62

def price
  @price
end

- (Object) quantity

Returns the value of attribute quantity



62
63
64
# File 'src/model/invoice.rb', line 62

def quantity
  @quantity
end

- (Object) text

Returns the value of attribute text



62
63
64
# File 'src/model/invoice.rb', line 62

def text
  @text
end

- (Object) time

Returns the value of attribute time



62
63
64
# File 'src/model/invoice.rb', line 62

def time
  @time
end

- (Object) type

Returns the value of attribute type



62
63
64
# File 'src/model/invoice.rb', line 62

def type
  @type
end

- (Object) unit

Returns the value of attribute unit



62
63
64
# File 'src/model/invoice.rb', line 62

def unit
  @unit
end

- (Object) user_pointer

Returns the value of attribute user_pointer



62
63
64
# File 'src/model/invoice.rb', line 62

def user_pointer
  @user_pointer
end

- (Object) vat_rate

Returns the value of attribute vat_rate



62
63
64
# File 'src/model/invoice.rb', line 62

def vat_rate
  @vat_rate
end

- (Object) yus_name

Returns the value of attribute yus_name



62
63
64
# File 'src/model/invoice.rb', line 62

def yus_name
  @yus_name
end

Instance Method Details

- (Object) dup



70
71
72
73
74
75
76
# File 'src/model/invoice.rb', line 70

def dup
  dup = super
  if(@data)
    dup.data = @data.dup
  end
  dup
end

- (Object) to_s



89
90
91
# File 'src/model/invoice.rb', line 89

def to_s
  @text.to_s
end

- (Object) total_brutto



77
78
79
# File 'src/model/invoice.rb', line 77

def total_brutto
  total_netto * (1.0 + (@vat_rate.to_f / 100.0))
end

- (Object) total_brutto=(total)



80
81
82
# File 'src/model/invoice.rb', line 80

def total_brutto=(total)
  self.total_netto = (total / (1.0 + (@vat_rate.to_f / 100.0)))
end

- (Object) total_netto



83
84
85
# File 'src/model/invoice.rb', line 83

def total_netto
  @quantity.to_f * @price.to_f
end

- (Object) total_netto=(total)



86
87
88
# File 'src/model/invoice.rb', line 86

def total_netto=(total)
  @price = total.to_f / @quantity.to_f
end

- (Object) values



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'src/model/invoice.rb', line 95

def values
  {
    :data         =>  @data,
    :duration     =>  @duration,
    :expiry_time  => @expiry_time,
    :item_pointer =>  @item_pointer,
    :price        =>  @price,
    :quantity     =>  @quantity,
    :text         =>  @text,
    :time         =>  @time,
    :type         =>  @type,
    :unit         =>  @unit,
    :yus_name     => @yus_name,
    :vat_rate     =>  @vat_rate,
  }
end

- (Object) vat



92
93
94
# File 'src/model/invoice.rb', line 92

def vat
  total_netto * @vat_rate.to_f / 100.0
end

- (Object) ydim_data



111
112
113
114
115
116
117
118
119
120
121
122
# File 'src/model/invoice.rb', line 111

def ydim_data
  {
    :data         =>  @data,
    :expiry_time  => @expiry_time,
    :price        =>  @price,
    :quantity     =>  @quantity,
    :text         =>  @text,
    :time         =>  @time,
    :unit         =>  @unit,
    :vat_rate     =>  @vat_rate,
  }
end