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

This commit is contained in:
Yan
2017-11-30 17:35:16 +06:30
27 changed files with 197 additions and 110 deletions

View File

@@ -1,5 +1,5 @@
class Inventory::InventoryController < BaseInventoryController
load_and_authorize_resource
def index
@products = InventoryDefinition.all.active.order('created_at desc')
end

View File

@@ -4,9 +4,18 @@ class Origami::CreditPaymentsController < BaseOrigamiController
# limit visa_amount
sale_data = Sale.find_by_sale_id(@sale_id)
total = sale_data.grand_total
total = sale_data.grand_total
@creditcount = 0
others = 0
@shop = Shop::ShopDetail
if @shop.is_rounding_adj
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
else
new_total = sale_data.grand_total
end
@rounding_adj = new_total-sale_data.grand_total
sale_data.sale_payments.each do |sale_payment|
if sale_payment.payment_method == "creditnote"
@creditcount = @creditcount + sale_payment.payment_amount

View File

@@ -6,7 +6,7 @@ class Origami::HomeController < BaseOrigamiController
@rooms = Room.all.active.order('status desc')
@complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
@orders = Order.all.order('date desc')
@shop = Shop.find_by_id(1)
@shop = Shop::ShopDetail
# @shift = ShiftSale.current_open_shift(current_user.id)
end

View File

@@ -1,6 +1,5 @@
class Origami::InDutiesController < BaseOrigamiController
before_action :set_in_duty, only: %i[show edit update edit_in_duty update_for_in_duty destroy destroy_in_duty]
# GET /in_duties
# GET /in_duties.json
def index

View File

@@ -8,6 +8,15 @@ class Origami::JcbController < BaseOrigamiController
total = sale_data.grand_total
@jcbcount = 0
others = 0
@shop = Shop::ShopDetail
if @shop.is_rounding_adj
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
else
new_total = sale_data.grand_total
end
@rounding_adj = new_total-sale_data.grand_total
sale_data.sale_payments.each do |sale_payment|
if sale_payment.payment_method == "jcb"
@jcbcount = @jcbcount + sale_payment.payment_amount

View File

@@ -8,6 +8,15 @@ class Origami::MasterController < BaseOrigamiController
total = sale_data.grand_total
@mastercount = 0
others = 0
@shop = Shop::ShopDetail
if @shop.is_rounding_adj
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
else
new_total = sale_data.grand_total
end
@rounding_adj = new_total-sale_data.grand_total
sale_data.sale_payments.each do |sale_payment|
if sale_payment.payment_method == "master"
@mastercount = @mastercount + sale_payment.payment_amount

View File

@@ -8,6 +8,14 @@ class Origami::MpuController < BaseOrigamiController
@mpucount = 0
others = 0
@shop = Shop::ShopDetail
if @shop.is_rounding_adj
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
else
new_total = sale_data.grand_total
end
@rounding_adj = new_total-sale_data.grand_total
sale_data.sale_payments.each do |sale_payment|
if sale_payment.payment_method == "mpu"
@mpucount = @mpucount + sale_payment.payment_amount

View File

@@ -24,7 +24,7 @@ class Origami::PaymentsController < BaseOrigamiController
# Print for First Bill to Customer
unique_code = "ReceiptBillPdf"
#shop detail
shop_details = Shop.find(1)
shop_details = Shop::ShopDetail
# customer= Customer.where('customer_id=' +.customer_id)
customer= Customer.find(sale_data.customer_id)
# get member information
@@ -54,6 +54,15 @@ class Origami::PaymentsController < BaseOrigamiController
if(Sale.exists?(sale_id))
saleObj = Sale.find(sale_id)
shop_details = Shop::ShopDetail
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 rounding adjment
end
sale_payment = SalePayment.new
sale_payment.process_payment(saleObj, @user, cash, "cash")
@@ -75,9 +84,7 @@ class Origami::PaymentsController < BaseOrigamiController
# For Print
unique_code = "ReceiptBillPdf"
customer= Customer.find(saleObj.customer_id)
#shop detail
shop_details = Shop.find(1)
# get member information
rebate = MembershipSetting.find_by_rebate(1)
if customer.membership_id != nil && rebate
@@ -114,6 +121,14 @@ class Origami::PaymentsController < BaseOrigamiController
@accountable_type = ''
@table_no = ''
@shop = Shop::ShopDetail
if @shop.is_rounding_adj
new_total = Sale.get_rounding_adjustment(@sale_data.grand_total)
else
new_total = @sale_data.grand_total
end
@rounding_adj = new_total-@sale_data.grand_total
#get customer amount
@customer = Customer.find(@sale_data.customer_id)
accounts = @customer.tax_profiles
@@ -127,7 +142,6 @@ class Origami::PaymentsController < BaseOrigamiController
# get member information
if @customer.membership_id != nil && rebate
response = Customer.get_member_account(@customer)
puts response.to_json
if response["status"]==true
response["account_data"].each do |res|
if res["accountable_type"] == "RebateAccount" || res["accountable_type"] == "RebatebonusAccount"
@@ -191,7 +205,7 @@ class Origami::PaymentsController < BaseOrigamiController
customer= Customer.find(saleObj.customer_id)
#shop detail
shop_details = Shop.find(1)
shop_details = Shop::ShopDetail
# get member information
rebate = MembershipSetting.find_by_rebate(1)
if customer.membership_id != nil && rebate
@@ -240,7 +254,7 @@ class Origami::PaymentsController < BaseOrigamiController
customer= Customer.find(saleObj.customer_id)
#shop detail
shop_details = Shop.find(1)
shop_details = Shop::ShopDetail
# get printer info
print_settings=PrintSetting.find_by_unique_code(unique_code)

View File

@@ -5,76 +5,65 @@ class Origami::RedeemPaymentsController < BaseOrigamiController
@membership_rebate_balance=0
sale_data = Sale.find_by_sale_id(@sale_id)
# limit redeem_amount
# rebate_prices = SaleItem.calculate_food_beverage(sale_data.sale_items)
# nonrebate_prices = sale_data.total_amount - rebate_prices
# @payparcount = 0
# others = 0
# sale_data.sale_payments.each do |sale_payment|
# if sale_payment.payment_method == "paypar"
# @payparcount = @payparcount + sale_payment.payment_amount
# else
# others = others + sale_payment.payment_amount
# end
# end
# non_rebate_exceed = others - (nonrebate_prices + sale_data.total_tax)
# if non_rebate_exceed < 0
# @redeem_prices = rebate_prices - @payparcount
# else
# @redeem_prices = rebate_prices - @payparcount -non_rebate_exceed
# end
@payparcount = 0
others = 0
sale_data.sale_payments.each do |sale_payment|
if sale_payment.payment_method == "paypar"
@payparcount = @payparcount + sale_payment.payment_amount
@shop = Shop::ShopDetail
if @shop.is_rounding_adj
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
else
others = others + sale_payment.payment_amount
new_total = sale_data.grand_total
end
end
@redeem_prices = sale_data.grand_total - @payparcount -others
@rounding_adj = new_total-sale_data.grand_total
@payparcount = 0
others = 0
sale_data.sale_payments.each do |sale_payment|
if sale_payment.payment_method == "paypar"
@payparcount = @payparcount + sale_payment.payment_amount
else
others = others + sale_payment.payment_amount
end
end
@redeem_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 customer_data
@membership_id = customer_data.membership_id
if !@membership_id.nil?
membership_setting = MembershipSetting.find_by_membership_type("paypar_url")
if membership_setting.gateway_url
member_actions =MembershipAction.find_by_membership_type("get_account_balance")
if member_actions.gateway_url
@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)
if membership_data["status"]==true
@membership_rebate_balance=membership_data["balance"]
@out = true, @membership_rebate_balance,@membership_id
end
else
@out =false,0
end
else
@out = false,0
end
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?
membership_setting = MembershipSetting.find_by_membership_type("paypar_url")
if membership_setting.gateway_url
member_actions =MembershipAction.find_by_membership_type("get_account_balance")
if member_actions.gateway_url
@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)
if membership_data["status"]==true
@membership_rebate_balance=membership_data["balance"]
@out = true, @membership_rebate_balance,@membership_id
end
else
@out =false,0
end
else
@out = false,0
end
else
@out = false, 0
end
else
@out = false, 0
end
else
@out = false, 0
end
else
@out = false, 0
end
@out = false, 0
end
else
@out = false, 0
end
else
@out = false, 0
end
else
@out = false, 0
end
else
@out = false, 0
end
@out = false, 0
end
end

View File

@@ -7,6 +7,15 @@ class Origami::VisaController < BaseOrigamiController
total = sale_data.grand_total
@visacount = 0
others = 0
@shop = Shop::ShopDetail
if @shop.is_rounding_adj
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
else
new_total = sale_data.grand_total
end
@rounding_adj = new_total-sale_data.grand_total
sale_data.sale_payments.each do |sale_payment|
if sale_payment.payment_method == "visa"
@visacount = @visacount + sale_payment.payment_amount

View File

@@ -7,6 +7,15 @@ class Origami::VoucherController < BaseOrigamiController
total = sale_data.grand_total
@vouchercount = 0
others = 0
@shop = Shop::ShopDetail
if @shop.is_rounding_adj
new_total = Sale.get_rounding_adjustment(sale_data.grand_total)
else
new_total = sale_data.grand_total
end
@rounding_adj = new_total-sale_data.grand_total
sale_data.sale_payments.each do |sale_payment|
if sale_payment.payment_method == "voucher"
@vouchercount = @vouchercount + sale_payment.payment_amount

View File

@@ -21,7 +21,7 @@ class Reports::PaymentMethodController < BaseReportController
end
@payment_type = params[:payment_type]
@sale_data,@pyament_method = Sale.get_payment_method_by_shift(@shift_sale_range,@shift,from,to,@payment_type)
puts @pyament_method.to_json
puts @sale_data.to_json
puts "sssssssssssss"
@from = from
@to = to

View File

@@ -26,8 +26,6 @@ class Settings::MenuItemInstancesController < ApplicationController
def get_instance
@id = MenuItemInstance.find(params[:id])
puts "iddddddddd"
puts @id.to_json
end
# GET /settings/menu_item_instances/1/edit