final db structure
This commit is contained in:
25
db/migrate/20170403160742_create_sales.rb
Normal file
25
db/migrate/20170403160742_create_sales.rb
Normal file
@@ -0,0 +1,25 @@
|
||||
class CreateSales < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
create_table :sales do |t|
|
||||
t.integer :cashier_id, :null => false, :index => true
|
||||
t.string :cashier_name, :null => false
|
||||
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 :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
|
||||
t.decimal :total_discount, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||
t.decimal :total_tax, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||
t.string :tax_type, :null => false , :dfault => "exclusive_tax"
|
||||
t.decimal :grant_total, :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_changed, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
17
db/migrate/20170403161857_create_sale_items.rb
Normal file
17
db/migrate/20170403161857_create_sale_items.rb
Normal file
@@ -0,0 +1,17 @@
|
||||
class CreateSaleItems < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
create_table :sale_items do |t|
|
||||
t.references :sale, foreign_key: true
|
||||
t.string :product_code, :null => false
|
||||
t.string :product_name, :null => false
|
||||
t.string :remark
|
||||
t.decimal :qty, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||
t.decimal :unit_price, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||
t.decimal :taxable_price, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||
t.decimal :price, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||
t.boolean :is_taxable, :null => false, :default => true
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
13
db/migrate/20170403162221_create_sale_discounts.rb
Normal file
13
db/migrate/20170403162221_create_sale_discounts.rb
Normal file
@@ -0,0 +1,13 @@
|
||||
class CreateSaleDiscounts < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
create_table :sale_discounts do |t|
|
||||
t.references :sale, foreign_key: true
|
||||
t.string :discount_type, :null => false
|
||||
t.decimal :discount_value, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||
t.decimal :discount_amount, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||
t.string :discount_code
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
19
db/migrate/20170403162844_create_sale_discount_items.rb
Normal file
19
db/migrate/20170403162844_create_sale_discount_items.rb
Normal file
@@ -0,0 +1,19 @@
|
||||
class CreateSaleDiscountItems < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
create_table :sale_discount_items do |t|
|
||||
t.references :sale, foreign_key: true
|
||||
t.string :product_code, :null => false
|
||||
t.string :product_name, :null => false
|
||||
t.decimal :unit_price, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||
t.decimal :discounted_price, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||
t.decimal :qty, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||
t.string :remark
|
||||
t.decimal :price, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||
t.string :discount_type, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||
t.decimal :discounted_value, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||
t.boolean :is_taxable, :null => false, :default => true
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
12
db/migrate/20170403163219_create_sale_taxes.rb
Normal file
12
db/migrate/20170403163219_create_sale_taxes.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
class CreateSaleTaxes < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
create_table :sale_taxes do |t|
|
||||
t.references :sale, foreign_key: true
|
||||
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
|
||||
t.boolean :inclusive, :default => false, :null => false
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
14
db/migrate/20170403163734_create_sale_payments.rb
Normal file
14
db/migrate/20170403163734_create_sale_payments.rb
Normal file
@@ -0,0 +1,14 @@
|
||||
class CreateSalePayments < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
create_table :sale_payments do |t|
|
||||
t.references :sale, foreign_key: true
|
||||
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
|
||||
end
|
||||
10
db/migrate/20170403174029_create_sale_orders.rb
Normal file
10
db/migrate/20170403174029_create_sale_orders.rb
Normal file
@@ -0,0 +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
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
14
db/migrate/20170403174111_create_sale_audits.rb
Normal file
14
db/migrate/20170403174111_create_sale_audits.rb
Normal file
@@ -0,0 +1,14 @@
|
||||
class CreateSaleAudits < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
create_table :sale_audits do |t|
|
||||
t.references :sale, foreign_key: true
|
||||
t.string :action, :null => false
|
||||
t.datetime :action_at, :null => false
|
||||
t.string :action_by, :null => false
|
||||
t.string :approved_by, :null => false
|
||||
t.datetime :approved_by, :null => false
|
||||
t.string :remark
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
9
db/migrate/20170403174309_create_lookups.rb
Normal file
9
db/migrate/20170403174309_create_lookups.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
class CreateLookups < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
create_table :lookups do |t|
|
||||
t.string :lookup_type, :null => false
|
||||
t.string :name, :null => false
|
||||
t.string :value, :null => false
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -59,7 +59,10 @@ order_queue_log {order_id, job_status [new, completed], print_status [], header:
|
||||
order_queue_process_by_zone {order_queue_station, zone}
|
||||
|
||||
payment_method_settings {payment_method, is_active, api_url , auth_token , account_id}
|
||||
cashier_terminals {name:string, is_active, print_name:string, header, font_size, font, footer, show_tax, show_cashier, show_guest_info}
|
||||
Employee {name, role, access_code, encrypted_code}
|
||||
|
||||
cashier_terminals {name:string, is_active,is_login_in, print_name:string, header, font_size, font, footer, show_tax, show_cashier, show_guest_info}
|
||||
cashier_login_logs {cashier_station, employee, login_at, logout_at}
|
||||
|
||||
sale {cashier, requested_by, receipt_no, customer, payment_status, sale_status, total_amount, total_discount, total_tax, tax_type, grand_total, amount_received, amount_changed}
|
||||
sale_items {sale, product_code, product_name, remark, qty, unit_price, taxable_amount, price}
|
||||
@@ -74,5 +77,3 @@ inventory_journal {product_code, qty, debit, credit, balance, references, stock_
|
||||
stock_entry { who, date, status [new, processing, completed], action [entry | audit] }
|
||||
|
||||
lookup {lookup_type, name, value} [status | payment_method | employee_role | payment_status | ]
|
||||
|
||||
Employee {name, role, access_code, encrypted_code}
|
||||
|
||||
Reference in New Issue
Block a user