polish_invoicer 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/polish_invoicer/invoice.rb +2 -0
- data/lib/polish_invoicer/validator.rb +3 -0
- data/lib/polish_invoicer/version.rb +1 -1
- data/lib/polish_invoicer/writer.rb +8 -3
- data/tpl/invoice-en.slim +106 -82
- data/tpl/invoice.slim +25 -42
- data/tpl/proforma.slim +115 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec8fe9758194499368f36ace07d8453e715f2b26
|
4
|
+
data.tar.gz: ee5146af343630569b5e12c2615272210be1d79d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d828c4af6ae2c363ba6da680a96212eafd9aae4d28ff956c14265e11eb7f19d04936bce36636fe073477d2e55e7e05a39d0f1b638fcc84b4a0c1f02f99f4113
|
7
|
+
data.tar.gz: c964efb4d34bc9bbd83f08b0063e9bba4087ad29f55972b53793775e692d3463563f0fb9ffab8e53c4329143c22f36c85ee494b8fd8620246cf322ce3a28c375
|
@@ -21,6 +21,7 @@ module PolishInvoicer
|
|
21
21
|
:footer, # treść umieszczana w stopce faktury (string)
|
22
22
|
:proforma, # znacznik faktury pro-forma, domyślnie: false (boolean)
|
23
23
|
:no_vat_reason, # podstawa prawna zwolnienia z VAT (string)
|
24
|
+
:foreign_buyer, # nabywcą jest firma spoza Polski, domyślnie: false (boolean)
|
24
25
|
].freeze
|
25
26
|
|
26
27
|
attr_accessor(*AVAILABLE_PARAMS)
|
@@ -84,6 +85,7 @@ module PolishInvoicer
|
|
84
85
|
@payment_type = 'Przelew'
|
85
86
|
@paid = true
|
86
87
|
@proforma = false
|
88
|
+
@foreign_buyer = false
|
87
89
|
end
|
88
90
|
|
89
91
|
def validate!
|
@@ -56,6 +56,9 @@ module PolishInvoicer
|
|
56
56
|
unless [true, false].include?(@invoice.proforma)
|
57
57
|
@errors[:proforma] = 'Znacznik faktury pro-forma musi być podany jako boolean'
|
58
58
|
end
|
59
|
+
unless [true, false].include?(@invoice.foreign_buyer)
|
60
|
+
@errors[:foreign_buyer] = 'Znacznik zagranicznego nabywcy musi być podany jako boolean'
|
61
|
+
end
|
59
62
|
end
|
60
63
|
|
61
64
|
def check_dates
|
@@ -1,12 +1,10 @@
|
|
1
1
|
module PolishInvoicer
|
2
2
|
class Writer
|
3
|
-
attr_accessor :invoice
|
3
|
+
attr_accessor :invoice
|
4
4
|
attr_accessor :logger, :wkhtmltopdf_path, :wkhtmltopdf_command
|
5
5
|
|
6
6
|
def initialize(invoice)
|
7
7
|
@invoice = invoice
|
8
|
-
default_template_path = File.expand_path('../../../tpl/invoice.slim', __FILE__)
|
9
|
-
@template_path = @invoice.template_path || default_template_path
|
10
8
|
@logger = @invoice.logger
|
11
9
|
@wkhtmltopdf_path = @invoice.wkhtmltopdf_path
|
12
10
|
@wkhtmltopdf_command = @invoice.wkhtmltopdf_command
|
@@ -22,6 +20,13 @@ module PolishInvoicer
|
|
22
20
|
@writer.save_to_pdf(path)
|
23
21
|
end
|
24
22
|
|
23
|
+
def template_path
|
24
|
+
tpl = 'invoice.slim'
|
25
|
+
tpl = 'invoice-en.slim' if invoice.foreign_buyer
|
26
|
+
tpl = 'proforma.slim' if invoice.proforma
|
27
|
+
invoice.template_path || File.expand_path("../../../tpl/#{tpl}", __FILE__)
|
28
|
+
end
|
29
|
+
|
25
30
|
private
|
26
31
|
|
27
32
|
def create_writer
|