This commit is contained in:
Myat Zin Wai Maw
2020-01-14 18:09:45 +06:30
parent 60af9124bb
commit d6e0079314
6 changed files with 188 additions and 131 deletions

View File

@@ -124,6 +124,9 @@ class Api::OrdersController < Api::ApiController
if @status && @booking if @status && @booking
Order.process_order_queue(@order.order_id,@order.table_id,@order.source) Order.process_order_queue(@order.order_id,@order.table_id,@order.source)
if @order.source == 'app'
@status, @sale = Sale.request_bill(@order,current_user,current_login_employee)
end
end end
if @order.table_id.to_i > 0 if @order.table_id.to_i > 0
table = DiningFacility.find(@booking.dining_facility_id) table = DiningFacility.find(@booking.dining_facility_id)

View File

@@ -2,11 +2,11 @@ class Api::ShopsController < Api::ApiController
skip_before_action :authenticate skip_before_action :authenticate
def index def index
@shops = Shop.select('id,logo,name,shop_code,address,phone_no').all @shops = Shop.select('id,logo,name,shop_code,address,phone_no').all
end end
def show def show
@shop = Shop.find_by_shop_code(params[:id]) @shop = Shop.find_by_shop_code(params[:id])
end end
end end

View File

@@ -20,7 +20,7 @@ class CustomerImageUploader < CarrierWave::Uploader::Base
end end
def filename def filename
if Shop.current_shop.shop_code.nil? if Shop.current_shop.nil?
"#{original_filename}" if original_filename.present? "#{original_filename}" if original_filename.present?
else else
"#{Shop.current_shop.shop_code}_#{original_filename}" if original_filename.present? "#{Shop.current_shop.shop_code}_#{original_filename}" if original_filename.present?

View File

@@ -1,3 +1,3 @@
if (@menu_item) if (@menu_item)
json.partial! 'api/restaurant/menu/menu_item', item: @menu_item, request_url: @request_url json.partial! 'api/restaurant/menu_items/menu_item', item: @menu_item, request_url: @request_url
end end

View File

@@ -20,11 +20,11 @@ class ActionController::Base
end end
else else
# check for license file # check for license file
if check_license # if check_license
current_license(ENV["SX_PROVISION_URL"]) # current_license(ENV["SX_PROVISION_URL"])
else # else
redirect_to activate_path # redirect_to activate_path
end # end
end end
end end

View File

@@ -1,167 +1,221 @@
task :add_manual_data, [:shop_code] do |task, args| namespace :manual_data do
puts args[:shop_code] desc "Add Manual Data"
# shop_code= args[:var] task :add, [:shop_code] => :environment do |t, args|
puts "#{args[:shop_code]}" gateway_communication_type =Lookup.create([{lookup_type:'gateway_communication_type',name: 'API',value: 'api',shop_code: args.shop_code},
gateway_communication_type = Lookup.create([{lookup_type:'gateway_communication_type',name: 'API',value: 'api',shop_code: "#{args[:shop_code]}"}, {lookup_type:'gateway_communication_type',name: 'USB',value: 'usb',shop_code: args.shop_code}])
{lookup_type:'gateway_communication_type',name: 'USB',value: 'usb',shop_code: "#{args[:shop_code]}"}]) puts " Finished gateway_communication_type Set Up Data"
payment_methods = Lookup.create([{lookup_type:'payment_methods',name: 'Cash',value: 'cash',shop_code: "#{args[:shop_code]}"},
{lookup_type:'payment_methods',name: 'CreditNote',value: 'creditnote',shop_code: "#{args[:shop_code]}"},
{lookup_type:'payment_methods',name: 'Card - VISA',value: 'visa',shop_code: "#{args[:shop_code]}"},
{lookup_type:'payment_methods',name: 'Card - MASTER',value: 'master',shop_code: "#{args[:shop_code]}"},
{lookup_type:'payment_methods',name: 'Card - JCB',value: 'jcb',shop_code: "#{args[:shop_code]}"},
{lookup_type:'payment_methods',name: 'Card - UnionPay',value: 'unionpay',shop_code: "#{args[:shop_code]}"},
{lookup_type:'payment_methods',name: 'Card - MPU',value: 'jcb',shop_code: "#{args[:shop_code]}"},
{lookup_type:'payment_methods',name: 'Vochure',value: 'vochure',shop_code: "#{args[:shop_code]}"},
{lookup_type:'payment_methods',name: 'Giftcard',value: 'gift',shop_code: "#{args[:shop_code]}"}])
payment_status = Lookup.create([{lookup_type:'payment_status',name: 'New',value: 'new',shop_code: "#{args[:shop_code]}"}, payment_methods = Lookup.create([{lookup_type:'payment_methods',name: 'Cash',value: 'cash',shop_code: args.shop_code},
{lookup_type:'payment_status',name: 'paid',value: 'paid',shop_code: "#{args[:shop_code]}"}, {lookup_type:'payment_methods',name: 'CreditNote',value: 'creditnote',shop_code: args.shop_code},
{lookup_type:'payment_status',name: 'Fail',value: 'fail',shop_code: "#{args[:shop_code]}"}, {lookup_type:'payment_methods',name: 'Card - VISA',value: 'visa',shop_code: args.shop_code},
{lookup_type:'payment_status',name: 'Outstanding',value: 'outstanding',shop_code: "#{args[:shop_code]}"}]) {lookup_type:'payment_methods',name: 'Card - MASTER',value: 'master',shop_code: args.shop_code},
{lookup_type:'payment_methods',name: 'Card - JCB',value: 'jcb',shop_code: args.shop_code},
{lookup_type:'payment_methods',name: 'Card - UnionPay',value: 'unionpay',shop_code: args.shop_code},
{lookup_type:'payment_methods',name: 'Card - MPU',value: 'jcb',shop_code: args.shop_code},
{lookup_type:'payment_methods',name: 'Vochure',value: 'vochure',shop_code: args.shop_code},
{lookup_type:'payment_methods',name: 'Giftcard',value: 'gift',shop_code: args.shop_code}])
puts " Finished payment_methods Set Up Data"
sales_status = Lookup.create([{lookup_type:'sales_status',name: 'New',value: 'new',shop_code: "#{args[:shop_code]}"}, payment_status = Lookup.create([{lookup_type:'payment_status',name: 'New',value: 'new',shop_code: args.shop_code},
{lookup_type:'sales_status',name: 'Void',value: 'void',shop_code: "#{args[:shop_code]}"}, {lookup_type:'payment_status',name: 'paid',value: 'paid',shop_code: args.shop_code},
{lookup_type:'sales_status',name: 'Completed',value: 'completed',shop_code: "#{args[:shop_code]}"}]) {lookup_type:'payment_status',name: 'Fail',value: 'fail',shop_code: args.shop_code},
{lookup_type:'payment_status',name: 'Outstanding',value: 'outstanding',shop_code: args.shop_code}])
puts " Finished payment_status Set Up Data"
order_status = Lookup.create([{lookup_type:'order_status',name: 'New',value: 'new',shop_code: "#{args[:shop_code]}"}, sales_status = Lookup.create([{lookup_type:'sales_status',name: 'New',value: 'new',shop_code: args.shop_code},
{lookup_type:'order_status',name: 'Completed',value: 'completed',shop_code: "#{args[:shop_code]}"}]) {lookup_type:'sales_status',name: 'Void',value: 'void',shop_code: args.shop_code},
{lookup_type:'sales_status',name: 'Completed',value: 'completed',shop_code: args.shop_code}])
puts " Finished sales_status Set Up Data"
order_item_status = Lookup.create([{lookup_type:'order_item_status',name: 'New',value: 'new',shop_code: "#{args[:shop_code]}"}, order_status = Lookup.create([{lookup_type:'order_status',name: 'New',value: 'new',shop_code: args.shop_code},
{lookup_type:'order_item_status',name: 'Processing',value: 'processing',shop_code: "#{args[:shop_code]}"}, {lookup_type:'order_status',name: 'Completed',value: 'completed',shop_code: args.shop_code}])
{lookup_type:'order_item_status',name: 'Served',value: 'served',shop_code: "#{args[:shop_code]}"}, puts " Finished order_status Set Up Data"
{lookup_type:'order_item_status',name: 'BIlled',value: 'billed',shop_code: "#{args[:shop_code]}"}])
order_item_status = Lookup.create([{lookup_type:'order_item_status',name: 'New',value: 'new',shop_code: args.shop_code},
{lookup_type:'order_item_status',name: 'Processing',value: 'processing',shop_code: args.shop_code},
{lookup_type:'order_item_status',name: 'Served',value: 'served',shop_code: args.shop_code},
{lookup_type:'order_item_status',name: 'BIlled',value: 'billed',shop_code: args.shop_code}])
puts " Finished order_item_status Set Up Data"
#order_source [tablet,order_station,emenu,api] #order_source [tablet,order_station,emenu,api]
order_source = Lookup.create([{lookup_type:'order_source',name: 'API',value: 'api',shop_code: "#{args[:shop_code]}"}, order_source = Lookup.create([{lookup_type:'order_source',name: 'API',value: 'api',shop_code: args.shop_code},
{lookup_type:'order_source',name: 'Tablet',value: 'tablet',shop_code: "#{args[:shop_code]}"}, {lookup_type:'order_source',name: 'Tablet',value: 'tablet',shop_code: args.shop_code},
{lookup_type:'order_source',name: 'EMenu',value: 'emenu',shop_code: "#{args[:shop_code]}"}, {lookup_type:'order_source',name: 'EMenu',value: 'emenu',shop_code: args.shop_code},
{lookup_type:'order_source',name: 'Order Station',value: 'order_station',shop_code: "#{args[:shop_code]}"}]) {lookup_type:'order_source',name: 'Order Station',value: 'order_station',shop_code: args.shop_code}])
puts " Finished order_source Set Up Data"
#order_type [dine-in,takeaway,delivery] #order_type [dine-in,takeaway,delivery]
order_type = Lookup.create([{lookup_type:'order_type',name: 'Dine-in',value: 'dine-in',shop_code: "#{args[:shop_code]}"}, order_type = Lookup.create([{lookup_type:'order_type',name: 'Dine-in',value: 'dine-in',shop_code: args.shop_code},
{lookup_type:'order_type',name: 'Takeaway',value: 'takeaway',shop_code: "#{args[:shop_code]}"}, {lookup_type:'order_type',name: 'Takeaway',value: 'takeaway',shop_code: args.shop_code},
{lookup_type:'order_type',name: 'Delivery',value: 'delivery',shop_code: "#{args[:shop_code]}"}]) {lookup_type:'order_type',name: 'Delivery',value: 'delivery',shop_code: args.shop_code}])
puts " Finished order_type Set Up Data"
#menu_item_type:[simple| set| DIY] #menu_item_type:[simple| set| DIY]
menu_item_type = Lookup.create([{lookup_type:'menu_item_type',name: 'SIMPLE',value: 'simpleItem',shop_code: "#{args[:shop_code]}"}, menu_item_type = Lookup.create([{lookup_type:'menu_item_type',name: 'SIMPLE',value: 'simpleItem',shop_code: args.shop_code},
{lookup_type:'menu_item_type',name: 'Set Menu',value: 'setMenu',shop_code: "#{args[:shop_code]}"}, {lookup_type:'menu_item_type',name: 'Set Menu',value: 'setMenu',shop_code: args.shop_code},
{lookup_type:'menu_item_type',name: 'DIY',value: 'diy',shop_code: "#{args[:shop_code]}"}]) {lookup_type:'menu_item_type',name: 'DIY',value: 'diy',shop_code: args.shop_code}])
puts " Finished menu_item_type Set Up Data"
member_group_type = Lookup.create([{lookup_type:'member_group_type',name: 'Normal',value: '1',shop_code: "#{args[:shop_code]}"}, member_group_type = Lookup.create([{lookup_type:'member_group_type',name: 'Normal',value: '1',shop_code: args.shop_code},
{lookup_type:'member_group_type',name: 'Platinum',value: '5',shop_code: "#{args[:shop_code]}"}, {lookup_type:'member_group_type',name: 'Platinum',value: '5',shop_code: args.shop_code},
{lookup_type:'member_group_type',name: 'Silver',value: '4',shop_code: "#{args[:shop_code]}"}, {lookup_type:'member_group_type',name: 'Silver',value: '4',shop_code: args.shop_code},
{lookup_type:'member_group_type',name: 'Gold',value: '3',shop_code: "#{args[:shop_code]}"}]) {lookup_type:'member_group_type',name: 'Gold',value: '3',shop_code: args.shop_code}])
puts " Finished member_group_type Set Up Data"
#menu_item_attribute:[size|] #menu_item_attribute:[size|]
menu_item_attribute_type = Lookup.create([{lookup_type:'menu_item_attribute_type',name: 'Size',value: 'size',shop_code: "#{args[:shop_code]}"}]) menu_item_attribute_type = Lookup.create([{lookup_type:'menu_item_attribute_type',name: 'Size',value: 'size',shop_code: args.shop_code}])
puts " Finished menu_item_attribute_type Set Up Data"
#Employee Roles #Employee Roles
employee_roles = Lookup.create([{lookup_type:'employee_roles',name: 'Cashier',value: 'cashier',shop_code: "#{args[:shop_code]}"}, employee_roles = Lookup.create([{lookup_type:'employee_roles',name: 'Cashier',value: 'cashier',shop_code: args.shop_code},
{lookup_type:'employee_roles',name: 'Waiter',value: 'waiter',shop_code: "#{args[:shop_code]}"}, {lookup_type:'employee_roles',name: 'Waiter',value: 'waiter',shop_code: args.shop_code},
{lookup_type:'employee_roles',name: 'Supervisor',value: 'supervisor',shop_code: "#{args[:shop_code]}"}, {lookup_type:'employee_roles',name: 'Supervisor',value: 'supervisor',shop_code: args.shop_code},
{lookup_type:'employee_roles',name: 'Manager',value: 'manager',shop_code: "#{args[:shop_code]}"}, {lookup_type:'employee_roles',name: 'Manager',value: 'manager',shop_code: args.shop_code},
{lookup_type:'employee_roles',name: 'Accountant',value: 'account',shop_code: "#{args[:shop_code]}"}, {lookup_type:'employee_roles',name: 'Accountant',value: 'account',shop_code: args.shop_code},
{lookup_type:'employee_roles',name: 'Administrator',value: 'administrator',shop_code: "#{args[:shop_code]}"}, {lookup_type:'employee_roles',name: 'Administrator',value: 'administrator',shop_code: args.shop_code},
{lookup_type:'employee_roles',name: 'FoodCourt Cashier',value: 'foodcourt_cashier',shop_code: "#{args[:shop_code]}"}]) {lookup_type:'employee_roles',name: 'FoodCourt Cashier',value: 'foodcourt_cashier',shop_code: args.shop_code}])
puts " Finished employee_roles Set Up Data"
#booking_status #booking_status
booking_status = Lookup.create([{lookup_type:'booking_status',name: 'Available',value: 'available',shop_code: "#{args[:shop_code]}"}, booking_status = Lookup.create([{lookup_type:'booking_status',name: 'Available',value: 'available',shop_code: args.shop_code},
{lookup_type:'booking_status',name: 'Reserved',value: 'reserved',shop_code: "#{args[:shop_code]}"}, {lookup_type:'booking_status',name: 'Reserved',value: 'reserved',shop_code: args.shop_code},
{lookup_type:'booking_status',name: 'Occupied',value: 'occupied',shop_code: "#{args[:shop_code]}"}, {lookup_type:'booking_status',name: 'Occupied',value: 'occupied',shop_code: args.shop_code},
{lookup_type:'booking_status',name: 'Cleaning',value: 'cleaning',shop_code: "#{args[:shop_code]}"}, {lookup_type:'booking_status',name: 'Cleaning',value: 'cleaning',shop_code: args.shop_code},
{lookup_type:'booking_status',name: 'Moved',value: 'moved',shop_code: "#{args[:shop_code]}"}]) {lookup_type:'booking_status',name: 'Moved',value: 'moved',shop_code: args.shop_code}])
puts " Finished booking_status Set Up Data"
#booking_status #account_type
account_type = Lookup.create([{lookup_type:'account_type',name: 'Income',value: '0',shop_code: "#{args[:shop_code]}"}, account_type = Lookup.create([{lookup_type:'account_type',name: 'Income',value: '0',shop_code: args.shop_code},
{lookup_type:'account_type',name: 'Expense',value: '1',shop_code: "#{args[:shop_code]}"}]) {lookup_type:'account_type',name: 'Expense',value: '1',shop_code: args.shop_code}])
puts " Finished account_type Set Up Data"
# sale void reason # sale void reason
void_reason = Lookup.create([{lookup_type:'void_reason',name: 'Approve By Manager',value: 'Approve By Manager',shop_code: "#{args[:shop_code]}"}, void_reason = Lookup.create([{lookup_type:'void_reason',name: 'Approve By Manager',value: 'Approve By Manager',shop_code: args.shop_code},
{lookup_type:'void_reason',name: 'Customer Mistake',value: 'Customer Mistake',shop_code: "#{args[:shop_code]}"}, {lookup_type:'void_reason',name: 'Customer Mistake',value: 'Customer Mistake',shop_code: args.shop_code},
{lookup_type:'void_reason',name: 'Cashier Mistake',value: 'Cashier Mistake',shop_code: "#{args[:shop_code]}"}, {lookup_type:'void_reason',name: 'Cashier Mistake',value: 'Cashier Mistake',shop_code: args.shop_code},
{lookup_type:'void_reason',name: 'Waiter Mistake',value: 'Waiter Mistake',shop_code: "#{args[:shop_code]}"}]) {lookup_type:'void_reason',name: 'Waiter Mistake',value: 'Waiter Mistake',shop_code: args.shop_code}])
puts " Finished void_reason Set Up Data"
# sale void reason # float_value
float_value = Lookup.create([{lookup_type:'float_value',name: '500',value: '500',shop_code: "#{args[:shop_code]}"}, float_value = Lookup.create([{lookup_type:'float_value',name: '500',value: '500',shop_code: args.shop_code},
{lookup_type:'float_value',name: '1000',value: '1000',shop_code: "#{args[:shop_code]}"}, {lookup_type:'float_value',name: '1000',value: '1000',shop_code: args.shop_code},
{lookup_type:'float_value',name: '5000',value: '5000',shop_code: "#{args[:shop_code]}"}, {lookup_type:'float_value',name: '5000',value: '5000',shop_code: args.shop_code},
{lookup_type:'float_value',name: '10000',value: '10000',shop_code: "#{args[:shop_code]}"}]) {lookup_type:'float_value',name: '10000',value: '10000',shop_code: args.shop_code}])
puts " Finished float_value Set Up Data"
# customer type # customer type
customer_type = Lookup.create([{lookup_type:'customer_type',name: 'Dinein',value: 'Dinein',shop_code: "#{args[:shop_code]}"}, customer_type = Lookup.create([{lookup_type:'customer_type',name: 'Dinein',value: 'Dinein',shop_code: args.shop_code},
{lookup_type:'customer_type',name: 'FoodCourt',value: 'FoodCourt',shop_code: "#{args[:shop_code]}"}, {lookup_type:'customer_type',name: 'FoodCourt',value: 'FoodCourt',shop_code: args.shop_code},
{lookup_type:'customer_type',name: 'Takeaway',value: 'Takeaway',shop_code: "#{args[:shop_code]}"}, {lookup_type:'customer_type',name: 'Takeaway',value: 'Takeaway',shop_code: args.shop_code},
{lookup_type:'customer_type',name: 'Delivery',value: 'Delivery',shop_code: "#{args[:shop_code]}"}]) {lookup_type:'customer_type',name: 'Delivery',value: 'Delivery',shop_code: args.shop_code}])
puts " Finished customer_type Set Up Data"
#unit #unit
units = Lookup.create([{lookup_type:'unit',name: 'PCS',value: 'pcs',shop_code: "#{args[:shop_code]}"}, units = Lookup.create([{lookup_type:'unit',name: 'PCS',value: 'pcs',shop_code: args.shop_code},
{lookup_type:'unit',name: 'KG',value: 'kg',shop_code: "#{args[:shop_code]}"}]) {lookup_type:'unit',name: 'KG',value: 'kg',shop_code: args.shop_code}])
puts " Finished units Set Up Data"
# Country # Country
countries = Lookup.create({lookup_type:'country',name: 'Japan',value: 'Japan',shop_code: "#{args[:shop_code]}"}) countries = Lookup.create({lookup_type:'country',name: 'Japan',value: 'Japan',shop_code: args.shop_code})
puts " Finished countries Set Up Data"
# number formats # number formats
number_formats = Lookup.create([{lookup_type: 'number_format',name: 'precision',value: '2',shop_code: "#{args[:shop_code]}"}, number_formats = Lookup.create([{lookup_type: 'number_format',name: 'precision',value: '2',shop_code: args.shop_code},
{lookup_type: 'number_format',name: 'delimiter',value:',',shop_code: "#{args[:shop_code]}"}, {lookup_type: 'number_format',name: 'delimiter',value:',',shop_code: args.shop_code},
{lookup_type: 'number_format',name: 'strip_insignificant_zeros',value:'0',shop_code: "#{args[:shop_code]}"}]) {lookup_type: 'number_format',name: 'strip_insignificant_zeros',value:'0',shop_code: args.shop_code}])
puts " Finished number_formats Set Up Data"
# checkin_time_limit
checkin_time_limit = Lookup.create([{lookup_type: 'checkin_time_limit',name: 'CheckinTimeLimit',value: '48',shop_code: args.shop_code}])
puts " Finished checkin_time_limit Set Up Data"
# display_type
display_type = Lookup.create({lookup_type:'display_type',name: 'Display Type',value: '2',shop_code: args.shop_code})
puts " Finished display_type Set Up Data"
# show_total_before_tax
show_total_before_tax = Lookup.create({lookup_type:'show_total_before_tax',name: 'Show Total Before Tax',value: '0',shop_code: args.shop_code})
puts " Finished show_total_before_tax Set Up Data"
# tax_profiles # tax_profiles
tax_profiles = Lookup.create([{lookup_type:'tax_profiles',name: 'Cashier',value: 'cashier',shop_code: "#{args[:shop_code]}"}, tax_profiles = Lookup.create([{lookup_type:'tax_profiles',name: 'Cashier',value: 'cashier',shop_code: args.shop_code},
{lookup_type:'tax_profiles',name: 'FoodCourt',value: 'food_court',shop_code: "#{args[:shop_code]}"}, {lookup_type:'tax_profiles',name: 'FoodCourt',value: 'food_court',shop_code: args.shop_code},
{lookup_type:'tax_profiles',name: 'Online Order',value: 'online_order',shop_code: "#{args[:shop_code]}"}]) {lookup_type:'tax_profiles',name: 'Online Order',value: 'online_order',shop_code: args.shop_code}])
puts " Finished tax_profiles Set Up Data"
# changable_tax
changable_tax = Lookup.create([{lookup_type:'changable_tax',name: 'change',value: '1',shop_code: args.shop_code}])
puts " Finished changable_tax Set Up Data"
# expity_time
expity_time = Lookup.create([{lookup_type:'expity_time',name: 'login',value: '{30}',shop_code: args.shop_code}])
puts " Finished expity_time Set Up Data"
#foodcourt use #foodcourt use
foodcourt = Lookup.create([{lookup_type:'food_court',name: 'FoodCourt',value: '1',shop_code: "#{args[:shop_code]}"}]) foodcourt = Lookup.create([{lookup_type:'food_court',name: 'FoodCourt',value: '1',shop_code: args.shop_code}])
# Default CUSTOMER puts " Finished foodcourt Set Up Data"
customer = Customer.create({name:"WALK-IN",email: "cus1@customer.com",contact_no:"000000000",card_no:"000",customer_type:"Dinein",tax_profiles:["2","1"],shop_code: "#{args[:shop_code]}"})
customer2 = Customer.create({name:"TAKEAWAY",email: "cus2@customer.com",contact_no:"111111111",card_no:"111",customer_type:"Takeaway",tax_profiles:["1"],shop_code: "#{args[:shop_code]}"})
# Tax Profile FoodCourt # Tax Profile FoodCourt
commercial_taxes_online_order = TaxProfile.create({name: "Commercial Tax",group_type: "food_court",rate:5.0,order_by:2,created_by:"SYSTEM DEFAULT",shop_code: "#{args[:shop_code]}"}) commercial_taxes_food_court = TaxProfile.create({name: "Commercial Tax",group_type: "food_court",rate:5.0,order_by:2,created_by:"SYSTEM DEFAULT",shop_code: args.shop_code})
service_charges_online_order = TaxProfile.create({name: "Service Charges",group_type: "food_court",rate:0,order_by:1,created_by:"SYSTEM DEFAULT",shop_code: "#{args[:shop_code]}"}) service_charges_food_court = TaxProfile.create({name: "Service Charges",group_type: "food_court",rate:0,order_by:1,created_by:"SYSTEM DEFAULT",shop_code: args.shop_code})
puts " Finished Tax Profile FoodCourt Set Up Data"
#Tax Profile Online Order #Tax Profile Online Order
commercial_taxes_online_order = TaxProfile.create({name: "Commercial Tax",group_type: "online_order",rate:5.0,order_by:2,created_by:"SYSTEM DEFAULT",shop_code: "#{args[:shop_code]}"}) commercial_taxes_online_order = TaxProfile.create({name: "Commercial Tax",group_type: "online_order",rate:5.0,order_by:2,created_by:"SYSTEM DEFAULT",shop_code: args.shop_code})
service_charges_online_order = TaxProfile.create({name: "Service Charges",group_type: "online_order",rate:0,order_by:1,created_by:"SYSTEM DEFAULT",shop_code: "#{args[:shop_code]}"}) service_charges_online_order = TaxProfile.create({name: "Service Charges",group_type: "online_order",rate:0,order_by:1,created_by:"SYSTEM DEFAULT",shop_code: args.shop_code})
convenience_charges_online_order= TaxProfile.create({name: "Convenience Charges",group_type: "online_order",rate:5.0,order_by:1,created_by:"SYSTEM DEFAULT",shop_code: "#{args[:shop_code]}"}) convenience_charges_online_order= TaxProfile.create({name: "Convenience Charges",group_type: "online_order",rate:5.0,order_by:1,created_by:"SYSTEM DEFAULT",shop_code: args.shop_code})
puts " Finished Tax Profile Online Order Set Up Data"
tax_ids =[]
tax_ids << "#{commercial_taxes_food_court.id}"
tax_ids << "#{service_charges_food_court.id}"
takeaway_tax =["#{service_charges_food_court.id}"]
# # Default CUSTOMER
ActiveRecord::Base.connection.execute("INSERT INTO customers(customer_id,name,email,contact_no,customer_type,tax_profiles,shop_code) VALUES ('CUS-L#{args.shop_code}00000001','WALK-IN','cus1@customer.com','000000000','Dinein','#{tax_ids}','#{args.shop_code}'),('CUS-L#{args.shop_code}00000002','TAKEAWAY','cus2@customer.com','111111111','Takeaway','#{takeaway_tax}','#{args.shop_code}');")
puts " Finished Default CUSTOMER Set Up Data"
#seed_generators
ActiveRecord::Base.connection.execute("INSERT INTO seed_generators(model,current,next,shop_code,created_at,updated_at) VALUES ('Customer',3,4,'#{args.shop_code}',CURRENT_TIMESTAMP(),CURRENT_TIMESTAMP());")
puts " Finished seed_generators Set Up Data"
#Create Adminstrator employee #Create Adminstrator employee
admin_employee = Employee.create({name: "Administrator",role: "administrator",password: "99999",emp_id:"999",created_by: "SYSTEM DEFAULT",shop_code: "#{args[:shop_code]}"}) ActiveRecord::Base.connection.execute("INSERT INTO employees(name,role,password_digest,emp_id,created_by,shop_code,created_at,updated_at) VALUES ('Administrator','administrator','$2a$10$OKFA4b4yh0xCJNmzjMMijusnO712LUSEL4/y56p2XmdKBRPWgXwDa','999','SYSTEM DEFAULT','#{args.shop_code}',CURRENT_TIMESTAMP(),CURRENT_TIMESTAMP()),('Cashier','cashier','$2a$12$NZ6JNxcp8PbSafAl1p740uUqGsULETtHq4Kr0JQYnfAiSNR3Jrfuu','222','SYSTEM DEFAULT','#{args.shop_code}',CURRENT_TIMESTAMP(),CURRENT_TIMESTAMP());")
foodcourt_employee = Employee.create({name: "Cashier",role: "cashier",password: "22222",emp_id:"221",created_by: "SYSTEM DEFAULT",shop_code: "#{args[:shop_code]}"}) puts " Finished Create Adminstrator employee Set Up Data"
#PrintSetting
order_item_printer = PrintSetting.create({name: "OrderItemPdf",unique_code: "OrderItemPdf",printer_name: "Cashier",api_settings: 'socket://192.168.1.118',print_copies: 1,header_font_size: 12,item_font_size: 8,precision: "0",delimiter: 0,heading_space: 5,page_width: 210,page_height: 1450,shop_code: args.shop_code})
order_summary_printer = PrintSetting.create({name: "Order Summary",unique_code: "OrderSummaryPdf",printer_name: "Cashier",api_settings: 'socket://192.168.1.118',print_copies: 1,header_font_size: 12,item_font_size: 8,precision: "0",delimiter: 0,heading_space: 5,page_width: 210,page_height: 1450,shop_code: args.shop_code})
request_bill_printer = PrintSetting.create({name: "Receipt Bill",unique_code: "ReceiptBillPdf",printer_name: "Cashier",api_settings: 'socket://192.168.1.118',print_copies: 1,header_font_size: 12,item_font_size: 8,precision: "0",delimiter: 0,heading_space: 5,page_width: 210,page_height: 1450,shop_code: args.shop_code})
close_cashier_printer = PrintSetting.create({name: "Close Cashier",unique_code: "CloseCashierPdf",printer_name: "Cashier",api_settings: 'socket://192.168.1.118',print_copies: 1,header_font_size: 12,item_font_size: 8,precision: "0",delimiter: 0,heading_space: 5,page_width: 210,page_height: 1450,shop_code: args.shop_code})
crm_order_printer = PrintSetting.create({name: "CRM Order",unique_code: "CrmOrderPdf",printer_name: "Cashier",api_settings: 'socket://192.168.1.118',print_copies: 1,header_font_size: 12,item_font_size: 8,precision: "0",delimiter: 0,heading_space: 5,page_width: 210,page_height: 1450,shop_code: args.shop_code})
queue_no_printer = PrintSetting.create({name: "Queue No",unique_code: "QueueNoPdf",printer_name: "Cashier",api_settings: 'socket://192.168.1.118',print_copies: 1,header_font_size: 12,item_font_size: 8,precision: "0",delimiter: 0,heading_space: 5,page_width: 210,page_height: 1450,shop_code: args.shop_code})
puts " Finished PrintSetting Set Up Data"
order_item_printer=PrintSetting.create({name: "OrderItemPdf",unique_code: "OrderItemPdf",printer_name: "Cashier",precision: "0",delimiter: 0,heading_space: 5,page_width: 210,page_height: 1450,shop_code: "#{args[:shop_code]}"}) member_setting = MembershipSetting.create({membership_type:"paypar_url",gateway_url: "https://staging.membership.paymal.ws",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",shop_code: args.shop_code})
order_summary_printer=PrintSetting.create({name: "Order Summary",unique_code: "OrderSummaryPdf",printer_name: "Cashier",precision: "0",delimiter: 0,heading_space: 5,page_width: 210,page_height: 1450,shop_code: "#{args[:shop_code]}"}) puts " Finished member_setting Set Up Data"
request_bill_printer=PrintSetting.create({name: "Receipt Bill",unique_code: "ReceiptBillPdf",printer_name: "Cashier",precision: "0",delimiter: 0,heading_space: 5,page_width: 210,page_height: 1450,shop_code: "#{args[:shop_code]}"})
close_cashier_printer=PrintSetting.create({name: "Close Cashier",unique_code: "CloseCashierPdf",printer_name: "Cashier",precision: "0",delimiter: 0,heading_space: 5,page_width: 210,page_height: 1450,shop_code: "#{args[:shop_code]}"})
crm_order_printer=PrintSetting.create({name: "CRM Order",unique_code: "CrmOrderPdf",printer_name: "Cashier",precision: "0",delimiter: 0,heading_space: 5,page_width: 210,page_height: 1450,shop_code: "#{args[:shop_code]}"})
queue_no_printer=PrintSetting.create({name: "Queue No",unique_code: "QueueNoPdf",printer_name: "Cashier",precision: "0",delimiter: 0,heading_space: 5,page_width: 210,page_height: 1450,shop_code: "#{args[:shop_code]}"})
zone = Zone.create({id:1,name: "H1",is_active:true,created_by: "SYSTEM DEFAULT",shop_code: "#{args[:shop_code]}"}) member_actions= MembershipAction.create([{membership_type:"get_account_balance",is_active:1,gateway_url:"/api/membership_campaigns/get_correspond_account_data",additional_parameter:{campaign_type_id:1},merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"pZBHXEFbGNj/G",shop_code: args.shop_code},
{membership_type:"redeem",is_active:1,gateway_url:"/api/membership_campaigns/redeem",additional_parameter:{campaign_type_id:1},merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"pZBHXEFbGNj/G",shop_code: args.shop_code},
{membership_type:"create_membership_customer",is_active:1,gateway_url:"/api/generic_customer/create_membership_customer",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"pZBHXEFbGNj/G",shop_code: args.shop_code},
{membership_type:"update_membership_customer",is_active:1,gateway_url:"/api/generic_customer/update_membership_customer",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"pZBHXEFbGNj/G",shop_code: args.shop_code},
{membership_type:"get_all_member_group",is_active:1,gateway_url:"/api/member_group/get_all_member_group",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"pZBHXEFbGNj/G",shop_code: args.shop_code},
{membership_type:"rebate",is_active:1,gateway_url:"/api/membership_campaigns/rebate",additional_parameter:{campaign_type_id:1},merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"pZBHXEFbGNj/G",shop_code: args.shop_code},
{membership_type:"get_all_member_account",is_active:1,gateway_url:"/api/generic_customer/get_member_data",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"pZBHXEFbGNj/G",shop_code: args.shop_code},
{membership_type:"get_member_transactions",is_active:1,gateway_url:"/api/generic_customer/get_membership_transactions",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"pZBHXEFbGNj/G",shop_code: args.shop_code},
{membership_type:"member_discount",is_active:1,gateway_url:"/api/membership_campaigns/discount",additional_parameter:{campaign_type_id:5},merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"pZBHXEFbGNj/G",shop_code: args.shop_code},
{membership_type:"get_member_campaign",is_active:1,gateway_url:"/api/membership_campaigns/get_member_campaign",additional_parameter:{campaign_type_id:5},merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"pZBHXEFbGNj/G",shop_code: args.shop_code},
{membership_type:"search_paypar_account_no",is_active:1,gateway_url:"/api/generic_customer/get_membership_customer_data",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"pZBHXEFbGNj/G",shop_code: args.shop_code},
{membership_type:"search_paypar_security_code",is_active:1,gateway_url:"/api/generic_customer/get_membership_customer_security_code",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"pZBHXEFbGNj/G",shop_code: args.shop_code}])
puts " Finished member_actions Set Up Data"
member_setting = MembershipSetting.create({membership_type:"paypar_url",gateway_url: "https://staging.membership.paymal.ws",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",shop_code: "#{args[:shop_code]}"}) payment_methods = PaymentMethodSetting.create({payment_method:"PAYMAL",gateway_url: "/api/create_payment",merchant_account_id:"pZBHXEFbGNj/G",shop_code: args.shop_code})
puts " Finished payment_methods Set Up Data"
member_actions= MembershipAction.create([{membership_type:"get_account_balance",is_active:1,gateway_url:"/api/membership_campaigns/get_correspond_account_data",additional_parameter:{campaign_type_id:1},merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"pZBHXEFbGNj/G",shop_code: "#{args[:shop_code]}"},
{membership_type:"redeem",is_active:1,gateway_url:"/api/membership_campaigns/redeem",additional_parameter:{campaign_type_id:1},merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"pZBHXEFbGNj/G",shop_code: "#{args[:shop_code]}"},
{membership_type:"create_membership_customer",is_active:1,gateway_url:"/api/generic_customer/create_membership_customer",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"pZBHXEFbGNj/G",shop_code: "#{args[:shop_code]}"},
{membership_type:"update_membership_customer",is_active:1,gateway_url:"/api/generic_customer/update_membership_customer",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"pZBHXEFbGNj/G",shop_code: "#{args[:shop_code]}"},
{membership_type:"get_all_member_group",is_active:1,gateway_url:"/api/member_group/get_all_member_group",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"pZBHXEFbGNj/G",shop_code: "#{args[:shop_code]}"},
{membership_type:"rebate",is_active:1,gateway_url:"/api/membership_campaigns/rebate",additional_parameter:{campaign_type_id:1},merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"pZBHXEFbGNj/G",shop_code: "#{args[:shop_code]}"},
{membership_type:"get_all_member_account",is_active:1,gateway_url:"/api/generic_customer/get_member_data",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"pZBHXEFbGNj/G",shop_code: "#{args[:shop_code]}"},
{membership_type:"get_member_transactions",is_active:1,gateway_url:"/api/generic_customer/get_membership_transactions",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"pZBHXEFbGNj/G",shop_code: "#{args[:shop_code]}"},
{membership_type:"member_discount",is_active:1,gateway_url:"/api/membership_campaigns/discount",additional_parameter:{campaign_type_id:5},merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"pZBHXEFbGNj/G",shop_code: "#{args[:shop_code]}"},
{membership_type:"get_member_campaign",is_active:1,gateway_url:"/api/membership_campaigns/get_member_campaign",additional_parameter:{campaign_type_id:5},merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"pZBHXEFbGNj/G",shop_code: "#{args[:shop_code]}"},
{membership_type:"search_paypar_account_no",is_active:1,gateway_url:"/api/generic_customer/get_membership_customer_data",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"pZBHXEFbGNj/G",shop_code: "#{args[:shop_code]}"},
{membership_type:"search_paypar_security_code",is_active:1,gateway_url:"/api/generic_customer/get_membership_customer_security_code",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"pZBHXEFbGNj/G",shop_code: "#{args[:shop_code]}"}])
payment_methods = PaymentMethodSetting.create({payment_method:"MPU",gateway_url: "http://membership.paypar.ws",shop_code: "#{args[:shop_code]}"})
payment_methods = PaymentMethodSetting.create({payment_method:"VISA",gateway_url: "http://membership.paypar.ws",shop_code: "#{args[:shop_code]}"})
payment_methods = PaymentMethodSetting.create({payment_method:"JCB",gateway_url: "http://membership.paypar.ws",shop_code: "#{args[:shop_code]}"})
payment_methods = PaymentMethodSetting.create({payment_method:"Master",gateway_url: "http://membership.paypar.ws",shop_code: "#{args[:shop_code]}"})
payment_methods = PaymentMethodSetting.create({payment_method:"Redeem",gateway_url: "/api/membership_campaigns/redeem",merchant_account_id:"pZBHXEFbGNj/G",shop_code: "#{args[:shop_code]}"})
payment_methods = PaymentMethodSetting.create({payment_method:"PAYMAL",gateway_url: "/api/create_payment",merchant_account_id:"pZBHXEFbGNj/G",shop_code: "#{args[:shop_code]}"})
puts " Finished System Default Set Up Data" puts " Finished System Default Set Up Data"
end
end end