Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant

This commit is contained in:
Aung Myo
2018-05-04 18:10:14 +06:30
7 changed files with 44 additions and 66 deletions

View File

@@ -282,8 +282,8 @@ function callback_url(callback,ref_no,order_id,status,time,exptime){
function timeFormat(date){
var isPM = date.getHours() >= 12;
var isMidday = date.getHours() == 12;
var time = [date.getHours() - (isPM && !isMidday ? 12 : 0),
date.getMinutes() || '00'].join(':') +
var time = [(date.getHours()>10? date.getHours() : '0'+date.getHours()) - (isPM && !isMidday ? 12 : 0),
(date.getMinutes()>10? date.getMinutes() : '0'+date.getMinutes()) || '00'].join(':') +
(isPM ? ' PM' : ' AM');
return time;
}

View File

@@ -279,6 +279,9 @@ class Origami::PaymentsController < BaseOrigamiController
new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
@rounding_adj = new_total-saleObj.grand_total
saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:@rounding_adj)
@sale_data.grand_total = new_total
@sale_data.old_grand_total = saleObj.grand_total
@sale_data.rounding_adjustment = @rounding_adj
else
@rounding_adj = @sale_data.rounding_adjustment
end

View File

@@ -19,9 +19,11 @@ class Origami::SplitBillController < BaseOrigamiController
table_bookings = Booking.where("dining_facility_id = #{dining_id} and sale_id IS NOT NULL")
if !table_bookings.nil?
table_bookings.each do |table_booking|
if table_booking.sale.sale_status != 'waste' && table_booking.sale.sale_status != 'spoile'
@sale_data.push(table_booking.sale)
end
end
end
if @booking
@booking.booking_orders.each do |booking_order|

View File

@@ -57,7 +57,11 @@ class OrderQueueStation < ApplicationRecord
if oqs.auto_print && order_source != "quick_service"
if oqs_order_items.length > 0
if oqs.cut_per_item
print_slip_item(oqs, order, oqs_order_items)
else
print_slip(oqs, order, oqs_order_items)
end
is_auto_printed = true
end
end
@@ -92,7 +96,11 @@ class OrderQueueStation < ApplicationRecord
if oqs.auto_print && order_source != "quick_service"
if oqs_order_items.length > 0
if oqs.cut_per_item
print_slip_item(oqs, order, oqs_order_items)
else
print_slip(oqs, order, oqs_order_items)
end
is_auto_printed = true
end
end
@@ -138,7 +146,11 @@ class OrderQueueStation < ApplicationRecord
if oqs.auto_print
if oqs_order_items.length > 0
if oqs.cut_per_item
print_slip_item(oqs, order, oqs_order_items)
else
print_slip(oqs, order, oqs_order_items)
end
is_auto_printed = true
end
end
@@ -166,7 +178,11 @@ class OrderQueueStation < ApplicationRecord
if oqs.auto_print
if oqs_order_items.length > 0
if oqs.cut_per_item
print_slip_item(oqs, order, oqs_order_items)
else
print_slip(oqs, order, oqs_order_items)
end
is_auto_printed = true
end
end
@@ -211,7 +227,7 @@ class OrderQueueStation < ApplicationRecord
end
#Print order_item in 1 slip per item
def print_slip_item(oqs, assigned_item)
def print_slip_item(oqs, order, assigned_items)
order_slim_pdf = Lookup.collection_of("print_settings") #print_settings with name:OrderSlimPdf
unique_code="OrderItemPdf"
if !order_slim_pdf.empty?
@@ -232,14 +248,17 @@ class OrderQueueStation < ApplicationRecord
end
end
order_item = OrderItem.where("order_id='#{assigned_item.order_id}' AND item_instance_code='#{assigned_item.instance_code}'").first()
# order_item = OrderItem.where("order_id='#{assigned_item.order_id}' AND item_instance_code='#{assigned_item.instance_code}'").first()
# print when complete click
print_settings=PrintSetting.find_by_unique_code(unique_code)
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
order_queue_printer.print_order_item(print_settings, oqs,item.order_id, order_item.order_items_id, print_status="" )
if !assigned_items.nil?
assigned_items.each do |order_item|
order_queue_printer.print_order_item(print_settings, oqs,order_item.order_id, order_item.order_items_id, print_status="" )
end
end
# update print status for completed same order items
assigned_order_item.each do |ai|
AssignedOrderItem.where("order_id = '#{ order.order_id }'").find_each do |ai|
ai.print_status=true
ai.save
end

View File

@@ -378,7 +378,7 @@
</div>
</div>
</div>
</div>
<p id="ref_no" class="hidden"></p>
<p id="callback_url" class="hidden"></p>
<p id="order_id" class="hidden"></p>
@@ -412,3 +412,5 @@
<div id="notify_new_order"></div>
<div id="notify_order_send_to_kitchen"></div>
<div id="notify_order_ready_to_delivery"></div>
</div>

View File

@@ -387,6 +387,6 @@ $('#re-print').click(function() {
var sale_id = $('#sale_id').val();
window.location.href = '/origami/'+ sale_id + "/reprint"
return false;
// return false;
});
</script>

View File

@@ -1,48 +0,0 @@
# Puma can serve each request in a thread from an internal thread pool.
# The `threads` method setting takes two numbers a minimum and maximum.
# Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for minimum
# and maximum, this matches the default thread size of Active Record.
#
threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i
threads threads_count, threads_count
# Specifies the `port` that Puma will listen on to receive requests, default is 3000.
#
port ENV.fetch("PORT") { 3000 }
# Specifies the `environment` that Puma will run in.
#
environment ENV.fetch("RAILS_ENV") { "development" }
# Specifies the number of `workers` to boot in clustered mode.
# Workers are forked webserver processes. If using threads and workers together
# the concurrency of the application would be max `threads` * `workers`.
# Workers do not work on JRuby or Windows (both of which do not support
# processes).
#
# workers ENV.fetch("WEB_CONCURRENCY") { 2 }
# Use the `preload_app!` method when specifying a `workers` number.
# This directive tells Puma to first boot the application and load code
# before forking the application. This takes advantage of Copy On Write
# process behavior so workers use less memory. If you use this option
# you need to make sure to reconnect any threads in the `on_worker_boot`
# block.
#
# preload_app!
# The code in the `on_worker_boot` will be called if you are using
# clustered mode by specifying a number of `workers`. After each worker
# process is booted this block will be run, if you are using `preload_app!`
# option you will want to use this block to reconnect to any threads
# or connections that may have been created at application boot, Ruby
# cannot share connections between processes.
#
# on_worker_boot do
# ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
# end
# Allow puma to be restarted by `rails restart` command.
plugin :tmp_restart