Class: ODDB::Html::View::PayPal::InvoiceItems
- Inherits:
-
HtmlGrid::List
- Object
- HtmlGrid::List
- ODDB::Html::View::PayPal::InvoiceItems
- Defined in:
- lib/oddb/html/view/paypal/register_form.rb
Constant Summary collapse
- COMPONENTS =
{ [0,0] => :quantity, [1,0] => :text, [2,0] => :price, }
- CSS_CLASS =
'invoice items'
- CSS_MAP =
{ [0,0] => 'right', [1,0] => '', [2,0] => 'right', }
- LEGACY_INTERFACE =
false
- OMIT_HEADER =
true
- STRIPED_BG =
false
Instance Method Summary collapse
- #compose_footer(matrix) ⇒ Object
- #format_price(price, currency = nil) ⇒ Object
- #price(model) ⇒ Object
- #quantity(model) ⇒ Object
- #text(model) ⇒ Object
- #total_brutto ⇒ Object
- #total_netto ⇒ Object
- #vat ⇒ Object
Instance Method Details
#compose_footer(matrix) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/oddb/html/view/paypal/register_form.rb', line 23 def (matrix) total_net = [nil, @lookandfeel.lookup(:total_netto), nil, total_netto()] vat = [nil, @lookandfeel.lookup(:vat), nil, vat()] total = [nil, @lookandfeel.lookup(:total_brutto), nil, total_brutto()] @grid.add(total_net, *matrix) @grid.set_row_attributes({'class' => 'bg'}, matrix.at(1)) @grid.add_style('right', *resolve_offset(matrix, [2,0])) matrix = resolve_offset(matrix, [0,1]) @grid.add(vat, *matrix) @grid.set_row_attributes({'class' => 'bg'}, matrix.at(1)) @grid.add_style('right', *resolve_offset(matrix, [2,0])) matrix = resolve_offset(matrix, [0,1]) @grid.add(total, *matrix) @grid.set_row_attributes({'class' => 'bg'}, matrix.at(1)) @grid.add_style('right total', *resolve_offset(matrix, [2,0])) end |
#format_price(price, currency = nil) ⇒ Object
42 43 44 |
# File 'lib/oddb/html/view/paypal/register_form.rb', line 42 def format_price(price, currency=nil) @lookandfeel.format_price(price.to_f * 100.0, currency) end |
#price(model) ⇒ Object
45 46 47 |
# File 'lib/oddb/html/view/paypal/register_form.rb', line 45 def price(model) format_price(model.total_netto) end |
#quantity(model) ⇒ Object
48 49 50 |
# File 'lib/oddb/html/view/paypal/register_form.rb', line 48 def quantity(model) model.quantity.to_i.to_s << ' x' end |
#text(model) ⇒ Object
39 40 41 |
# File 'lib/oddb/html/view/paypal/register_form.rb', line 39 def text(model) model.text end |
#total_brutto ⇒ Object
51 52 53 54 55 |
# File 'lib/oddb/html/view/paypal/register_form.rb', line 51 def total_brutto format_price(@model.inject(0) { |inj, item| inj + item.total_brutto }, 'EUR') end |
#total_netto ⇒ Object
56 57 58 59 60 |
# File 'lib/oddb/html/view/paypal/register_form.rb', line 56 def total_netto format_price @model.inject(0) { |inj, item| inj + item.total_netto } end |
#vat ⇒ Object
61 62 63 64 65 |
# File 'lib/oddb/html/view/paypal/register_form.rb', line 61 def vat format_price @model.inject(0) { |inj, item| inj + item.vat } end |