From 95454b4f0fd76d34bfb6100019bf787268e3c267 Mon Sep 17 00:00:00 2001 From: Min Zeya Phyo Date: Mon, 3 Apr 2017 22:30:27 +0630 Subject: [PATCH] order queue and print station --- app/models/cashier_login_log.rb | 4 ++++ app/models/cashier_terminal.rb | 2 ++ app/models/employee.rb | 2 ++ app/models/order_queue_process_by_zone.rb | 3 +++ app/models/order_queue_process_log.rb | 3 +++ app/models/order_queue_station.rb | 2 ++ app/models/payment_method_setting.rb | 2 ++ ...70403151731_create_order_queue_stations.rb | 16 +++++++++++++++ ...3152157_create_order_queue_process_logs.rb | 13 ++++++++++++ ...600_create_order_queue_process_by_zones.rb | 10 ++++++++++ ...03153001_create_payment_method_settings.rb | 14 +++++++++++++ db/migrate/20170403155230_create_employees.rb | 11 ++++++++++ ...20170403155500_create_cashier_terminals.rb | 20 +++++++++++++++++++ ...0170403155531_create_cashier_login_logs.rb | 12 +++++++++++ db/schema.txt | 18 ++++++++--------- spec/models/cashier_login_log_spec.rb | 5 +++++ spec/models/cashier_terminal_spec.rb | 5 +++++ spec/models/employee_spec.rb | 5 +++++ .../order_queue_process_by_zone_spec.rb | 5 +++++ spec/models/order_queue_process_log_spec.rb | 5 +++++ spec/models/order_queue_station_spec.rb | 5 +++++ spec/models/payment_method_setting_spec.rb | 5 +++++ 22 files changed, 158 insertions(+), 9 deletions(-) create mode 100644 app/models/cashier_login_log.rb create mode 100644 app/models/cashier_terminal.rb create mode 100644 app/models/employee.rb create mode 100644 app/models/order_queue_process_by_zone.rb create mode 100644 app/models/order_queue_process_log.rb create mode 100644 app/models/order_queue_station.rb create mode 100644 app/models/payment_method_setting.rb create mode 100644 db/migrate/20170403151731_create_order_queue_stations.rb create mode 100644 db/migrate/20170403152157_create_order_queue_process_logs.rb create mode 100644 db/migrate/20170403152600_create_order_queue_process_by_zones.rb create mode 100644 db/migrate/20170403153001_create_payment_method_settings.rb create mode 100644 db/migrate/20170403155230_create_employees.rb create mode 100644 db/migrate/20170403155500_create_cashier_terminals.rb create mode 100644 db/migrate/20170403155531_create_cashier_login_logs.rb create mode 100644 spec/models/cashier_login_log_spec.rb create mode 100644 spec/models/cashier_terminal_spec.rb create mode 100644 spec/models/employee_spec.rb create mode 100644 spec/models/order_queue_process_by_zone_spec.rb create mode 100644 spec/models/order_queue_process_log_spec.rb create mode 100644 spec/models/order_queue_station_spec.rb create mode 100644 spec/models/payment_method_setting_spec.rb diff --git a/app/models/cashier_login_log.rb b/app/models/cashier_login_log.rb new file mode 100644 index 00000000..d64860ce --- /dev/null +++ b/app/models/cashier_login_log.rb @@ -0,0 +1,4 @@ +class CashierLoginLog < ApplicationRecord + belongs_to :cashier_station + belongs_to :employee +end diff --git a/app/models/cashier_terminal.rb b/app/models/cashier_terminal.rb new file mode 100644 index 00000000..d99b84a0 --- /dev/null +++ b/app/models/cashier_terminal.rb @@ -0,0 +1,2 @@ +class CashierTerminal < ApplicationRecord +end diff --git a/app/models/employee.rb b/app/models/employee.rb new file mode 100644 index 00000000..d5e0233c --- /dev/null +++ b/app/models/employee.rb @@ -0,0 +1,2 @@ +class Employee < ApplicationRecord +end diff --git a/app/models/order_queue_process_by_zone.rb b/app/models/order_queue_process_by_zone.rb new file mode 100644 index 00000000..0c7fd538 --- /dev/null +++ b/app/models/order_queue_process_by_zone.rb @@ -0,0 +1,3 @@ +class OrderQueueProcessByZone < ApplicationRecord + belongs_to :zone +end diff --git a/app/models/order_queue_process_log.rb b/app/models/order_queue_process_log.rb new file mode 100644 index 00000000..6c3a3a6d --- /dev/null +++ b/app/models/order_queue_process_log.rb @@ -0,0 +1,3 @@ +class OrderQueueProcessLog < ApplicationRecord + belongs_to :order +end diff --git a/app/models/order_queue_station.rb b/app/models/order_queue_station.rb new file mode 100644 index 00000000..c695c076 --- /dev/null +++ b/app/models/order_queue_station.rb @@ -0,0 +1,2 @@ +class OrderQueueStation < ApplicationRecord +end diff --git a/app/models/payment_method_setting.rb b/app/models/payment_method_setting.rb new file mode 100644 index 00000000..1a7f26b1 --- /dev/null +++ b/app/models/payment_method_setting.rb @@ -0,0 +1,2 @@ +class PaymentMethodSetting < ApplicationRecord +end diff --git a/db/migrate/20170403151731_create_order_queue_stations.rb b/db/migrate/20170403151731_create_order_queue_stations.rb new file mode 100644 index 00000000..f5c84269 --- /dev/null +++ b/db/migrate/20170403151731_create_order_queue_stations.rb @@ -0,0 +1,16 @@ +class CreateOrderQueueStations < ActiveRecord::Migration[5.0] + def change + create_table :order_queue_stations do |t| + t.string :station_name, :null => false + t.boolean :is_active, :null => false, :default => false + t.json :processing_items + t.boolean :print_copy, :null => false, :default => false + t.string :printer_name + t.integer :font_size, :null => false, :default => 10 + t.boolean :cut_per_item, :null => false, :default => false + t.boolean :use_alternate_name, :null => false, :default => false + t.string :created_by, :null => false + t.timestamps + end + end +end diff --git a/db/migrate/20170403152157_create_order_queue_process_logs.rb b/db/migrate/20170403152157_create_order_queue_process_logs.rb new file mode 100644 index 00000000..5b855ec5 --- /dev/null +++ b/db/migrate/20170403152157_create_order_queue_process_logs.rb @@ -0,0 +1,13 @@ +class CreateOrderQueueProcessLogs < ActiveRecord::Migration[5.0] + def change + create_table :order_queue_process_logs do |t| + t.references :order, foreign_key: true + t.string :job_status, :default => "new", :null => "false" + t.string :print_status, :default => "new" + t.json :header #{table name, order_type, order_date} + t.json :items #{name, comment, qty} + + t.timestamps + end + end +end diff --git a/db/migrate/20170403152600_create_order_queue_process_by_zones.rb b/db/migrate/20170403152600_create_order_queue_process_by_zones.rb new file mode 100644 index 00000000..d6b7d207 --- /dev/null +++ b/db/migrate/20170403152600_create_order_queue_process_by_zones.rb @@ -0,0 +1,10 @@ +class CreateOrderQueueProcessByZones < ActiveRecord::Migration[5.0] + def change + create_table :order_queue_process_by_zones do |t| + t.references :order_queue_station, :null => false + t.references :zone, :null => false + + t.timestamps + end + end +end diff --git a/db/migrate/20170403153001_create_payment_method_settings.rb b/db/migrate/20170403153001_create_payment_method_settings.rb new file mode 100644 index 00000000..2fea9098 --- /dev/null +++ b/db/migrate/20170403153001_create_payment_method_settings.rb @@ -0,0 +1,14 @@ +class CreatePaymentMethodSettings < ActiveRecord::Migration[5.0] + def change + create_table :payment_method_settings do |t| + t.string :payment_method, :null => false + t.boolean :is_active, :null => false, :default => false + t.string :gateway_communication_type, :null => false, :default => "api" + t.string :gateway_url + t.string :auth_token + t.string :merchant_account_id + + t.timestamps + end + end +end diff --git a/db/migrate/20170403155230_create_employees.rb b/db/migrate/20170403155230_create_employees.rb new file mode 100644 index 00000000..72129195 --- /dev/null +++ b/db/migrate/20170403155230_create_employees.rb @@ -0,0 +1,11 @@ +class CreateEmployees < ActiveRecord::Migration[5.0] + def change + create_table :employees do |t| + t.string :name, :null => false + t.string :role, :null => false, :default => "cashier" + t.string :encrypted_access_code, :null => false + + t.timestamps + end + end +end diff --git a/db/migrate/20170403155500_create_cashier_terminals.rb b/db/migrate/20170403155500_create_cashier_terminals.rb new file mode 100644 index 00000000..9ecddcb3 --- /dev/null +++ b/db/migrate/20170403155500_create_cashier_terminals.rb @@ -0,0 +1,20 @@ +class CreateCashierTerminals < ActiveRecord::Migration[5.0] + def change + create_table :cashier_terminals do |t| + t.string :name, :null => false + t.boolean :is_active, :null => false, :default => true + t.boolean :is_currently_login, :null => false, :default => false + t.string :auto_print_receipt, :null => false, :default => false + t.string :printer_name + t.json :header + t.json :footer + t.string :font + t.string :font_size, :null => false, :default => 10 + t.boolean :show_tax, :null => false, :default => true + t.boolean :show_cashier, :null => false, :default => true + t.boolean :show_guest_info, :null => false, :default => false + + t.timestamps + end + end +end diff --git a/db/migrate/20170403155531_create_cashier_login_logs.rb b/db/migrate/20170403155531_create_cashier_login_logs.rb new file mode 100644 index 00000000..b12f258f --- /dev/null +++ b/db/migrate/20170403155531_create_cashier_login_logs.rb @@ -0,0 +1,12 @@ +class CreateCashierLoginLogs < ActiveRecord::Migration[5.0] + def change + create_table :cashier_login_logs do |t| + t.references :cashier_terminal, foreign_key: true + t.references :employee, foreign_key: true + t.datetime :login_at, :null => false + t.datetime :logout_at + + t.timestamps + end + end +end diff --git a/db/schema.txt b/db/schema.txt index 173289b2..f301b1f8 100644 --- a/db/schema.txt +++ b/db/schema.txt @@ -46,6 +46,7 @@ menu_items { menu_category, order_by, product_code, picture, menu_name, alt_menu variants:[{product_code, name, picture, add_on_price, options {option_name, option_value} }], max_variants_selection: integer, set_menu_items:[menu_items], is_sold_out, is_on_promotion promotion_price, options {option_name, option_value}} +customer {name, company, contact, email, member_id, member_type, member_authentication_code} order { id, date, order_ref, order_source [tablet, order_station, emenu, api], order_type [dine-in, takeaway, delivery],customer_id, item_count, quantity_count, status [new, processing, fulfilled], waiters[], guest_info: {adult_count, child_count, woman_count, man_count}} order_items { order_item_status, product_code, name, qty, price, remark, options , variants: [], set_menu_items :[]} @@ -53,26 +54,25 @@ order_delivery_info {name, address, contact_no, delivery-by [InHouse | YDoor2Doo dine-in-table {table, order, status} room-booking {room, check-in, check-out, reserved_by, status, orders} -order_queue_station {name, is_active, processing_items [product_code]} -order_queue_printer_setting { printer_name, font_size, cut_per_item} -order_queue_log {order_id, job_status [new, completed], header: {table name, order_type, order_date}, items :{name, comment, qty}} +order_queue_station {name, is_active, processing_items [product_code], print_copy: boolean, printer_name, font_size, cut_per_item, use_alternate_name} +order_queue_log {order_id, job_status [new, completed], print_status [], header: {table name, order_type, order_date}, items :{name, comment, qty}} +order_queue_process_by_zone {order_queue_station, zone} -customer {name, company, contact, email, member_id, member_type, member_authentication_code} +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} -sale_order {sale, order} -sale {table, cashier, receipt_no, customer, payment_status, sale_status, total_amount, total_discount, total_tax, grand_total, amount_received} +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} sale_discount {sale, discount_type, discount_value, discount_amount, discount_code} sale_taxes {sale, tax_name, tax_rate, tax_amount} sales_payment {sale, payment_method, payment_amount, payment_reference, payment_status} sales_audit {sale, action, action_by, approved_by, action_at} -sale_receipt_setting {header, font_size, font, footer, show_tax, show_cashier, show_guest_info} -payment_method_settings {payment_method , api_url , auth_token , account_id} +sale_order {sale, order} inventory_journal {product_code, qty, debit, credit, balance, references, stock_entry} stock_entry { who, date, status [new, processing, completed], action [entry | audit] } -lookup {lookup_type, name, value} [status | payment_method ] +lookup {lookup_type, name, value} [status | payment_method | employee_role | payment_status | ] Employee {name, role, access_code, encrypted_code} diff --git a/spec/models/cashier_login_log_spec.rb b/spec/models/cashier_login_log_spec.rb new file mode 100644 index 00000000..8e176e5c --- /dev/null +++ b/spec/models/cashier_login_log_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe CashierLoginLog, type: :model do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/cashier_terminal_spec.rb b/spec/models/cashier_terminal_spec.rb new file mode 100644 index 00000000..b43faa17 --- /dev/null +++ b/spec/models/cashier_terminal_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe CashierTerminal, type: :model do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/employee_spec.rb b/spec/models/employee_spec.rb new file mode 100644 index 00000000..f631c7aa --- /dev/null +++ b/spec/models/employee_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe Employee, type: :model do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/order_queue_process_by_zone_spec.rb b/spec/models/order_queue_process_by_zone_spec.rb new file mode 100644 index 00000000..63bdb5e7 --- /dev/null +++ b/spec/models/order_queue_process_by_zone_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe OrderQueueProcessByZone, type: :model do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/order_queue_process_log_spec.rb b/spec/models/order_queue_process_log_spec.rb new file mode 100644 index 00000000..21084f54 --- /dev/null +++ b/spec/models/order_queue_process_log_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe OrderQueueProcessLog, type: :model do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/order_queue_station_spec.rb b/spec/models/order_queue_station_spec.rb new file mode 100644 index 00000000..8649fb73 --- /dev/null +++ b/spec/models/order_queue_station_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe OrderQueueStation, type: :model do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/models/payment_method_setting_spec.rb b/spec/models/payment_method_setting_spec.rb new file mode 100644 index 00000000..a013eaef --- /dev/null +++ b/spec/models/payment_method_setting_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe PaymentMethodSetting, type: :model do + pending "add some examples to (or delete) #{__FILE__}" +end