diff --git a/app/models/lookup.rb b/app/models/lookup.rb index 40b95cb9..7b17006d 100644 --- a/app/models/lookup.rb +++ b/app/models/lookup.rb @@ -1,2 +1,15 @@ class Lookup < ApplicationRecord + + def available_types + {'Employee Roles' => 'employee_roles', + 'Dining Facilities Status' => 'dining_facilities_status', + 'Menu Item Type' => 'menu_item_type', + 'Order Type' => 'order_type', + 'Order Source' => 'order_source', + 'Order Status' => 'order_status', + 'Order Item Status' => 'order_item_status', + 'Sale Status' => 'sales_status', + 'Payment Status' => 'payment_status', + 'Payment Methods' => 'payment_methods'} + end end diff --git a/app/models/tax_profile.rb b/app/models/tax_profile.rb new file mode 100644 index 00000000..c7769034 --- /dev/null +++ b/app/models/tax_profile.rb @@ -0,0 +1,2 @@ +class TaxProfile < ApplicationRecord +end diff --git a/db/migrate/20170402084230_create_menu_item_instances.rb b/db/migrate/20170402084230_create_menu_item_instances.rb index 64dd1e13..5f50be93 100644 --- a/db/migrate/20170402084230_create_menu_item_instances.rb +++ b/db/migrate/20170402084230_create_menu_item_instances.rb @@ -4,10 +4,10 @@ class CreateMenuItemInstances < ActiveRecord::Migration[5.0] t.references :menu_item, :foreign_key => true, :null => false t.string :item_instance_code, :null => false t.json :attributes - t.decimal :price, :null => false + t.decimal :price,:precision => 10, :scale => 2, :null => false, :default => 0.00 t.boolean :is_available, :null => false, :default => true t.boolean :is_on_promotion, :null => false, :default => false - t.decimal :promotion_price, :null => false, :default => false + t.decimal :promotion_price, :precision => 10, :scale => 2, :null => false, :default => 0.00 t.timestamps end end diff --git a/db/migrate/20170403140820_create_order_items.rb b/db/migrate/20170403140820_create_order_items.rb index 537178d0..43dc7bc5 100644 --- a/db/migrate/20170403140820_create_order_items.rb +++ b/db/migrate/20170403140820_create_order_items.rb @@ -5,7 +5,7 @@ class CreateOrderItems < ActiveRecord::Migration[5.0] t.string :order_item_status, :null => false, :default => "new" t.string :item_code, :null => false t.string :item_name, :null => false - t.integer :qty, :null => false + t.decimal :qty, :precision => 10, :scale => 2, :null => false, :default => 0.00 t.string :item_order_by #person who order this t.string :remark t.string :options diff --git a/db/migrate/20170403142424_create_dining_facilities.rb b/db/migrate/20170403142424_create_dining_facilities.rb index 3e250a54..788747d8 100644 --- a/db/migrate/20170403142424_create_dining_facilities.rb +++ b/db/migrate/20170403142424_create_dining_facilities.rb @@ -3,6 +3,7 @@ class CreateDiningFacilities < ActiveRecord::Migration[5.0] create_table :dining_facilities do |t| t.references :zone, foreign_key: true t.string :name, :null => false + t.string :status, :null => false, :default => "available" t.string :type, :null => false, :default => "table" t.integer :seater, :null => false, :default => 2 t.integer :order_by diff --git a/db/migrate/20170403144732_create_room_bookings.rb b/db/migrate/20170403144732_create_room_bookings.rb index 16f17875..bc339585 100644 --- a/db/migrate/20170403144732_create_room_bookings.rb +++ b/db/migrate/20170403144732_create_room_bookings.rb @@ -2,7 +2,7 @@ class CreateRoomBookings < ActiveRecord::Migration[5.0] def change create_table :room_bookings do |t| t.references :room, :null => false - t.datetime :checkin_at + t.datetime :checkin_at, :null => false t.datetime :checkout_at t.string :checkout_by t.datetime :reserved_at diff --git a/db/migrate/20170403145042_create_room_orders.rb b/db/migrate/20170403145042_create_room_orders.rb index 00f54545..e8cfb4be 100644 --- a/db/migrate/20170403145042_create_room_orders.rb +++ b/db/migrate/20170403145042_create_room_orders.rb @@ -1,7 +1,7 @@ class CreateRoomOrders < ActiveRecord::Migration[5.0] def change create_table :room_orders do |t| - t.references :room, foreign_key: true + t.references :room t.references :orders, foreign_key: true t.string :order_by diff --git a/db/migrate/20170403183755_create_tax_profiles.rb b/db/migrate/20170403183755_create_tax_profiles.rb new file mode 100644 index 00000000..66f7f83a --- /dev/null +++ b/db/migrate/20170403183755_create_tax_profiles.rb @@ -0,0 +1,12 @@ +class CreateTaxProfiles < ActiveRecord::Migration[5.0] + def change + create_table :tax_profiles do |t| + t.string :name, :null => false + t.decimal :rate, :precision => 10, :scale => 2, :null => false, :default => 0.00 + t.boolean :inclusive, :null => false, :default => false + t.integer :order_by, :null => false, :default => 1 + + t.timestamps + end + end +end diff --git a/db/schema.txt b/db/schema.txt index a7f371fd..7925bb57 100644 --- a/db/schema.txt +++ b/db/schema.txt @@ -64,6 +64,7 @@ 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} +tax_profile {name, rate, inclusive, order_by} 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} sale_discount_items {sale, product_code, product_name, regular_price, discounted_price, qty, taxable_amount, price, discount_type :[nett, percentage],discount_value} diff --git a/db/seeds.rb b/db/seeds.rb index 1beea2ac..5379d9d3 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -5,3 +5,67 @@ # # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) # Character.create(name: 'Luke', movie: movies.first) + +payment_methods = Lookup.create([{lookup_type:'payment_methods', name: 'Cash', value: 'cash'}, + {lookup_type:'payment_methods', name: 'CreditNote', value: 'creditnote'}, + {lookup_type:'payment_methods', name: 'Card - VISA', value: 'visa'}, + {lookup_type:'payment_methods', name: 'Card - MASTER', value: 'master'}, + {lookup_type:'payment_methods', name: 'Card - JCB', value: 'jcb'}, + {lookup_type:'payment_methods', name: 'Card - UnionPay', value: 'unionpay'}, + {lookup_type:'payment_methods', name: 'Card - MPU', value: 'jcb'}, + {lookup_type:'payment_methods', name: 'Vochure', value: 'vochure'}, + {lookup_type:'payment_methods', name: 'Giftcard', value: 'gift'}]) + +payment_status = Lookup.create([{lookup_type:'payment_status', name: 'New', value: 'new'}, + {lookup_type:'payment_status', name: 'paid', value: 'paid'}, + {lookup_type:'payment_status', name: 'Fail', value: 'fail'}]) + +sales_status = Lookup.create([{lookup_type:'sales_status', name: 'New', value: 'new'}, + {lookup_type:'sales_status', name: 'Void', value: 'void'}, + {lookup_type:'sales_status', name: 'Completed', value: 'completed'}]) + +order_status = Lookup.create([{lookup_type:'order_status', name: 'New', value: 'new'}, + {lookup_type:'order_status', name: 'Completed', value: 'completed'}]) + +order_item_status = Lookup.create([{lookup_type:'order_status', name: 'New', value: 'new'}, + {lookup_type:'order_status', name: 'Processing', value: 'processing'}, + {lookup_type:'order_status', name: 'Served', value: 'served'}]) + +#order_source [tablet, order_station, emenu, api] +order_source = Lookup.create([{lookup_type:'order_source', name: 'API', value: 'api'}, + {lookup_type:'order_source', name: 'Tablet', value: 'tablet'}, + {lookup_type:'order_source', name: 'EMenu', value: 'emenu'}, + {lookup_type:'order_source', name: 'Order Station', value: 'order_station'}]) + +#order_type [dine-in, takeaway, delivery] +order_type = Lookup.create([{lookup_type:'order_type', name: 'Dine-in', value: 'dine-in'}, + {lookup_type:'order_type', name: 'Takeaway', value: 'takeaway'}, + {lookup_type:'order_type', name: 'Delivery', value: 'delivery'}]) + +#menu_item_type:[simple| set| DIY] +menu_item_type = Lookup.create([{lookup_type:'menu_item_type', name: 'SIMPLE', value: 'simple'}, + {lookup_type:'menu_item_type', name: 'Set Menu', value: 'set_menu'}, + {lookup_type:'menu_item_type', name: 'DIY', value: 'diy'}]) + +#dining_facilities:[available| reserved | occupied| cleaning] +dining_facilities_status = Lookup.create([{lookup_type:'dining_facilities_status', name: 'Available', value: 'available'}, + {lookup_type:'dining_facilities_status', name: 'Reserved', value: 'reserved'}, + {lookup_type:'dining_facilities_status', name: 'Occupied', value: 'occupied'}, + {lookup_type:'dining_facilities_status', name: 'Cleaning', value: 'cleaning'}]) + +#Employee Roles +employee_roles = Lookup.create([{lookup_type:'employee_roles', name: 'Cashier', value: 'cashier'}, + {lookup_type:'employee_roles', name: 'Waiter', value: 'waiter'}, + {lookup_type:'employee_roles', name: 'Supervisour', value: 'supervisour'}, + {lookup_type:'employee_roles', name: 'Manager', value: 'manager'}, + {lookup_type:'employee_roles', name: 'Administrator', value: 'Administrator'}]) + + +#WALK CUSTOMER - Default CUSTOMER (take key 1) +customer = Customer.create({id:1, name:"WALK-IN", contact_no:"000000000"}) + +#Default ZOne +zone = Zone.create({id: 1, name: "Default Zone", is_active:true, created_by: "SYSTEM DEFAULT"}) + +#Default dining_facilities +dining_facilities = DiningFacilities.create({id:1, zone: zone, status:"available", type: "table", seater: 2 , order_by:1, created_by:"SYSTEM DEFAULT"}) diff --git a/spec/models/tax_profile_spec.rb b/spec/models/tax_profile_spec.rb new file mode 100644 index 00000000..2343574b --- /dev/null +++ b/spec/models/tax_profile_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe TaxProfile, type: :model do + pending "add some examples to (or delete) #{__FILE__}" +end