polish_invoicer 0.0.24 → 0.0.25
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -2
- data/lib/polish_invoicer/invoice.rb +3 -4
- data/lib/polish_invoicer/validator.rb +2 -0
- data/lib/polish_invoicer/version.rb +1 -1
- data/test/invoice_test.rb +2 -0
- data/test/validator_test.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e50ba77f3a3539b5a75c12e3213dd8e0f56bc7788c7ab74d43ec661ef8e12d94
|
4
|
+
data.tar.gz: 9193da0b3dd714fa51ac52e06a2b87191a493f7539132b41115ce89c86851632
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0839922dbbab96b6e580f5c63ca86d4b2789c6b3f771d0195c5251cb48e9c6ef3b23fccd22ebfe3fb8f603ba007836d073f71a33f876af85a77f4e7e5a7d38d
|
7
|
+
data.tar.gz: 3f608c82265282b14e5c1af278e3b38fefb9830005ea0bf3c9517c552dc5a76e5c10052f684f056a180db45f7d5599a2bc4b12d25ef4901c2ab3858f73272ef5
|
data/README.md
CHANGED
@@ -87,8 +87,6 @@ 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
|
92
90
|
:proforma, # znacznik faktury pro-forma (boolean)
|
93
91
|
# wartość domyślna: false
|
94
92
|
:payment_type, # rodzaj płatności (string)
|
@@ -110,6 +108,7 @@ invoice.save_to_pdf('/path/to/invoice.pdf')
|
|
110
108
|
:pkwiu, # numer PKWiU (string)
|
111
109
|
:no_vat_reason, # podstawa prawna zwolnienia z VAT (string)
|
112
110
|
:footer, # treść umieszczana w stopce faktury (string)
|
111
|
+
:price_paid, # kwota częściowego opłacenia faktury w złotych (float)
|
113
112
|
|
114
113
|
### Parametry systemowe
|
115
114
|
|
@@ -11,7 +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
|
14
|
+
:price_paid, # kwota częściowego opłacenia faktury w złotych
|
15
15
|
:gross_price, # znacznik rodzaju ceny (netto/brutto), domyślnie: true (boolean)
|
16
16
|
:vat, # stawka vat, domyślnie: 23 (integer)
|
17
17
|
:pkwiu, # numer PKWiU (string)
|
@@ -90,11 +90,11 @@ module PolishInvoicer
|
|
90
90
|
end
|
91
91
|
|
92
92
|
def paid_value
|
93
|
-
paid ? total_to_pay_value : price_paid
|
93
|
+
paid ? total_to_pay_value : price_paid.to_f
|
94
94
|
end
|
95
95
|
|
96
96
|
def to_pay_value
|
97
|
-
paid ? 0 : (total_to_pay_value - price_paid)
|
97
|
+
paid ? 0 : (total_to_pay_value - price_paid.to_f)
|
98
98
|
end
|
99
99
|
|
100
100
|
private
|
@@ -104,7 +104,6 @@ module PolishInvoicer
|
|
104
104
|
@vat = 23
|
105
105
|
@payment_type = 'Przelew'
|
106
106
|
@paid = true
|
107
|
-
@price_paid = 0.0
|
108
107
|
@proforma = false
|
109
108
|
@foreign_buyer = false
|
110
109
|
@reverse_charge = false
|
@@ -84,7 +84,9 @@ module PolishInvoicer
|
|
84
84
|
end
|
85
85
|
|
86
86
|
def check_price_paid
|
87
|
+
return if @invoice.price_paid.nil?
|
87
88
|
return if @invoice.price.nil?
|
89
|
+
|
88
90
|
if @invoice.price_paid.is_a?(Numeric)
|
89
91
|
@errors[:price_paid] = 'Kwota zapłacona musi być liczbą dodatnią' unless @invoice.price_paid >= 0
|
90
92
|
@errors[:price_paid] = 'Kwota zapłacona musi być mniejsza lub równa cenie' unless @invoice.price_paid <= @invoice.price
|
data/test/invoice_test.rb
CHANGED
@@ -142,6 +142,7 @@ module PolishInvoicer
|
|
142
142
|
def test_paid_value
|
143
143
|
assert_equal 123, Invoice.new(price: 123).paid_value
|
144
144
|
assert_equal 123, Invoice.new(price: 123, price_paid: 100).paid_value
|
145
|
+
assert_equal 0, Invoice.new(price: 123, paid: false).paid_value
|
145
146
|
assert_equal 100, Invoice.new(price: 123, paid: false, price_paid: 100).paid_value
|
146
147
|
assert_equal 100, Invoice.new(price: 123, gross_price: false, paid: false, price_paid: 100).paid_value
|
147
148
|
assert_equal 100, Invoice.new(price: 123, reverse_charge: true, paid: false, price_paid: 100).paid_value
|
@@ -150,6 +151,7 @@ module PolishInvoicer
|
|
150
151
|
def test_to_pay_value
|
151
152
|
assert_equal 0, Invoice.new(price: 123).to_pay_value
|
152
153
|
assert_equal 0, Invoice.new(price: 123, price_paid: 100).to_pay_value
|
154
|
+
assert_equal 123, Invoice.new(price: 123, paid: false).to_pay_value
|
153
155
|
assert_equal 23, Invoice.new(price: 123, paid: false, price_paid: 100).to_pay_value
|
154
156
|
assert_equal 23, Invoice.new(price: 100, gross_price: false, paid: false, price_paid: 100).to_pay_value
|
155
157
|
assert_equal 50, Invoice.new(price: 123, reverse_charge: true, paid: false, price_paid: 50).to_pay_value
|
data/test/validator_test.rb
CHANGED
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.
|
4
|
+
version: 0.0.25
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Macuk
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-10-
|
11
|
+
date: 2020-10-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -152,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
152
152
|
- !ruby/object:Gem::Version
|
153
153
|
version: '0'
|
154
154
|
requirements: []
|
155
|
-
rubygems_version: 3.
|
155
|
+
rubygems_version: 3.1.4
|
156
156
|
signing_key:
|
157
157
|
specification_version: 4
|
158
158
|
summary: Creates polish invoices and proforms as HTML or PDF files
|