fixed otherpayment & redeem
This commit is contained in:
@@ -753,7 +753,7 @@ class Sale < ApplicationRecord
|
||||
|
||||
sales = select("
|
||||
sales.*,
|
||||
#{payment_methods.map { |method| "SUM(case when (sale_payments.payment_method='#{method}') then sale_payments.payment_amount else 0 end) as #{method}"}.join(', ')},
|
||||
#{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(', ')},
|
||||
SUM(case when (sale_payments.payment_method='cash') then sale_payments.payment_amount else 0 end) as cash_amount,
|
||||
CASE WHEN SUM(case when sale_payments.payment_method not in('creditnote')
|
||||
then sale_payments.payment_amount else 0 end) < sales.grand_total
|
||||
@@ -777,7 +777,7 @@ class Sale < ApplicationRecord
|
||||
(IFNULL(SUM(case when (sale_status='completed') then grand_total else 0 end),0))-(IFNULL(SUM(case when (sale_status='completed') then grand_total else 0 end),0) / 21) as net_sale,
|
||||
(IFNULL(SUM(case when (sale_status='completed') then grand_total else 0 end),0)) + (IFNULL(SUM(case when (sale_status='completed') then total_discount else 0 end),0)) as gross_sale,
|
||||
CAST((CONVERT_TZ(receipt_date,'+00:00','+06:30')) AS DATE) as sale_date,
|
||||
#{payment_methods.map { |method| "SUM(#{method}) as #{method}"}.join(', ')},
|
||||
#{payment_methods.map { |method| pm = method == 'paypar' ? 'redeem' : method; "SUM(#{pm}) as #{pm}"}.join(', ')},
|
||||
SUM(cash_amount) as cash_amount,
|
||||
SUM(credit_amount) as credit_amount,
|
||||
SUM(foc_amount) as foc_amount
|
||||
@@ -1342,7 +1342,7 @@ def self.get_payment_method_by_shift(shift,from,to,payment_type)
|
||||
|
||||
payments_total = SalePayment.select("
|
||||
sales.receipt_date as sale_date,
|
||||
#{payment_methods.map { |method| "SUM(case when (sale_payments.payment_method='#{method}') then sale_payments.payment_amount else 0 end) as #{method}"}.join(', ')},
|
||||
#{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(', ')},
|
||||
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='cash') then
|
||||
sales.amount_changed else 0 end) as total_change_amount,
|
||||
|
||||
@@ -142,8 +142,9 @@ class SaleAudit < ApplicationRecord
|
||||
if paymal[0]
|
||||
remark = paymal[0].remark.split("}")
|
||||
response = "["+remark[0]+'}]'
|
||||
response = JSON.parse(response)
|
||||
# puts response
|
||||
# response = JSON.parse(response)
|
||||
|
||||
if response[0]["status"] == true
|
||||
if response[0]["current_rebate_amount"].present?
|
||||
amount = response[0]["current_rebate_amount"]
|
||||
|
||||
Reference in New Issue
Block a user