From f739fd01b5fe48b28685e6534a8288337889612e Mon Sep 17 00:00:00 2001 From: "L.Regene" <125754132+Regene27@users.noreply.github.com> Date: Wed, 13 Nov 2024 18:26:47 +0700 Subject: [PATCH] Close #2055 Fix invoice calculation (#2056) --- app/views/spree/billing/shared/_invoice.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/spree/billing/shared/_invoice.html.erb b/app/views/spree/billing/shared/_invoice.html.erb index 2a8b8436d..1ef798ca5 100644 --- a/app/views/spree/billing/shared/_invoice.html.erb +++ b/app/views/spree/billing/shared/_invoice.html.erb @@ -39,7 +39,7 @@ @previous_order = @customer.orders[@current_order - 1] if @current_order && @current_order > 0 @outstanding_amount = Spree::Money.new(@previous_order&.outstanding_balance, currency: @invoice.order.line_items.first.variant.currency).to_s if @customer.user.store_credits.present? - @current_credit = @customer.user.store_credits.last.amount.to_d - (@customer.user.store_credits.last.amount_used * @invoice.order.total).to_d + @current_credit = @customer.user.store_credits.last.amount.to_d - @customer.user.store_credits.last.amount_used.to_d @display_current_credit = Spree::Money.new(@current_credit, currency: @invoice.order.line_items.first.variant.currency).to_s @display_amount_due = if @current_credit >= @total_price Spree::Money.new(0, currency: @invoice.order.line_items.first.variant.currency).to_s