Pull from master

This commit is contained in:
San Wai Lwin
2018-04-19 10:49:25 +06:30
parent 70ec80a1d5
commit 0241d209ac
28 changed files with 529 additions and 220 deletions

View File

@@ -4,32 +4,32 @@ class Origami::DingaController < BaseOrigamiController
payment_method = params[:payment_method]
@cashier_type = params[:type]
@membership_rebate_balance=0
sale_data = Sale.find_by_sale_id(@sale_id)
@receipt_no = sale_data.receipt_no
@sale_data = Sale.find_by_sale_id(@sale_id)
@receipt_no = @sale_data.receipt_no
@shop = Shop.first
# if @shop.is_rounding_adj
# new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
# new_total = Sale.get_rounding_adjustment(@sale_data.grand_total)
# else
# new_total = sale_data.grand_total
# new_total = @sale_data.grand_total
# end
# @rounding_adj = new_total-sale_data.grand_total
@rounding_adj = sale_data.rounding_adjustment
# @rounding_adj = new_total-@sale_data.grand_total
@rounding_adj = @sale_data.rounding_adjustment
@payparcount = 0
others = 0
sale_data.sale_payments.each do |sale_payment|
@sale_data.sale_payments.each do |sale_payment|
if sale_payment.payment_method == "dinga"
@payparcount = @payparcount + sale_payment.payment_amount
else
others = others + sale_payment.payment_amount
end
end
@payment_prices = sale_data.grand_total - @payparcount -others
@payment_prices = @sale_data.grand_total - @payparcount -others
if sale_data
if sale_data.customer_id
customer_data= Customer.find_by_customer_id(sale_data.customer_id)
if @sale_data
if @sale_data.customer_id
customer_data= Customer.find_by_customer_id(@sale_data.customer_id)
if customer_data
@membership_id = customer_data.membership_id
if !@membership_id.nil?
@@ -73,6 +73,7 @@ def create
cash = params[:payment_amount]
sale_id = params[:sale_id]
transaction_ref = params[:transaction_ref]
account_no = params[:account_no]
if(Sale.exists?(sale_id))
saleObj = Sale.find(sale_id)
shop_details = Shop.first
@@ -85,7 +86,7 @@ def create
# saleObj = Sale.find(sale_id)
sale_payment = SalePayment.new
status, @sale = sale_payment.process_payment(saleObj, @user, cash, "dinga",transaction_ref)
status, @sale = sale_payment.process_payment(saleObj, @user, cash, "dinga",account_no)
if status == true
@out = true, "Success!"
else