current shop
This commit is contained in:
@@ -1585,7 +1585,6 @@ end
|
||||
|
||||
|
||||
def self.top_bottom_products(current_user,from,to,type,current_shop)
|
||||
puts @current_shop
|
||||
query = Sale.joins("JOIN sale_items ON sale_items.sale_id = sales.sale_id")
|
||||
.completed
|
||||
.where("qty > 0 AND price > 0 AND shop_code='#{current_shop.shop_code}'")
|
||||
@@ -1768,7 +1767,6 @@ end
|
||||
query = Sale.select("SUM(sale_payments.payment_amount) - CASE WHEN sale_payments.payment_method = 'creditnote' THEN IFNULL(SUM(payments_for_credits.payment_amount), 0) ELSE ABS(SUM(CASE WHEN sale_payments.outstanding_amount < 0 THEN sale_payments.outstanding_amount ELSE 0 END)) END AS payment_amount")
|
||||
.joins(:sale_payments)
|
||||
.joins("LEFT JOIN (#{payments_for_credits}) payments_for_credits ON payments_for_credits.sale_id = sales.sale_id")
|
||||
.where("sales.shop_code='#{shop.shop_code}'")
|
||||
.completed
|
||||
|
||||
if payment_method == 'card'
|
||||
|
||||
Reference in New Issue
Block a user