Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant

This commit is contained in:
Moe Su
2017-06-11 17:40:53 +06:30
7 changed files with 54 additions and 7 deletions

View File

@@ -1,8 +1,17 @@
class Origami::MpuController < BaseOrigamiController
def index
@sale_id = params[:sale_id]
end
def create
cash = params[:amount]
sale_id = params[:sale_id]
if(Sale.exists?(sale_id))
saleObj = Sale.find(sale_id)
sale_payment = SalePayment.new
@status, @sale = sale_payment.process_payment(saleObj, @user, cash, "mpu")
end
end
end

View File

@@ -17,11 +17,16 @@ class Origami::PaymentsController < BaseOrigamiController
def show
sale_id = params[:sale_id]
if Sale.exists?(sale_id)
@cash = 0.0
@other = 0.0
@sale_data = Sale.find_by_sale_id(sale_id)
@sale_data.sale_payments.each do |spay|
if spay.payment_method == "cash"
@cash = spay.payment_amount
end
if spay.payment_method == "mpu"
@other = spay.payment_amount
end
end
end
end