conflic data

This commit is contained in:
San Wai Lwin
2018-02-09 10:17:56 +06:30
parent 625ee9bd34
commit 860e8db202
29 changed files with 622 additions and 296 deletions

View File

@@ -11,7 +11,7 @@ ruby 2.4.1p111
Osaka Osaka
Auth Token => rj0MJ0XI5GsKZehE => New Auth Token => wu8YvlLmah0CL => New ##note : Old => rj0MJ0XI5GsKZehE
=> code2lab => Old => code2lab => Old
@@ -23,7 +23,7 @@ ruby 2.4.1p111
BITP BITP
Auth Token => rj0MJ0XI5GsKZehE => New Auth Token => pZBHXEFbGNj/G => New ##note : Old => rj0MJ0XI5GsKZehE
=> code2lab => Old => code2lab => Old
@@ -103,6 +103,10 @@ Change type in mysql
=> ALTER TABLE [table_name] CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci #for table => ALTER TABLE [table_name] CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci #for table
=> ALTER DATABASE [database_name] CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci #for database => ALTER DATABASE [database_name] CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci #for database
###please open
sudo cat /etc/sudoers
### cope and parse
%superuser ALL=(ALL) NOPASSWD: ALL
* ToDo list * ToDo list

View File

@@ -25,6 +25,7 @@
//= require custom.js //= require custom.js
$(document).on('turbolinks:load', function() { $(document).on('turbolinks:load', function() {
var oqs_id = "";
$(".nav-completed").on("click", function(){ $(".nav-completed").on("click", function(){
$("#completed").removeClass('hide') $("#completed").removeClass('hide')
$(".oqs_append").addClass('hide') $(".oqs_append").addClass('hide')
@@ -37,7 +38,8 @@ $(document).on('turbolinks:load', function() {
$(".oqs_append").removeClass('hide'); $(".oqs_append").removeClass('hide');
$(this).addClass('oqs_active'); $(this).addClass('oqs_active');
$(".queue_station").addClass('queue_station_box'); $(".queue_station").addClass('queue_station_box');
var oqs_id = $(this).find(".oqs-id").text(); oqs_id = $(this).find(".oqs-id").text();
console.log(oqs_id);
var url = 'oqs/get_items/'+oqs_id; var url = 'oqs/get_items/'+oqs_id;
show_details(url); show_details(url);
@@ -143,7 +145,6 @@ $(document).on('turbolinks:load', function() {
url: '/oqs/' + orderNo, url: '/oqs/' + orderNo,
data: { 'status' : order_status }, data: { 'status' : order_status },
success: function(res){ success: function(res){
for (i = 0; i < res.length; i++) { for (i = 0; i < res.length; i++) {
var data = JSON.stringify(res[i]); var data = JSON.stringify(res[i]);
var parse_data = JSON.parse(data); var parse_data = JSON.parse(data);
@@ -156,10 +157,19 @@ $(document).on('turbolinks:load', function() {
}); });
} }
} }
if (oqs_id > 0){
var order_item_row = "<tr id='edit_"+assigned_item_id+"' class='order-item-edit'>" +
"<td class='order-items' style='width:80%; text-align:left'>" + parse_data.item_name + set_instance_items + "</td>" +
"<td class='order-qty' style='width:20%; text-align:right'>" + parse_data.qty + "</td>" +
"</tr>";
}else{
var order_item_row = "<tr>" + var order_item_row = "<tr>" +
"<td class='order-items' style='width:80%; text-align:left'>" + parse_data.item_name + set_instance_items + "</td>" + "<td class='order-items' style='width:80%; text-align:left'>" + parse_data.item_name + set_instance_items + "</td>" +
"<td class='order-qty' style='width:20%; text-align:right'>" + parse_data.qty + "</td>" + "<td class='order-qty' style='width:20%; text-align:right'>" + parse_data.qty + "</td>" +
"</tr>"; "</tr>";
}
$("#oqs-order-details-table").children("tbody").append(order_item_row); $("#oqs-order-details-table").children("tbody").append(order_item_row);
} }
} }

View File

@@ -7,15 +7,27 @@ App.call_waiter = App.cable.subscriptions.create('CallWaiterChannel', {
received: function(data) { received: function(data) {
table = data.table table = data.table
time = data.time
// for Notificaiotn message // for Notificaiotn message
var element = "#notify-wrapper" var element = "#notify-wrapper"
var placementFrom = "top";
var placementAlign = "center";
var animateEnter = ""; var animateEnter = "";
var animateExit = ""; var animateExit = "";
if (time == 'print_error') {
var colorName = "alert-danger";
var placementFrom = "center";
var placementAlign = "center";
var text = " Hello <br> "+table ;
style =""
}else{
var colorName = "alert-warning"; var colorName = "alert-warning";
var placementFrom = "top";
var placementAlign = "center";
var text = " Calling Waiter <br> "+table.name ; var text = " Calling Waiter <br> "+table.name ;
style ="width:180px !important;"
}
if (text != null || colorName != null){ if (text != null || colorName != null){
showNotification(element, colorName, text, placementFrom, placementAlign, animateEnter, animateExit); showNotification(element, colorName, text, placementFrom, placementAlign, animateEnter, animateExit);
@@ -43,7 +55,7 @@ App.call_waiter = App.cable.subscriptions.create('CallWaiterChannel', {
enter: animateEnter, enter: animateEnter,
exit: animateExit exit: animateExit
}, },
template: '<div data-notify="container" style="width:180px !important;" class="bootstrap-notify-container alert alert-dismissible {0} ' + (allowDismiss ? "p-r-30" : "") + '" role="alert">' + template: '<div data-notify="container" style="'+style+'" class="bootstrap-notify-container alert alert-dismissible {0} ' + (allowDismiss ? "p-r-30" : "") + '" role="alert">' +
'<button type="button" aria-hidden="true" class="close notify-close float-right m-l-5 m-t--5" data-notify="dismiss">×</button>' + '<button type="button" aria-hidden="true" class="close notify-close float-right m-l-5 m-t--5" data-notify="dismiss">×</button>' +
'<span data-notify="icon"></span> ' + '<span data-notify="icon"></span> ' +
'<span data-notify="title">{1}</span> ' + '<span data-notify="title">{1}</span> ' +

View File

@@ -46,7 +46,8 @@ class Api::BillController < Api::ApiController
Promotion.promo_activate(@sale) Promotion.promo_activate(@sale)
BillBroadcastJob.perform_later(table) #BillBroadcastJob.perform_later(table)
ActionCable.server.broadcast "bill_channel",table: table
else else
@status = false @status = false
@error_message = "No Current Open Shift" @error_message = "No Current Open Shift"

View File

@@ -5,7 +5,8 @@ class Api::CallWaitersController < ActionController::API
@table_id = params[:dining_id] @table_id = params[:dining_id]
@time = params[:time] @time = params[:time]
@table = DiningFacility.find(@table_id) @table = DiningFacility.find(@table_id)
CallWaiterJob.perform_later(@table,@time) # CallWaiterJob.perform_later(@table,@time)
ActionCable.server.broadcast "call_waiter_channel",table: @table,time:@time
# get printer info # get printer info
@shop = Shop::ShopDetail @shop = Shop::ShopDetail

View File

@@ -10,7 +10,9 @@ class Oqs::EditController < BaseOqsController
qty_weight = params[:qty_weight] qty_weight = params[:qty_weight]
remarks = params[:remarks] remarks = params[:remarks]
order_item = OrderItem.find(order_items_id); order_item = OrderItem.find(order_items_id)
before_updated_qty = order_item.qty
order_item.item_order_by = current_user.name order_item.item_order_by = current_user.name
order_item.qty = qty_weight order_item.qty = qty_weight
order_item.remark = remarks order_item.remark = remarks
@@ -45,7 +47,7 @@ class Oqs::EditController < BaseOqsController
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)
order_queue_printer.print_order_item(print_settings, oqs, order_item.order_id, order_items_id, print_status=" (Updated)" ) order_queue_printer.print_order_item(print_settings, oqs, order_item.order_id, order_items_id, print_status=" (Cancelled)", before_updated_qty )
end end
end end

View File

@@ -1,7 +1,7 @@
class Oqs::HomeController < BaseOqsController class Oqs::HomeController < BaseOqsController
def index def index
@queue_stations = OrderQueueStation.all
# Query for OQS with delivery status false # Query for OQS with delivery status false
# @queue_items_details = queue_items_query(false) # @queue_items_details = queue_items_query(false)
@@ -11,26 +11,28 @@ class Oqs::HomeController < BaseOqsController
@filter = params[:filter] @filter = params[:filter]
@queue_stations = OrderQueueStation.all
@queue_completed_item = completed_order(@filter) @queue_completed_item = completed_order(@filter)
if !@queue_completed_item.empty? # if !@queue_completed_item.empty?
@queue_completed_item.each do |queue_item| # @queue_completed_item.each do |queue_item|
if !queue_item.set_menu_items.nil? # if !queue_item.set_menu_items.nil?
instance_item_sets = JSON.parse(JSON.parse(queue_item.set_menu_items)) # instance_item_sets = JSON.parse(JSON.parse(queue_item.set_menu_items))
arr_instance_item_sets = Array.new # arr_instance_item_sets = Array.new
instance_item_sets.each do |instance_item| # instance_item_sets.each do |instance_item|
item_instance_name = MenuItemInstance.find_by_item_instance_code(instance_item["item_instance_code"]).item_instance_name # item_instance_name = MenuItemInstance.find_by_item_instance_code(instance_item["item_instance_code"]).item_instance_name
arr_instance_item_sets.push(item_instance_name) # arr_instance_item_sets.push(item_instance_name)
end # end
queue_item.set_menu_items = arr_instance_item_sets # queue_item.set_menu_items = arr_instance_item_sets
end # end
end # end
end # end
if !@filter.nil? if !@filter.nil?
@count = queue_items_count_query(false,@filter) @count = queue_items_count_query(false,@filter)
@count.each do |count| #@count.each do |count|
end #end
end end
# @queue_stations_items=Array.new # @queue_stations_items=Array.new
@@ -99,7 +101,6 @@ class Oqs::HomeController < BaseOqsController
end end
end end
end end
render :json => items.to_json render :json => items.to_json
end end
@@ -194,18 +195,35 @@ class Oqs::HomeController < BaseOqsController
# completed_order = AssignedOrderItem.group(:order_id).where('delivery_status=true'); # completed_order = AssignedOrderItem.group(:order_id).where('delivery_status=true');
end end
# def queue_items_count_query(status,filter)
# query = AssignedOrderItem.select("count(odt.item_code) as total,oqs.id as station_id")
# .joins(" 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
# left join order_items as odt ON odt.item_instance_code = assigned_order_items.instance_code AND odt.order_id = assigned_order_items.order_id
# left join customers as cus ON cus.customer_id = od.customer_id
# left join booking_orders as bo on bo.order_id = assigned_order_items.order_id
# left join bookings as bk on bk.booking_id = bo.booking_id
# left join dining_facilities as df on df.id = bk.dining_facility_id")
# .where("assigned_order_items.delivery_status = #{status} AND assigned_order_items.created_at >= '#{Time.now.beginning_of_day.utc}' ")
# query = query.where("df.name LIKE ? OR odt.order_id LIKE ? OR odt.item_name LIKE ? OR cus.name = '#{filter}'","%#{filter}%","%#{filter}%","%#{filter}%",)
# .group("oqs.id")
# end
def queue_items_count_query(status,filter) def queue_items_count_query(status,filter)
query = AssignedOrderItem.select("count(odt.item_code) as total,oqs.id as station_id") # query = OrderQueueStation.all
.joins(" left join order_queue_stations as oqs on oqs.id = assigned_order_items.order_queue_station_id query = OrderQueueStation.select("order_queue_stations.id as station_id,
left join orders as od ON od.order_id = assigned_order_items.order_id (case when (count(odt.item_code)>0) then count(odt.item_code) else 0 end) as total")
left join order_items as odt ON odt.item_instance_code = assigned_order_items.instance_code AND odt.order_id = assigned_order_items.order_id .joins(" left join assigned_order_items as aoi on aoi.order_queue_station_id= order_queue_stations.id
left join orders as od ON od.order_id = aoi.order_id
left join order_items as odt ON odt.item_instance_code = aoi.instance_code AND odt.order_id = aoi.order_id
left join customers as cus ON cus.customer_id = od.customer_id left join customers as cus ON cus.customer_id = od.customer_id
left join booking_orders as bo on bo.order_id = assigned_order_items.order_id left join booking_orders as bo on bo.order_id = aoi.order_id
left join bookings as bk on bk.booking_id = bo.booking_id left join bookings as bk on bk.booking_id = bo.booking_id
left join dining_facilities as df on df.id = bk.dining_facility_id") left join dining_facilities as df on df.id = bk.dining_facility_id")
.where("assigned_order_items.delivery_status = #{status} AND assigned_order_items.created_at >= '#{Time.now.beginning_of_day.utc}' ") .where("aoi.delivery_status = #{status} AND aoi.created_at >= '#{Time.now.beginning_of_day.utc}' ")
query = query.where("df.name LIKE ? OR odt.order_id LIKE ? OR odt.item_name LIKE ? OR cus.name = '#{filter}'","%#{filter}%","%#{filter}%","%#{filter}%",) query = query.where("df.name LIKE ? OR odt.order_id LIKE ? OR odt.item_name LIKE ? OR cus.name = '#{filter}'","%#{filter}%","%#{filter}%","%#{filter}%",)
.group("oqs.id") .group("order_queue_stations.id")
end end

View File

@@ -38,7 +38,7 @@ class Oqs::PrintController < ApplicationController
# print when complete click # print when complete click
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)
order_queue_printer.print_order_item(print_settings,oqs, assigned_item.order_id, order_item.order_items_id, print_status, options ) order_queue_printer.print_order_item(print_settings,oqs, assigned_item.order_id, order_item.order_items_id, print_status, "", options )
# update print status for completed same order items # update print status for completed same order items
assigned_items.each do |ai| assigned_items.each do |ai|

View File

@@ -6,7 +6,7 @@ class Origami::HomeController < BaseOrigamiController
@tables = Table.all.active.order('status desc') @tables = Table.all.active.order('status desc')
@rooms = Room.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')) @complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
@orders = Order.all.order('date desc') @orders = Order.where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
@shop = Shop::ShopDetail @shop = Shop::ShopDetail
# @shift = ShiftSale.current_open_shift(current_user.id) # @shift = ShiftSale.current_open_shift(current_user.id)
@@ -17,7 +17,7 @@ class Origami::HomeController < BaseOrigamiController
@tables = Table.all.active.order('status desc') @tables = Table.all.active.order('status desc')
@rooms = Room.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')) @complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
@orders = Order.all.order('date desc') @orders = Order.where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
@status_order = "" @status_order = ""
@status_sale = "" @status_sale = ""
@@ -27,6 +27,32 @@ class Origami::HomeController < BaseOrigamiController
@membership = MembershipSetting::MembershipSetting @membership = MembershipSetting::MembershipSetting
@payment_methods = PaymentMethodSetting.all @payment_methods = PaymentMethodSetting.all
@order_items_count = Hash.new
bookings = Booking.all
if !bookings.nil?
bookings.each do |booking|
if booking.sale_id.nil? && booking.booking_status != 'moved'
if !booking.booking_orders.empty?
booking.booking_orders.each do |booking_order|
order = Order.find(booking_order.order_id)
if !order.order_items.empty?
if !@order_items_count.key?(booking.dining_facility_id)
@order_items_count.store(booking.dining_facility_id, order.order_items.count)
end
end
end
end
else
sale = Sale.find(booking.sale_id)
if sale.sale_status !='completed'
if !@order_items_count.key?(booking.dining_facility_id)
@order_items_count.store(booking.dining_facility_id, sale.sale_items.count)
end
end
end
end
end
@dining.bookings.active.each do |booking| @dining.bookings.active.each do |booking|
if booking.sale_id.nil? && booking.booking_status != 'moved' if booking.sale_id.nil? && booking.booking_status != 'moved'
@order_items = Array.new @order_items = Array.new
@@ -65,7 +91,6 @@ class Origami::HomeController < BaseOrigamiController
else else
sale = Sale.find(booking.sale_id) sale = Sale.find(booking.sale_id)
if sale.sale_status != "completed" && sale.sale_status != 'void' if sale.sale_status != "completed" && sale.sale_status != 'void'
@sale_array.push(sale) @sale_array.push(sale)
if @status_order == 'order' if @status_order == 'order'
@status_order = 'sale' @status_order = 'sale'

View File

@@ -3,7 +3,7 @@ class Origami::OrdersController < BaseOrigamiController
@tables = Table.all.active.order('status desc') @tables = Table.all.active.order('status desc')
@rooms = Room.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')) @complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
@orders = Order.all.order('status desc') @orders = Order.where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
@order = Order.find(params[:order_id]) @order = Order.find(params[:order_id])
sale_order = SaleOrder.find_by_order_id(@order.order_id) sale_order = SaleOrder.find_by_order_id(@order.order_id)
if sale_order if sale_order
@@ -12,6 +12,32 @@ class Origami::OrdersController < BaseOrigamiController
@sale_status = sale.sale_status @sale_status = sale.sale_status
end end
end end
@order_items_count = Hash.new
bookings = Booking.all
if !bookings.nil?
bookings.each do |booking|
if booking.sale_id.nil? && booking.booking_status != 'moved'
if !booking.booking_orders.empty?
booking.booking_orders.each do |booking_order|
order = Order.find(booking_order.order_id)
if !order.order_items.empty?
if !@order_items_count.key?(booking.dining_facility_id)
@order_items_count.store(booking.dining_facility_id, order.order_items.count)
end
end
end
end
else
sale = Sale.find(booking.sale_id)
if sale.sale_status !='completed'
if !@order_items_count.key?(booking.dining_facility_id)
@order_items_count.store(booking.dining_facility_id, sale.sale_items.count)
end
end
end
end
end
end end
#Shop Name in Navbor #Shop Name in Navbor

View File

@@ -45,8 +45,8 @@ class Origami::PaymentsController < BaseOrigamiController
rebate = MembershipSetting.find_by_rebate(1) rebate = MembershipSetting.find_by_rebate(1)
if customer.membership_id != nil && rebate if customer.membership_id != nil && rebate
member_info = Customer.get_member_account(customer) member_info = Customer.get_member_account(customer)
# current_balance = SaleAudit.paymal_search(sale_id) current_balance = SaleAudit.paymal_search(sale_id)
current_balance = 0 # current_balance = 0
end end
# get printer info # get printer info
print_settings=PrintSetting.find_by_unique_code(unique_code) print_settings=PrintSetting.find_by_unique_code(unique_code)

View File

@@ -3,7 +3,7 @@ class Origami::RoomsController < BaseOrigamiController
@tables = Table.all.active.order('status desc') @tables = Table.all.active.order('status desc')
@rooms = Room.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')) @complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
@orders = Order.all.order('date desc') @orders = Order.where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
# @shift = ShiftSale.current_open_shift(current_user.id) # @shift = ShiftSale.current_open_shift(current_user.id)
end end
@@ -11,7 +11,7 @@ class Origami::RoomsController < BaseOrigamiController
@tables = Table.all.active.order('status desc') @tables = Table.all.active.order('status desc')
@rooms = Room.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')) @complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
@orders = Order.all.order('date desc') @orders = Order.where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
@room = DiningFacility.find(params[:room_id]) @room = DiningFacility.find(params[:room_id])
@@ -23,6 +23,32 @@ class Origami::RoomsController < BaseOrigamiController
@membership = MembershipSetting::MembershipSetting @membership = MembershipSetting::MembershipSetting
@payment_methods = PaymentMethodSetting.all @payment_methods = PaymentMethodSetting.all
@order_items_count = Hash.new
bookings = Booking.all
if !bookings.nil?
bookings.each do |booking|
if booking.sale_id.nil? && booking.booking_status != 'moved'
if !booking.booking_orders.empty?
booking.booking_orders.each do |booking_order|
order = Order.find(booking_order.order_id)
if !order.order_items.empty?
if !@order_items_count.key?(booking.dining_facility_id)
@order_items_count.store(booking.dining_facility_id, order.order_items.count)
end
end
end
end
else
sale = Sale.find(booking.sale_id)
if sale.sale_status !='completed'
if !@order_items_count.key?(booking.dining_facility_id)
@order_items_count.store(booking.dining_facility_id, sale.sale_items.count)
end
end
end
end
end
@room.bookings.active.each do |booking| @room.bookings.active.each do |booking|
if booking.sale_id.nil? && booking.booking_status != 'moved' if booking.sale_id.nil? && booking.booking_status != 'moved'
@order_items = Array.new @order_items = Array.new

View File

@@ -3,7 +3,7 @@ class Origami::SalesController < BaseOrigamiController
@tables = Table.all.active.order('status desc') @tables = Table.all.active.order('status desc')
@rooms = Room.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')) @complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
@orders = Order.all.order('date desc') @orders = Order.where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
@sale = Sale.find(params[:sale_id]) @sale = Sale.find(params[:sale_id])
@order = SaleOrder.find_by_sale_id(@sale.sale_id).order_id @order = SaleOrder.find_by_sale_id(@sale.sale_id).order_id
@booking = BookingOrder.find_by_order_id(@order).booking_id @booking = BookingOrder.find_by_order_id(@order).booking_id

View File

@@ -155,6 +155,14 @@ class DiningFacility < ApplicationRecord
def self.check_in_booking(table_id) def self.check_in_booking(table_id)
table = DiningFacility.find(table_id) table = DiningFacility.find(table_id)
#Send to background job for processing #Send to background job for processing
CheckInBookingJob.perform_later(table) # CheckInBookingJob.perform_later(table)
ActionCable.server.broadcast "check_in_booking_channel",table: table
end
def self.checkin_time
table = DiningFacility.get_checkin_booking
if table.length > 0
ActionCable.server.broadcast "checkin_channel",table: table
end
end end
end end

View File

@@ -278,16 +278,42 @@ class Order < ApplicationRecord
#Process order items and send to order queue #Process order items and send to order queue
def process_order_queue def process_order_queue
#Send to background job for processing #Send to background job for processing
cup_status = `#{"sudo service cups status"}`
print_status = check_cup_status(cup_status)
if print_status
OrderQueueProcessorJob.perform_later(self.id, self.table_id)
else
cup_start = `#{"sudo service cups start"}`
cup_status = `#{"sudo service cups status"}`
print_status = check_cup_status(cup_status)
if print_status
OrderQueueProcessorJob.perform_later(self.id, self.table_id)
else
msg = ' Print Error ! Please contact to service'
ActionCable.server.broadcast "call_waiter_channel",table: msg,time:'print_error'
OrderQueueProcessorJob.perform_later(self.id, self.table_id) OrderQueueProcessorJob.perform_later(self.id, self.table_id)
end end
end
end
def check_cup_status(status)
if status.include? "Active: active (running)" || "Active: active (exited)" #"Cup Server is already running"
return true
end
return false
end
#send order items and send to order queue #send order items and send to order queue
def send_order_broadcast(booking) def send_order_broadcast(booking)
table = DiningFacility.find(booking.dining_facility_id) table = DiningFacility.find(booking.dining_facility_id)
type = 'order' type = 'order'
#Send to background job for processing #Send to background job for processing
OrderBroadcastJob.perform_later(table,type) # OrderBroadcastJob.perform_later(table,type)
ActionCable.server.broadcast "order_channel",table: table,type:type
end end
#Origami: Cashier : to view order Table #Origami: Cashier : to view order Table

View File

@@ -1,6 +1,6 @@
class Printer::OrderQueuePrinter < Printer::PrinterWorker class Printer::OrderQueuePrinter < Printer::PrinterWorker
def print_order_item(print_settings,oqs, order_id, order_item_id, print_status, options="") def print_order_item(print_settings,oqs, order_id, order_item_id, print_status, before_updated_qty="", options="")
#Use CUPS service #Use CUPS service
#Generate PDF #Generate PDF
#Print #Print
@@ -14,7 +14,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
filename = "tmp/order_item_#{order_id}_#{order_item_id}" + ".pdf" filename = "tmp/order_item_#{order_id}_#{order_item_id}" + ".pdf"
pdf = OrderItemPdf.new(print_settings,order_item[0], print_status, options, oqs.use_alternate_name) pdf = OrderItemPdf.new(print_settings,order_item[0], print_status, options, oqs.use_alternate_name, before_updated_qty)
order_slim_pdf = Lookup.collection_of("print_settings") #print_settings with name:OrderSlimPdf order_slim_pdf = Lookup.collection_of("print_settings") #print_settings with name:OrderSlimPdf
# check for item not to show # check for item not to show
# if order_item[0].price != 0 # if order_item[0].price != 0
@@ -22,15 +22,15 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
order_slim_pdf.each do |order_item_slim| order_slim_pdf.each do |order_item_slim|
if order_item_slim[0] == 'OrderSlimPdf' if order_item_slim[0] == 'OrderSlimPdf'
if order_item_slim[1] == '1' if order_item_slim[1] == '1'
pdf = OrderItemSlimPdf.new(print_settings,order_item[0], print_status, options, oqs.use_alternate_name) pdf = OrderItemSlimPdf.new(print_settings,order_item[0], print_status, options, oqs.use_alternate_name, before_updated_qty)
else else
pdf = OrderItemPdf.new(print_settings,order_item[0], print_status, options, oqs.use_alternate_name) pdf = OrderItemPdf.new(print_settings,order_item[0], print_status, options, oqs.use_alternate_name, before_updated_qty)
end end
elsif order_item_slim[0] == 'OrderSetPdf' elsif order_item_slim[0] == 'OrderSetPdf'
if order_item_slim[1] == '1' if order_item_slim[1] == '1'
pdf = OrderSetItemPdf.new(print_settings,order_item[0], print_status, options, oqs.use_alternate_name) pdf = OrderSetItemPdf.new(print_settings,order_item[0], print_status, options, oqs.use_alternate_name, before_updated_qty)
else else
pdf = OrderItemPdf.new(print_settings,order_item[0], print_status, options, oqs.use_alternate_name) pdf = OrderItemPdf.new(print_settings,order_item[0], print_status, options, oqs.use_alternate_name, before_updated_qty)
end end
end end
end end
@@ -52,7 +52,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
end end
# Query for per order # Query for per order
def print_order_summary(print_settings,oqs, order_id, order_items, print_status) def print_order_summary(print_settings,oqs, order_id, order_items, print_status, before_updated_qty="", options="")
#Use CUPS service #Use CUPS service
#Generate PDF #Generate PDF
#Print #Print
@@ -76,20 +76,20 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
# check for item not to show # check for item not to show
#if odi.price != 0 #if odi.price != 0
pdf = OrderItemPdf.new(print_settings,odi_item[0], print_status, options, oqs.use_alternate_name) pdf = OrderItemPdf.new(print_settings,odi_item[0], print_status, options, oqs.use_alternate_name,before_updated_qty)
if !order_slim_pdf.empty? if !order_slim_pdf.empty?
order_slim_pdf.each do |order_item_slim| order_slim_pdf.each do |order_item_slim|
if order_item_slim[0] == 'OrderSlimPdf' if order_item_slim[0] == 'OrderSlimPdf'
if order_item_slim[1] == '1' if order_item_slim[1] == '1'
pdf = OrderItemSlimPdf.new(print_settings,odi_item[0], print_status, options, oqs.use_alternate_name) pdf = OrderItemSlimPdf.new(print_settings,odi_item[0], print_status, options, oqs.use_alternate_name,before_updated_qty)
else else
pdf = OrderItemPdf.new(print_settings,odi_item[0], print_status, options, oqs.use_alternate_name) pdf = OrderItemPdf.new(print_settings,odi_item[0], print_status, options, oqs.use_alternate_name,before_updated_qty)
end end
elsif order_item_slim[0] == 'OrderSetPdf' elsif order_item_slim[0] == 'OrderSetPdf'
if order_item_slim[1] == '1' if order_item_slim[1] == '1'
pdf = OrderSetItemPdf.new(print_settings,odi_item[0], print_status, options, oqs.use_alternate_name) pdf = OrderSetItemPdf.new(print_settings,odi_item[0], print_status, options, oqs.use_alternate_name,before_updated_qty)
else else
pdf = OrderItemPdf.new(print_settings,odi_item[0], print_status, options, oqs.use_alternate_name) pdf = OrderItemPdf.new(print_settings,odi_item[0], print_status, options, oqs.use_alternate_name,before_updated_qty)
end end
end end
end end
@@ -109,20 +109,20 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
# For Print Order Summary # For Print Order Summary
else else
filename = "tmp/order_summary_#{order_id}" + ".pdf" filename = "tmp/order_summary_#{order_id}" + ".pdf"
pdf = OrderSummaryPdf.new(print_settings,order, print_status, order_items, oqs.use_alternate_name) pdf = OrderSummaryPdf.new(print_settings,order, print_status, order_items, oqs.use_alternate_name,before_updated_qty)
if !order_slim_pdf.empty? if !order_slim_pdf.empty?
order_slim_pdf.each do |order_summary_slim| order_slim_pdf.each do |order_summary_slim|
if order_summary_slim[0] == 'OrderSlimPdf' if order_summary_slim[0] == 'OrderSlimPdf'
if order_summary_slim[1] == '1' if order_summary_slim[1] == '1'
pdf = OrderSummarySlimPdf.new(print_settings,order, print_status, order_items, oqs.use_alternate_name) pdf = OrderSummarySlimPdf.new(print_settings,order, print_status, order_items, oqs.use_alternate_name,before_updated_qty)
else else
pdf = OrderSummaryPdf.new(print_settings,order, print_status, order_items, oqs.use_alternate_name) pdf = OrderSummaryPdf.new(print_settings,order, print_status, order_items, oqs.use_alternate_name,before_updated_qty)
end end
elsif order_summary_slim[0] == 'OrderSetPdf' elsif order_summary_slim[0] == 'OrderSetPdf'
if order_summary_slim[1] == '1' if order_summary_slim[1] == '1'
pdf = OrderSummarySetPdf.new(print_settings,order, print_status, order_items, oqs.use_alternate_name) pdf = OrderSummarySetPdf.new(print_settings,order, print_status, order_items, oqs.use_alternate_name,before_updated_qty)
else else
pdf = OrderSummaryPdf.new(print_settings,order, print_status, order_items, oqs.use_alternate_name) pdf = OrderSummaryPdf.new(print_settings,order, print_status, order_items, oqs.use_alternate_name,before_updated_qty)
end end
end end
end end
@@ -143,7 +143,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
end end
# Print for orders in booking # Print for orders in booking
def print_booking_summary(print_settings,oqs, booking_id, print_status) def print_booking_summary(print_settings,oqs, booking_id, print_status,before_updated_qty="")
# Must be one print # Must be one print
if print_settings.print_copies == 0 if print_settings.print_copies == 0
print_settings.print_copies = 1 print_settings.print_copies = 1
@@ -162,20 +162,20 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
# check for item not to show # check for item not to show
#if odi.price != 0 #if odi.price != 0
pdf = OrderItemPdf.new(print_settings,odi, print_status, options,oqs.use_alternate_name) pdf = OrderItemPdf.new(print_settings,odi, print_status, options,oqs.use_alternate_name,before_updated_qty)
if !order_slim_pdf.empty? if !order_slim_pdf.empty?
order_slim_pdf.each do |order_item_slim| order_slim_pdf.each do |order_item_slim|
if order_item_slim[0] == 'OrderSlimPdf' if order_item_slim[0] == 'OrderSlimPdf'
if order_item_slim[1] == '1' if order_item_slim[1] == '1'
pdf = OrderItemSlimPdf.new(print_settings,odi, print_status, options,oqs.use_alternate_name) pdf = OrderItemSlimPdf.new(print_settings,odi, print_status, options,oqs.use_alternate_name,before_updated_qty)
else else
pdf = OrderItemPdf.new(print_settings,odi, print_status, options,oqs.use_alternate_name) pdf = OrderItemPdf.new(print_settings,odi, print_status, options,oqs.use_alternate_name,before_updated_qty)
end end
elsif order_item_slim[0] == 'OrderSetPdf' elsif order_item_slim[0] == 'OrderSetPdf'
if order_item_slim[1] == '1' if order_item_slim[1] == '1'
pdf = OrderSetItemPdf.new(print_settings,odi, print_status, options,oqs.use_alternate_name) pdf = OrderSetItemPdf.new(print_settings,odi, print_status, options,oqs.use_alternate_name,before_updated_qty)
else else
pdf = OrderItemPdf.new(print_settings,odi, print_status, options,oqs.use_alternate_name) pdf = OrderItemPdf.new(print_settings,odi, print_status, options,oqs.use_alternate_name,before_updated_qty)
end end
end end
end end
@@ -198,20 +198,20 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
# For Print Order Summary # For Print Order Summary
else else
filename = "tmp/booking_summary_#{booking_id}" + ".pdf" filename = "tmp/booking_summary_#{booking_id}" + ".pdf"
pdf = OrderSummaryPdf.new(print_settings,order, print_status,oqs.use_alternate_name) pdf = OrderSummaryPdf.new(print_settings,order, print_status,oqs.use_alternate_name,before_updated_qty)
if !order_slim_pdf.empty? if !order_slim_pdf.empty?
order_slim_pdf.each do |order_summary_slim| order_slim_pdf.each do |order_summary_slim|
if order_summary_slim[0] == 'OrderSlimPdf' if order_summary_slim[0] == 'OrderSlimPdf'
if order_summary_slim[1] == '1' if order_summary_slim[1] == '1'
pdf = OrderSummarySlimPdf.new(print_settings,order, print_status,oqs.use_alternate_name) pdf = OrderSummarySlimPdf.new(print_settings,order, print_status,oqs.use_alternate_name,before_updated_qty)
else else
pdf = OrderSummaryPdf.new(print_settings,order, print_status,oqs.use_alternate_name) pdf = OrderSummaryPdf.new(print_settings,order, print_status,oqs.use_alternate_name,before_updated_qty)
end end
elsif order_summary_slim[0] == 'OrderSetPdf' elsif order_summary_slim[0] == 'OrderSetPdf'
if order_summary_slim[1] == '1' if order_summary_slim[1] == '1'
pdf = OrderSummarySetPdf.new(print_settings,order, print_status,oqs.use_alternate_name) pdf = OrderSummarySetPdf.new(print_settings,order, print_status,oqs.use_alternate_name,before_updated_qty)
else else
pdf = OrderSummaryPdf.new(print_settings,order, print_status,oqs.use_alternate_name) pdf = OrderSummaryPdf.new(print_settings,order, print_status,oqs.use_alternate_name,before_updated_qty)
end end
end end
end end

View File

@@ -128,7 +128,9 @@ class Sale < ApplicationRecord
booking.checkout_by = requested_by.name booking.checkout_by = requested_by.name
booking.save booking.save
InventoryJob.perform_now(self.id) # InventoryJob.perform_now(self.id)
saleObj = Sale.find(self.id)
InventoryDefinition.calculate_product_count(saleObj)
return true, self.id return true, self.id
end end
@@ -137,6 +139,41 @@ class Sale < ApplicationRecord
end end
#fOR Quick Service pay and create
def self.request_bill(order,current_user,current_login_employee)
@sale = Sale.new
sale_order=SaleOrder.new
if shift = ShiftSale.current_open_shift(current_user.id)
order_id = order.order_id # order_id
bk_order = BookingOrder.find_by_order_id(order_id)
check_booking = Booking.find_by_booking_id(bk_order.booking_id)
if check_booking.sale_id.nil?
# Create Sale if it doesn't exist
# puts "current_login_employee"
# puts current_login_employee.name
@status, @sale_id = @sale.generate_invoice_from_booking(check_booking.id,current_login_employee, cashier = nil)
@sale_data = Sale.find_by_sale_id(@sale_id)
@sale_items = SaleItem.where("sale_id=?",@sale_id)
else
@sale_data = Sale.find_by_sale_id(check_booking.sale_id)
@sale_items = SaleItem.where("sale_id=?",@sale_data.sale_id)
end
# Bind shift sale id to sale
@sale_data.shift_sale_id = shift.id
@sale_data.save
# Promotion Activation
Promotion.promo_activate(@sale)
@status = true
return @status, @sale
else
@status = false
@message = "No Current Open Shift for This Employee"
end
end
#This is when spilt bill is request - then we cannot link order to invoice #This is when spilt bill is request - then we cannot link order to invoice
#Cos there will be multiple orders - and items are spilt from there. #Cos there will be multiple orders - and items are spilt from there.
#Unless order is spilt by then it is possible. #Unless order is spilt by then it is possible.
@@ -706,7 +743,7 @@ def self.get_item_query()
query = Sale.select("acc.title as account_name,mi.account_id, i.item_instance_code as item_code,i.account_id as account_id, " + query = Sale.select("acc.title as account_name,mi.account_id, i.item_instance_code as item_code,i.account_id as account_id, " +
"SUM(i.qty * i.unit_price) as grand_total,SUM(i.qty) as total_item,i.qty as qty," + "SUM(i.qty * i.unit_price) as grand_total,SUM(i.qty) as total_item,i.qty as qty," +
"i.remark as status_type,"+ "i.remark as status_type,"+
" i.unit_price as unit_price,i.price as price,i.product_name as product_name, mc.name as" + " mii.price as unit_price,i.price as price,i.product_name as product_name, mc.name as" +
" menu_category_name,mc.id as menu_category_id ") " menu_category_name,mc.id as menu_category_id ")
query = query.joins("JOIN sale_items i ON i.sale_id = sales.sale_id" + query = query.joins("JOIN sale_items i ON i.sale_id = sales.sale_id" +

View File

@@ -335,7 +335,7 @@ class SalePayment < ApplicationRecord
#record an payment in sale-audit #record an payment in sale-audit
remark = "#{response} Rebate- for Customer #{self.sale.customer_id} | Sale Id [#{self.sale.sale_id}]| pay amount -> #{self.received_amount} " remark = "#{response} Rebate- for Customer #{self.sale.customer_id} | Sale Id [#{self.sale.sale_id}]| pay amount -> #{self.received_amount} "
sale_audit = SaleAudit.record_paymal(self.sale.sale_id, remark, 1) sale_audit = SaleAudit.record_paymal(sObj.sale_id, remark, 1)
if !response.nil? if !response.nil?
if response["status"] == true if response["status"] == true
@@ -398,6 +398,7 @@ class SalePayment < ApplicationRecord
end end
else else
status = false status = false
sale_count += 1
end end
end end
end end
@@ -408,7 +409,8 @@ class SalePayment < ApplicationRecord
type = 'payment' type = 'payment'
#Send to background job for processing #Send to background job for processing
OrderBroadcastJob.perform_later(table,type) # OrderBroadcastJob.perform_later(table,type)
ActionCable.server.broadcast "order_channel",table: table,type:type
end end
end end

View File

@@ -1,7 +1,7 @@
class OrderItemPdf < Prawn::Document class OrderItemPdf < Prawn::Document
include ActionView::Helpers::NumberHelper include ActionView::Helpers::NumberHelper
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width
def initialize(print_settings,order_item, print_status, options, alt_name) def initialize(print_settings,order_item, print_status, options, alt_name, before_updated_qty)
self.page_width = print_settings.page_width self.page_width = print_settings.page_width
self.page_height = print_settings.page_height self.page_height = print_settings.page_height
self.margin = 0 self.margin = 0
@@ -46,7 +46,7 @@ class OrderItemPdf < Prawn::Document
order_info(order_item.order_id, order_item.order_by,order_item.order_at) order_info(order_item.order_id, order_item.order_by,order_item.order_at)
# order items # order items
order_items(order_item, options, alt_name, print_settings.precision) order_items(order_item, options, alt_name, print_settings.precision, before_updated_qty)
end end
# Write Order Information to PDF # Write Order Information to PDF
@@ -74,7 +74,7 @@ class OrderItemPdf < Prawn::Document
end end
# Write Order items to PDF # Write Order items to PDF
def order_items(order_item, options, alt_name, precision) def order_items(order_item, options, alt_name, precision, before_updated_qty)
y_position = cursor y_position = cursor
#Add Order Item #Add Order Item
@@ -82,6 +82,7 @@ class OrderItemPdf < Prawn::Document
dash(1, :space => 1, :phase => 1) dash(1, :space => 1, :phase => 1)
stroke_horizontal_line 0, (self.page_width - self.margin) stroke_horizontal_line 0, (self.page_width - self.margin)
add_updated_qty_text(before_updated_qty, order_item.qty, precision)
move_down 5 move_down 5
end end
@@ -127,4 +128,17 @@ class OrderItemPdf < Prawn::Document
end end
#add updated qty text
def add_updated_qty_text(before_updated_qty, updated_qty, precision)
if before_updated_qty.to_i > 0 && !before_updated_qty.nil?
move_down 5
# add option
y_position = cursor
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
text "* Change quantity [#{number_with_precision(before_updated_qty.to_i, :precision => precision.to_i)}] to [#{number_with_precision(updated_qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left
end
end
end
end end

View File

@@ -1,7 +1,7 @@
class OrderItemSlimPdf < Prawn::Document class OrderItemSlimPdf < Prawn::Document
include ActionView::Helpers::NumberHelper include ActionView::Helpers::NumberHelper
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width
def initialize(print_settings,order_item_slim, print_status, options, alt_name) def initialize(print_settings,order_item_slim, print_status, options, alt_name, before_updated_qty)
self.page_width = print_settings.page_width self.page_width = print_settings.page_width
self.page_height = print_settings.page_height self.page_height = print_settings.page_height
self.margin = 0 self.margin = 0
@@ -46,7 +46,7 @@ class OrderItemSlimPdf < Prawn::Document
order_info(order_item_slim.order_id, order_item_slim.order_by,order_item_slim.order_at) order_info(order_item_slim.order_id, order_item_slim.order_by,order_item_slim.order_at)
# order items slim # order items slim
order_items_slim(order_item_slim, options, alt_name, print_settings.precision) order_items_slim(order_item_slim, options, alt_name, print_settings.precision, before_updated_qty)
end end
# Write Order Information to PDF # Write Order Information to PDF
@@ -74,7 +74,7 @@ class OrderItemSlimPdf < Prawn::Document
end end
# Write Order items to PDF # Write Order items to PDF
def order_items_slim(order_item_slim, options, alt_name, precision) def order_items_slim(order_item_slim, options, alt_name, precision, before_updated_qty)
y_position = cursor y_position = cursor
#Add Order Item #Add Order Item
@@ -82,6 +82,7 @@ class OrderItemSlimPdf < Prawn::Document
dash(1, :space => 1, :phase => 1) dash(1, :space => 1, :phase => 1)
stroke_horizontal_line 0, (self.page_width - self.margin) stroke_horizontal_line 0, (self.page_width - self.margin)
add_updated_qty_text(before_updated_qty, order_item_slim.qty, precision)
move_down 1 move_down 1
end end
@@ -126,4 +127,17 @@ class OrderItemSlimPdf < Prawn::Document
end end
#add updated qty text
def add_updated_qty_text(before_updated_qty, updated_qty, precision)
if before_updated_qty.to_i > 0 && !before_updated_qty.nil?
move_down 1
# add option
y_position = cursor
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
text "* Change quantity [#{number_with_precision(before_updated_qty.to_i, :precision => precision.to_i)}] to [#{number_with_precision(updated_qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left
end
end
end
end end

View File

@@ -1,7 +1,7 @@
class OrderSetItemPdf < Prawn::Document class OrderSetItemPdf < Prawn::Document
include ActionView::Helpers::NumberHelper include ActionView::Helpers::NumberHelper
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width
def initialize(print_settings,order_set_item, print_status, options, alt_name) def initialize(print_settings,order_set_item, print_status, options, alt_name, before_updated_qty)
self.page_width = print_settings.page_width self.page_width = print_settings.page_width
self.page_height = print_settings.page_height self.page_height = print_settings.page_height
self.margin = 0 self.margin = 0
@@ -46,7 +46,7 @@ class OrderSetItemPdf < Prawn::Document
order_info(order_set_item.order_id, order_set_item.order_by,order_set_item.order_at) order_info(order_set_item.order_id, order_set_item.order_by,order_set_item.order_at)
# order items # order items
order_set_items(order_set_item, options, alt_name, print_settings.precision) order_set_items(order_set_item, options, alt_name, print_settings.precision, before_updated_qty)
end end
# Write Order Information to PDF # Write Order Information to PDF
@@ -74,7 +74,7 @@ class OrderSetItemPdf < Prawn::Document
end end
# Write Order items to PDF # Write Order items to PDF
def order_set_items(order_set_item, options, alt_name, precision) def order_set_items(order_set_item, options, alt_name, precision, before_updated_qty)
y_position = cursor y_position = cursor
#Add Order Item #Add Order Item
@@ -82,6 +82,7 @@ class OrderSetItemPdf < Prawn::Document
dash(1, :space => 1, :phase => 1) dash(1, :space => 1, :phase => 1)
stroke_horizontal_line 0, (self.page_width - self.margin) stroke_horizontal_line 0, (self.page_width - self.margin)
add_updated_qty_text(before_updated_qty, order_set_item.qty, precision)
move_down 5 move_down 5
end end
@@ -143,4 +144,17 @@ class OrderSetItemPdf < Prawn::Document
end end
#add updated qty text
def add_updated_qty_text(before_updated_qty, updated_qty, precision)
if before_updated_qty.to_i > 0 && !before_updated_qty.nil?
move_down 5
# add option
y_position = cursor
bounding_box([0,y_position], :width => self.item_width, :height => self.item_height) do
text "* Change quantity [#{number_with_precision(before_updated_qty.to_i, :precision => precision.to_i)}] to [#{number_with_precision(updated_qty.to_i, :precision => precision.to_i)}]", :size => self.item_font_size,:align => :left
end
end
end
end end

View File

@@ -155,7 +155,7 @@
<% if !(@total_payment_methods.nil?) %> <% if !(@total_payment_methods.nil?) %>
<% @total_payment_methods.each do |payment| %> <% @total_payment_methods.each do |payment| %>
<% if !@sale_data[0].empty? %> <% if !@sale_data[0].empty? %>
<% if payment.payment_method != 'mpu' && payment.payment_method != 'visa' && payment.payment_method != 'master' && payment.payment_method != 'jcb' %> <% if payment.payment_method != 'mpu' && payment.payment_method != 'visa' && payment.payment_method != 'master' && payment.payment_method != 'jcb' && payment.payment_method != 'unionpay' %>
<tr> <tr>
<td><%= payment.payment_method.to_s.capitalize %> Sale : </td> <td><%= payment.payment_method.to_s.capitalize %> Sale : </td>
<td align="right"> <td align="right">

View File

@@ -77,6 +77,7 @@
</a> </a>
</li> --> </li> -->
<%end%> <%end%>
<li class="header"><%= t :backend %></li>
<li> <li>
<a href="javascript:void(0);" class="menu-toggle"> <a href="javascript:void(0);" class="menu-toggle">
<i class="material-icons">widgets</i> <i class="material-icons">widgets</i>

View File

@@ -50,6 +50,11 @@
<% end %> <% end %>
<div class="card-block"> <div class="card-block">
<%= table.name %> <%= table.name %>
<% if !@order_items_count.nil? %>
<% if @order_items_count.key?(table.id) %>
(Orders : <%= @order_items_count[table.id] %>)
<% end %>
<% end %>
<span class="float-right font-12 new_text_<%= table.id %>"> billed</span> <span class="float-right font-12 new_text_<%= table.id %>"> billed</span>
<div style="font-size:12px;"></div> <div style="font-size:12px;"></div>
</div> </div>
@@ -62,6 +67,11 @@
<% end %> <% end %>
<div class="card-block"> <div class="card-block">
<%= table.name %> <%= table.name %>
<% if !@order_items_count.nil? %>
<% if @order_items_count.key?(table.id) %>
(Orders : <%= @order_items_count[table.id] %>)
<% end %>
<% end %>
<span class="float-right font-12 new_text_<%= table.id %>"> new</span> <span class="float-right font-12 new_text_<%= table.id %>"> new</span>
</div> </div>
</div> </div>
@@ -87,6 +97,11 @@
<div class="card rooms red text-white table_<%= room.id %>" data-id="<%= room.id %>"> <div class="card rooms red text-white table_<%= room.id %>" data-id="<%= room.id %>">
<div class="card-block"> <div class="card-block">
<%= room.name %> <%= room.name %>
<% if !@order_items_count.nil? %>
<% if @order_items_count.key?(room.id) %>
(Orders : <%= @order_items_count[room.id] %>)
<% end %>
<% end %>
<span class="float-right font-12 new_text_<%= room.id %>"> billed</span> <span class="float-right font-12 new_text_<%= room.id %>"> billed</span>
</div> </div>
</div> </div>
@@ -94,6 +109,11 @@
<div class="card rooms blue text-white table_<%= room.id %>" data-id="<%= room.id %>"> <div class="card rooms blue text-white table_<%= room.id %>" data-id="<%= room.id %>">
<div class="card-block"> <div class="card-block">
<%= room.name %> <%= room.name %>
<% if !@order_items_count.nil? %>
<% if @order_items_count.key?(room.id) %>
(Orders : <%= @order_items_count[room.id] %>)
<% end %>
<% end %>
<span class="float-right font-12 new_text_<%= room.id %>"> new</span> <span class="float-right font-12 new_text_<%= room.id %>"> new</span>
</div> </div>
</div> </div>
@@ -475,14 +495,16 @@
receipt_no = ($("#receipt_no").html()).trim(); receipt_no = ($("#receipt_no").html()).trim();
} }
// console.log(checkReceiptNoInFirstBillData(receipt_no)); discount="<%= @membership.discount%>"
if ($("#server_mode").val() != "cloud") { // first bill not used in cloud if ($("#server_mode").val() != "cloud") { // first bill not used in cloud
if (discount) {
if(checkReceiptNoInFirstBillData(receipt_no,"")){ if(checkReceiptNoInFirstBillData(receipt_no,"")){
$("#pay").show(); $("#pay").show();
}else{ }else{
$("#pay").hide(); $("#pay").hide();
} }
} }
}
/* end check first bill or not*/ /* end check first bill or not*/
$('.invoicedetails').on('click', function () { $('.invoicedetails').on('click', function () {

View File

@@ -39,20 +39,45 @@
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;"> <div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
<% @tables.each do |table| %> <% @tables.each do |table| %>
<% if table.status == 'occupied' %> <% if table.status == 'occupied' %>
<div class="card tables red text-white table_<%= table.id %>" data-id="<%= table.id %>">
<div class="card-block">
<%= table.name %>
<% if table.get_booking.nil? %> <% if table.get_booking.nil? %>
<span style="font-size:12px;float:right;line-height:inherit;"> billed</span> <% if table.get_checkout_booking.nil? %>
<div class="card tables red text-white table_<%= table.id %>" data-id="<%= table.id %>">
<% else %> <% else %>
<span style="font-size:12px;float:right;line-height:inherit;"> new</span> <div class="card tables orange text-white table_<%= table.id %>" data-id="<%= table.id %>">
<% end %> <% end %>
</div>
</div>
<% else %>
<div class="card tables green text-white" data-id="<%= table.id %>">
<div class="card-block"> <div class="card-block">
<%= table.name %> <%= table.name %>
<% if !@order_items_count.nil? %>
<% if @order_items_count.key?(table.id) %>
(Orders : <%= @order_items_count[table.id] %>)
<% end %>
<% end %>
<span class="float-right font-12 new_text_<%= table.id %>"> billed</span>
<div style="font-size:12px;"></div>
</div>
</div>
<% else %>
<% if table.get_checkout_booking.nil? %>
<div class="card tables blue text-white table_<%= table.id %>" data-id="<%= table.id %>">
<% else %>
<div class="card tables orange text-white table_<%= table.id %>" data-id="<%= table.id %>">
<% end %>
<div class="card-block">
<%= table.name %>
<% if !@order_items_count.nil? %>
<% if @order_items_count.key?(table.id) %>
(Orders : <%= @order_items_count[table.id] %>)
<% end %>
<% end %>
<span class="float-right font-12 new_text_<%= table.id %>"> new</span>
</div>
</div>
<% end %>
<% else %>
<div class="card tables green text-white table_<%= table.id %>" data-id="<%= table.id %>">
<div class="card-block">
<%= table.name %>
<span class="float-right font-12 new_text_<%= table.id %> hide"> new</span>
</div> </div>
</div> </div>
<% end %> <% end %>
@@ -65,20 +90,36 @@
<div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;"> <div class="card-columns" style="padding-top:10px; column-gap: 1.2rem;">
<% @rooms.each do |room| %> <% @rooms.each do |room| %>
<% if room.status == 'occupied' %> <% if room.status == 'occupied' %>
<div class="card rooms red text-white" data-id="<%= room.id %>">
<div class="card-block">
<%= room.name %>
<% if room.get_booking.nil? %> <% if room.get_booking.nil? %>
<span style="font-size:12px;float:right;line-height:inherit;"> billed</span> <div class="card rooms red text-white table_<%= room.id %>" data-id="<%= room.id %>">
<% else %>
<span style="font-size:12px;float:right;line-height:inherit;"> new</span>
<% end %>
</div>
</div>
<% else %>
<div class="card rooms green text-white" data-id="<%= room.id %>">
<div class="card-block"> <div class="card-block">
<%= room.name %> <%= room.name %>
<% if !@order_items_count.nil? %>
<% if @order_items_count.key?(room.id) %>
(Orders : <%= @order_items_count[room.id] %>)
<% end %>
<% end %>
<span class="float-right font-12 new_text_<%= room.id %>"> billed</span>
</div>
</div>
<% else %>
<div class="card rooms blue text-white table_<%= room.id %>" data-id="<%= room.id %>">
<div class="card-block">
<%= room.name %>
<% if !@order_items_count.nil? %>
<% if @order_items_count.key?(room.id) %>
(Orders : <%= @order_items_count[room.id] %>)
<% end %>
<% end %>
<span class="float-right font-12 new_text_<%= room.id %>"> new</span>
</div>
</div>
<% end %>
<% else %>
<div class="card rooms green text-white table_<%= room.id %>" data-id="<%= room.id %>">
<div class="card-block">
<%= room.name %>
<span class="float-right font-12 new_text_<%= room.id %> hide">
</div> </div>
</div> </div>
<% end %> <% end %>
@@ -107,7 +148,7 @@
order_status = order.status order_status = order.status
end end
%> %>
<%= order.order_id %> | <%= order_status %> <%= order.order_id %> <% if !order_status.empty? %>| <%= order_status %> <% end %>
</div> </div>
</div> </div>
<% end %> <% end %>
@@ -129,7 +170,7 @@
<div class="card-block"> <div class="card-block">
<div class="card-title row p-l-5 p-r-5"> <div class="card-title row p-l-5 p-r-5">
<div class="col-lg-6 col-md-6 col-sm-6"> <div class="col-lg-6 col-md-6 col-sm-6">
Receipt No: <span id="receipt_no"> Order No: <span id="receipt_no"> <%= @order.order_id %>
</span> </span>
</div> </div>
<div class="col-lg-6 col-md-6 col-sm-6 text-right"> <div class="col-lg-6 col-md-6 col-sm-6 text-right">
@@ -173,7 +214,7 @@
</div> </div>
</div> </div>
<div class="card-footer "> <div class="card-footer ">
<table class="m-b--20" id="order-charges-table" border="0"> <table class="table" id="order-charges-table" border="0">
<tr> <tr>
<td class="charges-name"><strong>Sub Total:</strong></td> <td class="charges-name"><strong>Sub Total:</strong></td>
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td> <td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
@@ -195,7 +236,7 @@
<div class="col-lg-1 col-md-1 col-sm-1"> <div class="col-lg-1 col-md-1 col-sm-1">
<button type="button" class="btn bg-default btn-block " id='back'><i class="material-icons">reply</i>Back</button> <button type="button" class="btn bg-default btn-block " id='back'><i class="material-icons">reply</i>Back</button>
<% if @sale_status != 'completed' %> <% if @sale_status != 'completed' %>
<button type="button" class="btn bg-blue btn-block" id='move'>MOVE</button> <!-- <button type="button" class="btn bg-blue btn-block" id='move'>MOVE</button> -->
<% end %> <% end %>
<!-- <button type="button" id="re-print" class="btn btn-primary btn-block">Re.Print</button> --> <!-- <button type="button" id="re-print" class="btn btn-primary btn-block">Re.Print</button> -->
</div> </div>

View File

@@ -50,6 +50,11 @@
<% end %> <% end %>
<div class="card-block"> <div class="card-block">
<%= table.name %> <%= table.name %>
<% if !@order_items_count.nil? %>
<% if @order_items_count.key?(table.id) %>
(Orders : <%= @order_items_count[table.id] %>)
<% end %>
<% end %>
<span class="pull-right font-12 new_text_<%= table.id %>"> billed</span> <span class="pull-right font-12 new_text_<%= table.id %>"> billed</span>
</div> </div>
</div> </div>
@@ -61,6 +66,11 @@
<% end %> <% end %>
<div class="card-block"> <div class="card-block">
<%= table.name %> <%= table.name %>
<% if !@order_items_count.nil? %>
<% if @order_items_count.key?(table.id) %>
(Orders : <%= @order_items_count[table.id] %>)
<% end %>
<% end %>
<span class="pull-right font-12 new_text_<%= table.id %>"> new</span> <span class="pull-right font-12 new_text_<%= table.id %>"> new</span>
</div> </div>
</div> </div>
@@ -87,6 +97,11 @@
<div class="card rooms red text-white table_<%= room.id %>" data-id="<%= room.id %>"> <div class="card rooms red text-white table_<%= room.id %>" data-id="<%= room.id %>">
<div class="card-block"> <div class="card-block">
<%= room.name %> <%= room.name %>
<% if !@order_items_count.nil? %>
<% if @order_items_count.key?(room.id) %>
(Orders : <%= @order_items_count[room.id] %>)
<% end %>
<% end %>
<span class="pull-right font-12 new_text_<%= room.id %>"> billed</span> <span class="pull-right font-12 new_text_<%= room.id %>"> billed</span>
<div style="font-size:12px;"></div> <div style="font-size:12px;"></div>
</div> </div>
@@ -95,6 +110,11 @@
<div class="card rooms blue text-white table_<%= room.id %>" data-id="<%= room.id %>"> <div class="card rooms blue text-white table_<%= room.id %>" data-id="<%= room.id %>">
<div class="card-block"> <div class="card-block">
<%= room.name %> <%= room.name %>
<% if !@order_items_count.nil? %>
<% if @order_items_count.key?(room.id) %>
(Orders : <%= @order_items_count[room.id] %>)
<% end %>
<% end %>
<span class="pull-right font-12 new_text_<%= room.id %>"> new</span> <span class="pull-right font-12 new_text_<%= room.id %>"> new</span>
</div> </div>
</div> </div>

View File

@@ -70,6 +70,7 @@ en:
sale_audits: "Sale Audits" sale_audits: "Sale Audits"
bottom: "Bottom" bottom: "Bottom"
payment: "Payment" payment: "Payment"
backend: "Backend"
views: views:
btn: btn:

View File

@@ -65,6 +65,7 @@ mm:
sale_audits: "အရောင်းပြင်ဆင်ခြင်းများ" sale_audits: "အရောင်းပြင်ဆင်ခြင်းများ"
bottom: "အရောင်းအနဲဆုံး" bottom: "အရောင်းအနဲဆုံး"
payment: "ငွေပေးချေမှု" payment: "ငွေပေးချေမှု"
backend: "Backend"
views: views:
btn: btn:

View File

@@ -11,5 +11,5 @@ every 30.minutes do
end end
every 1.minutes do every 1.minutes do
runner "CheckinJob.perform" runner "DiningFacility.checkin_time"
end end