Adding Redeem at payment
This commit is contained in:
1
Gemfile
1
Gemfile
@@ -10,6 +10,7 @@ end
|
|||||||
gem 'rails', '~> 5.1.0'
|
gem 'rails', '~> 5.1.0'
|
||||||
# Use mysql as the database for Active Record
|
# Use mysql as the database for Active Record
|
||||||
|
|
||||||
|
|
||||||
# gem 'mysql2', '>= 0.3.18', '< 0.5'
|
# gem 'mysql2', '>= 0.3.18', '< 0.5'
|
||||||
|
|
||||||
#Use PosgreSQL
|
#Use PosgreSQL
|
||||||
|
|||||||
@@ -123,7 +123,6 @@ GEM
|
|||||||
nokogiri (1.7.2)
|
nokogiri (1.7.2)
|
||||||
mini_portile2 (~> 2.1.0)
|
mini_portile2 (~> 2.1.0)
|
||||||
pdf-core (0.7.0)
|
pdf-core (0.7.0)
|
||||||
pg (0.20.0)
|
|
||||||
prawn (2.2.2)
|
prawn (2.2.2)
|
||||||
pdf-core (~> 0.7.0)
|
pdf-core (~> 0.7.0)
|
||||||
ttfunk (~> 1.5)
|
ttfunk (~> 1.5)
|
||||||
@@ -259,6 +258,7 @@ DEPENDENCIES
|
|||||||
kaminari!
|
kaminari!
|
||||||
listen (~> 3.0.5)
|
listen (~> 3.0.5)
|
||||||
pg
|
pg
|
||||||
|
mysql2 (>= 0.3.18, < 0.5)
|
||||||
prawn
|
prawn
|
||||||
prawn-table
|
prawn-table
|
||||||
puma (~> 3.0)
|
puma (~> 3.0)
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
class Origami::PayparController < ApplicationController
|
|
||||||
def create
|
|
||||||
end
|
|
||||||
end
|
|
||||||
22
app/controllers/origami/paypar_payments_controller.rb
Normal file
22
app/controllers/origami/paypar_payments_controller.rb
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
class Origami::PayparPaymentsController < BaseOrigamiController
|
||||||
|
def create
|
||||||
|
sale_id = params[:sale_id]
|
||||||
|
redeem_amount = params[:redeem_amount]
|
||||||
|
membership_id = params[:membership_id]
|
||||||
|
payment_method = "paypar"
|
||||||
|
if(Sale.exists?(sale_id))
|
||||||
|
saleObj = Sale.find(sale_id)
|
||||||
|
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
|
||||||
@@ -4,6 +4,6 @@ class Account < ApplicationRecord
|
|||||||
has_many :menu_items
|
has_many :menu_items
|
||||||
# belongs_to :lookup , :class_name => "Lookup"
|
# belongs_to :lookup , :class_name => "Lookup"
|
||||||
def self.collection
|
def self.collection
|
||||||
Account.select("id, title").map { |e| [e.title, e.id] }
|
Account.select("id, title").map { |e| [e.title, e.id] }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ class MenuItem < ApplicationRecord
|
|||||||
has_many :menu_item_instances
|
has_many :menu_item_instances
|
||||||
belongs_to :parent, :class_name => "MenuItem", foreign_key: "menu_item_id", :optional => true
|
belongs_to :parent, :class_name => "MenuItem", foreign_key: "menu_item_id", :optional => true
|
||||||
has_many :children, :class_name => "MenuItem", foreign_key: "menu_item_id"
|
has_many :children, :class_name => "MenuItem", foreign_key: "menu_item_id"
|
||||||
belongs_to :account, :optional => true
|
belongs_to :account
|
||||||
|
|
||||||
validates_presence_of :item_code, :name, :type, :min_qty, :taxable, :min_selectable_item, :max_selectable_item
|
validates_presence_of :item_code, :name, :type, :min_qty, :taxable, :min_selectable_item, :max_selectable_item
|
||||||
|
|
||||||
|
|||||||
@@ -208,8 +208,7 @@ class Order < ApplicationRecord
|
|||||||
OrderBroadcastJob.perform_later(self.id)
|
OrderBroadcastJob.perform_later(self.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
#Origami: Cashier : to view order type Table
|
#Origami: Cashier : to view order Table
|
||||||
|
|
||||||
def self.get_order_table
|
def self.get_order_table
|
||||||
order_table = Order.select("orders.order_id as order_id,sum(order_items.qty*order_items.price) as total_price,
|
order_table = Order.select("orders.order_id as order_id,sum(order_items.qty*order_items.price) as total_price,
|
||||||
order_items.order_items_id as order_items_id,dining_facilities.name as table_name")
|
order_items.order_items_id as order_items_id,dining_facilities.name as table_name")
|
||||||
@@ -220,6 +219,8 @@ class Order < ApplicationRecord
|
|||||||
.where("dining_facilities.type=? and orders.order_type=? and dining_facilities.is_active=?",DiningFacility::TABLE_TYPE,"dine_in",true)
|
.where("dining_facilities.type=? and orders.order_type=? and dining_facilities.is_active=?",DiningFacility::TABLE_TYPE,"dine_in",true)
|
||||||
.group("orders.order_id, order_items.order_items_id,dining_facilities.name")
|
.group("orders.order_id, order_items.order_items_id,dining_facilities.name")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#Origami: Cashier : to view booking order Table
|
||||||
def self.get_booking_order_table
|
def self.get_booking_order_table
|
||||||
booking_orders = Booking.select("sales.receipt_no,orders.status as order_status,
|
booking_orders = Booking.select("sales.receipt_no,orders.status as order_status,
|
||||||
bookings.booking_id,sales.sale_id as sale_id,dining_facilities.name as table_name")
|
bookings.booking_id,sales.sale_id as sale_id,dining_facilities.name as table_name")
|
||||||
|
|||||||
@@ -8,12 +8,10 @@ class SalePayment < ApplicationRecord
|
|||||||
|
|
||||||
attr_accessor :received_amount, :card_payment_reference, :voucher_no, :giftcard_no, :customer_id, :external_payment_status
|
attr_accessor :received_amount, :card_payment_reference, :voucher_no, :giftcard_no, :customer_id, :external_payment_status
|
||||||
|
|
||||||
def process_payment(invoice, action_by, cash_amount)
|
def process_payment(invoice, action_by, cash_amount,payment_method)
|
||||||
|
|
||||||
self.sale = invoice
|
self.sale = invoice
|
||||||
self.received_amount = cash_amount
|
self.received_amount = cash_amount
|
||||||
|
|
||||||
payment_method = "cash"
|
|
||||||
amount_due = invoice.grand_total
|
amount_due = invoice.grand_total
|
||||||
|
|
||||||
#get all payment for this invoices
|
#get all payment for this invoices
|
||||||
@@ -54,7 +52,7 @@ class SalePayment < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
#record an payment in sale-audit
|
#record an payment in sale-audit
|
||||||
remark = "Payment #{payment_method}- for Invoice #{invoice.receipt_no} Due [#{amount_due}]| pay amount -> #{amount} | Payment Status ->#{payment_status}"
|
remark = "Payment #{payment_method}- for Invoice #{invoice.receipt_no} Due [#{amount_due}]| pay amount -> #{cash_amount} | Payment Status ->#{payment_status}"
|
||||||
sale_audit = SaleAudit.record_payment(invoice.id, remark, action_by)
|
sale_audit = SaleAudit.record_payment(invoice.id, remark, action_by)
|
||||||
|
|
||||||
return true, self.sale
|
return true, self.sale
|
||||||
@@ -81,6 +79,21 @@ class SalePayment < ApplicationRecord
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.redeem(paypar_url,token,membership_id,received_amount,sale_id,campaign_type_id)
|
||||||
|
url = paypar_url.to_s + "/api/redeem".to_s
|
||||||
|
response = HTTParty.post(url,
|
||||||
|
:body => { generic_customer_id:membership_id,total_amount:received_amount,receipet_no:sale_id,campaign_type_id:campaign_type_id,account_no:""}.to_json,
|
||||||
|
:headers => {
|
||||||
|
'Content-Type' => 'application/json',
|
||||||
|
'Accept' => 'application/json'
|
||||||
|
}
|
||||||
|
)
|
||||||
|
puts "RRRRRRRR"
|
||||||
|
puts response.to_json
|
||||||
|
return response;
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
def cash_payment
|
def cash_payment
|
||||||
payment_status = false
|
payment_status = false
|
||||||
@@ -161,15 +174,38 @@ class SalePayment < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def paypar_payment
|
def paypar_payment
|
||||||
##TODO - Integration with Paypar (SmartPay)
|
puts "Paypar Payment"
|
||||||
|
payment_status = false
|
||||||
|
|
||||||
|
#Next time - validate if the vochure number is valid - within
|
||||||
|
self.payment_method = "paypar"
|
||||||
|
self.payment_amount = self.received_amount
|
||||||
|
self.payment_reference = self.voucher_no
|
||||||
|
self.outstanding_amount = self.sale.grand_total.to_f - self.received_amount.to_f
|
||||||
|
self.payment_status = "pending"
|
||||||
|
payment_method = self.save!
|
||||||
|
|
||||||
|
campaign_type_id =1;
|
||||||
|
customer_data = Customer.find_by_customer_id(self.sale.customer_id)
|
||||||
|
membership_setting = MembershipSetting.find_by_membership_type("smartpay_url")
|
||||||
|
membership_data = SalePayment.redeem(membership_setting.gateway_url,membership_setting.auth_token,customer_data.membership_id,self.received_amount,self.sale.sale_id,campaign_type_id)
|
||||||
|
if membership_data["status"]==true
|
||||||
|
SalePayment.where(:sale_payment_id => self.sale_payment_id).update_all(:payment_status => 'paid')
|
||||||
|
sale_update_payment_status(self.received_amount.to_f)
|
||||||
|
|
||||||
|
else
|
||||||
|
sale_update_payment_status(0)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
return payment_status
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def sale_update_payment_status(paid_amount)
|
def sale_update_payment_status(paid_amount)
|
||||||
puts "paid_amount"
|
|
||||||
puts paid_amount
|
|
||||||
#update amount_outstanding
|
#update amount_outstanding
|
||||||
self.sale.amount_received = self.sale.amount_received + paid_amount
|
self.sale.amount_received = self.sale.amount_received + paid_amount
|
||||||
self.sale.amount_changed = amount - self.sale.amount_received
|
self.sale.amount_changed = paid_amount - self.sale.amount_received
|
||||||
if (self.sale.grand_total <= self.sale.amount_received && self.sale.amount_changed > 0)
|
if (self.sale.grand_total <= self.sale.amount_received && self.sale.amount_changed > 0)
|
||||||
self.sale.payment_status = "paid"
|
self.sale.payment_status = "paid"
|
||||||
self.sale.sale_status = "completed"
|
self.sale.sale_status = "completed"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
if (@booking)
|
if (@booking)
|
||||||
json.id @booking.booking_id
|
json.id @booking.booking_id
|
||||||
json.status @booking.booking_status
|
json.status @booking.booking_status
|
||||||
json.checkin_at @booking.checkin_at
|
json.checkin_at @booking.checkin_at.strftime("%d-%m-%Y")
|
||||||
json.checkin_by @booking.checkin_by
|
json.checkin_by @booking.checkin_by
|
||||||
json.table_name @booking.dining_facility.name
|
json.table_name @booking.dining_facility.name
|
||||||
|
|
||||||
@@ -17,9 +17,9 @@ if (@booking)
|
|||||||
order_items = []
|
order_items = []
|
||||||
@booking.booking_orders.each do |bo|
|
@booking.booking_orders.each do |bo|
|
||||||
order = Order.find(bo.order_id)
|
order = Order.find(bo.order_id)
|
||||||
if (order.status == "new")
|
#if (order.status == "new")
|
||||||
order_items = order_items + order.order_items
|
order_items = order_items + order.order_items
|
||||||
end
|
#end
|
||||||
end
|
end
|
||||||
|
|
||||||
json.order_items order_items do |item|
|
json.order_items order_items do |item|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ $(function(){
|
|||||||
$(".summary-items tbody tr").remove();
|
$(".summary-items tbody tr").remove();
|
||||||
$("#cancel").removeAttr("disabled");
|
$("#cancel").removeAttr("disabled");
|
||||||
$("#assign").removeAttr("disabled");
|
$("#assign").removeAttr("disabled");
|
||||||
var url = $(this).attr('data-ref');alert(url);
|
var url = $(this).attr('data-ref');
|
||||||
show_details(url);
|
show_details(url);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
<div class="form-group col-lg-12 col-md-12 col-sm-12">
|
||||||
<label class="col-lg-4 col-md-4 col-sm-4">Valid Amount</label>
|
<label class="col-lg-4 col-md-4 col-sm-4">Valid Amount</label>
|
||||||
<input type="text" name="valid_amount" id="valid_amount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="<%= @membership_rebate_balance %>">
|
<input type="text" name="valid_amount" id="valid_amount" class="form-control col-lg-7 col-md-7 col-sm-7" readonly="" value="1000">
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
</div>
|
</div>
|
||||||
@@ -142,14 +142,23 @@ $("#redeem").click(function(){
|
|||||||
valid_amount = $("#valid_amount").val();
|
valid_amount = $("#valid_amount").val();
|
||||||
sale_id = $(this).attr("data-value")
|
sale_id = $(this).attr("data-value")
|
||||||
membership_id = $(this).attr("data-member-value");
|
membership_id = $(this).attr("data-member-value");
|
||||||
used_amount = parseInt($("#used_amount").text());
|
redeem_amount = parseInt($("#used_amount").text());
|
||||||
if(used_amount<=0){
|
if(redeem_amount<=0){
|
||||||
alert(" Insufficient Amount!")
|
alert(" Insufficient Amount!")
|
||||||
}else if(valid_amount< used_amount){
|
}else if(valid_amount< redeem_amount){
|
||||||
alert("Please type valid amount");
|
alert("Please type valid amount");
|
||||||
}else{
|
}else{
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "<%=origami_paypar_payment_process_path%>",
|
||||||
|
data: {redeem_amount:redeem_amount,membership_id:membership_id,sale_id:sale_id},
|
||||||
|
success: function(result){
|
||||||
|
if(result.status == true){
|
||||||
|
window.location.href = '/origami/sale/'+ sale_id + "/payment"
|
||||||
|
}else{
|
||||||
|
alert(result.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
2
app/views/origami/paypar_payments/create.json.jbuilder
Normal file
2
app/views/origami/paypar_payments/create.json.jbuilder
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
json.set! :status, @out[0]
|
||||||
|
json.set! :message, @out[1]
|
||||||
@@ -72,10 +72,13 @@ Rails.application.routes.draw do
|
|||||||
resources :customers, only: [:index,:new, :create ] #add customer type
|
resources :customers, only: [:index,:new, :create ] #add customer type
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
get "/request_bills/:id" => "request_bills#print"
|
get "/request_bills/:id" => "request_bills#print"
|
||||||
|
|
||||||
get 'sale/:sale_id/payment' => 'payments#show'
|
get 'sale/:sale_id/payment' => 'payments#show'
|
||||||
post 'payment_process' => 'payments#create'
|
post 'payment_process' => 'payments#create'
|
||||||
|
post 'paypar_payment_process' => 'paypar_payments#create'
|
||||||
|
|
||||||
|
|
||||||
get 'sale/:sale_id/payment/credit_payment' => "credit_payments#index"
|
get 'sale/:sale_id/payment/credit_payment' => "credit_payments#index"
|
||||||
get 'sale/:sale_id/payment/others_payment' => "others_payments#index"
|
get 'sale/:sale_id/payment/others_payment' => "others_payments#index"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class CreateZones < ActiveRecord::Migration[5.0]
|
class CreateZones < ActiveRecord::Migration[5.1]
|
||||||
def change
|
def change
|
||||||
create_table :zones do |t|
|
create_table :zones do |t|
|
||||||
t.string :name, :null => false
|
t.string :name, :null => false
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class CreateMenus < ActiveRecord::Migration[5.0]
|
class CreateMenus < ActiveRecord::Migration[5.1]
|
||||||
def change
|
def change
|
||||||
create_table :menus do |t|
|
create_table :menus do |t|
|
||||||
t.string :name
|
t.string :name
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class CreateMenuCategories < ActiveRecord::Migration[5.0]
|
class CreateMenuCategories < ActiveRecord::Migration[5.1]
|
||||||
def change
|
def change
|
||||||
create_table :menu_categories do |t|
|
create_table :menu_categories do |t|
|
||||||
t.references :menu, foreign_key: true
|
t.references :menu, foreign_key: true
|
||||||
|
|||||||
10
db/migrate/20170331024747_create_accounts.rb
Normal file
10
db/migrate/20170331024747_create_accounts.rb
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
class CreateAccounts < ActiveRecord::Migration[5.1]
|
||||||
|
def change
|
||||||
|
create_table :accounts do |t|
|
||||||
|
t.string :title
|
||||||
|
t.string :account_type
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
class CreateMenuItems < ActiveRecord::Migration[5.0]
|
class CreateMenuItems < ActiveRecord::Migration[5.1]
|
||||||
def change
|
def change
|
||||||
create_table :menu_items do |t|
|
create_table :menu_items do |t|
|
||||||
t.string :item_code, :null => false
|
t.string :item_code, :null => false
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class CreateMenuItemAttributes < ActiveRecord::Migration[5.0]
|
class CreateMenuItemAttributes < ActiveRecord::Migration[5.1]
|
||||||
def change
|
def change
|
||||||
create_table :menu_item_attributes do |t|
|
create_table :menu_item_attributes do |t|
|
||||||
t.string :attribute_type, :null => false
|
t.string :attribute_type, :null => false
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class CreateMenuItemOptions < ActiveRecord::Migration[5.0]
|
class CreateMenuItemOptions < ActiveRecord::Migration[5.1]
|
||||||
def change
|
def change
|
||||||
create_table :menu_item_options do |t|
|
create_table :menu_item_options do |t|
|
||||||
t.string :name, :null => false
|
t.string :name, :null => false
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class CreateMenuItemInstances < ActiveRecord::Migration[5.0]
|
class CreateMenuItemInstances < ActiveRecord::Migration[5.1]
|
||||||
def change
|
def change
|
||||||
create_table :menu_item_instances do |t|
|
create_table :menu_item_instances do |t|
|
||||||
t.references :menu_item, :foreign_key => true, :null => false
|
t.references :menu_item, :foreign_key => true, :null => false
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
class CreateCustomers < ActiveRecord::Migration[5.0]
|
class CreateCustomers < ActiveRecord::Migration[5.1]
|
||||||
def change
|
def change
|
||||||
create_table :customers, :id => false do |t|
|
create_table :customers, :id => false do |t|
|
||||||
t.string :customer_id, :limit => 16, :primary_key => true #custom foreign_key to prevent conflict during sync
|
t.string :customer_id, :limit => 16, :primary_key => true #custom foreign_key to prevent conflict during sync
|
||||||
t.string :name, :null => false
|
t.string :name, :null => false
|
||||||
t.string :company
|
t.string :company
|
||||||
t.string :contact_no
|
t.string :contact_no, :unique => true
|
||||||
t.string :email
|
t.string :email
|
||||||
t.date :date_of_birth
|
t.date :date_of_birth
|
||||||
t.string :membership_id
|
t.string :membership_id
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class CreateOrders < ActiveRecord::Migration[5.0]
|
class CreateOrders < ActiveRecord::Migration[5.1]
|
||||||
def change
|
def change
|
||||||
create_table :orders, :id => false do |t|
|
create_table :orders, :id => false do |t|
|
||||||
t.string :order_id, :limit => 16, :primary_key => true #custom foreign_key to prevent conflict during sync
|
t.string :order_id, :limit => 16, :primary_key => true #custom foreign_key to prevent conflict during sync
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class CreateOrderItems < ActiveRecord::Migration[5.0]
|
class CreateOrderItems < ActiveRecord::Migration[5.1]
|
||||||
def change
|
def change
|
||||||
create_table :order_items, :id => false do |t|
|
create_table :order_items, :id => false do |t|
|
||||||
t.string :order_items_id, :limit => 16, :primary_key => true #custom primary key - to ensure consistence for cloud syncing
|
t.string :order_items_id, :limit => 16, :primary_key => true #custom primary key - to ensure consistence for cloud syncing
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class CreateDiningFacilities < ActiveRecord::Migration[5.0]
|
class CreateDiningFacilities < ActiveRecord::Migration[5.1]
|
||||||
def change
|
def change
|
||||||
create_table :dining_facilities do |t|
|
create_table :dining_facilities do |t|
|
||||||
t.references :zone, foreign_key: true
|
t.references :zone, foreign_key: true
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class CreateOrderQueueStations < ActiveRecord::Migration[5.0]
|
class CreateOrderQueueStations < ActiveRecord::Migration[5.1]
|
||||||
def change
|
def change
|
||||||
create_table :order_queue_stations do |t|
|
create_table :order_queue_stations do |t|
|
||||||
t.string :station_name, :null => false
|
t.string :station_name, :null => false
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class CreateOrderQueueProcessByZones < ActiveRecord::Migration[5.0]
|
class CreateOrderQueueProcessByZones < ActiveRecord::Migration[5.1]
|
||||||
def change
|
def change
|
||||||
create_table :order_queue_process_by_zones do |t|
|
create_table :order_queue_process_by_zones do |t|
|
||||||
t.references :order_queue_station, :null => false
|
t.references :order_queue_station, :null => false
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class CreatePaymentMethodSettings < ActiveRecord::Migration[5.0]
|
class CreatePaymentMethodSettings < ActiveRecord::Migration[5.1]
|
||||||
def change
|
def change
|
||||||
create_table :payment_method_settings do |t|
|
create_table :payment_method_settings do |t|
|
||||||
t.string :payment_method, :null => false
|
t.string :payment_method, :null => false
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class CreateEmployees < ActiveRecord::Migration[5.0]
|
class CreateEmployees < ActiveRecord::Migration[5.1]
|
||||||
def change
|
def change
|
||||||
create_table :employees do |t|
|
create_table :employees do |t|
|
||||||
t.string :name, :null => false
|
t.string :name, :null => false
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class CreateCashierTerminals < ActiveRecord::Migration[5.0]
|
class CreateCashierTerminals < ActiveRecord::Migration[5.1]
|
||||||
def change
|
def change
|
||||||
create_table :cashier_terminals do |t|
|
create_table :cashier_terminals do |t|
|
||||||
t.string :name, :null => false
|
t.string :name, :null => false
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class CreateCashierLoginLogs < ActiveRecord::Migration[5.0]
|
class CreateCashierLoginLogs < ActiveRecord::Migration[5.1]
|
||||||
def change
|
def change
|
||||||
create_table :cashier_login_logs, :id => false, :primary_key => :cashier_login_log_id do |t|
|
create_table :cashier_login_logs, :id => false, :primary_key => :cashier_login_log_id do |t|
|
||||||
t.string :cashier_login_log_id, :limit => 16, :null => false, :index => true, :unique => true #custom primary key - to ensure consistence for cloud syncing
|
t.string :cashier_login_log_id, :limit => 16, :null => false, :index => true, :unique => true #custom primary key - to ensure consistence for cloud syncing
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class CreateSales < ActiveRecord::Migration[5.0]
|
class CreateSales < ActiveRecord::Migration[5.1]
|
||||||
def change
|
def change
|
||||||
create_table :sales, :id => false do |t|
|
create_table :sales, :id => false do |t|
|
||||||
t.string :sale_id, :limit => 16, :primary_key => true #custom primary key - to ensure consistence for cloud syncing
|
t.string :sale_id, :limit => 16, :primary_key => true #custom primary key - to ensure consistence for cloud syncing
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class CreateSaleItems < ActiveRecord::Migration[5.0]
|
class CreateSaleItems < ActiveRecord::Migration[5.1]
|
||||||
def change
|
def change
|
||||||
create_table :sale_items, :id => false do |t|
|
create_table :sale_items, :id => false do |t|
|
||||||
t.string :sale_item_id, :limit => 16, :primary_key => true#custom primary key - to ensure consistence for cloud syncing
|
t.string :sale_item_id, :limit => 16, :primary_key => true#custom primary key - to ensure consistence for cloud syncing
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class CreateSaleTaxes < ActiveRecord::Migration[5.0]
|
class CreateSaleTaxes < ActiveRecord::Migration[5.1]
|
||||||
def change
|
def change
|
||||||
create_table :sale_taxes, :id => false do |t|
|
create_table :sale_taxes, :id => false do |t|
|
||||||
t.string :sale_tax_id, :limit => 16, :primary_key => true #custom primary key - to ensure consistence for cloud syncing
|
t.string :sale_tax_id, :limit => 16, :primary_key => true #custom primary key - to ensure consistence for cloud syncing
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class CreateSalePayments < ActiveRecord::Migration[5.0]
|
class CreateSalePayments < ActiveRecord::Migration[5.1]
|
||||||
def change
|
def change
|
||||||
create_table :sale_payments, :id => false do |t|
|
create_table :sale_payments, :id => false do |t|
|
||||||
t.string :sale_payment_id, :limit => 16, :primary_key => true #custom primary key - to ensure consistence for cloud syncing
|
t.string :sale_payment_id, :limit => 16, :primary_key => true #custom primary key - to ensure consistence for cloud syncing
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class CreateSaleOrders < ActiveRecord::Migration[5.0]
|
class CreateSaleOrders < ActiveRecord::Migration[5.1]
|
||||||
def change
|
def change
|
||||||
create_table :sale_orders, :id => false do |t|
|
create_table :sale_orders, :id => false do |t|
|
||||||
t.primary_key :sale_order_id #custom primary key - to ensure consistence for cloud syncing
|
t.primary_key :sale_order_id #custom primary key - to ensure consistence for cloud syncing
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class CreateSaleAudits < ActiveRecord::Migration[5.0]
|
class CreateSaleAudits < ActiveRecord::Migration[5.1]
|
||||||
def change
|
def change
|
||||||
create_table :sale_audits, :id => false do |t|
|
create_table :sale_audits, :id => false do |t|
|
||||||
t.string :sale_audit_id, :limit => 16, :primary_key => true #custom primary key - to ensure consistence for cloud syncing
|
t.string :sale_audit_id, :limit => 16, :primary_key => true #custom primary key - to ensure consistence for cloud syncing
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class CreateLookups < ActiveRecord::Migration[5.0]
|
class CreateLookups < ActiveRecord::Migration[5.1]
|
||||||
def change
|
def change
|
||||||
create_table :lookups do |t|
|
create_table :lookups do |t|
|
||||||
t.string :lookup_type, :null => false
|
t.string :lookup_type, :null => false
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class CreateTaxProfiles < ActiveRecord::Migration[5.0]
|
class CreateTaxProfiles < ActiveRecord::Migration[5.1]
|
||||||
def change
|
def change
|
||||||
create_table :tax_profiles do |t|
|
create_table :tax_profiles do |t|
|
||||||
t.string :name, :null => false
|
t.string :name, :null => false
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class CreateBookings < ActiveRecord::Migration[5.0]
|
class CreateBookings < ActiveRecord::Migration[5.1]
|
||||||
def change
|
def change
|
||||||
create_table :bookings, :id => false do |t|
|
create_table :bookings, :id => false do |t|
|
||||||
t.string :booking_id, :limit => 16, :primary_key => true #custom primary key - to ensure consistence for cloud syncing
|
t.string :booking_id, :limit => 16, :primary_key => true #custom primary key - to ensure consistence for cloud syncing
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class CreateSeedGenerators < ActiveRecord::Migration[5.0]
|
class CreateSeedGenerators < ActiveRecord::Migration[5.1]
|
||||||
def change
|
def change
|
||||||
create_table :seed_generators do |t|
|
create_table :seed_generators do |t|
|
||||||
t.string :model, :null => false, :default => "sale"
|
t.string :model, :null => false, :default => "sale"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class CreateMembershipSettings < ActiveRecord::Migration[5.0]
|
class CreateMembershipSettings < ActiveRecord::Migration[5.1]
|
||||||
def change
|
def change
|
||||||
create_table :membership_settings do |t|
|
create_table :membership_settings do |t|
|
||||||
t.string :membership_type, :null => false, :default => "internal"
|
t.string :membership_type, :null => false, :default => "internal"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class CreateAssignedOrderItems < ActiveRecord::Migration[5.0]
|
class CreateAssignedOrderItems < ActiveRecord::Migration[5.1]
|
||||||
def change
|
def change
|
||||||
create_table :assigned_order_items, :id => false do |t|
|
create_table :assigned_order_items, :id => false do |t|
|
||||||
t.string :assigned_order_item_id, :limit => 16, :primary_key => true #custom primary key - to ensure consistence for cloud syncing
|
t.string :assigned_order_item_id, :limit => 16, :primary_key => true #custom primary key - to ensure consistence for cloud syncing
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class CreateBookingOrders < ActiveRecord::Migration[5.0]
|
class CreateBookingOrders < ActiveRecord::Migration[5.1]
|
||||||
def change
|
def change
|
||||||
create_table :booking_orders, :id => false do |t|
|
create_table :booking_orders, :id => false do |t|
|
||||||
#t.string :booking_order_id, :limit => 16, :null => false, :index => true, :unique => true #custom primary key - to ensure consistence for cloud syncing
|
#t.string :booking_order_id, :limit => 16, :null => false, :index => true, :unique => true #custom primary key - to ensure consistence for cloud syncing
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class AddCompanyAddressEmail < ActiveRecord::Migration[5.0]
|
class AddCompanyAddressEmail < ActiveRecord::Migration[5.1]
|
||||||
def change
|
def change
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class OrderItemsCompletedBy < ActiveRecord::Migration[5.0]
|
class OrderItemsCompletedBy < ActiveRecord::Migration[5.1]
|
||||||
def change
|
def change
|
||||||
add_column :order_items, :completed_by, :string
|
add_column :order_items, :completed_by, :string
|
||||||
add_column :order_items, :completed_at, :datetime
|
add_column :order_items, :completed_at, :datetime
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class CreateShops < ActiveRecord::Migration[5.1]
|
|||||||
t.string :state, :null => false
|
t.string :state, :null => false
|
||||||
t.string :country, :null => false
|
t.string :country, :null => false
|
||||||
t.string :phone_no, :null => false
|
t.string :phone_no, :null => false
|
||||||
t.string :reserviation_no, :null => false
|
t.string :reservation_no, :null => false
|
||||||
t.string :license, :null => false
|
t.string :license, :null => false
|
||||||
t.datetime :activated_at, :null => false
|
t.datetime :activated_at, :null => false
|
||||||
t.text :license_data, :null => false
|
t.text :license_data, :null => false
|
||||||
|
|||||||
@@ -75,9 +75,8 @@ account_type = Lookup.create([{lookup_type:'account_type', name: 'Income', value
|
|||||||
{lookup_type:'account_type', name: 'Expense', value: 'expense'}])
|
{lookup_type:'account_type', name: 'Expense', value: 'expense'}])
|
||||||
|
|
||||||
#WALK CUSTOMER - Default CUSTOMER (take key 1)
|
#WALK CUSTOMER - Default CUSTOMER (take key 1)
|
||||||
customer = Customer.create({id:1, name:"WALK-IN", contact_no:"000000000"})
|
customer = Customer.create({name:"WALK-IN", email: "cus1@customer.com", contact_no:"000000000"})
|
||||||
customer = Customer.create({id:2, name:"TAKEAWAY", contact_no:"000000000"})
|
customer2 = Customer.create({name:"TAKEAWAY", email: "cus2@customer.com", contact_no:"111111111"})
|
||||||
|
|
||||||
|
|
||||||
#Default ZOne
|
#Default ZOne
|
||||||
zone = Zone.create({id:1, name: "Default Zone", is_active:true, created_by: "SYSTEM DEFAULT"})
|
zone = Zone.create({id:1, name: "Default Zone", is_active:true, created_by: "SYSTEM DEFAULT"})
|
||||||
@@ -108,7 +107,7 @@ menu_category4 = MenuCategory.create({menu: menu, code:"C006", name: "Sample Men
|
|||||||
|
|
||||||
#Default Menu items
|
#Default Menu items
|
||||||
menu_category1_menu_item0 = SimpleMenuItem.create({item_code:"01001", name: "Default Menu Item Name 0", alt_name: "Alternate Menu Item Name 0",menu_category: menu_category1 , min_selectable_item: 1, max_selectable_item:1, account: food })
|
menu_category1_menu_item0 = SimpleMenuItem.create({item_code:"01001", name: "Default Menu Item Name 0", alt_name: "Alternate Menu Item Name 0",menu_category: menu_category1 , min_selectable_item: 1, max_selectable_item:1, account: food })
|
||||||
menu_item0_instance = MenuItemInstance.create([{item_instance_name:"half portion",item_instance_code:"01001-1", menu_item: menu_category1_menu_item0, price:12.00, is_on_promotion:false}])
|
menu_item0_instance = MenuItemInstance.create([{item_instance_name:"half portion",item_instance_code:"II0101", menu_item: menu_category1_menu_item0, price:12.00, is_on_promotion:false}])
|
||||||
menu_item0_instance = MenuItemInstance.create([{item_instance_name:"full portion",item_instance_code:"01001-2", menu_item: menu_category1_menu_item0, price:18.00, is_on_promotion:false}])
|
menu_item0_instance = MenuItemInstance.create([{item_instance_name:"full portion",item_instance_code:"01001-2", menu_item: menu_category1_menu_item0, price:18.00, is_on_promotion:false}])
|
||||||
|
|
||||||
menu_category1_menu_item1 = SetMenuItem.create({item_code:"I004", name: "Default Menu Item Name 1", alt_name: "Alternate Menu Item Name 1",menu_category: menu_category1 , min_selectable_item: 1, max_selectable_item:1 , account: food})
|
menu_category1_menu_item1 = SetMenuItem.create({item_code:"I004", name: "Default Menu Item Name 1", alt_name: "Alternate Menu Item Name 1",menu_category: menu_category1 , min_selectable_item: 1, max_selectable_item:1 , account: food})
|
||||||
|
|||||||
Reference in New Issue
Block a user