fixed for pm key changed

This commit is contained in:
Yan
2017-06-05 18:52:19 +06:30
parent f004db9b19
commit f1877408be
16 changed files with 40 additions and 10 deletions

View File

@@ -36,7 +36,7 @@ class Oqs::HomeController < BaseOqsController
# Query for OQS with status
def queue_items_query(status)
AssignedOrderItem.select("assigned_order_items.assigned_order_item_id, oqs.station_name, oqs.is_active, df.name as zone, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, cus.name as customer_name, odt.created_at")
.joins("join order_queue_process_by_zones as oqpz ON oqpz.order_queue_station_id = assigned_order_items.order_queue_station_id
.joins(" left join order_queue_process_by_zones as oqpz ON oqpz.order_queue_station_id = assigned_order_items.order_queue_station_id
left join dining_facilities as df on df.zone_id = oqpz.zone_id
left join order_queue_stations as oqs ON oqs.id = assigned_order_items.order_queue_station_id
left join orders as od ON od.order_id = assigned_order_items.order_id

View File

@@ -5,7 +5,8 @@ class OrderQueueProcessorJob < ApplicationJob
# Do something later
#Order ID
order = Order.find(order_id)
puts order_id
puts order
#Loop through the order stations and process the items
#Execute orders and send to order stations
if order

View File

@@ -1,6 +1,9 @@
class AssignedOrderItem < ApplicationRecord
before_create :generate_custom_id
#primary key - need to be unique
self.primary_key = "assigned_order_item_id"
belongs_to :order
belongs_to :order_queue_station

View File

@@ -1,6 +1,8 @@
class Booking < ApplicationRecord
before_create :generate_custom_id
class Booking < ApplicationRecord
self.primary_key = "booking_id"
#primary key - need to be unique
before_create :generate_custom_id
belongs_to :dining_facility, :optional => true
belongs_to :sale, :optional => true

View File

@@ -1,5 +1,5 @@
class BookingOrder < ApplicationRecord
#primary key - need to be unique
#primary key - need to be unique
belongs_to :booking
belongs_to :order

View File

@@ -1,4 +1,6 @@
class Customer < ApplicationRecord
self.primary_key = "customer_id"
before_create :generate_custom_id
has_many :orders
has_many :sales

View File

@@ -1,4 +1,6 @@
class Order < ApplicationRecord
self.primary_key = "order_id"
#primary key - need to be unique
before_create :generate_custom_id
before_create :set_order_date

View File

@@ -1,4 +1,6 @@
class OrderItem < ApplicationRecord
self.primary_key = "order_items_id"
#primary key - need to be unique
before_create :generate_custom_id

View File

@@ -1,5 +1,8 @@
class Sale < ApplicationRecord
self.primary_key = "sale_id"
#primary key - need to be unique generated for multiple shops
before_create :generate_custom_id
#before_create :generate_receipt_no
belongs_to :cashier, :optional => true

View File

@@ -1,5 +1,8 @@
class SaleAudit < ApplicationRecord
#primary key - need to be unique generated for multiple shops
self.primary_key = "sale_audit_id"
#primary key - need to be unique generated for SaleAudit
before_create :generate_custom_id
belongs_to :sale

View File

@@ -1,4 +1,6 @@
class SaleItem < ApplicationRecord
self.primary_key = "sale_item_id"
#primary key - need to be unique generated for multiple shops
before_create :generate_custom_id

View File

@@ -1,5 +1,7 @@
class SaleOrder < ApplicationRecord
#primary key - need to be unique generated for multiple shops
self.primary_key = "sale_order_id"
#primary key - need to be unique generated for multiple shops
before_create :generate_custom_id
belongs_to :sale

View File

@@ -1,4 +1,6 @@
class SalePayment < ApplicationRecord
self.primary_key = "sale_payment_id"
#primary key - need to be unique generated for multiple shops
before_create :generate_custom_id

View File

@@ -1,5 +1,7 @@
class SaleTax < ApplicationRecord
#primary key - need to be unique generated for multiple shops
self.primary_key = "sale_tax_id"
#primary key - need to be unique generated for multiple shops
before_create :generate_custom_id
belongs_to :sale

View File

@@ -1,7 +1,7 @@
class CreateAssignedOrderItems < ActiveRecord::Migration[5.0]
def change
create_table :assigned_order_items, :id => false, :primary_key => :assigned_order_item_id do |t|
t.string :assigned_order_item_id, :limit => 16, :null => false, :index => true, :unique => true #custom primary key - to ensure consistence for cloud syncing
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.string :order_id, foreign_key: true, :limit => 16

View File

@@ -133,3 +133,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"})