polish_invoicer 0.0.19 → 0.0.24

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: b3f7e001192f272c399b89003c67319860952016
4
- data.tar.gz: 81fbc5378c8c2d768116b0ad2f0c7286330e1ea1
2
+ SHA256:
3
+ metadata.gz: 83d6168d0e9d3dee433a2d9a0e7b6444120ea67834543ea6faf56ba4bf97d573
4
+ data.tar.gz: 12ce7534dd021a52e3b78efd9cb07e2f8872fd2b97c731c672785e68560b03fb
5
5
  SHA512:
6
- metadata.gz: d3445e63f58a3fa8a665fb7eef10a846a046f1e4d13d66aab1591aa3426b20d7cb2a0bac769e9ed28b1e3c243bc67c38cfd66aee7261876d9d2ae1a425f338e4
7
- data.tar.gz: 477e55cf5e6a946ab513a4a7ffa5f1f82ae99e0d1de72bee6e99211d4ec7c40ca68af436ff3bc2d0395eebde24f536815d26544af8cfda8bcb141fe8d8212139
6
+ metadata.gz: 78c45cea18508cdabaef2d83a67b622135b1270b251f7ae9fa291ef31818ba0368784a28a1800ceaa811b6fdb470993dbf0815e41e443050a65146ffb7e5b6fb
7
+ data.tar.gz: 2ea922f4e34e5b20a27204ef7ca3a189a211cf1d8cb31da26c74310a6d8a468214ebf5902f0b5020783832397b4885c90ff181252440bbe39ee78b8289dced83
@@ -1,6 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2.10
4
- - 2.3.7
5
- - 2.4.4
6
- - 2.5.1
3
+ - 2.5.8
4
+ - 2.6.6
5
+ - 2.7.2
data/README.md CHANGED
@@ -87,14 +87,20 @@ invoice.save_to_pdf('/path/to/invoice.pdf')
87
87
  # wartość domyślna: 23
88
88
  :paid, # znacznik opłacenia usługi (boolean)
89
89
  # wartość domyślna: true, czyli opłacona
90
+ :price_paid, # kwota częściowego opłacenia faktury w złotych (float)
91
+ # wartość domyślna: 0.0
90
92
  :proforma, # znacznik faktury pro-forma (boolean)
91
93
  # wartość domyślna: false
92
94
  :payment_type, # rodzaj płatności (string)
93
95
  # wartość domyślna: 'Przelew'
94
- :foreign_buyer, # nabywcą jest firma spoza Polski
95
- # wartość domyślna: false (boolean)
96
- :reverse_charge # faktura z odwrotnym obciążeniem VAT
97
- # wartość domyślna: false (boolean)
96
+ :foreign_buyer, # nabywcą jest firma spoza Polski (boolean)
97
+ # wartość domyślna: false
98
+ :reverse_charge # faktura z odwrotnym obciążeniem VAT (boolean)
99
+ # wartość domyślna: false
100
+ :currency # waluta rozliczeniowa (string)
101
+ # wartość domyślna: PLN
102
+ :exchange_rate # kurs waluty rozliczeniowej (float)
103
+ # wartość domyślna: 1.0000
98
104
 
99
105
  ### Parametry dodatkowe
100
106
 
@@ -19,7 +19,10 @@ invoice = PolishInvoicer::Invoice.new(
19
19
  # proforma: true,
20
20
  # paid: false,
21
21
  foreign_buyer: true,
22
- reverse_charge: true
22
+ reverse_charge: true,
23
+ currency: 'EUR',
24
+ exchange_rate: 3.5432,
25
+ comments: 'To jest komentarz w ważnej sprawie do dokumentu'
23
26
  )
24
27
  invoice.save_to_html('/tmp/invoice.html')
25
28
  invoice.save_to_pdf('/tmp/invoice.pdf')
@@ -11,6 +11,7 @@ module PolishInvoicer
11
11
  :recipient, # odbiorca faktury (tablica stringów)
12
12
  :item_name, # nazwa usługi (string)
13
13
  :price, # cena w złotych (float)
14
+ :price_paid, # kwota częściowego opłacenia faktury w złotych, domyślnie: 0.0 (float)
14
15
  :gross_price, # znacznik rodzaju ceny (netto/brutto), domyślnie: true (boolean)
15
16
  :vat, # stawka vat, domyślnie: 23 (integer)
16
17
  :pkwiu, # numer PKWiU (string)
@@ -22,7 +23,9 @@ module PolishInvoicer
22
23
  :proforma, # znacznik faktury pro-forma, domyślnie: false (boolean)
23
24
  :no_vat_reason, # podstawa prawna zwolnienia z VAT (string)
24
25
  :foreign_buyer, # nabywcą jest firma spoza Polski, domyślnie: false (boolean)
25
- :reverse_charge # faktura z odwrotnym obciążeniem VAT
26
+ :reverse_charge, # faktura z odwrotnym obciążeniem VAT
27
+ :currency, # waluta rozliczeniowa, domyślnie: PLN (string)
28
+ :exchange_rate # kurs waluty rozliczeniowej, domyślnie: 1.0000 (float)
26
29
  ].freeze
27
30
 
28
31
  attr_accessor(*AVAILABLE_PARAMS)
@@ -78,6 +81,22 @@ module PolishInvoicer
78
81
  Presenter.new(self).data
79
82
  end
80
83
 
84
+ def exchanged_tax
85
+ (vat_value * exchange_rate)
86
+ end
87
+
88
+ def total_to_pay_value
89
+ reverse_charge ? net_value : gross_value
90
+ end
91
+
92
+ def paid_value
93
+ paid ? total_to_pay_value : price_paid
94
+ end
95
+
96
+ def to_pay_value
97
+ paid ? 0 : (total_to_pay_value - price_paid)
98
+ end
99
+
81
100
  private
82
101
 
83
102
  def set_defaults
@@ -85,9 +104,12 @@ module PolishInvoicer
85
104
  @vat = 23
86
105
  @payment_type = 'Przelew'
87
106
  @paid = true
107
+ @price_paid = 0.0
88
108
  @proforma = false
89
109
  @foreign_buyer = false
90
110
  @reverse_charge = false
111
+ @currency = 'PLN'
112
+ @exchange_rate = 1.0000
91
113
  @recipient = []
92
114
  end
93
115
 
@@ -31,7 +31,7 @@ module PolishInvoicer
31
31
  end
32
32
 
33
33
  def copy_additional_params
34
- %w[net_value vat_value gross_value].each do |field|
34
+ %w[net_value vat_value gross_value exchanged_tax].each do |field|
35
35
  @out[field.to_sym] = @invoice.send(field)
36
36
  end
37
37
  end
@@ -45,7 +45,7 @@ module PolishInvoicer
45
45
  end
46
46
 
47
47
  def format_prices
48
- %w[net_value vat_value gross_value].each do |field|
48
+ %w[net_value vat_value gross_value exchanged_tax total_to_pay_value paid_value to_pay_value].each do |field|
49
49
  v = @invoice.send(field)
50
50
  next unless v
51
51
  @out[field.to_sym] = sprintf('%02.2f', v).tr('.', ',')
@@ -15,9 +15,11 @@ module PolishInvoicer
15
15
  check_arrays
16
16
  check_booleans
17
17
  check_price
18
+ check_price_paid
18
19
  check_vat
19
20
  check_proforma
20
21
  check_create_and_payment_date
22
+ check_currency
21
23
  @errors.empty?
22
24
  end
23
25
 
@@ -40,6 +42,8 @@ module PolishInvoicer
40
42
  def check_not_nil
41
43
  @errors[:gross_price] = 'Konieczne jest ustawienie znacznika rodzaju ceny (netto/brutto)' if @invoice.gross_price.nil?
42
44
  @errors[:paid] = 'Konieczne jest ustawienie znacznika opłacenia faktury' if @invoice.paid.nil?
45
+ @errors[:currency] = 'Konieczne jest ustawienie waluty rozliczeniowej' if @invoice.currency.nil?
46
+ @errors[:exchange_rate] = 'Konieczne jest podanie kursu waluty rozliczeniowej' if @invoice.exchange_rate.nil?
43
47
  end
44
48
 
45
49
  def check_arrays
@@ -79,6 +83,16 @@ module PolishInvoicer
79
83
  end
80
84
  end
81
85
 
86
+ def check_price_paid
87
+ return if @invoice.price.nil?
88
+ if @invoice.price_paid.is_a?(Numeric)
89
+ @errors[:price_paid] = 'Kwota zapłacona musi być liczbą dodatnią' unless @invoice.price_paid >= 0
90
+ @errors[:price_paid] = 'Kwota zapłacona musi być mniejsza lub równa cenie' unless @invoice.price_paid <= @invoice.price
91
+ else
92
+ @errors[:price_paid] = 'Kwota zapłacona musi być liczbą'
93
+ end
94
+ end
95
+
82
96
  def check_vat
83
97
  if Vat.valid?(@invoice.vat)
84
98
  if Vat.zw?(@invoice.vat) && blank?(@invoice.no_vat_reason)
@@ -102,6 +116,12 @@ module PolishInvoicer
102
116
  @errors[:payment_date] = 'Termin płatności nie może być wcześniejszy niż data wystawienia'
103
117
  end
104
118
 
119
+ def check_currency
120
+ return if @errors[:currency]
121
+ return if %w[PLN EUR USD GBP].include?(@invoice.currency)
122
+ @errors[:currency] = 'Nieznana waluta'
123
+ end
124
+
105
125
  def blank?(value)
106
126
  value.to_s.strip == ''
107
127
  end
@@ -1,35 +1,27 @@
1
1
  module PolishInvoicer
2
2
  class Vat
3
3
  def self.rates
4
- [23, 8, 5, 0, -1] # -1 oznacza zwolniony z VAT
4
+ (0..27)
5
5
  end
6
6
 
7
7
  def self.valid?(rate)
8
+ return true if zw?(rate)
8
9
  rates.include?(rate)
9
10
  end
10
11
 
11
12
  # Czy stawka VAT to "zwolniony"?
12
13
  def self.zw?(rate)
13
- rate == -1
14
+ rate == -1 # -1 oznacza zwolniony z VAT
14
15
  end
15
16
 
16
17
  def self.to_s(rate)
17
- hash.invert[rate]
18
+ return 'zw.' if zw?(rate)
19
+ "#{rate}%"
18
20
  end
19
21
 
20
22
  # Potrzebne do obliczeń netto/vat/brutto
21
23
  def self.to_i(rate)
22
- rate != -1 ? rate : 0
23
- end
24
-
25
- def self.hash
26
- h = {}
27
- rates.each do |r|
28
- name = "#{r}%"
29
- name = 'zw.' if r == -1
30
- h[name] = r
31
- end
32
- h
24
+ zw?(rate) ? 0 : rate
33
25
  end
34
26
  end
35
27
  end
@@ -1,3 +1,3 @@
1
1
  module PolishInvoicer
2
- VERSION = '0.0.19'.freeze
2
+ VERSION = '0.0.24'.freeze
3
3
  end
@@ -26,26 +26,41 @@ module PolishInvoicer
26
26
  end
27
27
 
28
28
  def test_net_value
29
- i = Invoice.new(price: 123.45, gross_price: false, vat: 23)
29
+ i = Invoice.new(price: 123.45, gross_price: false)
30
+ i.vat = 23
30
31
  assert_in_delta 123.45, i.net_value, 0.01
32
+
31
33
  i.gross_price = true
34
+ i.vat = 23
32
35
  assert_in_delta 100.37, i.net_value, 0.01
36
+ i.vat = 5.5
37
+ assert_in_delta 117.01, i.net_value, 0.01
33
38
  i.vat = 0
34
39
  assert_in_delta 123.45, i.net_value, 0.01
35
40
  i.vat = -1
36
41
  assert_in_delta 123.45, i.net_value, 0.01
42
+
37
43
  i.gross_price = false
38
44
  i.vat = 0
39
45
  assert_in_delta 123.45, i.net_value, 0.01
40
46
  i.vat = -1
41
47
  assert_in_delta 123.45, i.net_value, 0.01
48
+ i.vat = 5.5
49
+ assert_in_delta 123.45, i.net_value, 0.01
42
50
  end
43
51
 
44
52
  def test_vat_value
45
- i = Invoice.new(price: 123.45, gross_price: false, vat: 23)
53
+ i = Invoice.new(price: 123.45, gross_price: false)
54
+ i.vat = 23
46
55
  assert_in_delta 28.39, i.vat_value, 0.01
56
+ i.vat = 5.5
57
+ assert_in_delta 6.79, i.vat_value, 0.01
58
+
47
59
  i.gross_price = true
60
+ i.vat = 23
48
61
  assert_in_delta 23.08, i.vat_value, 0.01
62
+ i.vat = 5.5
63
+ assert_in_delta 6.44, i.vat_value, 0.01
49
64
  i.vat = 0
50
65
  assert_equal 0.00, i.vat_value
51
66
  i.vat = -1
@@ -53,15 +68,23 @@ module PolishInvoicer
53
68
  end
54
69
 
55
70
  def test_gross_value
56
- i = Invoice.new(price: 123.45, gross_price: false, vat: 23)
71
+ i = Invoice.new(price: 123.45, gross_price: false)
72
+ i.vat = 23
57
73
  assert_in_delta 151.84, i.gross_value, 0.01
74
+
58
75
  i.gross_price = true
76
+ i.vat = 23
77
+ assert_in_delta 123.45, i.gross_value, 0.01
78
+ i.vat = 5.5
59
79
  assert_in_delta 123.45, i.gross_value, 0.01
60
80
  i.vat = 0
61
81
  assert_in_delta 123.45, i.gross_value, 0.01
62
82
  i.vat = -1
63
83
  assert_in_delta 123.45, i.gross_value, 0.01
84
+
64
85
  i.gross_price = false
86
+ i.vat = 5.5
87
+ assert_in_delta 130.24, i.gross_value, 0.01
65
88
  i.vat = 0
66
89
  assert_in_delta 123.45, i.gross_value, 0.01
67
90
  i.vat = -1
@@ -110,5 +133,62 @@ module PolishInvoicer
110
133
  assert_equal false, h[:gross_price] # params
111
134
  assert_equal '123,45', h[:net_value] # presenter
112
135
  end
136
+
137
+ def test_total_to_pay_value
138
+ assert_equal 123, Invoice.new(price: 123).paid_value
139
+ assert_equal 100, Invoice.new(price: 123, reverse_charge: true).paid_value
140
+ end
141
+
142
+ def test_paid_value
143
+ assert_equal 123, Invoice.new(price: 123).paid_value
144
+ assert_equal 123, Invoice.new(price: 123, price_paid: 100).paid_value
145
+ assert_equal 100, Invoice.new(price: 123, paid: false, price_paid: 100).paid_value
146
+ assert_equal 100, Invoice.new(price: 123, gross_price: false, paid: false, price_paid: 100).paid_value
147
+ assert_equal 100, Invoice.new(price: 123, reverse_charge: true, paid: false, price_paid: 100).paid_value
148
+ end
149
+
150
+ def test_to_pay_value
151
+ assert_equal 0, Invoice.new(price: 123).to_pay_value
152
+ assert_equal 0, Invoice.new(price: 123, price_paid: 100).to_pay_value
153
+ assert_equal 23, Invoice.new(price: 123, paid: false, price_paid: 100).to_pay_value
154
+ assert_equal 23, Invoice.new(price: 100, gross_price: false, paid: false, price_paid: 100).to_pay_value
155
+ assert_equal 50, Invoice.new(price: 123, reverse_charge: true, paid: false, price_paid: 50).to_pay_value
156
+ end
157
+
158
+ def test_gross_and_net_price
159
+ gross_invoice = Invoice.new(price: 123, price_paid: 60, paid: false)
160
+ assert_equal 100, gross_invoice.net_value
161
+ assert_equal 23, gross_invoice.vat_value
162
+ assert_equal 123, gross_invoice.gross_value
163
+ assert_equal 123, gross_invoice.total_to_pay_value
164
+ assert_equal 60, gross_invoice.paid_value
165
+ assert_equal 63, gross_invoice.to_pay_value
166
+
167
+ net_invoice = Invoice.new(price: 100, price_paid: 60, paid: false, gross_price: false)
168
+ assert_equal 100, net_invoice.net_value
169
+ assert_equal 23, net_invoice.vat_value
170
+ assert_equal 123, net_invoice.gross_value
171
+ assert_equal 123, net_invoice.total_to_pay_value
172
+ assert_equal 60, net_invoice.paid_value
173
+ assert_equal 63, net_invoice.to_pay_value
174
+ end
175
+
176
+ def test_reverse_charge
177
+ gross_invoice = Invoice.new(price: 123, price_paid: 60, paid: false, reverse_charge: true)
178
+ assert_equal 100, gross_invoice.net_value
179
+ assert_equal 23, gross_invoice.vat_value
180
+ assert_equal 123, gross_invoice.gross_value
181
+ assert_equal 100, gross_invoice.total_to_pay_value
182
+ assert_equal 60, gross_invoice.paid_value
183
+ assert_equal 40, gross_invoice.to_pay_value
184
+
185
+ net_invoice = Invoice.new(price: 100, price_paid: 60, paid: false, gross_price: false, reverse_charge: true)
186
+ assert_equal 100, net_invoice.net_value
187
+ assert_equal 23, net_invoice.vat_value
188
+ assert_equal 123, net_invoice.gross_value
189
+ assert_equal 100, net_invoice.total_to_pay_value
190
+ assert_equal 60, net_invoice.paid_value
191
+ assert_equal 40, net_invoice.to_pay_value
192
+ end
113
193
  end
114
194
  end
@@ -54,6 +54,16 @@ module PolishInvoicer
54
54
  check_ok(:price, 19.99)
55
55
  end
56
56
 
57
+ def test_price_paid_validation
58
+ @invoice.price = 200
59
+ check_error(:price_paid)
60
+ check_error(:price_paid, 'test')
61
+ check_error(:price_paid, '100')
62
+ check_error(:price_paid, -10)
63
+ check_error(:price_paid, 300)
64
+ check_ok(:price_paid, 19.99)
65
+ end
66
+
57
67
  def test_gross_price_validation
58
68
  check_error(:gross_price)
59
69
  check_error(:gross_price, 'test')
@@ -142,6 +152,32 @@ module PolishInvoicer
142
152
  assert_nil v.errors[:payment_date]
143
153
  end
144
154
 
155
+ def test_currency
156
+ @invoice.currency = nil
157
+ v = Validator.new(@invoice)
158
+ v.valid?
159
+ assert v.errors[:currency]
160
+ @invoice.currency = 'XYZ'
161
+ v = Validator.new(@invoice)
162
+ v.valid?
163
+ assert v.errors[:currency]
164
+ @invoice.currency = 'EUR'
165
+ v = Validator.new(@invoice)
166
+ v.valid?
167
+ refute v.errors[:currency]
168
+ end
169
+
170
+ def test_exchange_rate
171
+ @invoice.exchange_rate = nil
172
+ v = Validator.new(@invoice)
173
+ v.valid?
174
+ assert v.errors[:exchange_rate]
175
+ @invoice.exchange_rate = 4,1234
176
+ v = Validator.new(@invoice)
177
+ v.valid?
178
+ refute v.errors[:exchange_rate]
179
+ end
180
+
145
181
  private
146
182
 
147
183
  def check_error(field, value = nil)
@@ -4,22 +4,35 @@ module PolishInvoicer
4
4
  class VatTest < Minitest::Test
5
5
  def test_valid
6
6
  assert Vat.valid?(23)
7
+ assert Vat.valid?(27)
8
+ assert Vat.valid?(2)
9
+ assert Vat.valid?(5.5)
10
+ assert Vat.valid?(4.8)
7
11
  assert Vat.valid?(0)
8
12
  assert Vat.valid?(-1)
9
- assert_equal false, Vat.valid?(123)
10
- assert_equal false, Vat.valid?(-10)
11
- assert_equal false, Vat.valid?('test')
13
+ refute Vat.valid?(123)
14
+ refute Vat.valid?(-10)
15
+ refute Vat.valid?('test')
16
+ refute Vat.valid?('2,1')
17
+ refute Vat.valid?('2.1')
12
18
  end
13
19
 
14
20
  def test_zw
15
21
  assert Vat.zw?(-1)
16
- assert_equal false, Vat.zw?(23)
22
+ refute Vat.zw?(23)
17
23
  end
18
24
 
19
25
  def test_to_s
20
26
  assert_equal '23%', Vat.to_s(23)
27
+ assert_equal '5.5%', Vat.to_s(5.5)
21
28
  assert_equal '0%', Vat.to_s(0)
22
29
  assert_equal 'zw.', Vat.to_s(-1)
23
30
  end
31
+
32
+ def test_to_i
33
+ assert_equal 0, Vat.to_i(-1)
34
+ assert_equal 5.5, Vat.to_i(5.5)
35
+ assert_equal 20, Vat.to_i(20)
36
+ end
24
37
  end
25
38
  end
@@ -127,7 +127,7 @@ html
127
127
  - unless reverse_charge
128
128
  td.text-center = vat
129
129
  td.text-center = vat_value
130
- td.text-center = gross_value
130
+ td.text-center = total_to_pay_value
131
131
  tr
132
132
  td colspan="#{pkwiu ? 3 : 2}"
133
133
  | &nbsp;
@@ -139,7 +139,7 @@ html
139
139
  - unless reverse_charge
140
140
  td.text-center = vat
141
141
  td.text-center = vat_value
142
- th.text-center = gross_value
142
+ th.text-center = total_to_pay_value
143
143
 
144
144
  br
145
145
 
@@ -151,27 +151,35 @@ html
151
151
  .small
152
152
  em Total to pay:
153
153
  .col-xs-6
154
- b = "#{reverse_charge == true ? net_value : gross_value} PLN"
154
+ b = "#{total_to_pay_value} #{currency}"
155
155
  .row
156
156
  .col-xs-6
157
157
  | Zapłacono:
158
158
  .small
159
159
  em Amount paid:
160
- .col-xs-6
161
- - if paid
162
- = "#{reverse_charge == true ? net_value : gross_value} PLN"
163
- - else
164
- | 0,00 PLN
160
+ .col-xs-6 = "#{paid_value} #{currency}"
165
161
  .row
166
162
  .col-xs-6
167
163
  | Zostało do zapłaty:
168
164
  .small
169
165
  em Left to pay:
170
- .col-xs-6
171
- - if paid
172
- | 0,00 PLN
173
- - else
174
- = "#{reverse_charge == true ? net_value : gross_value} PLN"
166
+ .col-xs-6 = "#{to_pay_value} #{currency}"
167
+ - if currency != 'PLN'
168
+ .row
169
+ .col-xs-6
170
+ | Kurs waluty:
171
+ .small
172
+ em Exchange rate:
173
+ .col-xs-6
174
+ = exchange_rate
175
+ - unless reverse_charge
176
+ .row
177
+ .col-xs-6
178
+ | Podatek w PLN:
179
+ .small
180
+ em Exchanged tax amount:
181
+ .col-xs-6
182
+ = "#{exchanged_tax} PLN"
175
183
 
176
184
  .col-xs-6
177
185
  - if comments.any?
@@ -83,7 +83,7 @@ html
83
83
  td.text-center = net_value
84
84
  td.text-center = vat
85
85
  td.text-center = vat_value
86
- td.text-center = gross_value
86
+ td.text-center = total_to_pay_value
87
87
  tr
88
88
  td colspan="#{pkwiu ? 3 : 2}"
89
89
  | &nbsp;
@@ -91,7 +91,7 @@ html
91
91
  td.text-center = net_value
92
92
  td.text-center = vat
93
93
  td.text-center = vat_value
94
- th.text-center = gross_value
94
+ th.text-center = total_to_pay_value
95
95
 
96
96
  br
97
97
 
@@ -102,18 +102,22 @@ html
102
102
  | Zapłacono:
103
103
  br
104
104
  | Zostało do zapłaty:
105
+ - if currency != 'PLN'
106
+ br
107
+ | Kurs waluty:
108
+ br
109
+ | Podatek w PLN:
105
110
  .col-xs-3
106
- b = "#{gross_value} PLN"
111
+ b = "#{total_to_pay_value} #{currency}"
107
112
  br
108
- - if paid
109
- = "#{gross_value} PLN"
110
- - else
111
- | 0,00 PLN
113
+ = "#{paid_value} #{currency}"
112
114
  br
113
- - if paid
114
- | 0,00 PLN
115
- - else
116
- = "#{gross_value} PLN"
115
+ = "#{to_pay_value} #{currency}"
116
+ - if currency != 'PLN'
117
+ br
118
+ = exchange_rate
119
+ br
120
+ = "#{exchanged_tax} PLN"
117
121
  - if comments.any?
118
122
  .col-xs-6
119
123
  b Uwagi:
@@ -115,7 +115,7 @@ html
115
115
  em 1&nbsp;service
116
116
  td.text-center = net_value
117
117
  td.text-center = net_value
118
- td.text-center = (reverse_charge == true ? net_value : gross_value)
118
+ td.text-center = total_to_pay_value
119
119
  tr
120
120
  td colspan="#{pkwiu ? 3 : 2}"
121
121
  | &nbsp;
@@ -124,7 +124,7 @@ html
124
124
  .small
125
125
  em Total
126
126
  td.text-center = net_value
127
- th.text-center = (reverse_charge == true ? net_value : gross_value)
127
+ th.text-center = total_to_pay_value
128
128
 
129
129
  br
130
130
 
@@ -136,27 +136,19 @@ html
136
136
  .small
137
137
  em Total to pay:
138
138
  .col-xs-6
139
- b = "#{reverse_charge == true ? net_value : gross_value} PLN"
139
+ b = "#{total_to_pay_value} #{currency}"
140
140
  .row
141
141
  .col-xs-6
142
142
  | Zapłacono:
143
143
  .small
144
144
  em Amount paid:
145
- .col-xs-6
146
- - if paid
147
- = "#{reverse_charge == true ? net_value : gross_value} PLN"
148
- - else
149
- | 0,00 PLN
145
+ .col-xs-6 = "#{paid_value} #{currency}"
150
146
  .row
151
147
  .col-xs-6
152
148
  | Zostało do zapłaty:
153
149
  .small
154
150
  em Left to pay:
155
- .col-xs-6
156
- - if paid
157
- | 0,00 PLN
158
- - else
159
- = "#{reverse_charge == true ? net_value : gross_value} PLN"
151
+ .col-xs-6 = "#{to_pay_value} #{currency}"
160
152
 
161
153
  .col-xs-6
162
154
  - if comments.any?
@@ -77,13 +77,13 @@ html
77
77
  | 1&nbsp;usł.
78
78
  td.text-center = net_value
79
79
  td.text-center = net_value
80
- td.text-center = gross_value
80
+ td.text-center = total_to_pay_value
81
81
  tr
82
82
  td colspan="#{pkwiu ? 3 : 2}"
83
83
  | &nbsp;
84
84
  th.text-center Razem
85
85
  td.text-center = net_value
86
- th.text-center = gross_value
86
+ th.text-center = total_to_pay_value
87
87
 
88
88
  br
89
89
 
@@ -95,17 +95,11 @@ html
95
95
  br
96
96
  | Zostało do zapłaty:
97
97
  .col-xs-3
98
- b = "#{gross_value} PLN"
98
+ b = "#{total_to_pay_value} #{currency}"
99
99
  br
100
- - if paid
101
- = "#{gross_value} PLN"
102
- - else
103
- | 0,00 PLN
100
+ = "#{paid_value} #{currency}"
104
101
  br
105
- - if paid
106
- | 0,00 PLN
107
- - else
108
- = "#{gross_value} PLN"
102
+ = "#{to_pay_value} #{currency}"
109
103
  - if comments.any?
110
104
  .col-xs-6
111
105
  b Uwagi:
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: polish_invoicer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.19
4
+ version: 0.0.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Macuk
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-09 00:00:00.000000000 Z
11
+ date: 2020-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -137,7 +137,7 @@ homepage: ''
137
137
  licenses:
138
138
  - MIT
139
139
  metadata: {}
140
- post_install_message:
140
+ post_install_message:
141
141
  rdoc_options: []
142
142
  require_paths:
143
143
  - lib
@@ -152,9 +152,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
152
152
  - !ruby/object:Gem::Version
153
153
  version: '0'
154
154
  requirements: []
155
- rubyforge_project:
156
- rubygems_version: 2.6.14.1
157
- signing_key:
155
+ rubygems_version: 3.0.8
156
+ signing_key:
158
157
  specification_version: 4
159
158
  summary: Creates polish invoices and proforms as HTML or PDF files
160
159
  test_files: