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

This commit is contained in:
Aung Myo
2018-04-09 13:20:47 +06:30
33 changed files with 269 additions and 163 deletions

View File

@@ -1,4 +1,5 @@
class Api::SurveyController < Api::ApiController
# before_action :authenticate
def index

View File

@@ -1,5 +1,5 @@
class Origami::DingaController < BaseOrigamiController
def index
def index
@sale_id = params[:sale_id]
payment_method = params[:payment_method]
@cashier_type = params[:type]
@@ -15,16 +15,16 @@ class Origami::DingaController < BaseOrigamiController
# @rounding_adj = new_total-sale_data.grand_total
@rounding_adj = sale_data.rounding_adjustment
@payparcount = 0
@dingacount = 0
others = 0
sale_data.sale_payments.each do |sale_payment|
if sale_payment.payment_method == "paypar"
@payparcount = @payparcount + sale_payment.payment_amount
if sale_payment.payment_method == "dinga"
@dingacount = @dingacount + sale_payment.payment_amount
else
others = others + sale_payment.payment_amount
end
end
@payment_prices = sale_data.grand_total - @payparcount -others
@redeem_prices = sale_data.grand_total - @dingacount -others
if sale_data
@@ -33,15 +33,15 @@ class Origami::DingaController < BaseOrigamiController
if customer_data
@membership_id = customer_data.membership_id
if !@membership_id.nil?
membership_setting = MembershipSetting.find_by_membership_type("paypar_url")
membership_setting = MembershipSetting.find_by_membership_type("dinga_url")
if membership_setting.gateway_url
member_actions =MembershipAction.find_by_membership_type("get_account_balance")
if member_actions.gateway_url
@campaign_type_id = nil
@campaign_type_id = member_actions.additional_parameter["campaign_type_id"]
url = membership_setting.gateway_url.to_s + member_actions.gateway_url.to_s
merchant_uid= member_actions.merchant_account_id
auth_token = member_actions.auth_token.to_s
membership_data = SalePayment.get_paypar_account(url,membership_setting.auth_token,@membership_id,@campaign_type_id,merchant_uid,auth_token)
membership_data = SalePayment.get_dinga_account(url,membership_setting.auth_token,@membership_id,@campaign_type_id,merchant_uid,auth_token)
if membership_data["status"]==true
@membership_rebate_balance=membership_data["balance"]
@out = true, @membership_rebate_balance,@membership_id
@@ -67,36 +67,36 @@ class Origami::DingaController < BaseOrigamiController
@out = false, 0
end
@out = false, 0
end
def create
cash = params[:payment_amount]
sale_id = params[:sale_id]
if(Sale.exists?(sale_id))
saleObj = Sale.find(sale_id)
shop_details = Shop::ShopDetail
# rounding adjustment
# if shop_details.is_rounding_adj
# new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
# rounding_adj = new_total-saleObj.grand_total
# saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj)
# end
end
# saleObj = Sale.find(sale_id)
sale_payment = SalePayment.new
status, @sale = sale_payment.process_payment(saleObj, @user, cash, "dinga")
if status == true
@out = true, "Success!"
else
@out =false, "Please try again payment!"
end
end
end
#Shop Name in Navbor
helper_method :shop_detail
def shop_detail
@shop = Shop.first
def create
sale_id = params[:sale_id]
@cashier_type = params[:type]
redeem_amount = params[:redeem_amount]
membership_id = params[:membership_id]
payment_method = "dinga"
if(Sale.exists?(sale_id))
saleObj = Sale.find(sale_id)
shop_details = Shop::ShopDetail
# rounding adjustment
if shop_details.is_rounding_adj
new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
rounding_adj = new_total-saleObj.grand_total
saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj)
end
sale_payment = SalePayment.new
status,msg =sale_payment.process_payment(saleObj, @user, redeem_amount,payment_method)
if status == true
@out = true, "Success!"
else
@out =false, "Please try again payment!"
end
else
@out = false, "There has no sale record!"
end
end
end

View File

@@ -62,9 +62,19 @@ class Origami::MovetableController < BaseOrigamiController
bookings = Booking.where('dining_facility_id=?',change_from)
booking_array = Array.new
bookings.each do | booking |
if booking.sale_id.nil? && booking.booking_status != 'moved'
booking_array.push(booking)
order_items = Array.new
if !bookings.nil?
bookings.each do | booking |
if booking.sale_id.nil? && booking.booking_status != 'moved'
booking_array.push(booking)
end
booking.booking_orders.each do |booking_order|
order = Order.find(booking_order.order_id)
order.order_items.each do |order_item|
order_items.push(order_item)
end
end
end
end
@@ -82,12 +92,13 @@ class Origami::MovetableController < BaseOrigamiController
#print_settings = PrintSetting.find_by_unique_code(unique_code)
printer_array = []
printer_array = PrintSetting.where(:unique_code => unique_code)
for i in 0..pdf_no
if i != pdf_no
print_settings = printer_array[i]
printer = Printer::ReceiptPrinter.new(print_settings)
printer.print_move_table(print_settings,@to,@from ,@shop,@date,@type,@moved_by)
printer = Printer::ReceiptPrinter.new(print_settings)
printer.print_move_table(print_settings,@to,@from ,@shop,@date,@type,@moved_by,order_items)
end
end
end
end
end

View File

@@ -85,7 +85,7 @@ class PrintSettingsController < ApplicationController
# Never trust parameters from the scary internet, only allow the white list through.
def print_setting_params
params.require(:print_setting).permit(:name, :unique_code, :template, :printer_name, :brand_name, :printer_type, :font, :api_settings, :page_width, :page_height, :print_copies,:precision,:delimiter,:heading_space)
params.require(:print_setting).permit(:name, :unique_code, :template, :printer_name, :font,:header_font_size, :item_font_size, :api_settings, :page_width, :page_height, :print_copies,:precision,:delimiter,:heading_space)
end
#Shop Name in Navbor