facturae_print 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,5 @@
1
+ require 'date'
2
+
1
3
  module FacturaePrint
2
4
  module Renderers
3
5
  module HTMLRendererHelpers
@@ -20,6 +22,39 @@ module FacturaePrint
20
22
  [individual.name, individual.first_surname, individual.second_surname].compact.join(' ')
21
23
  end
22
24
 
25
+ def formatted_date(date, strftime="%d/%m/%Y")
26
+ (date.is_a?(String) ? Date.parse(date) : date).strftime(strftime)
27
+ end
28
+
29
+ def tax_abbreviation(tax_type_code)
30
+ TAX_ABBREVIATIONS[tax_type_code]
31
+ end
32
+
33
+ def tax_description(tax_type_code, tax_rate)
34
+ "#{tax_abbreviation(tax_type_code)} #{tax_rate.to_i}%"
35
+ end
36
+
37
+ TAX_ABBREVIATIONS = {
38
+ '01' => 'IVA',
39
+ '02' => 'IPSI',
40
+ '03' => 'IGIC',
41
+ '04' => 'IRPF',
42
+ '05' => 'Otro',
43
+ '06' => 'ITPAJD',
44
+ '07' => 'IE',
45
+ '08' => 'Ra',
46
+ '09' => 'IGTECM',
47
+ '10' => 'IECDPCAC',
48
+ '11' => 'IIIMAB',
49
+ '12' => 'ICIO',
50
+ '13' => 'IMVDN',
51
+ '14' => 'IMSN',
52
+ '15' => 'IMGSN',
53
+ '16' => 'IMPN',
54
+ '17' => 'REIVA',
55
+ '18' => 'REIGIC',
56
+ '19' => 'REIPSI'
57
+ }
23
58
  end
24
59
  end
25
60
  end
@@ -1,3 +1,3 @@
1
1
  module FacturaePrint
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -62,10 +62,12 @@
62
62
  </tr>
63
63
  </tbody>
64
64
  <tbody class="invoice-taxes">
65
+ <% for tax in @invoice.invoices.first.taxes_outputs %>
65
66
  <tr>
66
- <td class="description">IRPF 15%</td>
67
- <td class="amount">-97.50 €</td>
67
+ <td class="description"><%= tax_description(tax.tax_type_code, tax.tax_rate) %></td>
68
+ <td class="amount"><%= to_currency(tax.tax_amount.total_amount) %></td>
68
69
  </tr>
70
+ <% end %>
69
71
  </tbody>
70
72
  <tbody class="invoice-total">
71
73
  <tr>
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: facturae_print
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
5
- prerelease:
4
+ hash: 25
5
+ prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Alvaro Bautista
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-23 00:00:00 +01:00
18
+ date: 2011-02-11 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -179,7 +179,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
179
179
  requirements: []
180
180
 
181
181
  rubyforge_project:
182
- rubygems_version: 1.4.2
182
+ rubygems_version: 1.3.7
183
183
  signing_key:
184
184
  specification_version: 3
185
185
  summary: facturae_print translates a facturae xml file into an understandable HTML or PDF file