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,7 +19,9 @@ 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|
@sale_data.push(table_booking.sale)
if table_booking.sale.sale_status != 'waste' && table_booking.sale.sale_status != 'spoile'
@sale_data.push(table_booking.sale)
end
end
end

View File

@@ -57,7 +57,11 @@ class OrderQueueStation < ApplicationRecord
if oqs.auto_print && order_source != "quick_service"
if oqs_order_items.length > 0
print_slip(oqs, order, oqs_order_items)
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
@@ -91,8 +95,12 @@ class OrderQueueStation < ApplicationRecord
end
if oqs.auto_print && order_source != "quick_service"
if oqs_order_items.length > 0
print_slip(oqs, order, oqs_order_items)
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
@@ -137,8 +145,12 @@ class OrderQueueStation < ApplicationRecord
end
if oqs.auto_print
if oqs_order_items.length > 0
print_slip(oqs, order, oqs_order_items)
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
@@ -165,8 +177,12 @@ class OrderQueueStation < ApplicationRecord
end
if oqs.auto_print
if oqs_order_items.length > 0
print_slip(oqs, order, oqs_order_items)
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>
@@ -411,4 +411,6 @@
<div id="notify_new_order"></div>
<div id="notify_order_send_to_kitchen"></div>
<div id="notify_order_ready_to_delivery"></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>