fix discount with selected

This commit is contained in:
Yan
2017-07-20 17:42:02 +06:30
parent e45bc7964c
commit 30e1854969
3 changed files with 54 additions and 50 deletions

View File

@@ -124,7 +124,8 @@ class Origami::DiscountsController < BaseOrigamiController
# Member Discount
def member_discount
sale_id = params[:sale_id]
account_types = JSON.parse(params[:account_types])
# account_types = JSON.parse(params[:account_types])
account_types = Account.where("discount=?",true)
sub_total = params[:sub_total]
sale = Sale.find(sale_id)
price = SaleItem.calculate_price_by_accounts(sale.sale_items)
@@ -133,7 +134,7 @@ class Origami::DiscountsController < BaseOrigamiController
account_types.each do |at|
price.each do |pc|
if pc[:name].to_s == at["name"].to_s && pc[:price]>0
if pc[:name] == at.title && pc[:price]>0
str={type:pc[:name],amount:pc[:price]}
arr.push(str)
end