Merge branch 'doemal_ordering' of bitbucket.org:code2lab/sxrestaurant into doemal_ordering
This commit is contained in:
@@ -241,6 +241,8 @@ Menu Image (Import guideline)
|
|||||||
=> Second, import [menu].xlsx file in /settings/menus and then checked image is uploaded into Application/[sxrestaurant]/public/image/menu_images and insert into menu_items table in database.
|
=> Second, import [menu].xlsx file in /settings/menus and then checked image is uploaded into Application/[sxrestaurant]/public/image/menu_images and insert into menu_items table in database.
|
||||||
=> Last, if shop has shop_code, update marked/noted shop_code into shops table again.
|
=> Last, if shop has shop_code, update marked/noted shop_code into shops table again.
|
||||||
|
|
||||||
|
For Edit Order Open & Close
|
||||||
|
1) settings/lookups => {type:edit_order, name:EditOrderOrigami, value: {1 or 0}}
|
||||||
|
|
||||||
* ToDo list
|
* ToDo list
|
||||||
|
|
||||||
|
|||||||
@@ -109,6 +109,19 @@ class Origami::HomeController < BaseOrigamiController
|
|||||||
if !lookup_spit_bill[0].nil?
|
if !lookup_spit_bill[0].nil?
|
||||||
@split_bill = lookup_spit_bill[0][1]
|
@split_bill = lookup_spit_bill[0][1]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#for edit order open & close
|
||||||
|
@edit_order_origami = true
|
||||||
|
lookup_edit_order = Lookup.collection_of('edit_order')
|
||||||
|
if !lookup_edit_order.empty?
|
||||||
|
lookup_edit_order.each do |edit_order|
|
||||||
|
if edit_order[0].downcase == "editorderorigami"
|
||||||
|
if edit_order[1] == '0' && (current_login_employee.role == 'cashier' || current_login_employee.role == 'waiter')
|
||||||
|
@edit_order_origami = false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_emp_access_code
|
def check_emp_access_code
|
||||||
|
|||||||
@@ -137,6 +137,19 @@ class Origami::RoomsController < BaseOrigamiController
|
|||||||
if !lookup_spit_bill[0].nil?
|
if !lookup_spit_bill[0].nil?
|
||||||
@split_bill = lookup_spit_bill[0][1]
|
@split_bill = lookup_spit_bill[0][1]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#for edit order open & close
|
||||||
|
@edit_order_origami = true
|
||||||
|
lookup_edit_order = Lookup.collection_of('edit_order')
|
||||||
|
if !lookup_edit_order.empty?
|
||||||
|
lookup_edit_order.each do |edit_order|
|
||||||
|
if edit_order[0].downcase == "editorderorigami"
|
||||||
|
if edit_order[1] == '0' && (current_login_employee.role == 'cashier' || current_login_employee.role == 'waiter')
|
||||||
|
@edit_order_origami = false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -298,7 +298,7 @@
|
|||||||
sub_total = sub_total + (order_item.price * order_item.qty)
|
sub_total = sub_total + (order_item.price * order_item.qty)
|
||||||
|
|
||||||
# unless order_item.price == 0 %>
|
# unless order_item.price == 0 %>
|
||||||
<tr class="edit_order" data-id='<%= order_item.order_items_id %>'>
|
<tr class="<%= @edit_order_origami==true ? 'edit_order' : '' %>" data-id='<%= order_item.order_items_id %>'>
|
||||||
<td><%= count %></td>
|
<td><%= count %></td>
|
||||||
<td class='item-name'>
|
<td class='item-name'>
|
||||||
<%= order_item.item_name %>
|
<%= order_item.item_name %>
|
||||||
@@ -402,7 +402,7 @@
|
|||||||
set_item_prices = 0
|
set_item_prices = 0
|
||||||
count += 1
|
count += 1
|
||||||
%>
|
%>
|
||||||
<tr class="edit_order" data-id='<%= order_item.order_items_id %>'>
|
<tr class="<%= @edit_order_origami==true ? 'edit_order' : '' %>" data-id='<%= order_item.order_items_id %>'>
|
||||||
<td><%= count %>
|
<td><%= count %>
|
||||||
<td class='item-name'>
|
<td class='item-name'>
|
||||||
<%= order_item.item_name %>
|
<%= order_item.item_name %>
|
||||||
|
|||||||
@@ -287,7 +287,7 @@
|
|||||||
sub_total = sub_total + (order_item.price * order_item.qty)
|
sub_total = sub_total + (order_item.price * order_item.qty)
|
||||||
|
|
||||||
# unless order_item.price == 0 %>
|
# unless order_item.price == 0 %>
|
||||||
<tr class="edit_order" data-id='<%= order_item.order_items_id %>'>
|
<tr class="<%= @edit_order_origami== true ? 'edit_order' : ''%>" data-id='<%= order_item.order_items_id %>'>
|
||||||
<td><%= count %></td>
|
<td><%= count %></td>
|
||||||
<td class='item-name'>
|
<td class='item-name'>
|
||||||
<%= order_item.item_name %>
|
<%= order_item.item_name %>
|
||||||
@@ -391,7 +391,7 @@
|
|||||||
set_item_prices = 0
|
set_item_prices = 0
|
||||||
count += 1
|
count += 1
|
||||||
%>
|
%>
|
||||||
<tr class="edit_order" data-id='<%= order_item.order_items_id %>'>
|
<tr class="<%= @edit_order_origami== true ? 'edit_order' : ''%>" data-id='<%= order_item.order_items_id %>'>
|
||||||
<td><%= count %>
|
<td><%= count %>
|
||||||
<td class='item-name'>
|
<td class='item-name'>
|
||||||
<%= order_item.item_name %>
|
<%= order_item.item_name %>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
class CreateMenuItems < ActiveRecord::Migration[5.1]
|
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, :index => true
|
||||||
t.string :name, :null => false
|
t.string :name, :null => false
|
||||||
t.string :alt_name
|
t.string :alt_name
|
||||||
t.string :image_path
|
t.string :image_path
|
||||||
|
|||||||
@@ -2,17 +2,18 @@ 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
|
||||||
t.datetime :date, :null => false
|
t.datetime :date, :index => true, :null => false
|
||||||
t.string :source, :null => false, :default => "emenu"
|
t.string :source, :index => true, :null => false, :default => "emenu"
|
||||||
t.string :order_type, :null => false, :default => "dine-in"
|
t.string :order_type, :null => false, :default => "dine-in"
|
||||||
t.string :customer_id, foreign_key: true, :limit => 16
|
t.string :customer_id, foreign_key: true, :limit => 16
|
||||||
t.integer :item_count, :null => false, :default => 0
|
t.integer :item_count, :null => false, :default => 0
|
||||||
t.integer :quantity_count, :null => false, :default => 0
|
t.integer :quantity_count, :null => false, :default => 0
|
||||||
t.string :status, :null => false, :default => "new"
|
t.string :status, :index => true, :null => false, :default => "new"
|
||||||
t.json :waiters
|
t.json :waiters
|
||||||
t.json :guest_info
|
t.json :guest_info
|
||||||
|
|
||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
|
add_index :orders, [:date, :source, :status], name: 'index_date_source_status'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ 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
|
||||||
t.string :order_id, foreign_key: true, :null => false, :limit => 16
|
t.string :order_id, foreign_key: true, :index => true, :null => false, :limit => 16
|
||||||
t.string :order_item_status, :null => false, :default => "new"
|
t.string :order_item_status, :null => false, :default => "new"
|
||||||
t.string :item_order_by #person who order this
|
t.string :item_order_by #person who order this
|
||||||
t.string :item_code, :null => false
|
t.string :item_code, :null => false
|
||||||
|
|||||||
@@ -3,15 +3,16 @@ class CreateDiningFacilities < ActiveRecord::Migration[5.1]
|
|||||||
create_table :dining_facilities do |t|
|
create_table :dining_facilities do |t|
|
||||||
t.references :zone, foreign_key: true
|
t.references :zone, foreign_key: true
|
||||||
t.string :name, :null => false
|
t.string :name, :null => false
|
||||||
t.string :status, :null => false, :default => "available"
|
t.string :status, :null => false, :default => "available", :index => true
|
||||||
t.string :type, :null => false, :default => "Table"
|
t.string :type, :null => false, :default => "Table", :index => true
|
||||||
t.integer :seater, :null => false, :default => 2
|
t.integer :seater, :null => false, :default => 2
|
||||||
t.integer :order_by
|
t.integer :order_by
|
||||||
|
|
||||||
t.string :created_by
|
t.string :created_by
|
||||||
t.boolean :is_active, :null => false, :default => true
|
t.boolean :is_active, :null => false, :default => true, :index => true
|
||||||
|
|
||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
|
add_index :dining_facilities, [:status, :type, :is_active]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -3,15 +3,16 @@ class CreateEmployees < ActiveRecord::Migration[5.1]
|
|||||||
create_table :employees do |t|
|
create_table :employees do |t|
|
||||||
t.string :name, :null => false
|
t.string :name, :null => false
|
||||||
t.string :role, :null => false, :default => "cashier"
|
t.string :role, :null => false, :default => "cashier"
|
||||||
t.boolean :is_active, :default => true
|
t.boolean :is_active, :default => true, :index=>true
|
||||||
t.string :emp_id, :null => false
|
t.string :emp_id, :null => false
|
||||||
t.string :password_digest, :null => false
|
t.string :password_digest, :null => false
|
||||||
t.string :token_session
|
t.string :token_session, :index=>true
|
||||||
t.datetime :session_expiry
|
t.datetime :session_expiry
|
||||||
t.datetime :session_last_login
|
t.datetime :session_last_login
|
||||||
t.string :created_by
|
t.string :created_by
|
||||||
t.string :image_path
|
t.string :image_path
|
||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
|
add_index :employees, [:is_active, :token_session]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,21 +2,22 @@ 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
|
||||||
t.string :sale_id, foreign_key: true, :limit => 16
|
t.string :sale_id, foreign_key: true, :limit => 16, :index => true
|
||||||
t.string :product_code, :null => false
|
t.string :product_code, :null => false
|
||||||
t.string :item_instance_code
|
t.string :item_instance_code
|
||||||
t.string :product_name, :null => false
|
t.string :product_name, :null => false
|
||||||
t.string :product_alt_name, :null => false
|
t.string :product_alt_name, :null => false
|
||||||
t.integer :account_id, :limit => 8, :null => false, :default => 1
|
t.integer :account_id, :index => true, :limit => 8, :null => false, :default => 1
|
||||||
t.string :status
|
t.string :status, :index => true
|
||||||
t.string :remark
|
t.string :remark, :index => true
|
||||||
t.decimal :qty, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
t.decimal :qty, :index => true, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||||
t.decimal :unit_price, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
t.decimal :unit_price, :index => true, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||||
t.decimal :taxable_price, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
t.decimal :taxable_price, :index => true, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||||
t.decimal :price, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
t.decimal :price, :index => true, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||||
t.boolean :is_taxable, :null => false, :default => true
|
t.boolean :is_taxable, :index => true, :null => false, :default => true
|
||||||
|
|
||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
|
add_index :sale_items, [:sale_id, :account_id, :status, :remark, :qty, :unit_price, :taxable_price, :price, :is_taxable], name: 'index_sale_items'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ class CreateSaleTaxes < ActiveRecord::Migration[5.1]
|
|||||||
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
|
||||||
|
|
||||||
t.string :sale_id, foreign_key: true, :limit => 16
|
t.string :sale_id, foreign_key: true, :limit => 16, :index => true, :null => false
|
||||||
t.string :tax_name, :null => false
|
t.string :tax_name, :null => false
|
||||||
t.decimal :tax_rate, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
t.decimal :tax_rate, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||||
t.decimal :tax_payable_amount, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
t.decimal :tax_payable_amount, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ class CreateSalePayments < ActiveRecord::Migration[5.1]
|
|||||||
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
|
||||||
|
|
||||||
t.string :sale_id, foreign_key: true, :limit => 16
|
t.string :sale_id, foreign_key: true, :limit => 16, :index => true
|
||||||
t.string :payment_method, :null => false, :default => "cash"
|
t.string :payment_method, :null => false, :default => "cash", :index => true
|
||||||
t.decimal :payment_amount, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
t.decimal :payment_amount, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||||
t.decimal :outstanding_amount, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
t.decimal :outstanding_amount, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||||
t.string :payment_reference
|
t.string :payment_reference
|
||||||
@@ -12,5 +12,6 @@ class CreateSalePayments < ActiveRecord::Migration[5.1]
|
|||||||
|
|
||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
|
add_index :sale_payments, [:sale_id, :payment_method]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -3,10 +3,11 @@ class CreateSaleOrders < ActiveRecord::Migration[5.1]
|
|||||||
create_table :sale_orders, :id => false do |t|
|
create_table :sale_orders, :id => false do |t|
|
||||||
|
|
||||||
t.string :sale_order_id, :limit => 16, :primary_key => true
|
t.string :sale_order_id, :limit => 16, :primary_key => true
|
||||||
t.string :sale_id, foreign_key: true,:limit => 16
|
t.string :sale_id, foreign_key: true,:limit => 16, :index => true
|
||||||
t.string :order_id, foreign_key: true, :limit => 16
|
t.string :order_id, foreign_key: true, :limit => 16, :index => true
|
||||||
|
|
||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
|
add_index :sale_orders, [:sale_id, :order_id], name: 'index_sale_id_order_id'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
class CreateLookups < ActiveRecord::Migration[5.1]
|
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, :index => true
|
||||||
t.string :name, :null => false
|
t.string :name, :null => false
|
||||||
t.string :value, :null => false
|
t.string :value, :null => false
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -5,17 +5,18 @@ class CreateBookings < ActiveRecord::Migration[5.1]
|
|||||||
|
|
||||||
t.references :dining_facility, foreign_key: true
|
t.references :dining_facility, foreign_key: true
|
||||||
t.string :type, :null => false, :default => "Table"
|
t.string :type, :null => false, :default => "Table"
|
||||||
t.datetime :checkin_at, :null => false
|
t.datetime :checkin_at, :index => true, :null => false
|
||||||
t.string :checkin_by
|
t.string :checkin_by
|
||||||
t.datetime :checkout_at
|
t.datetime :checkout_at
|
||||||
t.string :checkout_by
|
t.string :checkout_by, :index => true
|
||||||
t.datetime :reserved_at
|
t.datetime :reserved_at
|
||||||
t.string :reserved_by
|
t.string :reserved_by, :index => true
|
||||||
t.string :booking_status, :null => false, :default => "new"
|
t.string :booking_status, :index => true, :null => false, :default => "new"
|
||||||
t.string :sale_id, foreign_key: true, :limit => 16
|
t.string :sale_id, foreign_key: true, :limit => 16
|
||||||
t.string :customer_id, foreign_key: true, :limit => 16
|
t.string :customer_id, foreign_key: true, :limit => 16
|
||||||
|
|
||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
|
add_index :bookings, [:checkin_at, :checkout_by, :reserved_by, :booking_status], name: 'index_bookings'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
class CreateSeedGenerators < ActiveRecord::Migration[5.1]
|
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", :index => true
|
||||||
t.integer :increase_by, :null => false, :default => 1
|
t.integer :increase_by, :null => false, :default => 1
|
||||||
t.bigint :current, :null => false ,:default => 1
|
t.bigint :current, :null => false ,:default => 1
|
||||||
t.bigint :next, :null => false, :default => 2
|
t.bigint :next, :null => false, :default => 2
|
||||||
|
|||||||
@@ -4,12 +4,14 @@ class CreateAssignedOrderItems < ActiveRecord::Migration[5.1]
|
|||||||
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
|
||||||
t.string :item_code, :null => false, :index => true
|
t.string :item_code, :null => false, :index => true
|
||||||
t.string :instance_code, :null => false, :index => true
|
t.string :instance_code, :null => false, :index => true
|
||||||
t.references :order_queue_station, foreign_key: true
|
t.references :order_queue_station, foreign_key: true, :index => true
|
||||||
t.string :order_id, foreign_key: true, :limit => 16
|
t.string :order_id, foreign_key: true, :limit => 16
|
||||||
t.boolean :print_status
|
t.boolean :print_status
|
||||||
t.boolean :delivery_status
|
t.boolean :delivery_status, :index => true
|
||||||
|
|
||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
|
add_index :assigned_order_items, :created_at
|
||||||
|
add_index :assigned_order_items, [:item_code, :instance_code, :order_queue_station_id, :delivery_status, :created_at], name: 'index_assigned_order_items'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -3,10 +3,11 @@ class CreateBookingOrders < ActiveRecord::Migration[5.1]
|
|||||||
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
|
||||||
t.primary_key :booking_order_id
|
t.primary_key :booking_order_id
|
||||||
t.string :booking_id, foreign_key: true, :limit => 16
|
t.string :booking_id, foreign_key: true, :index => true, :limit => 16
|
||||||
t.string :order_id, foreign_key: true, :limit => 16
|
t.string :order_id, foreign_key: true, :index => true, :limit => 16
|
||||||
|
|
||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
|
add_index :booking_orders, [:booking_id, :order_id], name: 'index_booking_id_order_id'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -13,12 +13,13 @@ class CreateCustomers < ActiveRecord::Migration[5.1]
|
|||||||
t.string :address
|
t.string :address
|
||||||
t.string :card_no, :unique => true
|
t.string :card_no, :unique => true
|
||||||
t.string :paypar_account_no, :unique => true
|
t.string :paypar_account_no, :unique => true
|
||||||
t.string :membership_id
|
t.string :membership_id, :index => true
|
||||||
t.string :membership_type
|
t.string :membership_type
|
||||||
t.string :membership_authentication_code
|
t.string :membership_authentication_code
|
||||||
t.string :customer_type, :default => "Dinein"
|
t.string :customer_type, :default => "Dinein", :index => true
|
||||||
t.json :tax_profiles
|
t.json :tax_profiles
|
||||||
t.string :image_path
|
t.string :image_path
|
||||||
end
|
end
|
||||||
|
add_index :customers, [:membership_id, :customer_type]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ class CreateShiftSales < ActiveRecord::Migration[5.1]
|
|||||||
def change
|
def change
|
||||||
create_table :shift_sales do |t|
|
create_table :shift_sales do |t|
|
||||||
t.references :cashier_terminal, foreign_key: true, :null => false
|
t.references :cashier_terminal, foreign_key: true, :null => false
|
||||||
t.datetime :shift_started_at
|
t.datetime :shift_started_at, :index => true
|
||||||
t.datetime :shift_closed_at
|
t.datetime :shift_closed_at, :index => true
|
||||||
t.references :employee, foreign_key: true #cashier
|
t.references :employee, foreign_key: true #cashier
|
||||||
t.decimal :opening_balance, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
t.decimal :opening_balance, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||||
t.decimal :closing_balance, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
t.decimal :closing_balance, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||||
@@ -26,5 +26,6 @@ class CreateShiftSales < ActiveRecord::Migration[5.1]
|
|||||||
t.decimal :total_void, :default => 0
|
t.decimal :total_void, :default => 0
|
||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
|
add_index :shift_sales, [:shift_started_at, :shift_closed_at]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ class CreatePrintSettings < ActiveRecord::Migration[5.1]
|
|||||||
def change
|
def change
|
||||||
create_table :print_settings do |t|
|
create_table :print_settings do |t|
|
||||||
t.string :name, :null => false
|
t.string :name, :null => false
|
||||||
t.string :unique_code, :null => false
|
t.string :unique_code, :null => false, :index => true
|
||||||
t.string :template
|
t.string :template
|
||||||
t.string :font, :default => ""
|
t.string :font, :default => ""
|
||||||
t.integer :header_font_size, :null => false, :default => 10
|
t.integer :header_font_size, :null => false, :default => 10
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ class CreateSales < ActiveRecord::Migration[5.1]
|
|||||||
t.string :requested_by, :null => false
|
t.string :requested_by, :null => false
|
||||||
t.datetime :requested_at, :null => false
|
t.datetime :requested_at, :null => false
|
||||||
t.string :receipt_no, :null => false
|
t.string :receipt_no, :null => false
|
||||||
t.datetime :receipt_date, :null => false
|
t.datetime :receipt_date, :index => true, :null => false
|
||||||
t.string :customer_id, foreign_key: true, :limit => 16
|
t.string :customer_id, foreign_key: true, :limit => 16
|
||||||
t.string :payment_status, :null => false, :default => "outstanding"
|
t.string :payment_status, :index => true, :null => false, :default => "outstanding"
|
||||||
t.string :sale_status, :null => false, :default => "new"
|
t.string :sale_status, :index => true, :null => false, :default => "new"
|
||||||
t.decimal :total_amount, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
t.decimal :total_amount, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||||
t.string :discount_type, :default => "overall"
|
t.string :discount_type, :default => "overall"
|
||||||
t.decimal :total_discount, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
t.decimal :total_discount, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||||
@@ -21,11 +21,13 @@ class CreateSales < ActiveRecord::Migration[5.1]
|
|||||||
t.decimal :rounding_adjustment, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
t.decimal :rounding_adjustment, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||||
t.decimal :amount_received, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
t.decimal :amount_received, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||||
t.decimal :amount_changed, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
t.decimal :amount_changed, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||||
t.integer :shift_sale_id
|
t.integer :shift_sale_id, :index => true
|
||||||
t.decimal :old_grand_total
|
t.decimal :old_grand_total
|
||||||
t.string :rebate_status
|
t.string :rebate_status
|
||||||
t.integer :equal_persons
|
t.integer :equal_persons
|
||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
|
add_index :sales, :created_at, name: 'index_created_at'
|
||||||
|
add_index :sales, [:cashier_id, :receipt_date, :payment_status, :sale_status, :shift_sale_id, :created_at], name: 'index_sales'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ class CreatePromotion < ActiveRecord::Migration[5.1]
|
|||||||
create_table :promotions do |t|
|
create_table :promotions do |t|
|
||||||
t.string :promo_code, :limit => 16
|
t.string :promo_code, :limit => 16
|
||||||
|
|
||||||
t.date :promo_start_date, :null => false
|
t.date :promo_start_date, :null => false, :index => true
|
||||||
t.date :promo_end_date, :null => false
|
t.date :promo_end_date, :null => false, :index => true
|
||||||
t.time :promo_start_hour, :null => false
|
t.time :promo_start_hour, :null => false, :index => true
|
||||||
t.time :promo_end_hour, :null => false
|
t.time :promo_end_hour, :null => false, :index => true
|
||||||
t.string :promo_day, :null => false, :default => "[0,1,2,3,4,5,6]"
|
t.string :promo_day, :null => false, :default => "[0,1,2,3,4,5,6]"
|
||||||
t.string :promo_type, :null => false, :default => "Quantity"
|
t.string :promo_type, :null => false, :default => "Quantity"
|
||||||
t.string :original_product
|
t.string :original_product
|
||||||
@@ -14,5 +14,6 @@ class CreatePromotion < ActiveRecord::Migration[5.1]
|
|||||||
t.string :created_by, :null => false
|
t.string :created_by, :null => false
|
||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
|
add_index :promotions, [:promo_start_date, :promo_end_date, :promo_start_hour, :promo_end_hour], name: 'index_promotions'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
class CreateCardSaleTrans < ActiveRecord::Migration[5.1]
|
class CreateCardSaleTrans < ActiveRecord::Migration[5.1]
|
||||||
def change
|
def change
|
||||||
create_table :card_sale_trans do |t|
|
create_table :card_sale_trans do |t|
|
||||||
t.string :sale_id
|
t.string :sale_id, :index=>true
|
||||||
t.date :req_date
|
t.date :req_date
|
||||||
t.time :req_time
|
t.time :req_time
|
||||||
t.float :req_amt, :limit=>50
|
t.float :req_amt, :limit=>50
|
||||||
|
|||||||
Reference in New Issue
Block a user