fixed shiftsale print

This commit is contained in:
NyanLinHtut
2020-07-30 12:03:23 +06:30
parent 32ec0055bf
commit 7d9c2379ae

View File

@@ -154,7 +154,7 @@ class ShiftSale < ApplicationRecord
shift_other_payments = Sale.select("sales.sale_id,sale_payments.payment_method as name")
if payment_methods.present?
shift_other_payments = shift_other_payments.select("#{payment_methods.map { |method| "SUM(case when (sale_payments.payment_method='#{method}') then sale_payments.payment_amount else 0 end) as #{method == 'paypar' ? 'redeem' : method}"}.join(', ')}")
shift_other_payments = shift_other_payments.select("#{payment_methods.map { |method| "SUM(case when (sale_payments.payment_method='#{method}') then sale_payments.payment_amount else 0 end) as `#{method == 'paypar' ? 'redeem' : method}`"}.join(', ')}")
end
shift_other_payments.select("SUM(case when (sale_payments.payment_method='foc') then (sale_payments.payment_amount) else 0 end) as foc_amount")
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")