merge with master

This commit is contained in:
Yan
2017-06-14 19:43:05 +06:30
15 changed files with 284 additions and 70 deletions

View File

@@ -2,6 +2,21 @@ class Origami::JcbController < BaseOrigamiController
def index
@sale_id = params[:sale_id]
# limit jcb_amount
sale_data = Sale.find_by_sale_id(@sale_id)
total = sale_data.grand_total
@jcbcount = 0
others = 0
sale_data.sale_payments.each do |sale_payment|
if sale_payment.payment_method == "jcb"
@jcbcount = @jcbcount + sale_payment.payment_amount
else
others = others + sale_payment.payment_amount
end
end
@can_jcb = total - @jcbcount - others
end
def create

View File

@@ -2,6 +2,20 @@ class Origami::MasterController < BaseOrigamiController
def index
@sale_id = params[:sale_id]
# limit master_amount
sale_data = Sale.find_by_sale_id(@sale_id)
total = sale_data.grand_total
@mastercount = 0
others = 0
sale_data.sale_payments.each do |sale_payment|
if sale_payment.payment_method == "master"
@mastercount = @mastercount + sale_payment.payment_amount
else
others = others + sale_payment.payment_amount
end
end
@can_master = total - @mastercount - others
end
def create

View File

@@ -2,6 +2,21 @@ class Origami::MpuController < BaseOrigamiController
def index
@sale_id = params[:sale_id]
# limit mpu_amount
sale_data = Sale.find_by_sale_id(@sale_id)
total = sale_data.grand_total
@mpucount = 0
others = 0
sale_data.sale_payments.each do |sale_payment|
if sale_payment.payment_method == "mpu"
@mpucount = @mpucount + sale_payment.payment_amount
else
others = others + sale_payment.payment_amount
end
end
@can_mpu = total - @mpucount - others
end
def create

View File

@@ -35,6 +35,9 @@ class Origami::PaymentsController < BaseOrigamiController
@cash = 0.0
@other = 0.0
@ppamount = 0.0
@visacount= 0.0
@jcbcount= 0.0
@mastercount = 0.0
@sale_data = Sale.find_by_sale_id(sale_id)
#get customer amount
@@ -64,6 +67,12 @@ class Origami::PaymentsController < BaseOrigamiController
@other += spay.payment_amount
elsif spay.payment_method == "paypar"
@ppamount += spay.payment_amount
elsif spay.payment_method == "visa"
@visacount += spay.payment_amount
elsif spay.payment_method == "jcb"
@jcbcount += spay.payment_amount
elsif spay.payment_method == "master"
@mastercount += spay.payment_amount
end
end
end

View File

@@ -2,6 +2,20 @@ class Origami::VisaController < BaseOrigamiController
def index
@sale_id = params[:sale_id]
# limit visa_amount
sale_data = Sale.find_by_sale_id(@sale_id)
total = sale_data.grand_total
@visacount = 0
others = 0
sale_data.sale_payments.each do |sale_payment|
if sale_payment.payment_method == "visa"
@visacount = @visacount + sale_payment.payment_amount
else
others = others + sale_payment.payment_amount
end
end
@can_visa = total - @visacount - others
end
def create