This commit is contained in:
Yan
2018-04-09 10:09:24 +06:30
16 changed files with 297 additions and 53 deletions

View File

@@ -178,6 +178,9 @@ For MoveTablePdf in print settings
/* Tax Profile Group Types in lookups */
>>>>>>> 1c13b0469758fb968c0dfcc1f0a876ed2c5e395a
Add Kitchen Role of Employee
=> 1) settings/lookups => { type:employee_roles, name: Kitchen, value:kitchen }
* ToDo list
1. Migration

View File

@@ -266,11 +266,22 @@ $(function() {
$('.set_order').attr('data-min-qty',item_sets[field]["min_selectable_qty"]);
value = item_sets[field]["instances"];
$(value).each(function(i){
if (type != -1 && modify_order != -1) {
url = '../../../../api/restaurant/menu_item_instances/'+value[i]["id"];
console.log("ssssssss")
}
if(modify_order == -1 && type != -1){
url = '../../api/restaurant/menu_item_instances/'+value[i]["id"] ;
console.log("aaaaaa")
}
if (type ==-1 && modify_order == -1){
url = '../../api/restaurant/menu_item_instances/'+value[i]["id"];
console.log("cccccccccc")
}
$.ajax({
type: "GET",
url: '../../api/restaurant/menu_item_instances/'+value[i]["id"],
url: url,
data: {id:value[i]},
success:function(result){
@@ -370,7 +381,7 @@ $(function() {
// $(this).removeAttr('data-options');
// $('#instance_option').text('')
// }else {
if (rowCount.length+1 <= max_qty) {
if (setCount.length+1 <= max_qty) {
sub_total = $('#set_total_price').text();
name = $(this).data('name');
price = $(this).data('price');
@@ -1317,9 +1328,18 @@ console.log(d_option)
}
function customer_display_view(data,status) {
if (type != -1 && modify_order != -1) {
url = '../../../../origami/customer_view';
}
if(modify_order == -1 && type != -1){
url = '../../origami/customer_view';
}
if (type ==-1 && modify_order == -1){
url = '../../origami/customer_view';
}
$.ajax({
type: "POST",
url: '../../origami/customer_view',
url: url,
data: {"data":data,"status":status},
dataType: "json",
success:function(result){

View File

@@ -70,6 +70,9 @@ class HomeController < ApplicationController
elsif @employee.role == "account"
session[:session_token] = @employee.token_session
redirect_to reports_dailysale_index_path
elsif @employee.role == "kitchen"
session[:session_token] = @employee.token_session
redirect_to oqs_root_path
else
render :index
end

View File

@@ -1,4 +1,5 @@
class Oqs::EditController < BaseOqsController
authorize_resource :class => false
def index
assigned_item_id = params[:id]
@link_type = params[:type]

View File

@@ -1,8 +1,6 @@
class Oqs::HomeController < BaseOqsController
authorize_resource :class => false
def index
# Query for OQS with delivery status false
# @queue_items_details = queue_items_query(false)

View File

@@ -1,4 +1,5 @@
class Oqs::PrintController < ApplicationController
authorize_resource :class => false
# Print Order Item
def print
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server

View File

@@ -3,11 +3,7 @@ class Origami::HomeController < BaseOrigamiController
before_action :set_dining, only: [:show]
def index
@webview = false
if check_mobile
@webview = true
end
@webview = check_mobile
@tables = Table.all.active.order('status desc')
@rooms = Room.all.active.order('status desc')
@complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
@@ -19,10 +15,7 @@ class Origami::HomeController < BaseOrigamiController
# origami table detail
def show
@webview = false
if check_mobile
@webview = true
end
@webview = check_mobile
@tables = Table.all.active.order('status desc')
@rooms = Room.all.active.order('status desc')

View File

@@ -98,6 +98,22 @@ class Ability
can :create, :split_bill
can :update_sale, :split_bill
#oqs Home
can :index, :home
can :index, :show
can :get_order_items, :home
can :get_items_by_oqs, :home
can :update_delivery_status, :home
can :queue_items_query, :home
can :completed_order, :home
can :queue_items_count_query, :home
can :index, :edit
can :update, :edit
can :print, :print
can :print_order_summary, :print
elsif user.role == "cashier"
# can :overall_void, :void
@@ -144,6 +160,22 @@ class Ability
can :index, :split_bill
can :create, :split_bill
can :update_sale, :split_bill
#oqs Home
can :index, :home
can :index, :show
can :get_order_items, :home
can :get_items_by_oqs, :home
can :update_delivery_status, :home
can :queue_items_query, :home
can :completed_order, :home
can :queue_items_count_query, :home
can :index, :edit
can :update, :edit
can :print, :print
can :print_order_summary, :print
elsif user.role == "account"
@@ -206,6 +238,23 @@ class Ability
can :index, :split_bill
can :create, :split_bill
can :update_sale, :split_bill
#oqs Home
can :index, :home
can :index, :show
can :get_order_items, :home
can :get_items_by_oqs, :home
can :update_delivery_status, :home
can :queue_items_query, :home
can :completed_order, :home
can :queue_items_count_query, :home
can :index, :edit
can :update, :edit
can :print, :print
can :print_order_summary, :print
elsif user.role == "waiter"
can :index, :home
can :show, :home
@@ -232,6 +281,40 @@ class Ability
#ability for split_bill
can :index, :split_bill
can :create, :split_bill
#oqs Home
can :index, :home
can :index, :show
can :get_order_items, :home
can :get_items_by_oqs, :home
can :update_delivery_status, :home
can :queue_items_query, :home
can :completed_order, :home
can :queue_items_count_query, :home
can :index, :edit
can :update, :edit
can :print, :print
can :print_order_summary, :print
elsif user.role == "kitchen"
#oqs Home
can :index, :home
can :index, :show
can :get_order_items, :home
can :get_items_by_oqs, :home
can :update_delivery_status, :home
can :queue_items_query, :home
can :completed_order, :home
can :queue_items_count_query, :home
can :index, :edit
can :update, :edit
can :print, :print
can :print_order_summary, :print
end
end
end

View File

@@ -8,7 +8,10 @@ class Printer::CashierStationPrinter < Printer::PrinterWorker
#Print
pdf = CashierStationOpening.new
pdf.render_file "tmp/cashier_station_#{order_id}_closing_#{time}.pdf"
self.print("tmp/cashier_station_#{order_id}_closing_#{time}.pdf")
#no print in cloud server
if ENV["SERVER_MODE"] != "cloud"
self.print("tmp/cashier_station_#{order_id}_closing_#{time}.pdf")
end
end
# def print_close_cashier(receipt_no)
@@ -59,7 +62,10 @@ class Printer::CashierStationPrinter < Printer::PrinterWorker
end
pdf.render_file filename
self.print(filename, cashier_terminal.printer_name)
#no print in cloud server
if ENV["SERVER_MODE"] != "cloud"
self.print(filename, cashier_terminal.printer_name)
end
end
#sqa
end

View File

@@ -39,14 +39,20 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
pdf.render_file filename
if oqs.print_copy
self.print(filename, oqs.printer_name)
#no print in cloud server
if ENV["SERVER_MODE"] != "cloud"
self.print(filename, oqs.printer_name)
end
#For print copy
# pdf.render_file filename.gsub(".","-copy.")
# self.print(filename.gsub(".","-copy."), oqs.printer_name)
else
print_settings.print_copies = 1
print_settings.save!
self.print(filename, oqs.printer_name)
#no print in cloud server
if ENV["SERVER_MODE"] != "cloud"
self.print(filename, oqs.printer_name)
end
end
# end
end
@@ -96,13 +102,19 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
end
# pdf.render_file "tmp/order_item.pdf"
pdf.render_file filename
if oqs.print_copy
self.print(filename, oqs.printer_name)
# self.print(filename.gsub(".","-copy."), oqs.printer_name)
if oqs.print_copy
#no print in cloud server
if ENV["SERVER_MODE"] != "cloud"
self.print(filename, oqs.printer_name)
# self.print(filename.gsub(".","-copy."), oqs.printer_name)
end
else
print_settings.print_copies = 1
print_settings.save!
self.print(filename, oqs.printer_name)
#no print in cloud server
if ENV["SERVER_MODE"] != "cloud"
self.print(filename, oqs.printer_name)
end
end
#end
end
@@ -130,14 +142,20 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
pdf.render_file filename
if oqs.print_copy
self.print(filename, oqs.printer_name)
#no print in cloud server
if ENV["SERVER_MODE"] != "cloud"
self.print(filename, oqs.printer_name)
end
#For print copy
# pdf.render_file filename.gsub(".","-copy.")
# self.print(filename.gsub(".","-copy."), oqs.printer_name)
else
print_settings.print_copies = 1
print_settings.save!
self.print(filename, oqs.printer_name)
#no print in cloud server
if ENV["SERVER_MODE"] != "cloud"
self.print(filename, oqs.printer_name)
end
end
end
end
@@ -183,15 +201,20 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
pdf.render_file filename
if oqs.print_copy
self.print(filename, oqs.printer_name)
#no print in cloud server
if ENV["SERVER_MODE"] != "cloud"
self.print(filename, oqs.printer_name)
end
#For print copy
# pdf.render_file filename.gsub(".","-copy.")
# self.print(filename.gsub(".","-copy."), oqs.printer_name)
else
print_settings.print_copies = 1
print_settings.save!
self.print(filename, oqs.printer_name)
#no print in cloud server
if ENV["SERVER_MODE"] != "cloud"
self.print(filename, oqs.printer_name)
end
end
#end
end
@@ -219,15 +242,20 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
pdf.render_file filename
if oqs.print_copy
self.print(filename, oqs.printer_name)
#no print in cloud server
if ENV["SERVER_MODE"] != "cloud"
self.print(filename, oqs.printer_name)
end
#For print copy
# pdf.render_file filename.gsub(".","-copy.")
# self.print(filename.gsub(".","-copy."), oqs.printer_name)
else
print_settings.print_copies = 1
print_settings.save!
self.print(filename, oqs.printer_name)
#no print in cloud server
if ENV["SERVER_MODE"] != "cloud"
self.print(filename, oqs.printer_name)
end
end
end
end

View File

@@ -24,7 +24,10 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
end
end
pdf.render_file "tmp/order_item_queue_#{order_id}_#{order_item_id}" + ".pdf"
self.print("tmp/receipt.pdf")
#no print in cloud server
if ENV["SERVER_MODE"] != "cloud"
self.print("tmp/receipt.pdf")
end
end
def print_receipt_payment_by_card(booking_id)
@@ -52,8 +55,10 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
end
end
pdf.render_file filename
self.print(filename)
#no print in cloud server
if ENV["SERVER_MODE"] != "cloud"
self.print(filename)
end
end
def print_receipt_payment_by_account(sale_id)
@@ -81,8 +86,10 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
end
end
pdf.render_file filename
self.print(filename)
#no print in cloud server
if ENV["SERVER_MODE"] != "cloud"
self.print(filename)
end
end
def print_receipt_payment_by_vochure(sale_id)
@@ -110,8 +117,10 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
end
end
pdf.render_file filename
self.print(filename)
#no print in cloud server
if ENV["SERVER_MODE"] != "cloud"
self.print(filename)
end
end
def print_receipt_payment_by_giftcard(sale_id)
@@ -139,8 +148,10 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
end
end
pdf.render_file filename
self.print(filename)
#no print in cloud server
if ENV["SERVER_MODE"] != "cloud"
self.print(filename)
end
end
def print_receipt_payment_by_foc(sale_id)
@@ -168,8 +179,10 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
end
end
pdf.render_file filename
self.print(filename)
#no print in cloud server
if ENV["SERVER_MODE"] != "cloud"
self.print(filename)
end
end
#Bill Receipt Print
@@ -205,13 +218,19 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
filename = directory_name + "/receipt_bill_#{sale_data.receipt_no}.pdf"
pdf.render_file filename
if printed_status != 'Paid'
self.print(directory_name + "/receipt_bill_#{sale_data.receipt_no}.pdf", cashier_terminal.printer_name)
#no print in cloud server
if ENV["SERVER_MODE"] != "cloud"
self.print(directory_name + "/receipt_bill_#{sale_data.receipt_no}.pdf", cashier_terminal.printer_name)
end
end
else
filename = directory_name + "/receipt_bill_#{sale_data.receipt_no}_#{count}.pdf"
pdf.render_file filename
if printed_status != 'Paid'
self.print(directory_name + "/receipt_bill_#{sale_data.receipt_no}_#{count}.pdf", cashier_terminal.printer_name)
#no print in cloud server
if ENV["SERVER_MODE"] != "cloud"
self.print(directory_name + "/receipt_bill_#{sale_data.receipt_no}_#{count}.pdf", cashier_terminal.printer_name)
end
end
end
@@ -225,7 +244,10 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
def print_stock_check_result(print_settings,stockcheck, stockcheck_items,checker_name, shop_details)
pdf = StockResultPdf.new(print_settings,stockcheck, stockcheck_items,checker_name, shop_details)
pdf.render_file "tmp/print_stock_check_result.pdf"
self.print("tmp/print_stock_check_result.pdf")
#no print in cloud server
if ENV["SERVER_MODE"] != "cloud"
self.print("tmp/print_stock_check_result.pdf")
end
end
#Queue No Print
@@ -235,7 +257,10 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
#Print
pdf = QueueNoPdf.new(printer_settings,queue)
pdf.render_file "tmp/print_queue_no.pdf"
self.print("tmp/print_queue_no.pdf")
#no print in cloud server
if ENV["SERVER_MODE"] != "cloud"
self.print("tmp/print_queue_no.pdf")
end
end
#Move Table Print
@@ -255,7 +280,10 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
#Print
pdf = CrmOrderPdf.new(booking,order_items,setting)
pdf.render_file "tmp/print_crm_order.pdf"
self.print("tmp/print_crm_order.pdf")
#no print in cloud server
if ENV["SERVER_MODE"] != "cloud"
self.print("tmp/print_crm_order.pdf")
end
end
#Queue No Print
@@ -265,7 +293,10 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
#Print
pdf = CallWaiterPdf.new(printer_settings,table,time,shop_detail)
pdf.render_file "tmp/print_call_waiter.pdf"
self.print("tmp/print_call_waiter.pdf")
#no print in cloud server
if ENV["SERVER_MODE"] != "cloud"
self.print("tmp/print_call_waiter.pdf")
end
end
#print receipt pdf from js
@@ -276,10 +307,16 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
# else
begin
if count == 1
self.print(filename, printer_name)
#no print in cloud server
if ENV["SERVER_MODE"] != "cloud"
self.print(filename, printer_name)
end
else
filename = "public/receipts/receipt_bill_#{receipt_no}_#{count}.pdf"
self.print(filename, printer_name)
#no print in cloud server
if ENV["SERVER_MODE"] != "cloud"
self.print(filename, printer_name)
end
end
count -= 1

View File

@@ -193,8 +193,6 @@
<button type="button" data-href="<%=origami_second_display_index_path%>" target="_blank" id="second_view" class="btn action-btn bg-blue waves-effect second_view hidden" style="height: 45px">Customer View</button>
<script>
$(".cashier_view").on('click', function() {
window.location.href = '/origami';
});

View File

@@ -140,7 +140,11 @@
<script>
$(document).ready(function(){
var webview = <%= @webview %>;
if(webview){
code2lab.checkMobile(webview); //js func: for mobile login
}
showHideNavbar(webview,"index");
$(".tables").on('click', function(){
var dining_id = $(this).attr("data-id");
window.location.href = '/origami/table/' + dining_id;

View File

@@ -0,0 +1,26 @@
class CreateOrderReservations < ActiveRecord::Migration[5.1]
def change
create_table :order_reservations, :id => false do |t|
t.string :order_reservation_id, :limit => 16, :primary_key => true
t.string :order_reservation_type, :null => false
t.string :customer_id, :null => false
t.datetime :requested_time, :null => false
t.integer :item_count, :null => false, :default => 0
t.integer :total_customer
t.string :payment_type
t.string :payment_status
t.string :payment_ref
t.decimal :total_amount, :precision => 10, :scale => 2, :null => false, :default => 0.00
t.decimal :total_tax, :precision => 10, :scale => 2, :null => false, :default => 0.00
t.decimal :discount_amount, :precision => 10, :scale => 2, :null => false, :default => 0.00
t.decimal :grand_total, :precision => 10, :scale => 2, :null => false, :default => 0.00
t.string :status, :null => false, :default => "new"
t.string :order_remark
t.string :reservation_remark
end
end
def down
drop_table :order_reservations
end
end

View File

@@ -0,0 +1,25 @@
class CreateOrderReservationItems < ActiveRecord::Migration[5.1]
def change
create_table :order_reservation_items, :id => false do |t|
t.string :order_reservation_items_id, :limit => 16, :primary_key => true
t.string :order_reservation_id, foreign_key: true, :null => false, :limit => 16
t.string :item_status, :null => false, :default => "new"
t.string :item_code, :null => false
t.string :item_instance_code
t.string :item_name, :null => false
t.string :alt_name, :null => false
t.json :set_menu_items
t.integer :account_id, :limit => 8, :null => false, :default => 1
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 :price, :precision => 10, :scale => 2, :null => false, :default => 0.00
t.string :remark
t.string :options
t.boolean :taxable, :null => false, :default => true
end
end
def down
drop_table :order_reservation_items
end
end

View File

@@ -0,0 +1,18 @@
class CreateDeliveries < ActiveRecord::Migration[5.1]
def change
create_table :deliveries do |t|
t.string :order_reservation_id, foreign_key: true, :null => false, :limit => 16
t.string :provider, :null => false
t.string :delivery_type, :null => false
t.string :township
t.string :address
t.string :direction_address
t.string :delivery_fee
t.string :remark
end
end
def down
drop_table :deliveries
end
end