merge with master

This commit is contained in:
PhyoTheingi
2017-06-07 10:33:30 +06:30
71 changed files with 1115 additions and 248 deletions

View File

@@ -1,6 +1,7 @@
class CreateCustomers < ActiveRecord::Migration[5.0]
def change
create_table :customers 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 :name, :null => false
t.string :company
t.string :contact_no

View File

@@ -1,10 +1,11 @@
class CreateOrders < ActiveRecord::Migration[5.0]
def change
create_table :orders 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.datetime :date, :null => false
t.string :source, :null => false, :default => "emenu"
t.string :order_type, :null => false, :default => "dine-in"
t.references :customer, foreign_key: true
t.string :customer_id, foreign_key: true, :limit => 16
t.integer :item_count, :null => false, :default => 0
t.integer :quantity_count, :null => false, :default => 0
t.string :status, :null => false, :default => "new"

View File

@@ -1,7 +1,8 @@
class CreateOrderItems < ActiveRecord::Migration[5.0]
def change
create_table :order_items do |t|
t.references :order, foreign_key: true, :null => false
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_id, foreign_key: true, :null => false, :limit => 16
t.string :order_item_status, :null => false, :default => "new"
t.string :item_order_by #person who order this
t.string :item_code, :null => false

View File

@@ -1,6 +1,8 @@
class CreateCashierLoginLogs < ActiveRecord::Migration[5.0]
def change
create_table :cashier_login_logs 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.references :cashier_terminal, foreign_key: true
t.references :employee, foreign_key: true
t.datetime :login_at, :null => false

View File

@@ -1,13 +1,15 @@
class CreateSales < ActiveRecord::Migration[5.0]
def change
create_table :sales 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.integer :cashier_id, :index => true
t.string :cashier_name
t.string :requested_by, :null => false
t.datetime :requested_at, :null => false
t.string :receipt_no, :null => false
t.datetime :receipt_date, :null => false
t.references :customer, foreign_key: true
t.string :customer_id, foreign_key: true, :limit => 16
t.string :payment_status, :null => false, :default => "outstanding"
t.string :sale_status, :null => false, :default => "new"
t.decimal :total_amount, :precision => 10, :scale => 2, :null => false, :default => 0.00

View File

@@ -1,7 +1,8 @@
class CreateSaleItems < ActiveRecord::Migration[5.0]
def change
create_table :sale_items do |t|
t.references :sale, foreign_key: true
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_id, foreign_key: true, :limit => 16
t.string :product_code, :null => false
t.string :product_name, :null => false
t.string :remark

View File

@@ -1,7 +1,9 @@
class CreateSaleTaxes < ActiveRecord::Migration[5.0]
def change
create_table :sale_taxes do |t|
t.references :sale, foreign_key: true
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_id, foreign_key: true, :limit => 16
t.string :tax_name, :null => false
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

View File

@@ -1,13 +1,15 @@
class CreateSalePayments < ActiveRecord::Migration[5.0]
def change
create_table :sale_payments do |t|
t.references :sale, foreign_key: true
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_id, foreign_key: true, :limit => 16
t.string :payment_method, :null => false, :default => "cash"
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.string :payment_reference
t.string :payment_status, :null => false, :default => "new"
t.timestamps
end
end

View File

@@ -1,8 +1,10 @@
class CreateSaleOrders < ActiveRecord::Migration[5.0]
def change
create_table :sale_orders do |t|
t.references :sale, foreign_key: true
t.references :order, foreign_key: true
create_table :sale_orders, :id => false do |t|
t.primary_key :sale_order_id #custom primary key - to ensure consistence for cloud syncing
t.string :sale_id, foreign_key: true,:limit => 16
t.string :order_id, foreign_key: true, :limit => 16
t.timestamps
end

View File

@@ -1,7 +1,9 @@
class CreateSaleAudits < ActiveRecord::Migration[5.0]
def change
create_table :sale_audits do |t|
t.references :sale, foreign_key: true
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_id, foreign_key: true, :limit => 16
t.string :action, :null => false
t.datetime :action_at, :null => false
t.string :action_by, :null => false

View File

@@ -1,6 +1,8 @@
class CreateBookings < ActiveRecord::Migration[5.0]
def change
create_table :bookings 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.references :dining_facility, foreign_key: true
t.string :type, :null => false, :default => "Table"
t.datetime :checkin_at, :null => false
@@ -10,7 +12,8 @@ class CreateBookings < ActiveRecord::Migration[5.0]
t.datetime :reserved_at
t.string :reserved_by
t.string :booking_status, :null => false, :default => "new"
t.references :sale, foreign_key: true
t.string :sale_id, foreign_key: true, :limit => 16
t.string :customer_id, foreign_key: true, :limit => 16
t.timestamps
end

View File

@@ -1,9 +1,10 @@
class CreateAssignedOrderItems < ActiveRecord::Migration[5.0]
def change
create_table :assigned_order_items 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 :item_code, :null => false, :index => true
t.references :order_queue_station, foreign_key: true
t.references :order, foreign_key: true
t.string :order_id, foreign_key: true, :limit => 16
t.boolean :print_status
t.boolean :delivery_status

View File

@@ -1,8 +1,10 @@
class CreateBookingOrders < ActiveRecord::Migration[5.0]
def change
create_table :booking_orders do |t|
t.references :booking, foreign_key: true
t.references :order, foreign_key: true
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.primary_key :booking_order_id
t.string :booking_id, foreign_key: true, :limit => 16
t.string :order_id, foreign_key: true, :limit => 16
t.timestamps
end

View File

@@ -137,3 +137,7 @@ zone_queue_station = OrderQueueProcessByZone.create({order_queue_station: zone_o
#Create Adminstrator employee
admin_employee = Employee.create({name: "Administrator", role: "Administrator", password: "99999", emp_id:"999", created_by: "SYSTEM DEFAULT"})
#Account for Menu Item Type (eg: Food, Beverage)
food = Account.create({title: "Food", account_type: "0"})
beverage = Account.create({title: "Beverage", account_type: "1"})