dorsale 3.20.0 → 4.1.0
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 +4 -4
- data/CHANGELOG.md +18 -3
- data/app/controllers/dorsale/alexandrie/attachments_controller.rb +1 -1
- data/app/controllers/dorsale/application_controller.rb +1 -1
- data/app/controllers/dorsale/billing_machine/application_controller.rb +2 -2
- data/app/controllers/dorsale/billing_machine/invoices_controller.rb +1 -1
- data/app/controllers/dorsale/billing_machine/payment_terms_controller.rb +1 -1
- data/app/controllers/dorsale/billing_machine/quotations_controller.rb +1 -1
- data/app/controllers/dorsale/comments_controller.rb +1 -1
- data/app/controllers/dorsale/customer_vault/activity_types_controller.rb +1 -1
- data/app/controllers/dorsale/customer_vault/application_controller.rb +1 -1
- data/app/controllers/dorsale/customer_vault/events_controller.rb +1 -1
- data/app/controllers/dorsale/customer_vault/links_controller.rb +1 -1
- data/app/controllers/dorsale/customer_vault/origins_controller.rb +1 -1
- data/app/controllers/dorsale/customer_vault/people_controller.rb +1 -1
- data/app/controllers/dorsale/expense_gun/application_controller.rb +1 -1
- data/app/controllers/dorsale/expense_gun/categories_controller.rb +1 -1
- data/app/controllers/dorsale/flyboy/application_controller.rb +1 -1
- data/app/controllers/dorsale/flyboy/task_comments_controller.rb +1 -1
- data/app/controllers/dorsale/flyboy/tasks_controller.rb +1 -1
- data/app/controllers/dorsale/users_controller.rb +1 -1
- data/app/filters/dorsale/billing_machine/small_data/filter_for_invoices.rb +1 -1
- data/app/filters/dorsale/billing_machine/small_data/filter_for_quotations.rb +1 -1
- data/app/filters/dorsale/billing_machine/small_data/filter_strategy_by_customer.rb +1 -1
- data/app/filters/dorsale/billing_machine/small_data/filter_strategy_by_payment_status.rb +1 -1
- data/app/filters/dorsale/billing_machine/small_data/filter_strategy_by_state.rb +1 -1
- data/app/filters/dorsale/customer_vault/small_data/filter_for_events.rb +1 -1
- data/app/filters/dorsale/customer_vault/small_data/filter_for_people.rb +1 -1
- data/app/filters/dorsale/customer_vault/small_data/filter_strategy_by_activity_type.rb +1 -1
- data/app/filters/dorsale/expense_gun/small_data/filter_for_expenses.rb +1 -1
- data/app/filters/dorsale/flyboy/small_data/filter_for_tasks.rb +1 -1
- data/app/filters/dorsale/flyboy/small_data/filter_strategy_by_task_state.rb +2 -2
- data/app/helpers/dorsale/alexandrie/attachments_helper.rb +1 -1
- data/app/helpers/dorsale/comments_helper.rb +2 -2
- data/app/helpers/dorsale/customer_vault/application_helper.rb +1 -1
- data/app/helpers/dorsale/flyboy/application_helper.rb +2 -2
- data/app/mailers/dorsale/application_mailer.rb +1 -1
- data/app/mailers/dorsale/flyboy/task_mailer.rb +1 -1
- data/app/mailers/dorsale/user_mailer.rb +1 -1
- data/app/models/dorsale/address.rb +3 -3
- data/app/models/dorsale/alexandrie/attachment.rb +1 -1
- data/app/models/dorsale/alexandrie/attachment_type.rb +1 -1
- data/app/models/dorsale/billing_machine/invoice.rb +1 -1
- data/app/models/dorsale/billing_machine/invoice_line.rb +1 -1
- data/app/models/dorsale/billing_machine/payment_term.rb +1 -1
- data/app/models/dorsale/billing_machine/quotation.rb +8 -8
- data/app/models/dorsale/billing_machine/quotation_line.rb +1 -1
- data/app/models/dorsale/comment.rb +1 -1
- data/app/models/dorsale/customer_vault/activity_type.rb +1 -1
- data/app/models/dorsale/customer_vault/corporation.rb +2 -2
- data/app/models/dorsale/customer_vault/event.rb +3 -3
- data/app/models/dorsale/customer_vault/individual.rb +2 -2
- data/app/models/dorsale/customer_vault/link.rb +1 -1
- data/app/models/dorsale/customer_vault/origin.rb +1 -1
- data/app/models/dorsale/customer_vault/person.rb +6 -6
- data/app/models/dorsale/expense_gun/category.rb +1 -1
- data/app/models/dorsale/expense_gun/expense.rb +2 -2
- data/app/models/dorsale/expense_gun/expense_line.rb +1 -1
- data/app/models/dorsale/flyboy/task.rb +5 -5
- data/app/models/dorsale/flyboy/task_comment.rb +1 -1
- data/app/pdfs/dorsale/application_pdf.rb +1 -1
- data/app/pdfs/dorsale/billing_machine/invoice_multiple_vat_pdf.rb +19 -17
- data/app/pdfs/dorsale/billing_machine/invoice_single_vat_pdf.rb +30 -28
- data/app/pdfs/dorsale/billing_machine/quotation_multiple_vat_pdf.rb +1 -1
- data/app/pdfs/dorsale/billing_machine/quotation_single_vat_pdf.rb +1 -1
- data/app/pdfs/dorsale/expense_gun/expense_pdf.rb +2 -2
- data/app/pdfs/dorsale/prawn_helpers.rb +2 -2
- data/app/policies/dorsale/application_policy.rb +1 -1
- data/app/services/dorsale/billing_machine/invoice/copy.rb +1 -1
- data/app/services/dorsale/billing_machine/invoice/statistics.rb +5 -5
- data/app/services/dorsale/billing_machine/quotation/copy.rb +1 -1
- data/app/services/dorsale/billing_machine/quotation/statistics.rb +5 -5
- data/app/services/dorsale/billing_machine/quotation/to_invoice.rb +5 -5
- data/app/services/dorsale/expense_gun/expense/copy.rb +1 -1
- data/app/services/dorsale/flyboy/task/copy.rb +1 -1
- data/app/services/dorsale/flyboy/task/snoozer.rb +1 -1
- data/app/services/dorsale/service.rb +2 -2
- data/app/services/dorsale/tag_list_for_model.rb +1 -1
- data/app/uploaders/dorsale/alexandrie/file_uploader.rb +1 -1
- data/app/uploaders/dorsale/application_uploader.rb +1 -1
- data/app/uploaders/dorsale/avatar_uploader.rb +1 -1
- data/app/uploaders/dorsale/image_uploader.rb +2 -2
- data/app/uploaders/dorsale/pdf_uploader.rb +2 -2
- data/app/views/dorsale/customer_vault/people/index.xlsx.ruby +3 -3
- data/features/step_definitions/billing_machine_invoices_steps.rb +4 -4
- data/features/step_definitions/billing_machine_multiple_vat.rb +1 -1
- data/features/step_definitions/billing_machine_quotations_steps.rb +2 -2
- data/features/step_definitions/customer_vault_corporations_steps.rb +4 -4
- data/features/step_definitions/customer_vault_people_steps.rb +1 -1
- data/features/step_definitions/customer_vault_tasks_steps.rb +3 -3
- data/features/step_definitions/flyboy_tasks_steps.rb +1 -1
- data/lib/dorsale/engine.rb +11 -5
- data/lib/dorsale/version.rb +1 -1
- data/spec/controllers/dorsale/alexandrie/attachments_controller_spec.rb +1 -1
- data/spec/controllers/dorsale/customer_vault/events_controller_spec.rb +1 -1
- data/spec/controllers/dorsale/customer_vault/people_controller_spec.rb +3 -3
- data/spec/controllers/dorsale/expense_gun/expenses_controller_spec.rb +5 -5
- data/spec/controllers/dorsale/flyboy/task_comments_controller_spec.rb +1 -1
- data/spec/controllers/dorsale/flyboy/tasks_controller_spec.rb +2 -2
- data/spec/factories/alexandrie_attachment_types.rb +1 -1
- data/spec/factories/alexandrie_attachments.rb +1 -1
- data/spec/factories/billing_machine_invoice_lines.rb +1 -1
- data/spec/factories/billing_machine_invoices.rb +1 -1
- data/spec/factories/billing_machine_payment_terms.rb +1 -1
- data/spec/factories/billing_machine_quotation_lines.rb +1 -1
- data/spec/factories/billing_machine_quotations.rb +1 -1
- data/spec/factories/customer_vault_activity_types.rb +1 -1
- data/spec/factories/customer_vault_corporations.rb +1 -1
- data/spec/factories/customer_vault_event.rb +1 -1
- data/spec/factories/customer_vault_individuals.rb +2 -2
- data/spec/factories/customer_vault_links.rb +1 -1
- data/spec/factories/customer_vault_origins.rb +1 -1
- data/spec/factories/dorsale_addresses.rb +1 -1
- data/spec/factories/dorsale_comments.rb +1 -1
- data/spec/factories/expense_gun_categories.rb +1 -1
- data/spec/factories/expense_gun_expense_lines.rb +1 -1
- data/spec/factories/expense_gun_expenses.rb +2 -2
- data/spec/factories/flyboy_task_comments.rb +1 -1
- data/spec/factories/flyboy_tasks.rb +1 -1
- data/spec/mailers/user_mailer_spec.rb +2 -2
- data/spec/models/dorsale/alexandrie/attachment_spec.rb +1 -1
- data/spec/models/dorsale/alexandrie/attachment_type_spec.rb +1 -1
- data/spec/models/dorsale/billing_machine/invoice_line_spec.rb +5 -5
- data/spec/models/dorsale/billing_machine/invoice_spec.rb +10 -10
- data/spec/models/dorsale/billing_machine/quotation_line_spec.rb +6 -6
- data/spec/models/dorsale/billing_machine/quotation_spec.rb +8 -8
- data/spec/models/dorsale/billing_machine_spec.rb +1 -1
- data/spec/models/dorsale/customer_vault/activity_type_spec.rb +1 -1
- data/spec/models/dorsale/customer_vault/corporation_spec.rb +1 -1
- data/spec/models/dorsale/customer_vault/event_spec.rb +1 -1
- data/spec/models/dorsale/customer_vault/individual_spec.rb +3 -3
- data/spec/models/dorsale/customer_vault/link_spec.rb +1 -1
- data/spec/models/dorsale/customer_vault/origin_spec.rb +1 -1
- data/spec/models/dorsale/customer_vault/person_spec.rb +2 -2
- data/spec/models/dorsale/expense_gun/category_spec.rb +1 -1
- data/spec/models/dorsale/expense_gun/expense_line_spec.rb +2 -2
- data/spec/models/dorsale/flyboy/task_comment_spec.rb +5 -5
- data/spec/models/dorsale/flyboy/task_spec.rb +7 -7
- data/spec/models/dorsale/i18n_spec.rb +1 -1
- data/spec/pdfs/dorsale/billing_machine/invoice_multiple_vat_pdf_spec.rb +3 -3
- data/spec/pdfs/dorsale/billing_machine/invoice_single_vat_pdf_spec.rb +3 -3
- data/spec/pdfs/dorsale/billing_machine/quotation_multiple_vat_pdf_spec.rb +3 -3
- data/spec/pdfs/dorsale/billing_machine/quotation_single_vat_pdf_spec.rb +3 -3
- data/spec/rails_helper.rb +0 -3
- data/spec/routing/dorsale/billing_machine/invoices_routing_spec.rb +2 -2
- data/spec/routing/dorsale/billing_machine/quotations_routing_spec.rb +2 -2
- data/spec/routing/dorsale/customer_vault/activity_types_routing_spec.rb +2 -2
- data/spec/routing/dorsale/customer_vault/events_routing_spec.rb +2 -2
- data/spec/routing/dorsale/customer_vault/origins_routing_spec.rb +2 -2
- data/spec/routing/dorsale/customer_vault/people_routing_spec.rb +2 -2
- data/spec/routing/dorsale/expense_gun/expenses_routing_spec.rb +2 -2
- data/spec/routing/dorsale/flyboy/task_comments_routing_spec.rb +2 -2
- data/spec/routing/dorsale/flyboy/tasks_routing_spec.rb +2 -2
- data/spec/routing/dorsale/users_routing_spec.rb +2 -2
- data/spec/services/dorsale/expense_gun/expense/copy_spec.rb +2 -2
- metadata +111 -114
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
class Dorsale::BillingMachine::InvoiceMultipleVatPdf <
|
|
2
|
-
# rubocop:disable Style/SingleLineMethods
|
|
1
|
+
class Dorsale::BillingMachine::InvoiceMultipleVatPdf < Dorsale::BillingMachine::InvoiceSingleVatPdf
|
|
2
|
+
# rubocop:disable Style/SingleLineMethods
|
|
3
3
|
def first_column_width; 64.mm; end
|
|
4
4
|
def second_column_width; 22.mm; end
|
|
5
5
|
def third_column_width; 20.mm; end
|
|
6
6
|
def fourth_column_width; 20.mm; end
|
|
7
7
|
def fifth_column_width; 29.mm; end
|
|
8
|
-
# rubocop:enable Style/SingleLineMethods
|
|
8
|
+
# rubocop:enable Style/SingleLineMethods
|
|
9
9
|
|
|
10
10
|
def last_column_width
|
|
11
11
|
bounds.width - first_column_width - second_column_width - third_column_width - fourth_column_width - fifth_column_width
|
|
@@ -32,14 +32,16 @@ class Dorsale::BillingMachine::InvoiceMultipleVatPdf < ::Dorsale::BillingMachine
|
|
|
32
32
|
|
|
33
33
|
# Products table
|
|
34
34
|
bb height: height do
|
|
35
|
-
table_products = [
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
35
|
+
table_products = [
|
|
36
|
+
[
|
|
37
|
+
main_document.t(:designation).upcase.to_s,
|
|
38
|
+
main_document.t(:quantity).upcase.to_s,
|
|
39
|
+
main_document.t(:unit).upcase.to_s,
|
|
40
|
+
main_document.t(:tax).upcase.to_s,
|
|
41
|
+
main_document.t(:unit_price).upcase.to_s,
|
|
42
|
+
main_document.t(:line_total).upcase.to_s,
|
|
43
|
+
],
|
|
44
|
+
]
|
|
43
45
|
|
|
44
46
|
main_document.lines.each do |line|
|
|
45
47
|
table_products.push [
|
|
@@ -81,34 +83,34 @@ class Dorsale::BillingMachine::InvoiceMultipleVatPdf < ::Dorsale::BillingMachine
|
|
|
81
83
|
|
|
82
84
|
if has_discount
|
|
83
85
|
table_totals.push [
|
|
84
|
-
main_document.t(:commercial_discount).
|
|
86
|
+
main_document.t(:commercial_discount).upcase.to_s,
|
|
85
87
|
bm_currency(-main_document.commercial_discount),
|
|
86
88
|
]
|
|
87
89
|
end
|
|
88
90
|
|
|
89
91
|
table_totals.push [
|
|
90
|
-
main_document.t(:total_excluding_taxes).
|
|
92
|
+
main_document.t(:total_excluding_taxes).upcase.to_s,
|
|
91
93
|
bm_currency(main_document.total_excluding_taxes),
|
|
92
94
|
]
|
|
93
95
|
|
|
94
96
|
table_totals.push [
|
|
95
|
-
main_document.t(:vat_amount).
|
|
97
|
+
main_document.t(:vat_amount).upcase.to_s,
|
|
96
98
|
bm_currency(main_document.vat_amount),
|
|
97
99
|
]
|
|
98
100
|
|
|
99
101
|
if has_advance
|
|
100
102
|
table_totals.push [
|
|
101
|
-
main_document.t(:advance).
|
|
103
|
+
main_document.t(:advance).upcase.to_s,
|
|
102
104
|
bm_currency(main_document.advance),
|
|
103
105
|
]
|
|
104
106
|
|
|
105
107
|
table_totals.push [
|
|
106
|
-
main_document.t(:total_including_taxes).
|
|
108
|
+
main_document.t(:total_including_taxes).upcase.to_s,
|
|
107
109
|
bm_currency(main_document.balance),
|
|
108
110
|
]
|
|
109
111
|
else
|
|
110
112
|
table_totals.push [
|
|
111
|
-
main_document.t(:total_including_taxes).
|
|
113
|
+
main_document.t(:total_including_taxes).upcase.to_s,
|
|
112
114
|
bm_currency(main_document.total_including_taxes),
|
|
113
115
|
]
|
|
114
116
|
end
|
|
@@ -24,7 +24,7 @@ class Dorsale::BillingMachine::InvoiceSingleVatPdf < Dorsale::ApplicationPdf
|
|
|
24
24
|
currency(n, Dorsale::BillingMachine.default_currency)
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
-
# rubocop:disable Style/SingleLineMethods
|
|
27
|
+
# rubocop:disable Style/SingleLineMethods
|
|
28
28
|
def header_height; 90.mm; end
|
|
29
29
|
def logo_height; 32.mm; end
|
|
30
30
|
def logo_width; 50.mm; end
|
|
@@ -42,7 +42,7 @@ class Dorsale::BillingMachine::InvoiceSingleVatPdf < Dorsale::ApplicationPdf
|
|
|
42
42
|
def second_column_width; 2.4.cm; end
|
|
43
43
|
def third_column_width; 2.5.cm; end
|
|
44
44
|
def fourth_column_width; 2.9.cm; end
|
|
45
|
-
# rubocop:enable Style/SingleLineMethods
|
|
45
|
+
# rubocop:enable Style/SingleLineMethods
|
|
46
46
|
|
|
47
47
|
def last_column_width
|
|
48
48
|
bounds.width - first_column_width - second_column_width - third_column_width - fourth_column_width
|
|
@@ -110,7 +110,7 @@ class Dorsale::BillingMachine::InvoiceSingleVatPdf < Dorsale::ApplicationPdf
|
|
|
110
110
|
|
|
111
111
|
def build_contact_infos
|
|
112
112
|
top = bounds.top - 4.cm
|
|
113
|
-
width = bounds.width / 2 - 1.1.cm
|
|
113
|
+
width = (bounds.width / 2) - 1.1.cm
|
|
114
114
|
height = contact_infos_height
|
|
115
115
|
|
|
116
116
|
bb top: top, width: width, height: height do
|
|
@@ -120,7 +120,7 @@ class Dorsale::BillingMachine::InvoiceSingleVatPdf < Dorsale::ApplicationPdf
|
|
|
120
120
|
|
|
121
121
|
def build_subject
|
|
122
122
|
top = bounds.top - 7.5.cm
|
|
123
|
-
width = bounds.width / 2 - 1.1.cm
|
|
123
|
+
width = (bounds.width / 2) - 1.1.cm
|
|
124
124
|
height = 15.mm
|
|
125
125
|
|
|
126
126
|
bb top: top, width: width, height: height do
|
|
@@ -146,17 +146,17 @@ class Dorsale::BillingMachine::InvoiceSingleVatPdf < Dorsale::ApplicationPdf
|
|
|
146
146
|
content << main_document.customer.address.country
|
|
147
147
|
|
|
148
148
|
if main_document.customer.try(:european_union_vat_number).present?
|
|
149
|
-
content << main_document.customer.t(:european_union_vat_number) + " : "
|
|
149
|
+
content << (main_document.customer.t(:european_union_vat_number) + " : ")
|
|
150
150
|
content << main_document.customer.european_union_vat_number
|
|
151
151
|
end
|
|
152
152
|
|
|
153
|
-
content.
|
|
153
|
+
content.compact_blank.join("\n")
|
|
154
154
|
end
|
|
155
155
|
|
|
156
156
|
def build_customer
|
|
157
157
|
top = bounds.top - 4.cm
|
|
158
|
-
left = bounds.width / 2 + 1.1.cm
|
|
159
|
-
width = bounds.width / 2 - 1.1.cm
|
|
158
|
+
left = (bounds.width / 2) + 1.1.cm
|
|
159
|
+
width = (bounds.width / 2) - 1.1.cm
|
|
160
160
|
height = 4.5.cm
|
|
161
161
|
padding = 3.mm
|
|
162
162
|
|
|
@@ -177,11 +177,11 @@ class Dorsale::BillingMachine::InvoiceSingleVatPdf < Dorsale::ApplicationPdf
|
|
|
177
177
|
end
|
|
178
178
|
|
|
179
179
|
def has_advance
|
|
180
|
-
main_document.try(:advance) && main_document.advance.to_d != 0.0
|
|
180
|
+
main_document.try(:advance) && main_document.advance.to_d != BigDecimal("0.0")
|
|
181
181
|
end
|
|
182
182
|
|
|
183
183
|
def has_discount
|
|
184
|
-
main_document.try(:commercial_discount) && main_document.commercial_discount.to_d != 0.0
|
|
184
|
+
main_document.try(:commercial_discount) && main_document.commercial_discount.to_d != BigDecimal("0.0")
|
|
185
185
|
end
|
|
186
186
|
|
|
187
187
|
def build_table
|
|
@@ -199,7 +199,7 @@ class Dorsale::BillingMachine::InvoiceSingleVatPdf < Dorsale::ApplicationPdf
|
|
|
199
199
|
fourth_column_width,
|
|
200
200
|
last_column_width,
|
|
201
201
|
],
|
|
202
|
-
:cell_style => {height:
|
|
202
|
+
:cell_style => {height:} \
|
|
203
203
|
do
|
|
204
204
|
row(0).style :text_color => BLACK
|
|
205
205
|
row(0).style :font_style => :bold
|
|
@@ -212,13 +212,15 @@ class Dorsale::BillingMachine::InvoiceSingleVatPdf < Dorsale::ApplicationPdf
|
|
|
212
212
|
|
|
213
213
|
# Products table
|
|
214
214
|
bb height: height do
|
|
215
|
-
table_products = [
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
215
|
+
table_products = [
|
|
216
|
+
[
|
|
217
|
+
main_document.t(:designation).upcase.to_s,
|
|
218
|
+
main_document.t(:quantity).upcase.to_s,
|
|
219
|
+
main_document.t(:unit).upcase.to_s,
|
|
220
|
+
main_document.t(:unit_price).upcase.to_s,
|
|
221
|
+
main_document.t(:line_total).upcase.to_s,
|
|
222
|
+
],
|
|
223
|
+
]
|
|
222
224
|
|
|
223
225
|
main_document.lines.each do |line|
|
|
224
226
|
table_products.push [
|
|
@@ -258,35 +260,35 @@ class Dorsale::BillingMachine::InvoiceSingleVatPdf < Dorsale::ApplicationPdf
|
|
|
258
260
|
|
|
259
261
|
if has_discount
|
|
260
262
|
table_totals.push [
|
|
261
|
-
main_document.t(:commercial_discount).
|
|
263
|
+
main_document.t(:commercial_discount).upcase.to_s,
|
|
262
264
|
bm_currency(-main_document.commercial_discount),
|
|
263
265
|
]
|
|
264
266
|
end
|
|
265
267
|
|
|
266
268
|
table_totals.push [
|
|
267
|
-
main_document.t(:total_excluding_taxes).
|
|
269
|
+
main_document.t(:total_excluding_taxes).upcase.to_s,
|
|
268
270
|
bm_currency(main_document.total_excluding_taxes),
|
|
269
271
|
]
|
|
270
272
|
|
|
271
273
|
vat_rate = number(main_document.vat_rate)
|
|
272
274
|
table_totals.push [
|
|
273
|
-
"#{main_document.t(:vat).
|
|
275
|
+
"#{main_document.t(:vat).upcase} #{percentage vat_rate}",
|
|
274
276
|
bm_currency(main_document.vat_amount),
|
|
275
277
|
]
|
|
276
278
|
|
|
277
279
|
if has_advance
|
|
278
280
|
table_totals.push [
|
|
279
|
-
main_document.t(:advance).
|
|
281
|
+
main_document.t(:advance).upcase.to_s,
|
|
280
282
|
bm_currency(main_document.advance),
|
|
281
283
|
]
|
|
282
284
|
|
|
283
285
|
table_totals.push [
|
|
284
|
-
main_document.t(:total_including_taxes).
|
|
286
|
+
main_document.t(:total_including_taxes).upcase.to_s,
|
|
285
287
|
bm_currency(main_document.balance),
|
|
286
288
|
]
|
|
287
289
|
else
|
|
288
290
|
table_totals.push [
|
|
289
|
-
main_document.t(:total_including_taxes).
|
|
291
|
+
main_document.t(:total_including_taxes).upcase.to_s,
|
|
290
292
|
bm_currency(main_document.total_including_taxes),
|
|
291
293
|
]
|
|
292
294
|
end
|
|
@@ -323,7 +325,7 @@ class Dorsale::BillingMachine::InvoiceSingleVatPdf < Dorsale::ApplicationPdf
|
|
|
323
325
|
|
|
324
326
|
txt << main_document.comments
|
|
325
327
|
|
|
326
|
-
txt.
|
|
328
|
+
txt.compact_blank.join("\n\n")
|
|
327
329
|
end
|
|
328
330
|
|
|
329
331
|
def build_document_infos
|
|
@@ -331,7 +333,7 @@ class Dorsale::BillingMachine::InvoiceSingleVatPdf < Dorsale::ApplicationPdf
|
|
|
331
333
|
height = middle_height - products_table_height - 5.mm
|
|
332
334
|
width = 10.cm
|
|
333
335
|
|
|
334
|
-
btb document_infos_content, top
|
|
336
|
+
btb document_infos_content, top:, height:, width:
|
|
335
337
|
end
|
|
336
338
|
|
|
337
339
|
def build_footer
|
|
@@ -355,7 +357,7 @@ class Dorsale::BillingMachine::InvoiceSingleVatPdf < Dorsale::ApplicationPdf
|
|
|
355
357
|
end
|
|
356
358
|
|
|
357
359
|
def build_footer_line
|
|
358
|
-
top = bounds.top - footer_top_height - (footer_height - footer_top_height - footer_bottom_height - footer_pagination_height) / 2
|
|
360
|
+
top = bounds.top - footer_top_height - ((footer_height - footer_top_height - footer_bottom_height - footer_pagination_height) / 2)
|
|
359
361
|
stroke do
|
|
360
362
|
horizontal_line bounds.left, bounds.right, at: top
|
|
361
363
|
end
|
|
@@ -369,7 +371,7 @@ class Dorsale::BillingMachine::InvoiceSingleVatPdf < Dorsale::ApplicationPdf
|
|
|
369
371
|
height = footer_bottom_height
|
|
370
372
|
top = bounds.bottom + height + footer_pagination_height
|
|
371
373
|
|
|
372
|
-
btb footer_bottom_content, top
|
|
374
|
+
btb footer_bottom_content, top:, height:, size: 9
|
|
373
375
|
end
|
|
374
376
|
|
|
375
377
|
def build_page_numbers
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
class Dorsale::BillingMachine::QuotationMultipleVatPdf <
|
|
1
|
+
class Dorsale::BillingMachine::QuotationMultipleVatPdf < Dorsale::BillingMachine::InvoiceMultipleVatPdf
|
|
2
2
|
include ::Dorsale::BillingMachine::QuotationPdfCommonMethods
|
|
3
3
|
end
|
|
@@ -34,11 +34,11 @@ class Dorsale::ExpenseGun::ExpensePdf < Dorsale::ApplicationPdf
|
|
|
34
34
|
|
|
35
35
|
private
|
|
36
36
|
|
|
37
|
-
def info(obj, attribute, helper: nil, **
|
|
37
|
+
def info(obj, attribute, helper: nil, **)
|
|
38
38
|
key = obj.t(attribute)
|
|
39
39
|
value = obj.public_send(attribute)
|
|
40
40
|
value = helper ? H.public_send(helper, value) : value.to_s
|
|
41
|
-
text
|
|
41
|
+
text("<b>#{key} :</b> #{value}", inline_format: true, **)
|
|
42
42
|
end
|
|
43
43
|
|
|
44
44
|
def table_data
|
|
@@ -8,25 +8,25 @@ class Dorsale::BillingMachine::Invoice::Statistics
|
|
|
8
8
|
def total_excluding_taxes
|
|
9
9
|
@total_excluding_taxes ||= @invoices
|
|
10
10
|
.pluck(:total_excluding_taxes)
|
|
11
|
-
.
|
|
11
|
+
.compact
|
|
12
12
|
.sum
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
def vat_amount
|
|
16
16
|
@vat_amount ||= @invoices
|
|
17
17
|
.pluck(:vat_amount)
|
|
18
|
-
.
|
|
18
|
+
.compact
|
|
19
19
|
.sum
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
def total_including_taxes
|
|
23
23
|
@total_including_taxes ||= @invoices
|
|
24
24
|
.pluck(:total_including_taxes)
|
|
25
|
-
.
|
|
25
|
+
.compact
|
|
26
26
|
.sum
|
|
27
27
|
end
|
|
28
28
|
|
|
29
|
-
def t(*
|
|
30
|
-
::Dorsale::BillingMachine::Invoice.t(*
|
|
29
|
+
def t(*)
|
|
30
|
+
::Dorsale::BillingMachine::Invoice.t(*)
|
|
31
31
|
end
|
|
32
32
|
end
|
|
@@ -9,7 +9,7 @@ class Dorsale::BillingMachine::Quotation::Statistics
|
|
|
9
9
|
@total_excluding_taxes ||= @quotations
|
|
10
10
|
.where.not(state: "canceled")
|
|
11
11
|
.pluck(:total_excluding_taxes)
|
|
12
|
-
.
|
|
12
|
+
.compact
|
|
13
13
|
.sum
|
|
14
14
|
end
|
|
15
15
|
|
|
@@ -17,7 +17,7 @@ class Dorsale::BillingMachine::Quotation::Statistics
|
|
|
17
17
|
@vat_amount ||= @quotations
|
|
18
18
|
.where.not(state: "canceled")
|
|
19
19
|
.pluck(:vat_amount)
|
|
20
|
-
.
|
|
20
|
+
.compact
|
|
21
21
|
.sum
|
|
22
22
|
end
|
|
23
23
|
|
|
@@ -25,11 +25,11 @@ class Dorsale::BillingMachine::Quotation::Statistics
|
|
|
25
25
|
@total_including_taxes ||= @quotations
|
|
26
26
|
.where.not(state: "canceled")
|
|
27
27
|
.pluck(:total_including_taxes)
|
|
28
|
-
.
|
|
28
|
+
.compact
|
|
29
29
|
.sum
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
-
def t(*
|
|
33
|
-
::Dorsale::BillingMachine::Quotation.t(*
|
|
32
|
+
def t(*)
|
|
33
|
+
::Dorsale::BillingMachine::Quotation.t(*)
|
|
34
34
|
end
|
|
35
35
|
end
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class Dorsale::BillingMachine::Quotation::ToInvoice <
|
|
1
|
+
class Dorsale::BillingMachine::Quotation::ToInvoice < Dorsale::Service
|
|
2
2
|
attr_accessor :quotation, :invoice
|
|
3
3
|
|
|
4
4
|
def initialize(quotation)
|
|
@@ -12,8 +12,8 @@ class Dorsale::BillingMachine::Quotation::ToInvoice < ::Dorsale::Service
|
|
|
12
12
|
quotation.attributes.each do |k, v|
|
|
13
13
|
next if ignored_key?(k)
|
|
14
14
|
|
|
15
|
-
if invoice.respond_to?("#{k}=")
|
|
16
|
-
invoice.public_send("#{k}=", v)
|
|
15
|
+
if invoice.respond_to?(:"#{k}=")
|
|
16
|
+
invoice.public_send(:"#{k}=", v)
|
|
17
17
|
end
|
|
18
18
|
end
|
|
19
19
|
|
|
@@ -23,8 +23,8 @@ class Dorsale::BillingMachine::Quotation::ToInvoice < ::Dorsale::Service
|
|
|
23
23
|
quotation_line.attributes.each do |k, v|
|
|
24
24
|
next if ignored_key?(k)
|
|
25
25
|
|
|
26
|
-
if invoice_line.respond_to?("#{k}=")
|
|
27
|
-
invoice_line.public_send("#{k}=", v)
|
|
26
|
+
if invoice_line.respond_to?(:"#{k}=")
|
|
27
|
+
invoice_line.public_send(:"#{k}=", v)
|
|
28
28
|
end
|
|
29
29
|
end
|
|
30
30
|
end
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
class Dorsale::Alexandrie::FileUploader <
|
|
1
|
+
class Dorsale::Alexandrie::FileUploader < Dorsale::ApplicationUploader
|
|
2
2
|
end
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
class Dorsale::ApplicationUploader <
|
|
1
|
+
class Dorsale::ApplicationUploader < ApplicationUploader
|
|
2
2
|
end
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
fields = %w
|
|
1
|
+
fields = %w[
|
|
2
2
|
person_type
|
|
3
3
|
first_name
|
|
4
4
|
last_name
|
|
@@ -26,7 +26,7 @@ fields = %w(
|
|
|
26
26
|
address.city
|
|
27
27
|
address.zip
|
|
28
28
|
address.country
|
|
29
|
-
|
|
29
|
+
]
|
|
30
30
|
|
|
31
31
|
data = []
|
|
32
32
|
|
|
@@ -41,7 +41,7 @@ data << fields.map { |field| model.t(field) }
|
|
|
41
41
|
elsif field.include?("address.")
|
|
42
42
|
line << person.address.public_send(field.gsub("address.", ""))
|
|
43
43
|
else
|
|
44
|
-
line << person.
|
|
44
|
+
line << person.try(field)
|
|
45
45
|
end
|
|
46
46
|
end
|
|
47
47
|
|
|
@@ -23,7 +23,7 @@ Given(/^an existing paid invoice$/) do
|
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
Given(/^billing machine in single vat mode$/) do
|
|
26
|
-
|
|
26
|
+
Dorsale::BillingMachine.vat_mode = :single
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
Given(/^a bunch of existing invoices$/) do
|
|
@@ -149,7 +149,7 @@ When(/^he changes the advance to "(.*?)"€$/) do |value|
|
|
|
149
149
|
end
|
|
150
150
|
|
|
151
151
|
When(/^he goes to the newly created invoice page$/) do
|
|
152
|
-
@invoice =
|
|
152
|
+
@invoice = Dorsale::BillingMachine::Invoice.last_created
|
|
153
153
|
visit dorsale.edit_billing_machine_invoice_path(@invoice)
|
|
154
154
|
end
|
|
155
155
|
|
|
@@ -178,7 +178,7 @@ When(/^the user download the pdf$/) do
|
|
|
178
178
|
end
|
|
179
179
|
|
|
180
180
|
Then(/^he should see (\d+) invoices?$/) do |count|
|
|
181
|
-
expect(page).to have_selector ".invoice", count:
|
|
181
|
+
expect(page).to have_selector ".invoice", count:
|
|
182
182
|
end
|
|
183
183
|
|
|
184
184
|
Then(/^the invoice is displayed correctly$/) do
|
|
@@ -205,7 +205,7 @@ Then(/^it's added to the invoice list$/) do
|
|
|
205
205
|
step("the user goes to the invoices page")
|
|
206
206
|
expect(page).to have_selector ".invoice .date", text: @date
|
|
207
207
|
# There are no other invoices for this test so we should get the right number
|
|
208
|
-
tracking_id =
|
|
208
|
+
tracking_id = Dorsale::BillingMachine::Invoice.first.tracking_id
|
|
209
209
|
expect(page).to have_selector ".invoice .tracking_id", text: tracking_id
|
|
210
210
|
expect(page).to have_selector ".invoice .customer_name", text: @customer.name
|
|
211
211
|
expect(page).to have_selector ".invoice .total_excluding_taxes", text: "180,00 €"
|
|
@@ -18,7 +18,7 @@ end
|
|
|
18
18
|
|
|
19
19
|
Given(/^(\d+) associated documents to this quotation$/) do |n|
|
|
20
20
|
n.to_i.times do |i|
|
|
21
|
-
instance_variable_set "@document#{i}", create(:alexandrie_attachment, attachable: @quotation)
|
|
21
|
+
instance_variable_set :"@document#{i}", create(:alexandrie_attachment, attachable: @quotation)
|
|
22
22
|
end
|
|
23
23
|
end
|
|
24
24
|
|
|
@@ -165,7 +165,7 @@ Then(/^he will see links to the documents$/) do
|
|
|
165
165
|
end
|
|
166
166
|
|
|
167
167
|
Then(/^the quotation informations are visible on the quotation details$/) do
|
|
168
|
-
@quotation =
|
|
168
|
+
@quotation = Dorsale::BillingMachine::Quotation.last_created
|
|
169
169
|
visit dorsale.billing_machine_quotation_path(@quotation)
|
|
170
170
|
expect(page).to have_content @payment_term.label
|
|
171
171
|
expect(page).to have_content "I-am-a-comment"
|
|
@@ -47,7 +47,7 @@ Then(/^i see an error message for the missing name$/) do
|
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
Then(/^he can see (\d+) corporate$/) do |count|
|
|
50
|
-
expect(page).to have_selector ".person", count:
|
|
50
|
+
expect(page).to have_selector ".person", count:
|
|
51
51
|
end
|
|
52
52
|
|
|
53
53
|
Then(/^the corporation is created$/) do
|
|
@@ -182,7 +182,7 @@ Given(/^a closed task to this corporation$/) do
|
|
|
182
182
|
end
|
|
183
183
|
|
|
184
184
|
Given(/^a link between this individual and this corporation$/) do
|
|
185
|
-
@link =
|
|
185
|
+
@link = Dorsale::CustomerVault::Link.create!(
|
|
186
186
|
:alice => @corporation,
|
|
187
187
|
:bob => @individual,
|
|
188
188
|
:title => "I-am-a-link",
|
|
@@ -203,14 +203,14 @@ Then(/^I am on the corporation page$/) do
|
|
|
203
203
|
end
|
|
204
204
|
|
|
205
205
|
When(/^I delete this corporation$/) do
|
|
206
|
-
@corporations_count =
|
|
206
|
+
@corporations_count = Dorsale::CustomerVault::Corporation.count
|
|
207
207
|
|
|
208
208
|
find(".context [href$=edit]").click
|
|
209
209
|
find(".context [data-method=delete]").click
|
|
210
210
|
end
|
|
211
211
|
|
|
212
212
|
Then(/^the corporation is deleted$/) do
|
|
213
|
-
expect(
|
|
213
|
+
expect(Dorsale::CustomerVault::Corporation.count).to eq(@corporations_count - 1)
|
|
214
214
|
end
|
|
215
215
|
|
|
216
216
|
Then(/^I am on the people page$/) do
|
|
@@ -8,7 +8,7 @@ end
|
|
|
8
8
|
|
|
9
9
|
Given(/^a very long comment on this person$/) do
|
|
10
10
|
text = Faker::Lorem.paragraph(sentence_count: 30)
|
|
11
|
-
@comment = create(:customer_vault_event_comment, person: @person, text:
|
|
11
|
+
@comment = create(:customer_vault_event_comment, person: @person, text:)
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
Then(/^I see the truncated comment$/) do
|
|
@@ -3,7 +3,7 @@ When(/^I go on the tasks section$/) do
|
|
|
3
3
|
end
|
|
4
4
|
|
|
5
5
|
When(/^I create a task on this person$/) do
|
|
6
|
-
@tasks_count =
|
|
6
|
+
@tasks_count = Dorsale::Flyboy::Task.count
|
|
7
7
|
find("#context-main a[href*='tasks/new']").click
|
|
8
8
|
fill_in :task_name, with: "YepYep"
|
|
9
9
|
fill_in :task_description, with: "Trololo"
|
|
@@ -11,8 +11,8 @@ When(/^I create a task on this person$/) do
|
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
Then(/^the person task is created$/) do
|
|
14
|
-
expect(
|
|
15
|
-
@task =
|
|
14
|
+
expect(Dorsale::Flyboy::Task.count).to eq(@tasks_count + 1)
|
|
15
|
+
@task = Dorsale::Flyboy::Task.last_created
|
|
16
16
|
person = @corporation || @individual || @person
|
|
17
17
|
expect(current_path).to eq dorsale.tasks_customer_vault_person_path(person)
|
|
18
18
|
end
|