Class: SAFT::V2::HTML::TaxTable
- Inherits:
-
Object
- Object
- SAFT::V2::HTML::TaxTable
- Defined in:
- lib/saft/v2/html.rb
Instance Method Summary collapse
-
#initialize(tax_table) ⇒ TaxTable
constructor
A new instance of TaxTable.
- #to_tubby ⇒ Object
Constructor Details
#initialize(tax_table) ⇒ TaxTable
Returns a new instance of TaxTable.
304 305 306 |
# File 'lib/saft/v2/html.rb', line 304 def initialize(tax_table) @tax_table = tax_table end |
Instance Method Details
#to_tubby ⇒ Object
308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 |
# File 'lib/saft/v2/html.rb', line 308 def to_tubby Tubby.new { |t| t.table { t.thead { t.tr { t.th("Tax code") t.th("Description") t.th("Country") t.th("Std code") t.th("Tax %", class: "text-right") t.th("Base rate", class: "text-right") t.th("rest") } } t.tbody { @tax_table.each { |table| table.tax_code_details.each { |detail| vat_code = SAFT::V2::Norway.vat_code(detail.standard_tax_code) vat_code_title = "Not found" if vat_code vat_code_title = <<~TEXT Vat Code #{vat_code.code} #{vat_code.description_en} #{vat_code.description_no} #{vat_code.tax_rate} #{"Can be used for compensation" if vat_code.compensation} TEXT end t.tr { t.td(detail.tax_code) t.td(detail.description) t.td(detail.country) t.td(detail.standard_tax_code, title: vat_code_title) t.td(detail.tax_percentage, class: "text-right") t.td(class: "text-right") { detail.base_rates.each { t.div(_1) } } t.td(class: "pl-2") { t.div(class: "pl-2 border-l-2") { t << RenderHash.new( detail .attributes .except( :tax_code, :description, :country, :standard_tax_code, :base_rate, :tax_percentage, ), ) } } } } } } } } end |