update query data for origami
This commit is contained in:
3
Gemfile
3
Gemfile
@@ -12,6 +12,9 @@ gem 'rails', '~> 5.1.0'
|
|||||||
|
|
||||||
gem 'mysql2', '>= 0.3.18', '< 0.5'
|
gem 'mysql2', '>= 0.3.18', '< 0.5'
|
||||||
|
|
||||||
|
#Use PosgreSQL
|
||||||
|
# gem 'pg'
|
||||||
|
|
||||||
# redis server for cable
|
# redis server for cable
|
||||||
# gem 'redis', '~> 3.0'
|
# gem 'redis', '~> 3.0'
|
||||||
|
|
||||||
|
|||||||
@@ -80,4 +80,14 @@ $(document).ready(function(){
|
|||||||
success: function(data){ }
|
success: function(data){ }
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#print_order_summary').on('click',function(){
|
||||||
|
var assigned_item_id=$('.selected-item').children('.card-block').children('.assigned-order-item').text();
|
||||||
|
var params = { 'id':assigned_item_id };
|
||||||
|
$.ajax({
|
||||||
|
type: 'GET',
|
||||||
|
url: '/oqs/print/print_order_summary/'+assigned_item_id,
|
||||||
|
success: function(data){ }
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class Api::OrdersController < Api::ApiController
|
|||||||
@order = Order.new
|
@order = Order.new
|
||||||
@order.source = params[:order_source]
|
@order.source = params[:order_source]
|
||||||
@order.order_type = params[:order_type]
|
@order.order_type = params[:order_type]
|
||||||
@order.customer_id = params[:customer_id]
|
@order.customer_id = params[:customer_id] == ""? "CUS-000000000001" : params[:customer_id] # for no customer id from mobile
|
||||||
@order.items = params[:order_items]
|
@order.items = params[:order_items]
|
||||||
@order.guest = params[:guest_info]
|
@order.guest = params[:guest_info]
|
||||||
@order.table_id = params[:table_id]
|
@order.table_id = params[:table_id]
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ class Crm::CustomersController < ApplicationController
|
|||||||
# GET /crm/customers
|
# GET /crm/customers
|
||||||
# GET /crm/customers.json
|
# GET /crm/customers.json
|
||||||
def index
|
def index
|
||||||
@crm_customers = Crm::Customer.all
|
@crm_customers = Customer.all
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET /crm/customers/1
|
# GET /crm/customers/1
|
||||||
@@ -14,7 +14,7 @@ class Crm::CustomersController < ApplicationController
|
|||||||
|
|
||||||
# GET /crm/customers/new
|
# GET /crm/customers/new
|
||||||
def new
|
def new
|
||||||
@crm_customer = Crm::Customer.new
|
@crm_customer = Customer.new
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET /crm/customers/1/edit
|
# GET /crm/customers/1/edit
|
||||||
@@ -24,7 +24,7 @@ class Crm::CustomersController < ApplicationController
|
|||||||
# POST /crm/customers
|
# POST /crm/customers
|
||||||
# POST /crm/customers.json
|
# POST /crm/customers.json
|
||||||
def create
|
def create
|
||||||
@crm_customer = Crm::Customer.new(crm_customer_params)
|
@crm_customer = Customer.new(crm_customer_params)
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @crm_customer.save
|
if @crm_customer.save
|
||||||
@@ -64,7 +64,7 @@ class Crm::CustomersController < ApplicationController
|
|||||||
private
|
private
|
||||||
# Use callbacks to share common setup or constraints between actions.
|
# Use callbacks to share common setup or constraints between actions.
|
||||||
def set_crm_customer
|
def set_crm_customer
|
||||||
@crm_customer = Crm::Customer.find(params[:id])
|
@crm_customer = Customer.find(params[:id])
|
||||||
end
|
end
|
||||||
|
|
||||||
# Never trust parameters from the scary internet, only allow the white list through.
|
# Never trust parameters from the scary internet, only allow the white list through.
|
||||||
|
|||||||
@@ -35,15 +35,15 @@ class Oqs::HomeController < BaseOqsController
|
|||||||
|
|
||||||
# Query for OQS with status
|
# Query for OQS with status
|
||||||
def queue_items_query(status)
|
def queue_items_query(status)
|
||||||
AssignedOrderItem.select("assigned_order_items.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")
|
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("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 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 order_queue_stations as oqs ON oqs.id = assigned_order_items.order_queue_station_id
|
||||||
left join orders as od ON od.id = assigned_order_items.order_id
|
left join orders as od ON od.order_id = assigned_order_items.order_id
|
||||||
left join order_items as odt ON odt.item_code = assigned_order_items.item_code
|
left join order_items as odt ON odt.item_code = assigned_order_items.item_code
|
||||||
left join customers as cus ON cus.id = od.customer_id")
|
left join customers as cus ON cus.customer_id = od.customer_id")
|
||||||
.where("assigned_order_items.delivery_status = #{status}")
|
.where("assigned_order_items.delivery_status = #{status}")
|
||||||
.group("assigned_order_items.id")
|
.group("assigned_order_items.assigned_order_item_id")
|
||||||
.order("odt.item_name DESC")
|
.order("odt.item_name DESC")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ class Oqs::PrintController < ApplicationController
|
|||||||
def print
|
def print
|
||||||
unique_code="OrderItemPdf"
|
unique_code="OrderItemPdf"
|
||||||
assigned_item_id=params[:id]
|
assigned_item_id=params[:id]
|
||||||
assigned_order_item=AssignedOrderItem.select("order_id, item_code").where('id='+assigned_item_id)
|
assigned_order_item=AssignedOrderItem.select("order_id, item_code").where('assigned_order_item_id='+assigned_item_id)
|
||||||
|
|
||||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||||
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
||||||
@@ -13,4 +13,19 @@ class Oqs::PrintController < ApplicationController
|
|||||||
assigned_item.print_status=true
|
assigned_item.print_status=true
|
||||||
assigned_item.save
|
assigned_item.save
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def print_order_summary
|
||||||
|
unique_code="OrderSummaryPdf"
|
||||||
|
assigned_item_id=params[:id]
|
||||||
|
assigned_order_item=AssignedOrderItem.select("order_id").where('assigned_order_item_id='+assigned_item_id)
|
||||||
|
|
||||||
|
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||||
|
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
||||||
|
order_queue_printer.print_order_summary(print_settings,assigned_order_item[0].order_id)
|
||||||
|
|
||||||
|
# update print status when complete click
|
||||||
|
assigned_item=AssignedOrderItem.find(assigned_item_id)
|
||||||
|
assigned_item.print_status=true
|
||||||
|
assigned_item.save
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -3,13 +3,15 @@ class Origami::RequestBillsController < BaseOrigamiController
|
|||||||
@sale = Sale.new
|
@sale = Sale.new
|
||||||
|
|
||||||
booking_id = params[:id]
|
booking_id = params[:id]
|
||||||
check_booking = Booking.find_by_id(booking_id)
|
check_booking = Booking.find_by_booking_id(booking_id)
|
||||||
if check_booking.sale_id.nil?
|
if check_booking.sale_id.nil?
|
||||||
#check if it doesn't exist
|
#check if it doesn't exist
|
||||||
@status = @sale.generate_invoice_from_booking(check_booking.id,current_login_employee.name)
|
@status = @sale.generate_invoice_from_booking(check_booking.id,current_login_employee.name)
|
||||||
@sale_data = Sale.find_by_id(check_booking.sale_id)
|
@sale_data = Sale.find_by_sale_id(check_booking.sale_id)
|
||||||
|
@sale_items = SaleItem.where("sale_id=?",check_booking.sale_id)
|
||||||
|
else
|
||||||
|
@sale_data = Sale.find_by_sale_id(check_booking.sale_id)
|
||||||
@sale_items = SaleItem.where("sale_id=?",check_booking.sale_id)
|
@sale_items = SaleItem.where("sale_id=?",check_booking.sale_id)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
unique_code="ReceiptBillPdf"
|
unique_code="ReceiptBillPdf"
|
||||||
@@ -21,4 +23,5 @@ class Origami::RequestBillsController < BaseOrigamiController
|
|||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class Settings::MenuItemInstancesController < ApplicationController
|
|||||||
category = MenuCategory.find(catID.menu_category_id)
|
category = MenuCategory.find(catID.menu_category_id)
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @settings_menu_item_instances.save
|
if @settings_menu_item_instances.save
|
||||||
@settings_menu_item_instances.item_attributes = params[:menu_item_instance][:item_attributes]
|
@settings_menu_item_instances.item_attributes = params[:menu_item_instance][:item_attributes].reject(&:blank?)
|
||||||
@settings_menu_item_instances.save
|
@settings_menu_item_instances.save
|
||||||
format.html { redirect_to settings_menu_category_simple_menu_item_path(category,catID), notice: 'Menu item instance was successfully created.' }
|
format.html { redirect_to settings_menu_category_simple_menu_item_path(category,catID), notice: 'Menu item instance was successfully created.' }
|
||||||
format.json { render :show, status: :created, location: @settings_menu_item_instances }
|
format.json { render :show, status: :created, location: @settings_menu_item_instances }
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
class MenuItem < ApplicationRecord
|
class MenuItem < ApplicationRecord
|
||||||
|
|
||||||
#belongs_to :account
|
#belongs_to :account
|
||||||
|
|
||||||
belongs_to :menu_category, :optional => true
|
belongs_to :menu_category, :optional => true
|
||||||
has_many :menu_item_instances
|
has_many :menu_item_instances
|
||||||
belongs_to :parent, :class_name => "MenuItem", foreign_key: "menu_item_id", :optional => true
|
belongs_to :parent, :class_name => "MenuItem", foreign_key: "menu_item_id", :optional => true
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ class Order < ApplicationRecord
|
|||||||
|
|
||||||
self.adding_line_items
|
self.adding_line_items
|
||||||
#Add Order Table and Room relation afrer order creation
|
#Add Order Table and Room relation afrer order creation
|
||||||
BookingOrder.create({:booking_id => booking.id, :order => self})
|
BookingOrder.create({:booking_id => booking.booking_id, :order => self})
|
||||||
|
|
||||||
#Send order to queue one it done!
|
#Send order to queue one it done!
|
||||||
process_order_queue
|
process_order_queue
|
||||||
@@ -209,75 +209,67 @@ class Order < ApplicationRecord
|
|||||||
#Origami: Cashier : to view order type Table
|
#Origami: Cashier : to view order type Table
|
||||||
|
|
||||||
def self.get_booking_order_table
|
def self.get_booking_order_table
|
||||||
booking_orders = Booking.select("sales.receipt_no,
|
booking_orders = Booking.select("sales.receipt_no,orders.status as order_status,
|
||||||
orders.status as order_status,
|
bookings.booking_id,sales.sale_id as sale_id,dining_facilities.name as table_name")
|
||||||
bookings.booking_id,
|
.joins("left join booking_orders on booking_orders.booking_id = bookings.booking_id")
|
||||||
sales.sale_id as sale_id,
|
|
||||||
dining_facilities.name as table_name")
|
|
||||||
.joins("left join booking_orders on booking_orders.booking = bookings.booking_id")
|
|
||||||
.joins("left join dining_facilities on dining_facilities.id = bookings.dining_facility_id")
|
.joins("left join dining_facilities on dining_facilities.id = bookings.dining_facility_id")
|
||||||
.joins("left join orders on orders.order_id = booking_orders.order")
|
.joins("left join orders on orders.order_id = booking_orders.order_id")
|
||||||
.joins("left join sale_orders on sale_orders.order = orders.order_id")
|
.joins("left join sale_orders on sale_orders.order_id = orders.order_id")
|
||||||
.joins("left join sales on sales.sale_id = sale_orders.sale")
|
.joins("left join sales on sales.sale_id = sale_orders.sale_id")
|
||||||
.where("booking_orders.order IS NOT NULL and dining_facilities.type=? and dining_facilities.is_active=?",DiningFacility::TABLE_TYPE,true)
|
.where("booking_orders.order_id IS NOT NULL and dining_facilities.type=? and dining_facilities.is_active=?",DiningFacility::TABLE_TYPE,true)
|
||||||
.group("bookings.booking_id")
|
.group("bookings.booking_id")
|
||||||
|
|
||||||
end
|
end
|
||||||
#Origami: Cashier : to view order type Room
|
#Origami: Cashier : to view order type Room
|
||||||
def self.get_booking_order_rooms
|
def self.get_booking_order_rooms
|
||||||
booking_rooms = Booking.select("sales.receipt_no,
|
booking_rooms = Booking.select("sales.receipt_no,orders.status as order_status,bookings.booking_id,sales.sale_id as sale_id,dining_facilities.name as room_name")
|
||||||
orders.status as order_status,bookings.booking_id,
|
.joins("left join booking_orders on booking_orders.booking_id = bookings.booking_id")
|
||||||
sales.sale_id as sale_id,
|
|
||||||
dining_facilities.name as room_name")
|
|
||||||
.joins("left join booking_orders on booking_orders.booking = bookings.booking_id")
|
|
||||||
.joins("left join dining_facilities on dining_facilities.id = bookings.dining_facility_id")
|
.joins("left join dining_facilities on dining_facilities.id = bookings.dining_facility_id")
|
||||||
.joins("left join orders on orders.order_id = booking_orders.order")
|
.joins("left join orders on orders.order_id = booking_orders.order_id")
|
||||||
.joins("left join sale_orders on sale_orders.order = orders.order_id")
|
.joins("left join sale_orders on sale_orders.order_id = orders.order_id")
|
||||||
.joins("left join sales on sales.sale_id = sale_orders.sale")
|
.joins("left join sales on sales.sale_id = sale_orders.sale_id")
|
||||||
.where("booking_orders.order IS NOT NULL and dining_facilities.type=? and dining_facilities.is_active=?",DiningFacility::ROOM_TYPE,true)
|
.where("booking_orders.order_id IS NOT NULL and dining_facilities.type=? and dining_facilities.is_active=?",DiningFacility::ROOM_TYPE,true)
|
||||||
.group("bookings.booking_id")
|
.group("bookings.booking_id")
|
||||||
end
|
end
|
||||||
#Origami: Cashier : to view order type Room
|
#Origami: Cashier : to view order type Room
|
||||||
def self.get_order_rooms
|
def self.get_order_rooms
|
||||||
order_rooms = Order.select("orders.order_id as order_id,
|
order_rooms = Order.select("orders.order_id as order_id,sum(order_items.qty*order_items.price) as total_price,
|
||||||
sum(order_items.qty*order_items.price) as total_price,
|
order_items.id as order_items_id,dining_facilities.name as room_name")
|
||||||
order_items.order_items_id as order_items_id,dining_facilities.name as room_name")
|
.joins("left join booking_orders on booking_orders.order_id = orders.order_id
|
||||||
.joins("left join booking_orders on booking_orders.order = orders.order_id
|
left join bookings on bookings.booking_id = booking_orders.order_id
|
||||||
left join bookings on bookings.booking_id = booking_orders.booking_order_id
|
|
||||||
left join dining_facilities on dining_facilities.id = bookings.dining_facility_id
|
left join dining_facilities on dining_facilities.id = bookings.dining_facility_id
|
||||||
left join order_items on order_items.order_id = orders.order_id")
|
left join order_items on order_items.order_id = orders.order_id")
|
||||||
.where("dining_facilities.type=? and orders.order_type=? and dining_facilities.is_active=?",DiningFacility::ROOM_TYPE,"dine_in",true)
|
.where("dining_facilities.type=? and orders.order_type=? and dining_facilities.is_active=?",DiningFacility::ROOM_TYPE,"dine_in",true)
|
||||||
.group("orders.order_id,order_items.order_items_id,dining_facilities.name")
|
.group("orders.order_id,order_items.id,dining_facilities.name")
|
||||||
|
|
||||||
end
|
end
|
||||||
#Origami: Cashier : to view orders
|
#Origami: Cashier : to view orders
|
||||||
def self.get_orders
|
def self.get_orders
|
||||||
from = Time.now.beginning_of_day.utc
|
from = Time.now.beginning_of_day.utc
|
||||||
to = Time.now.end_of_day.utc
|
to = Time.now.end_of_day.utc
|
||||||
orders = Order.select("orders.order_id as order_id,
|
orders = Order.select("orders.order_id as order_id,sales.receipt_no,orders.status as order_status,bookings.booking_id,sales.sale_id as sale_id,dining_facilities.name as table_name")
|
||||||
sales.receipt_no,orders.status as order_status,bookings.booking_id,
|
.joins("left join booking_orders on booking_orders.order_id = orders.order_id
|
||||||
sales.sale_id as sale_id,dining_facilities.name as table_name")
|
left join bookings on bookings.booking_id = booking_orders.order_id
|
||||||
.joins("left join booking_orders on booking_orders.order = orders.order_id
|
|
||||||
left join bookings on bookings.booking_id = booking_orders.booking_order_id
|
|
||||||
left join dining_facilities on dining_facilities.id = bookings.dining_facility_id
|
left join dining_facilities on dining_facilities.id = bookings.dining_facility_id
|
||||||
|
|
||||||
left join order_items on order_items.order_id = orders.order_id
|
left join order_items on order_items.order_id = orders.order_id
|
||||||
left join sale_orders on sale_orders.order = orders.order_id
|
left join sale_orders on sale_orders.order_id = orders.order_id
|
||||||
left join sales on sales.sale_id = sale_orders.sale")
|
left join sales on sales.sale_id = sale_orders.sale_id")
|
||||||
.where("dining_facilities.is_active=? and orders.date between ? and ?",true,from,to)
|
.where("dining_facilities.is_active=? and orders.date between ? and ?",true,from,to)
|
||||||
.group("orders.order_id")
|
.group("orders.order_id")
|
||||||
|
|
||||||
# Booking.select("sales.receipt_no,orders.status as order_status,bookings.id,sales.id as sale_id,dining_facilities.name as table_name")
|
# Booking.select("sales.receipt_no,orders.status as order_status,bookings.booking_id,sales.sale_id as sale_id,dining_facilities.name as table_name")
|
||||||
# .joins("left join booking_orders on booking_orders.booking_id = bookings.id")
|
# .joins("left join booking_orders on booking_orders.booking_id = bookings.booking_id")
|
||||||
# .joins("left join dining_facilities on dining_facilities.id = bookings.dining_facility_id")
|
# .joins("left join dining_facilities on dining_facilities.id = bookings.dining_facility_id")
|
||||||
# .joins("left join orders on orders.id = booking_orders.order_id")
|
# .joins("left join orders on orders.order_id = booking_orders.order_id")
|
||||||
# .joins("left join sale_orders on sale_orders.order_id = orders.id")
|
# .joins("left join sale_orders on sale_orders.order_id = orders.order_id")
|
||||||
# .joins("left join sales on sales.id = sale_orders.sale_id")
|
# .joins("left join sales on sales.sale_id = sale_orders.sale_id")
|
||||||
# .where("booking_orders.order_id IS NOT NULL and dining_facilities.is_active=? and orders.date between ? and ?",true,from,to)
|
# .where("booking_orders.order_id IS NOT NULL and dining_facilities.is_active=? and orders.date between ? and ?",true,from,to)
|
||||||
# .group("orders.id")
|
# .group("orders.order_id")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private
|
private
|
||||||
def generate_custom_id
|
def generate_custom_id
|
||||||
self.order_id = SeedGenerator.generate_id(self.class.name, "ODR")
|
self.order_id = SeedGenerator.generate_id(self.class.name, "ODR")
|
||||||
|
|||||||
@@ -39,12 +39,9 @@ class OrderItem < ApplicationRecord
|
|||||||
#Origami : Cashier : to show order items details
|
#Origami : Cashier : to show order items details
|
||||||
|
|
||||||
def self.get_order_items_details(booking_id)
|
def self.get_order_items_details(booking_id)
|
||||||
booking_orders = BookingOrder.where("booking=?",booking_id)
|
booking_orders = BookingOrder.where("booking_id=?",booking_id)
|
||||||
puts booking_orders.to_json
|
|
||||||
if booking_orders
|
if booking_orders
|
||||||
booking_orders.each do |book_order|
|
booking_orders.each do |book_order|
|
||||||
puts "booooooooo"
|
|
||||||
puts book_order.booking_order_id
|
|
||||||
order_details = OrderItem.select("order_items.item_name,order_items.qty,order_items.price,(order_items.qty*order_items.price) as total_price")
|
order_details = OrderItem.select("order_items.item_name,order_items.qty,order_items.price,(order_items.qty*order_items.price) as total_price")
|
||||||
.joins("left join orders on orders.order_id = order_items.order_id")
|
.joins("left join orders on orders.order_id = order_items.order_id")
|
||||||
.where("order_items.order_id=?",book_order.order)
|
.where("order_items.order_id=?",book_order.order)
|
||||||
@@ -57,6 +54,6 @@ puts booking_orders.to_json
|
|||||||
|
|
||||||
private
|
private
|
||||||
def generate_custom_id
|
def generate_custom_id
|
||||||
self.order_item_id = SeedGenerator.generate_id(self.class.name, "ODI")
|
self.order_items_id = SeedGenerator.generate_id(self.class.name, "ODI")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -10,12 +10,12 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
|||||||
self.print("tmp/receipt.pdf")
|
self.print("tmp/receipt.pdf")
|
||||||
end
|
end
|
||||||
|
|
||||||
def print_order_summary(printer_settings,booking_id)
|
def print_order_summary(printer_settings,order_id)
|
||||||
#Use CUPS service
|
#Use CUPS service
|
||||||
#Generate PDF
|
#Generate PDF
|
||||||
#Print
|
#Print
|
||||||
order=print_query('booking',booking_id)
|
order=print_query('order_summary',order_id)
|
||||||
filename = "tmp/order_summary_#{booking_id}" + ".pdf"
|
filename = "tmp/order_summary_#{order_id}" + ".pdf"
|
||||||
pdf = OrderSummaryPdf.new(order,printer_settings)
|
pdf = OrderSummaryPdf.new(order,printer_settings)
|
||||||
pdf.render_file filename
|
pdf.render_file filename
|
||||||
|
|
||||||
@@ -25,21 +25,23 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
|||||||
# Query for OQS with status
|
# Query for OQS with status
|
||||||
def print_query(type, code)
|
def print_query(type, code)
|
||||||
if type == 'order_item'
|
if type == 'order_item'
|
||||||
OrderItem.select("order_items.item_code, order_items.item_name,order_items.item_order_by as order_by, order_items.created_at as order_at, cus.name as customer, df.name as dining")
|
OrderItem.select("order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.item_order_by as order_by, order_items.created_at as order_at, cus.name as customer, df.name as dining")
|
||||||
.joins("left join orders ON orders.id = order_items.order_id
|
.joins("left join orders ON orders.order_id = order_items.order_id
|
||||||
left join booking_orders AS bo ON bo.order_id=order_items.order_id
|
left join booking_orders AS bo ON bo.order_id=order_items.order_id
|
||||||
left join bookings AS b ON b.id = bo.booking_id
|
left join bookings AS b ON b.booking_id = bo.booking_id
|
||||||
left join dining_facilities AS df ON df.id = b.dining_facility_id
|
left join dining_facilities AS df ON df.dining_facility_id = b.dining_facility_id
|
||||||
left join customers as cus ON cus.id = orders.customer_id")
|
left join customers as cus ON cus.customer_id = orders.customer_id")
|
||||||
.where("order_items.item_code=" + code)
|
.where("order_items.item_code=" + code)
|
||||||
.group("order_items.item_code")
|
.group("order_items.item_code")
|
||||||
else
|
else
|
||||||
OrderItem.select("order_items.item_code, order_items.item_name, df.name as dining")
|
OrderItem.select("order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.item_order_by as order_by, order_items.created_at as order_at, cus.name as customer, df.name as dining")
|
||||||
.joins("left join orders ON orders.id = order_items.order_id
|
.joins("left join orders ON orders.order_id = order_items.order_id
|
||||||
left join booking_orders AS bo ON bo.order_id=order_items.order_id
|
left join booking_orders AS bo ON bo.order_id=order_items.order_id
|
||||||
left join bookings AS b ON b.id = bo.booking_id
|
left join bookings AS b ON b.booking_id = bo.booking_id
|
||||||
left join dining_facilities AS df ON df.id = b.dining_facility_id")
|
left join dining_facilities AS df ON df.dining_facility_id = b.dining_facility_id
|
||||||
.where("booking.id=" + code)
|
left join customers as cus ON cus.customer_id = orders.customer_id")
|
||||||
|
.where("orders.order_id=" + code.to_s)
|
||||||
|
.group("order_items.item_code")
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
class Sale < ApplicationRecord
|
class Sale < ApplicationRecord
|
||||||
#primary key - need to be unique generated for multiple shops
|
#primary key - need to be unique generated for multiple shops
|
||||||
|
before_create :generate_custom_id
|
||||||
#before_create :generate_receipt_no
|
#before_create :generate_receipt_no
|
||||||
belongs_to :cashier, :optional => true
|
belongs_to :cashier, :optional => true
|
||||||
belongs_to :customer, :optional => true
|
belongs_to :customer, :optional => true
|
||||||
|
|||||||
@@ -10,12 +10,12 @@ class SaleItem < ApplicationRecord
|
|||||||
|
|
||||||
|
|
||||||
def self.get_order_items_details(sale_id)
|
def self.get_order_items_details(sale_id)
|
||||||
sale_orders = SaleOrder.where("sale=?",sale_id)
|
sale_orders = SaleOrder.where("sale_id=?",sale_id)
|
||||||
if sale_orders
|
if sale_orders
|
||||||
sale_orders.each do |sale_order|
|
sale_orders.each do |sale_order|
|
||||||
order_details = SaleItem.select("sales.total_discount as discount_amount,DATE_FORMAT(sales.receipt_date,'%Y-%m-%d %h:%m') as receipt_date,sales.cashier_name,sales.receipt_no,sale_items.product_name as item_name,sale_items.qty,sale_items.price,sale_items.unit_price as total_price")
|
order_details = SaleItem.select("sales.total_discount as discount_amount,DATE_FORMAT(sales.receipt_date,'%Y-%m-%d %h:%m') as receipt_date,sales.cashier_name,sales.receipt_no,sale_items.product_name as item_name,sale_items.qty,sale_items.price,sale_items.unit_price as total_price")
|
||||||
.joins("left join sales on sales.sale_id = sale_items.sale_id")
|
.joins("left join sales on sales.id = sale_items.sale_id")
|
||||||
.where("sale_items.sale_id=?",sale_order.sale)
|
.where("sale_items.sale_id=?",sale_order.sale_id)
|
||||||
return order_details
|
return order_details
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -14,9 +14,11 @@ class SeedGenerator < ApplicationRecord
|
|||||||
seed.current = current_no
|
seed.current = current_no
|
||||||
seed.save
|
seed.save
|
||||||
end
|
end
|
||||||
padding_len = 12 - prefix.length
|
|
||||||
|
|
||||||
return prefix +"-"+ seed.current.to_s.to_s.rjust((12-prefix.length)+1,'0')
|
padding_len = 15 - prefix.length
|
||||||
|
|
||||||
|
return prefix +"-"+ seed.current.to_s.to_s.rjust((14-prefix.length)+1,'0')
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.new_receipt_no
|
def self.new_receipt_no
|
||||||
|
|||||||
@@ -11,21 +11,61 @@ class OrderItemPdf < Prawn::Document
|
|||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
move_down 5
|
move_down 5
|
||||||
|
|
||||||
cashier_info(order_item.order_by,order_item.order_at, order_item.customer)
|
#order_info
|
||||||
|
order_info(order_item.order_by,order_item.order_at, order_item.customer)
|
||||||
|
|
||||||
|
# order items
|
||||||
|
order_items(order_item)
|
||||||
end
|
end
|
||||||
|
|
||||||
def cashier_info(order_by, order_at, customer)
|
# Write Order Information to PDF
|
||||||
move_down 5
|
def order_info(order_by, order_at, customer)
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
|
|
||||||
bounding_box([0,y_position], :width =>200, :height => 20) do
|
bounding_box([0,y_position], :width => 200, :height => 15) do
|
||||||
text "OrderBy:#{order_by} Customer:#{customer} Date:#{order_at.strftime("%Y %m %d")}", :size => 7,:align => :left
|
text "OrderBy:#{order_by} Customer:#{customer} Date:#{order_at.strftime("%Y-%m-%d")}", :size => 7,:align => :left
|
||||||
end
|
end
|
||||||
|
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
|
|
||||||
|
move_down 20
|
||||||
|
end
|
||||||
|
|
||||||
|
# Write Order items to PDF
|
||||||
|
def order_items(order_item)
|
||||||
|
y_position = cursor
|
||||||
|
|
||||||
|
bounding_box([0,y_position], :width => 180, :height => 15) do
|
||||||
|
text "Item", :size => 7,:align => :left
|
||||||
|
end
|
||||||
|
|
||||||
|
bounding_box([160,y_position], :width => 20, :height => 15) do
|
||||||
|
text "Qty", :size => 7,:align => :right
|
||||||
|
end
|
||||||
|
|
||||||
|
stroke_horizontal_rule
|
||||||
move_down 5
|
move_down 5
|
||||||
|
|
||||||
|
#Add Order Item
|
||||||
|
add_order_items(order_item)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Add order items under order info
|
||||||
|
def add_order_items(order_item)
|
||||||
|
y_position = cursor
|
||||||
|
|
||||||
|
move_down 5
|
||||||
|
|
||||||
|
bounding_box([0,y_position], :width => 180, :height => 20) do
|
||||||
|
text "#{order_item.item_name}", :size => 7,:align => :left
|
||||||
|
end
|
||||||
|
|
||||||
|
bounding_box([160,y_position], :width => 20, :height => 20) do
|
||||||
|
text "#{order_item.qty}", :size => 7,:align => :right
|
||||||
|
end
|
||||||
|
|
||||||
|
move_down 5
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -7,11 +7,68 @@ class OrderSummaryPdf < Prawn::Document
|
|||||||
# font "public/fonts/Zawgyi-One.ttf"
|
# font "public/fonts/Zawgyi-One.ttf"
|
||||||
# font "public/fonts/padauk.ttf"
|
# font "public/fonts/padauk.ttf"
|
||||||
|
|
||||||
|
|
||||||
font_size 9
|
font_size 9
|
||||||
text "#{"table_name"}", :size => 15
|
text "#{order[0].dining}", :size => 15
|
||||||
stroke_horizontal_rule
|
stroke_horizontal_rule
|
||||||
move_down 5
|
move_down 5
|
||||||
|
|
||||||
|
#order_info
|
||||||
|
order_info(order[0].order_by,order[0].order_at, order[0].customer)
|
||||||
|
|
||||||
|
# order items
|
||||||
|
order_items(order)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
# Write Order Information to PDF
|
||||||
|
def order_info(order_by, order_at, customer)
|
||||||
|
y_position = cursor
|
||||||
|
|
||||||
|
bounding_box([0,y_position], :width => 200, :height => 15) do
|
||||||
|
text "OrderBy:#{order_by} Customer:#{customer} Date:#{order_at.strftime("%Y-%m-%d")}", :size => 7,:align => :left
|
||||||
|
end
|
||||||
|
|
||||||
|
stroke_horizontal_rule
|
||||||
|
|
||||||
|
move_down 20
|
||||||
|
end
|
||||||
|
|
||||||
|
# Write Order items to PDF
|
||||||
|
def order_items(order_item)
|
||||||
|
y_position = cursor
|
||||||
|
|
||||||
|
bounding_box([0,y_position], :width => 180, :height => 15) do
|
||||||
|
text "Item", :size => 7,:align => :left
|
||||||
|
end
|
||||||
|
|
||||||
|
bounding_box([160,y_position], :width => 20, :height => 15) do
|
||||||
|
text "Qty", :size => 7,:align => :right
|
||||||
|
end
|
||||||
|
|
||||||
|
stroke_horizontal_rule
|
||||||
|
move_down 5
|
||||||
|
|
||||||
|
#Add Order Item
|
||||||
|
add_order_items(order_item)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Add order items under order info
|
||||||
|
def add_order_items(order_item)
|
||||||
|
y_position = cursor
|
||||||
|
|
||||||
|
move_down 5
|
||||||
|
|
||||||
|
order_item.each do|odi|
|
||||||
|
bounding_box([0,y_position], :width => 180, :height => 20) do
|
||||||
|
text "#{odi.item_name}", :size => 7,:align => :left
|
||||||
|
end
|
||||||
|
|
||||||
|
bounding_box([160,y_position], :width => 20, :height => 20) do
|
||||||
|
text "#{odi.qty}", :size => 7,:align => :right
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
move_down 5
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
if (@booking)
|
if (@booking)
|
||||||
json.id @booking.id
|
json.id @booking.booking_id
|
||||||
json.status @booking.booking_status
|
json.status @booking.booking_status
|
||||||
json.checkin_at @booking.checkin_at
|
json.checkin_at @booking.checkin_at
|
||||||
json.checkin_by @booking.checkin_by
|
json.checkin_by @booking.checkin_by
|
||||||
@@ -13,6 +13,7 @@ if (@booking)
|
|||||||
@total_amount = 0.00
|
@total_amount = 0.00
|
||||||
@total_tax = 0.00
|
@total_tax = 0.00
|
||||||
|
|
||||||
|
@booking_orders = BookingOrder.where("booking_id = #{@booking.booking_id}").all;
|
||||||
if @booking.booking_orders
|
if @booking.booking_orders
|
||||||
order_items = []
|
order_items = []
|
||||||
@booking.booking_orders.each do |bo|
|
@booking.booking_orders.each do |bo|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<%= simple_form_for(@crm_customer) do |f| %>
|
|
||||||
|
<%= simple_form_for([:crm,@crm_customer]) do |f| %>
|
||||||
<%= f.error_notification %>
|
<%= f.error_notification %>
|
||||||
|
|
||||||
<div class="form-inputs">
|
<div class="form-inputs">
|
||||||
@@ -7,7 +8,7 @@
|
|||||||
<%= f.input :contact_no %>
|
<%= f.input :contact_no %>
|
||||||
<%= f.input :email %>
|
<%= f.input :email %>
|
||||||
<%= f.input :date_of_birth %>
|
<%= f.input :date_of_birth %>
|
||||||
<%= f.association :membership %>
|
|
||||||
<%= f.input :membership_type %>
|
<%= f.input :membership_type %>
|
||||||
<%= f.input :membership_authentication_code %>
|
<%= f.input :membership_authentication_code %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,5 +2,5 @@
|
|||||||
|
|
||||||
<%= render 'form', crm_customer: @crm_customer %>
|
<%= render 'form', crm_customer: @crm_customer %>
|
||||||
|
|
||||||
<%= link_to 'Show', @crm_customer %> |
|
<%= link_to 'Show', @crm_customers_path %> |
|
||||||
<%= link_to 'Back', crm_customers_path %>
|
<%= link_to 'Back', crm_customers_path %>
|
||||||
|
|||||||
@@ -25,12 +25,12 @@
|
|||||||
<td><%= crm_customer.contact_no %></td>
|
<td><%= crm_customer.contact_no %></td>
|
||||||
<td><%= crm_customer.email %></td>
|
<td><%= crm_customer.email %></td>
|
||||||
<td><%= crm_customer.date_of_birth %></td>
|
<td><%= crm_customer.date_of_birth %></td>
|
||||||
<td><%= crm_customer.membership %></td>
|
<td><%= crm_customer.membership_id %></td>
|
||||||
<td><%= crm_customer.membership_type %></td>
|
<td><%= crm_customer.membership_type %></td>
|
||||||
<td><%= crm_customer.membership_authentication_code %></td>
|
<td><%= crm_customer.membership_authentication_code %></td>
|
||||||
<td><%= link_to 'Show', crm_customer %></td>
|
<td><%= link_to 'Show', crm_customer_path(crm_customer) %></td>
|
||||||
<td><%= link_to 'Edit', edit_crm_customer_path(crm_customer) %></td>
|
<td><%= link_to 'Edit', edit_crm_customer_path(crm_customer) %></td>
|
||||||
<td><%= link_to 'Destroy', crm_customer, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
<td><%= link_to 'Destroy', crm_customer_path(crm_customer), method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<% @i = 0 %>
|
<% @i = 0 %>
|
||||||
<% @booking.each do |booking| %>
|
<% @booking.each do |booking| %>
|
||||||
<% if booking.booking_status == "new" %>
|
<% if booking.booking_status == "assign" %>
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-block booking_click" data-ref="<%= api_booking_path booking.id%>" id="card-block booking_block" style="width:100%;">
|
<div class="card-block booking_click" data-ref="<%= api_booking_path booking.id%>" id="card-block booking_block" style="width:100%;">
|
||||||
<h4 class="card-title">
|
<h4 class="card-title">
|
||||||
@@ -40,7 +40,7 @@ $(function(){
|
|||||||
$(".summary-items tbody tr").remove();
|
$(".summary-items tbody tr").remove();
|
||||||
$("#cancel").removeAttr("disabled");
|
$("#cancel").removeAttr("disabled");
|
||||||
$("#assign").removeAttr("disabled");
|
$("#assign").removeAttr("disabled");
|
||||||
var url = $(this).attr('data-ref');
|
var url = $(this).attr('data-ref');alert(url);
|
||||||
show_details(url);
|
show_details(url);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -61,7 +61,7 @@
|
|||||||
</small>
|
</small>
|
||||||
</p>
|
</p>
|
||||||
<p class="hidden order-customer"><%= qid.customer_name %></p>
|
<p class="hidden order-customer"><%= qid.customer_name %></p>
|
||||||
<p class="hidden assigned-order-item"><%= qid.id %></p>
|
<p class="hidden assigned-order-item"><%= qid.assigned_order_item_id %></p>
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="card-footer">
|
<!-- <div class="card-footer">
|
||||||
<button id=<%= 'assigned_queue_' + qid.id.to_s %> class="btn btn-primary btn-lg btn-block order-complete">COMPLETE</button>
|
<button id=<%= 'assigned_queue_' + qid.id.to_s %> class="btn btn-primary btn-lg btn-block order-complete">COMPLETE</button>
|
||||||
@@ -112,10 +112,10 @@
|
|||||||
</p>
|
</p>
|
||||||
<!-- Hidden Fields for Items -->
|
<!-- Hidden Fields for Items -->
|
||||||
<p class="hidden order-customer"><%= qid.customer_name %></p>
|
<p class="hidden order-customer"><%= qid.customer_name %></p>
|
||||||
<p class="hidden assigned-order-item"><%= qid.id %></p>
|
<p class="hidden assigned-order-item"><%= qid.assigned_order_item_id %></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-footer">
|
<div class="card-footer">
|
||||||
<button id=<%= 'assigned_queue_' + qid.id.to_s %> class="btn btn-primary btn-lg btn-block order-complete">COMPLETE</button>
|
<button id=<%= 'assigned_queue_' + qid.assigned_order_item_id.to_s %> class="btn btn-primary btn-lg btn-block order-complete">COMPLETE</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<%
|
<%
|
||||||
@@ -193,7 +193,7 @@
|
|||||||
<div class="col-lg-1 col-md-1 col-sm-1">
|
<div class="col-lg-1 col-md-1 col-sm-1">
|
||||||
<!-- OQS Buttons -->
|
<!-- OQS Buttons -->
|
||||||
<button type="button" title="Print Order Item" id="print_order_item" class="btn btn-primary btn-lg btn-block">Print</a>
|
<button type="button" title="Print Order Item" id="print_order_item" class="btn btn-primary btn-lg btn-block">Print</a>
|
||||||
<button type="button" class="btn btn-primary btn-lg btn-block" id="print_order_item" disabled>Print <br/>Order<br/>Summary</button>
|
<button type="button" class="btn btn-primary btn-lg btn-block" id="print_order_summary">Print <br/>Order<br/>Summary</button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -31,15 +31,13 @@
|
|||||||
<span id="table-name-<%=booking_order.sale_id%>" class="table-name"><%=booking_order.table_name%></span></h4>
|
<span id="table-name-<%=booking_order.sale_id%>" class="table-name"><%=booking_order.table_name%></span></h4>
|
||||||
<span>Receipt No : <%=booking_order.receipt_no%></span><br/>
|
<span>Receipt No : <%=booking_order.receipt_no%></span><br/>
|
||||||
<span>Order Status : <%=booking_order.order_status %></span>
|
<span>Order Status : <%=booking_order.order_status %></span>
|
||||||
<span>sale_<%=booking_order.sale_id %></span>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% else %>
|
<% else %>
|
||||||
<div class="card" id="table-order-<%=booking_order.booking_id%>" onclick="callOrderDetails('order_<%=booking_order.booking_id%>')">
|
<div class="card" id="table-order-<%=booking_order.id%>" onclick="callOrderDetails('order_<%=booking_order.id%>')">
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<h4 class="card-title"><span id="table-name-<%=booking_order.booking_id%>" class="table-name"><%=booking_order.table_name%></span></h4>
|
<h4 class="card-title"><span id="table-name-<%=booking_order.id%>" class="table-name"><%=booking_order.table_name%></span></h4>
|
||||||
<span>Order Status : <%=booking_order.order_status %></span>
|
<span>Order Status : <%=booking_order.order_status %></span>
|
||||||
<span>sale_<%=booking_order.sale_id %></span>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -55,18 +53,18 @@
|
|||||||
<% if @booking_rooms %>
|
<% if @booking_rooms %>
|
||||||
<% @booking_rooms.each do |booking_room| %>
|
<% @booking_rooms.each do |booking_room| %>
|
||||||
<% if !booking_room.order_status = 'new'%>
|
<% if !booking_room.order_status = 'new'%>
|
||||||
<div style="background-color: red;color: white;" class="card" id="table-order-<%=booking_room.booking_id%>" onclick="callOrderDetails('sale_<%=booking_room.booking_id%>')">
|
<div style="background-color: red;color: white;" class="card" id="table-order-<%=booking_room.id%>" onclick="callOrderDetails('sale_<%=booking_room.id%>')">
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<h4 class="card-title">
|
<h4 class="card-title">
|
||||||
<span id="table-name-<%=booking_room.booking_id%>" class="table-name"><%=booking_room.room_name%></span></h4>
|
<span id="table-name-<%=booking_room.id%>" class="table-name"><%=booking_room.room_name%></span></h4>
|
||||||
<span>Receipt No : <%=booking_room.receipt_no%></span><br/>
|
<span>Receipt No : <%=booking_room.receipt_no%></span><br/>
|
||||||
<span>Order Status : <%=booking_room.order_status %></span>
|
<span>Order Status : <%=booking_room.order_status %></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% else %>
|
<% else %>
|
||||||
<div class="card" id="table-order-<%=booking_room.booking_id%>" onclick="callOrderDetails('order_<%=booking_room.booking_id%>')">
|
<div class="card" id="table-order-<%=booking_room.id%>" onclick="callOrderDetails('order_<%=booking_room.id%>')">
|
||||||
<div class="card-block">
|
<div class="card-block">
|
||||||
<h4 class="card-title"><span id="table-name-<%=booking_room.booking_id%>" class="table-name"><%=booking_room.room_name%>ddd</span></h4> \
|
<h4 class="card-title"><span id="table-name-<%=booking_room.id%>" class="table-name"><%=booking_room.room_name%>ddd</span></h4> \
|
||||||
<span>Order Status : <%=booking_room.order_status %></span>
|
<span>Order Status : <%=booking_room.order_status %></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -205,26 +203,21 @@
|
|||||||
var table_or_order_id = 0
|
var table_or_order_id = 0
|
||||||
|
|
||||||
function callOrderDetails(sale_order_id){
|
function callOrderDetails(sale_order_id){
|
||||||
|
|
||||||
var order_id = 0
|
var order_id = 0
|
||||||
var data_val = ""
|
var data_val = ""
|
||||||
sale_order = sale_order_id.split("_")[0]
|
sale_order = sale_order_id.split("_")[0]
|
||||||
if (sale_order == 'sale') {
|
if (sale_order == 'sale') {
|
||||||
order_id = sale_order_id.split("_")[1]
|
order_id = sale_order_id.split("_")[1]
|
||||||
url = "origami/"+sale_order_id.split("_")[1]
|
url = "origami/"+sale_order_id.split("_")[1]
|
||||||
|
|
||||||
data_val = { sale_id: sale_order_id.split("_")[1]}
|
data_val = { sale_id: sale_order_id.split("_")[1]}
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
order_id = sale_order_id.split("_")[1]
|
order_id = sale_order_id.split("_")[1]
|
||||||
url = "origami/"+order_id
|
url = "origami/"+order_id
|
||||||
|
|
||||||
data_val = { order_id: sale_order_id.split("_")[1]}
|
data_val = { order_id: sale_order_id.split("_")[1]}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
table_or_order_id = order_id
|
table_or_order_id = order_id
|
||||||
|
|
||||||
var tbody = ""
|
var tbody = ""
|
||||||
$("#append-table").html("")
|
$("#append-table").html("")
|
||||||
if (old_order_id != order_id){
|
if (old_order_id != order_id){
|
||||||
@@ -237,10 +230,8 @@ function callOrderDetails(sale_order_id){
|
|||||||
$("#sub-total").html("")
|
$("#sub-total").html("")
|
||||||
$.ajax({type: "GET",
|
$.ajax({type: "GET",
|
||||||
url: url,
|
url: url,
|
||||||
|
|
||||||
data: data_val,
|
data: data_val,
|
||||||
success:function(result){
|
success:function(result){
|
||||||
|
|
||||||
var sub_total = 0
|
var sub_total = 0
|
||||||
var discount_amount = 0
|
var discount_amount = 0
|
||||||
var receipt_no = ""
|
var receipt_no = ""
|
||||||
|
|||||||
@@ -99,7 +99,9 @@ Rails.application.routes.draw do
|
|||||||
|
|
||||||
post 'update_delivery', to: "home#update_delivery_status"
|
post 'update_delivery', to: "home#update_delivery_status"
|
||||||
|
|
||||||
|
# Pass assigned_order_item_id
|
||||||
get 'print/print/:id', to: "print#print"
|
get 'print/print/:id', to: "print#print"
|
||||||
|
get 'print/print_order_summary/:id', to: "print#print_order_summary"
|
||||||
#dashboard
|
#dashboard
|
||||||
#
|
#
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
class CreateCustomers < ActiveRecord::Migration[5.0]
|
class CreateCustomers < ActiveRecord::Migration[5.0]
|
||||||
def change
|
def change
|
||||||
create_table :customers, :id => false, :primary_key => :customer_id do |t|
|
create_table :customers, :id => false do |t|
|
||||||
t.string :customer_id, :limit => 16, :null => false, :index => true, :unique => true #custom foreign_key to prevent conflict during sync
|
t.string :customer_id, :limit => 16, :primary_key => true #custom foreign_key to prevent conflict during sync
|
||||||
t.string :name, :null => false
|
t.string :name, :null => false
|
||||||
t.string :company
|
t.string :company
|
||||||
t.string :contact_no
|
t.string :contact_no
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
class CreateOrders < ActiveRecord::Migration[5.0]
|
class CreateOrders < ActiveRecord::Migration[5.0]
|
||||||
def change
|
def change
|
||||||
create_table :orders, :id => false, :primary_key => :order_id do |t|
|
create_table :orders, :id => false do |t|
|
||||||
t.string :order_id, :limit => 16, :null => false, :index => true, :unique => true #custom foreign_key to prevent conflict during sync
|
t.string :order_id, :limit => 16, :primary_key => true #custom foreign_key to prevent conflict during sync
|
||||||
t.datetime :date, :null => false
|
t.datetime :date, :null => false
|
||||||
t.string :source, :null => false, :default => "emenu"
|
t.string :source, :null => false, :default => "emenu"
|
||||||
t.string :order_type, :null => false, :default => "dine-in"
|
t.string :order_type, :null => false, :default => "dine-in"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
class CreateOrderItems < ActiveRecord::Migration[5.0]
|
class CreateOrderItems < ActiveRecord::Migration[5.0]
|
||||||
def change
|
def change
|
||||||
create_table :order_items, :id => false, :primary_key => :order_items_id do |t|
|
create_table :order_items, :id => false do |t|
|
||||||
t.string :order_items_id, :limit => 16, :null => false, :index => true, :unique => true #custom primary key - to ensure consistence for cloud syncing
|
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_id, foreign_key: true, :null => false, :limit => 16
|
||||||
t.string :order_item_status, :null => false, :default => "new"
|
t.string :order_item_status, :null => false, :default => "new"
|
||||||
t.string :item_order_by #person who order this
|
t.string :item_order_by #person who order this
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
class CreateSales < ActiveRecord::Migration[5.0]
|
class CreateSales < ActiveRecord::Migration[5.0]
|
||||||
def change
|
def change
|
||||||
create_table :sales, :id => false, :primary_key => :sale_id do |t|
|
create_table :sales, :id => false do |t|
|
||||||
t.string :sale_id, :limit => 16, :null => false, :index => true, :unique => true #custom primary key - to ensure consistence for cloud syncing
|
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.integer :cashier_id, :index => true
|
||||||
t.string :cashier_name
|
t.string :cashier_name
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
class CreateSaleItems < ActiveRecord::Migration[5.0]
|
class CreateSaleItems < ActiveRecord::Migration[5.0]
|
||||||
def change
|
def change
|
||||||
create_table :sale_items, :id => false, :primary_key => :sale_item_id do |t|
|
create_table :sale_items, :id => false do |t|
|
||||||
t.string :sale_item_id, :limit => 16, :null => false, :index => true, :unique => true #custom primary key - to ensure consistence for cloud syncing
|
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 :sale_id, foreign_key: true, :limit => 16
|
||||||
t.string :product_code, :null => false
|
t.string :product_code, :null => false
|
||||||
t.string :product_name, :null => false
|
t.string :product_name, :null => false
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
class CreateSaleTaxes < ActiveRecord::Migration[5.0]
|
class CreateSaleTaxes < ActiveRecord::Migration[5.0]
|
||||||
def change
|
def change
|
||||||
create_table :sale_taxes, :id => false, :primary_key => :sale_tax_id do |t|
|
create_table :sale_taxes, :id => false do |t|
|
||||||
t.string :sale_tax_id, :limit => 16, :null => false, :index => true, :unique => true #custom primary key - to ensure consistence for cloud syncing
|
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 :sale_id, foreign_key: true, :limit => 16
|
||||||
t.string :tax_name, :null => false
|
t.string :tax_name, :null => false
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
class CreateSalePayments < ActiveRecord::Migration[5.0]
|
class CreateSalePayments < ActiveRecord::Migration[5.0]
|
||||||
def change
|
def change
|
||||||
create_table :sale_payments, :id => false, :primary_key => :sale_payment_id do |t|
|
create_table :sale_payments, :id => false do |t|
|
||||||
t.string :sale_payment_id, :limit => 16, :null => false, :index => true, :unique => true #custom primary key - to ensure consistence for cloud syncing
|
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 :sale_id, foreign_key: true, :limit => 16
|
||||||
t.string :payment_method, :null => false, :default => "cash"
|
t.string :payment_method, :null => false, :default => "cash"
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
class CreateSaleOrders < ActiveRecord::Migration[5.0]
|
class CreateSaleOrders < ActiveRecord::Migration[5.0]
|
||||||
def change
|
def change
|
||||||
create_table :sale_orders, :id => false, :primary_key => :sale_order_id do |t|
|
create_table :sale_orders, :id => false do |t|
|
||||||
t.string :sale_order_id, :limit => 16, :null => false, :index => true, :unique => true #custom primary key - to ensure consistence for cloud syncing
|
t.primary_key :sale_order_id #custom primary key - to ensure consistence for cloud syncing
|
||||||
|
|
||||||
t.string :sale, foreign_key: true,:limit => 16
|
t.string :sale_id, foreign_key: true,:limit => 16
|
||||||
t.string :order, foreign_key: true, :limit => 16
|
t.string :order_id, foreign_key: true, :limit => 16
|
||||||
|
|
||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
class CreateSaleAudits < ActiveRecord::Migration[5.0]
|
class CreateSaleAudits < ActiveRecord::Migration[5.0]
|
||||||
def change
|
def change
|
||||||
create_table :sale_audits, :id => false, :primary_key => :sale_audit_id do |t|
|
create_table :sale_audits, :id => false do |t|
|
||||||
t.string :sale_audit_id, :limit => 16, :null => false, :index => true, :unique => true #custom primary key - to ensure consistence for cloud syncing
|
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 :sale_id, foreign_key: true, :limit => 16
|
||||||
t.string :action, :null => false
|
t.string :action, :null => false
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
class CreateBookings < ActiveRecord::Migration[5.0]
|
class CreateBookings < ActiveRecord::Migration[5.0]
|
||||||
def change
|
def change
|
||||||
create_table :bookings, :id => false, :primary_key => :booking_id do |t|
|
create_table :bookings, :id => false do |t|
|
||||||
t.string :booking_id, :limit => 16, :null => false, :index => true, :unique => true #custom primary key - to ensure consistence for cloud syncing
|
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.references :dining_facility, foreign_key: true
|
||||||
t.string :type, :null => false, :default => "Table"
|
t.string :type, :null => false, :default => "Table"
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
class CreateBookingOrders < ActiveRecord::Migration[5.0]
|
class CreateBookingOrders < ActiveRecord::Migration[5.0]
|
||||||
def change
|
def change
|
||||||
create_table :booking_orders, :id => false, :primary_key => :booking_order_id do |t|
|
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.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, foreign_key: true, :limit => 16
|
t.string :booking_id, foreign_key: true, :limit => 16
|
||||||
t.string :order, foreign_key: true, :limit => 16
|
t.string :order_id, foreign_key: true, :limit => 16
|
||||||
|
|
||||||
t.timestamps
|
t.timestamps
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user