polish_invoicer 0.0.20 → 0.0.21

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 644beb638eed958e59e1975f1c05c01c925622f5
4
- data.tar.gz: b8b85f18b71cce1b17f039af4d03df5eb28f4c4e
3
+ metadata.gz: bda191d866cc449891ddda539f7d4488596ce329
4
+ data.tar.gz: ac4b56ac399d2605d877ed5e8cb9edc80ae9191b
5
5
  SHA512:
6
- metadata.gz: 392e24d56f6e06c8c584da31b42292a653db624f59796ea809cdb17f62f534179b296fab8b2ccba018841f7f5de89e01ab0ebcfd1f69c7e43f85ebbd3ca935eb
7
- data.tar.gz: b046255d9abd0474c8a4289ae96fbe36f7643965216dfe46ac8905f390cda8c45e121b912da87abc24ce2ba2140e7a188cf455da1f45dc85db5c0afc109ebeb3
6
+ metadata.gz: 4c1b33a78b3da1dc507ea771709ffb1411ba230d89fd7cd03c920cdbcb4aded9613c374267bb29689364ef3db5f450c1e74c29044a1cc562097838c6e6c40b2c
7
+ data.tar.gz: 95ffbb8601037dda21507c02285beb0c78301815babdcfed0e2069be11ca08e2d27f17e9aecf9bd257252b763b29470c17db5ffb6343c56deb498f3fe603eeda
data/README.md CHANGED
@@ -97,6 +97,8 @@ invoice.save_to_pdf('/path/to/invoice.pdf')
97
97
  # wartość domyślna: false
98
98
  :currency # waluta rozliczeniowa (string)
99
99
  # wartość domyślna: PLN
100
+ :exchange_rate # kurs waluty rozliczeniowej (float)
101
+ # wartość domyślna: 1.0000
100
102
 
101
103
  ### Parametry dodatkowe
102
104
 
data/doc/invoice.rb CHANGED
@@ -20,7 +20,9 @@ invoice = PolishInvoicer::Invoice.new(
20
20
  # paid: false,
21
21
  foreign_buyer: true,
22
22
  reverse_charge: true,
23
- currency: 'USD'
23
+ currency: 'EUR',
24
+ exchange_rate: 3.5432,
25
+ comments: 'To jest komentarz w ważnej sprawie do dokumentu'
24
26
  )
25
27
  invoice.save_to_html('/tmp/invoice.html')
26
28
  invoice.save_to_pdf('/tmp/invoice.pdf')
@@ -23,7 +23,8 @@ module PolishInvoicer
23
23
  :no_vat_reason, # podstawa prawna zwolnienia z VAT (string)
24
24
  :foreign_buyer, # nabywcą jest firma spoza Polski, domyślnie: false (boolean)
25
25
  :reverse_charge, # faktura z odwrotnym obciążeniem VAT
26
- :currency # waluta rozliczeniowa, domyślnie: PLN (string)
26
+ :currency, # waluta rozliczeniowa, domyślnie: PLN (string)
27
+ :exchange_rate # kurs waluty rozliczeniowej, domyślnie: 1.0000 (float)
27
28
  ].freeze
28
29
 
29
30
  attr_accessor(*AVAILABLE_PARAMS)
@@ -90,6 +91,7 @@ module PolishInvoicer
90
91
  @foreign_buyer = false
91
92
  @reverse_charge = false
92
93
  @currency = 'PLN'
94
+ @exchange_rate = 1.0000
93
95
  @recipient = []
94
96
  end
95
97
 
@@ -42,6 +42,7 @@ module PolishInvoicer
42
42
  @errors[:gross_price] = 'Konieczne jest ustawienie znacznika rodzaju ceny (netto/brutto)' if @invoice.gross_price.nil?
43
43
  @errors[:paid] = 'Konieczne jest ustawienie znacznika opłacenia faktury' if @invoice.paid.nil?
44
44
  @errors[:currency] = 'Konieczne jest ustawienie waluty rozliczeniowej' if @invoice.currency.nil?
45
+ @errors[:exchange_rate] = 'Konieczne jest podanie kursu waluty rozliczeniowej' if @invoice.exchange_rate.nil?
45
46
  end
46
47
 
47
48
  def check_arrays
@@ -1,3 +1,3 @@
1
1
  module PolishInvoicer
2
- VERSION = '0.0.20'.freeze
2
+ VERSION = '0.0.21'.freeze
3
3
  end
@@ -157,6 +157,17 @@ module PolishInvoicer
157
157
  refute v.errors[:currency]
158
158
  end
159
159
 
160
+ def test_exchange_rate
161
+ @invoice.exchange_rate = nil
162
+ v = Validator.new(@invoice)
163
+ v.valid?
164
+ assert v.errors[:exchange_rate]
165
+ @invoice.exchange_rate = 4,1234
166
+ v = Validator.new(@invoice)
167
+ v.valid?
168
+ refute v.errors[:exchange_rate]
169
+ end
170
+
160
171
  private
161
172
 
162
173
  def check_error(field, value = nil)
data/tpl/invoice-en.slim CHANGED
@@ -172,6 +172,14 @@ html
172
172
  = "0,00 #{currency}"
173
173
  - else
174
174
  = "#{reverse_charge == true ? net_value : gross_value} #{currency}"
175
+ - if currency != 'PLN'
176
+ .row
177
+ .col-xs-6
178
+ | Kurs waluty:
179
+ .small
180
+ em Exchange rate:
181
+ .col-xs-6
182
+ = exchange_rate
175
183
 
176
184
  .col-xs-6
177
185
  - if comments.any?
data/tpl/invoice.slim CHANGED
@@ -102,6 +102,9 @@ html
102
102
  | Zapłacono:
103
103
  br
104
104
  | Zostało do zapłaty:
105
+ - if currency != 'PLN'
106
+ br
107
+ | Kurs waluty:
105
108
  .col-xs-3
106
109
  b = "#{gross_value} #{currency}"
107
110
  br
@@ -114,6 +117,9 @@ html
114
117
  = "0,00 #{currency}"
115
118
  - else
116
119
  = "#{gross_value} #{currency}"
120
+ - if currency != 'PLN'
121
+ br
122
+ = exchange_rate
117
123
  - if comments.any?
118
124
  .col-xs-6
119
125
  b Uwagi:
data/tpl/proforma-en.slim CHANGED
@@ -157,6 +157,14 @@ html
157
157
  = "0,00 #{currency}"
158
158
  - else
159
159
  = "#{reverse_charge == true ? net_value : gross_value} #{currency}"
160
+ - if currency != 'PLN'
161
+ .row
162
+ .col-xs-6
163
+ | Kurs waluty:
164
+ .small
165
+ em Exchange rate:
166
+ .col-xs-6
167
+ = exchange_rate
160
168
 
161
169
  .col-xs-6
162
170
  - if comments.any?
data/tpl/proforma.slim CHANGED
@@ -94,6 +94,9 @@ html
94
94
  | Zapłacono:
95
95
  br
96
96
  | Zostało do zapłaty:
97
+ - if currency != 'PLN'
98
+ br
99
+ | Kurs waluty:
97
100
  .col-xs-3
98
101
  b = "#{gross_value} #{currency}"
99
102
  br
@@ -106,6 +109,9 @@ html
106
109
  = "0,00 #{currency}"
107
110
  - else
108
111
  = "#{gross_value} #{currency}"
112
+ - if currency != 'PLN'
113
+ br
114
+ = exchange_rate
109
115
  - if comments.any?
110
116
  .col-xs-6
111
117
  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.20
4
+ version: 0.0.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Macuk
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-11 00:00:00.000000000 Z
11
+ date: 2018-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler