diff --git a/app/models/sale.rb b/app/models/sale.rb index 661222bc..8e7b0677 100644 --- a/app/models/sale.rb +++ b/app/models/sale.rb @@ -427,7 +427,7 @@ class Sale < ApplicationRecord SUM(case when (sale_payments.payment_method='jcb') then sale_payments.payment_amount else 0 end) as jcb_amount, SUM(case when (sale_payments.payment_method='paypar') then sale_payments.payment_amount else 0 end) as paypar_amount, SUM(case when (sale_payments.payment_method='cash') then sale_payments.payment_amount else 0 end) as cash_amount, - SUM(case when (sale_payments.payment_method='credit') then sale_payments.payment_amount else 0 end) as credit_amount, + SUM(case when (sale_payments.payment_method='creditnote') then sale_payments.payment_amount else 0 end) as credit_amount, SUM(case when (sale_payments.payment_method='foc') then sale_payments.payment_amount else 0 end) as foc_amount") .joins("join (select * from sale_payments group by sale_payments.sale_id, sale_payments.payment_method) sale_payments on sale_payments.sale_id = sales.sale_id") .where("sale_status = ? AND sales.receipt_date between ? and ? AND total_amount != 0", 'completed', from, to) diff --git a/app/views/reports/receipt_no/index.html.erb b/app/views/reports/receipt_no/index.html.erb index d30d6154..d5f2cafc 100644 --- a/app/views/reports/receipt_no/index.html.erb +++ b/app/views/reports/receipt_no/index.html.erb @@ -79,7 +79,7 @@