Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(groupe-by): Ensure all groups appears on invoice #1724

Merged
merged 1 commit into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions app/views/templates/invoices/v4/_default_fee.slim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
- fee = self.first
- fee = self
tr
td
.body-1 = fee.invoice_name + FeeDisplayHelper.grouped_by_display(fee)
Expand All @@ -8,7 +8,7 @@ tr
.body-3 = I18n.t('invoice.total_events', count: fee.events_count)
- if fee.charge.prorated?
.body-3 = I18n.t('invoice.fee_prorated')
td.body-2 = self.sum(&:units)
td.body-2 = MoneyHelper.format_with_precision(self.sum(&:precise_unit_amount), fee.unit_amount.currency)
td.body-2 = fee.units
td.body-2 = MoneyHelper.format_with_precision(fee.precise_unit_amount, fee.unit_amount.currency)
td.body-2 == TaxHelper.applied_taxes(fee)
td.body-2 = MoneyHelper.format(self.sum(&:amount))
td.body-2 = MoneyHelper.format(fee.amount)
6 changes: 3 additions & 3 deletions app/views/templates/invoices/v4/_fees_without_groups.slim
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
- fee = self.first
- fee = self

- if fee.amount.zero? || fee.amount_details.blank?
== SlimHelper.render('templates/invoices/v4/_default_fee', self)
== SlimHelper.render('templates/invoices/v4/_default_fee', fee)
- else
tr.charge-name
td.body-1
Expand Down Expand Up @@ -31,4 +31,4 @@

/ True up fees attached to the fee
- if fee.true_up_fee.present?
== SlimHelper.render('templates/invoices/v4/_true_up_fee', fee)
== SlimHelper.render('templates/invoices/v4/_true_up_fee', fee)
13 changes: 8 additions & 5 deletions app/views/templates/invoices/v4/_subscription_details.slim
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
- if fees.all? { |f| f.group_id? } && fees.sum(&:units) > 0
- fees.select { |f| f.units.positive? }.each do |fee|
- if fee.amount_details.blank?
== SlimHelper.render('templates/invoices/v4/_default_fee', fees)
== SlimHelper.render('templates/invoices/v4/_default_fee', fee)
- else
== SlimHelper.render('templates/invoices/v4/_fee_with_groups', fee)

Expand All @@ -46,7 +46,8 @@

/ Fees without group
- else
== SlimHelper.render('templates/invoices/v4/_fees_without_groups', fees)
- fees.sort_by { |f| f.invoice_sorting_clause }.each do |fee|
== SlimHelper.render('templates/invoices/v4/_fees_without_groups', fee)

/ Charge fees section for subscription invoice
- if subscription? && subscription_fees(subscription.id).charge_kind.any?
Expand Down Expand Up @@ -81,7 +82,8 @@

/ Fees without group
- else
== SlimHelper.render('templates/invoices/v4/_fees_without_groups', fees)
- fees.sort_by { |f| f.invoice_sorting_clause }.each do |fee|
== SlimHelper.render('templates/invoices/v4/_fees_without_groups', fee)

/ Charges payed in advance on payed in arrears plan
- if subscription.plan.charges.where(pay_in_advance: true).any? && !subscription.plan.pay_in_advance? && existing_fees_in_interval?(subscription_id: subscription.id, charge_in_advance: true)
Expand All @@ -104,7 +106,7 @@
- if fees.all? { |f| f.group_id? } && fees.sum(&:units) > 0
- fees.select { |f| f.units.positive? }.each do |fee|
- if fee.amount_details.blank?
== SlimHelper.render('templates/invoices/v4/_default_fee', fees)
== SlimHelper.render('templates/invoices/v4/_default_fee', fee)
- else
== SlimHelper.render('templates/invoices/v4/_fee_with_groups', fee)

Expand All @@ -114,7 +116,8 @@

/ Fees without group
- else
== SlimHelper.render('templates/invoices/v4/_fees_without_groups', fees)
- fees.sort_by { |f| f.invoice_sorting_clause }.each do |fee|
== SlimHelper.render('templates/invoices/v4/_fees_without_groups', fee)

/ Total section
.invoice-resume.overflow-auto
Expand Down
Loading