diff --git a/app/assets/javascripts/channels/check_new_order.js b/app/assets/javascripts/channels/check_new_order.js index a51327c3..a4890681 100644 --- a/app/assets/javascripts/channels/check_new_order.js +++ b/app/assets/javascripts/channels/check_new_order.js @@ -34,10 +34,11 @@ App.check_new_order = App.cable.subscriptions.create('CheckNewOrderChannel', { // } // }); $("#notify_new_order_lists").text(order_lists); - $("#notify_new_order").on('shown.bs.modal', function(e){ - $("#notify_new_order").focus(); + $("#notify_new_order").on('show.bs.modal', function(e){ $("#notify_order_send_to_kitchen").modal('hide'); $("#notify_order_ready_to_delivery").modal('hide'); + }).on('shown.bs.modal', function(e){ + $("#notify_new_order").focus(); }).on('hide.bs.modal', function (e) { $("#notify_new_order").modal("hide"); }).modal({show: true, keyboard: false, backdrop: false}); diff --git a/app/assets/javascripts/channels/check_order_ready_to_delivery.js b/app/assets/javascripts/channels/check_order_ready_to_delivery.js index 97e2a266..2e576266 100644 --- a/app/assets/javascripts/channels/check_order_ready_to_delivery.js +++ b/app/assets/javascripts/channels/check_order_ready_to_delivery.js @@ -35,9 +35,10 @@ App.check_order_ready_to_delivery = App.cable.subscriptions.create('CheckOrderRe // }); $("#notify_order_ready_to_delivery_lists").text(order_lists); $("#notify_order_ready_to_delivery").on('shown.bs.modal', function(e){ - $("#notify_order_ready_to_delivery").focus(); $("#notify_new_order").modal('hide'); $("#notify_order_send_to_kitchen").modal('hide'); + }).on('shown.bs.modal', function(e){ + $("#notify_order_ready_to_delivery").focus(); }).on('hide.bs.modal', function (e) { $("#notify_order_ready_to_delivery").modal("hide"); }).modal({show: true, keyboard: false, backdrop: false}); diff --git a/app/assets/javascripts/channels/check_order_send_to_kitchen.js b/app/assets/javascripts/channels/check_order_send_to_kitchen.js index f3a15903..fbb233f8 100644 --- a/app/assets/javascripts/channels/check_order_send_to_kitchen.js +++ b/app/assets/javascripts/channels/check_order_send_to_kitchen.js @@ -34,10 +34,11 @@ App.check_order_send_to_kitchen = App.cable.subscriptions.create('CheckOrderSend // } // }); $("#notify_order_send_to_kitchen_lists").text(order_lists); - $("#notify_order_send_to_kitchen").on('shown.bs.modal', function(e){ - $("#notify_order_send_to_kitchen").focus(); + $("#notify_order_send_to_kitchen").on('show.bs.modal', function(e){ $("#notify_new_order").modal('hide'); $("#notify_order_ready_to_delivery").modal('hide'); + }).on('shown.bs.modal', function(e){ + $("#notify_order_send_to_kitchen").focus(); }).on('hide.bs.modal', function (e) { $("#notify_order_send_to_kitchen").modal("hide"); }).modal({show: true, keyboard: false, backdrop: false}); diff --git a/app/controllers/oqs/edit_controller.rb b/app/controllers/oqs/edit_controller.rb index 4bc99f59..e8f0edb5 100644 --- a/app/controllers/oqs/edit_controller.rb +++ b/app/controllers/oqs/edit_controller.rb @@ -27,49 +27,55 @@ class Oqs::EditController < BaseOqsController remarks = params[:remarks] order_item = OrderItem.find(order_items_id) - before_updated_qty = order_item.qty + order = Order.find(order_item.order_id) + if qty_weight.to_i <= order_item.qty.to_i + before_updated_qty = order_item.qty - order_item.item_order_by = current_user.name - order_item.qty = qty_weight - order_item.remark = remarks - order_item.save + order_item.item_order_by = current_user.name + order_item.qty = qty_weight + order_item.remark = remarks + order_item.save - if ENV["SERVER_MODE"] != "cloud" #no print in cloud server - # print - assigned_item = AssignedOrderItem.find_by_instance_code(order_item.item_instance_code) - assigned_items = AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'") - - if !assigned_items.nil? - assigned_items.each do |assign_item| - # order queue stations - oqs = assign_item.order_queue_station + if ENV["SERVER_MODE"] != "cloud" && order.source == 'cashier' #no print in cloud server + # print + assigned_item = AssignedOrderItem.find_by_instance_code(order_item.item_instance_code) + assigned_items = AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'") + + if !assigned_items.nil? + assigned_items.each do |assign_item| + # order queue stations + oqs = assign_item.order_queue_station - order_slim_pdf = Lookup.collection_of("print_settings") #print_settings with name:OrderSlimPdf - - unique_code="OrderItemPdf" - if !order_slim_pdf.empty? - order_slim_pdf.each do |order_item_slim| - if order_item_slim[0] == 'OrderSlimPdf' - if order_item_slim[1] == '1' - unique_code="OrderItemSlimPdf" - else - unique_code="OrderItemPdf" - end - elsif order_item_slim[0] == 'OrderSetPdf' - if order_item_slim[1] == '1' - unique_code="OrderSetItemPdf" - else - unique_code="OrderItemPdf" + order_slim_pdf = Lookup.collection_of("print_settings") #print_settings with name:OrderSlimPdf + + unique_code="OrderItemPdf" + if !order_slim_pdf.empty? + order_slim_pdf.each do |order_item_slim| + if order_item_slim[0] == 'OrderSlimPdf' + if order_item_slim[1] == '1' + unique_code="OrderItemSlimPdf" + else + unique_code="OrderItemPdf" + end + elsif order_item_slim[0] == 'OrderSetPdf' + if order_item_slim[1] == '1' + unique_code="OrderSetItemPdf" + else + unique_code="OrderItemPdf" + end end end end - end - 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, order_item.order_id, order_items_id, print_status=" (Cancelled)", before_updated_qty ) + 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, order_item.order_id, order_items_id, print_status=" (Cancelled)", before_updated_qty ) + end end end + render :json => {:status=> true } + else + render :json => {:status=> false, :message => "Not allowed over quantity!" } end end diff --git a/app/controllers/origami/moveroom_controller.rb b/app/controllers/origami/moveroom_controller.rb index b7260863..8f1430a6 100755 --- a/app/controllers/origami/moveroom_controller.rb +++ b/app/controllers/origami/moveroom_controller.rb @@ -11,6 +11,8 @@ class Origami::MoveroomController < BaseOrigamiController @orders = Order.all.order('date desc') @status_order = "" + @status_sale = "" + @sale_array = Array.new @dining = DiningFacility.find(params[:dining_id]) @dining.bookings.each do |booking| if booking.sale_id.nil? @@ -18,21 +20,38 @@ class Origami::MoveroomController < BaseOrigamiController booking.booking_orders.each do |booking_order| order = Order.find(booking_order.order_id) @obj_order = order + @customer = order.customer @date = order.created_at + @booking= booking order.order_items.each do |item| @order_items.push(item) end + accounts = @customer.tax_profiles + @account_arr =[] + accounts.each do |acc| + account = TaxProfile.find(acc) + @account_arr.push(account) + end end @status_order = 'order' else sale = Sale.find(booking.sale_id) - if sale.sale_status != "completed" + if sale.sale_status != "completed" && sale.sale_status != "waste" && sale.sale_status != "spoile" + @sale_array.push(sale) if @status_order == 'order' @status_order = 'sale' end + @booking= booking @date = sale.created_at @status_sale = 'sale' @obj_sale = sale + @customer = sale.customer + accounts = @customer.tax_profiles + @account_arr =[] + accounts.each do |acc| + account = TaxProfile.find(acc) + @account_arr.push(account) + end end end end diff --git a/app/controllers/origami/movetable_controller.rb b/app/controllers/origami/movetable_controller.rb index eaf7fca1..7efdd46c 100755 --- a/app/controllers/origami/movetable_controller.rb +++ b/app/controllers/origami/movetable_controller.rb @@ -18,7 +18,6 @@ class Origami::MovetableController < BaseOrigamiController if booking.sale_id.nil? @order_items = Array.new booking.booking_orders.each do |booking_order| - order = Order.find(booking_order.order_id) @obj_order = order @customer = order.customer @@ -37,7 +36,7 @@ class Origami::MovetableController < BaseOrigamiController @status_order = 'order' else sale = Sale.find(booking.sale_id) - if sale.sale_status != "completed" + if sale.sale_status != "completed" && sale.sale_status != "waste" && sale.sale_status != "spoile" @sale_array.push(sale) if @status_order == 'order' @status_order = 'sale' diff --git a/app/controllers/origami/order_reservation_controller.rb b/app/controllers/origami/order_reservation_controller.rb index e3536205..827cfcda 100644 --- a/app/controllers/origami/order_reservation_controller.rb +++ b/app/controllers/origami/order_reservation_controller.rb @@ -1,7 +1,6 @@ class Origami::OrderReservationController < BaseOrigamiController def index - puts Time.now.utc @order = OrderReservation.latest_order #.active @count_on_order = OrderReservation.get_count_on_order @count_on_completed = OrderReservation.get_count_on_completed diff --git a/app/controllers/reports/receipt_no_controller.rb b/app/controllers/reports/receipt_no_controller.rb index a86fb9b2..aa1dd8bd 100755 --- a/app/controllers/reports/receipt_no_controller.rb +++ b/app/controllers/reports/receipt_no_controller.rb @@ -20,7 +20,7 @@ authorize_resource :class => false payment_type = params[:payment_type] @sale_data = Sale.get_shift_sales_by_receipt_no(@shift_sale_range,@shift,from,to,payment_type) @sale_taxes = Sale.get_separate_tax(@shift_sale_range,@shift,from,to,payment_type) - @tax_profiles = TaxProfile.order('order_by asc').limit(2) + @tax_profiles = TaxProfile.where('group_type = "cashier"').order('order_by asc').limit(2) @from = from @to = to # get printer info diff --git a/app/views/oqs/edit/index.html.erb b/app/views/oqs/edit/index.html.erb index 27595303..d9485b3a 100644 --- a/app/views/oqs/edit/index.html.erb +++ b/app/views/oqs/edit/index.html.erb @@ -123,25 +123,29 @@ $(document).ready(function(){ data: params, success: function(result){ // alert("Updated!"); - <% if !@link_type.nil? %> - <% if @link_type == 'oqs' %> - window.location.href = '/oqs'; - <% elsif @link_type == 'pending' %> - window.location.href = '/origami/quick_service/pending_order/'+booking_id; - <% else %> - <% if !@dining_type.nil? %> - <% if @dining_type == 'Table' %> + if(result.status){ + <% if !@link_type.nil? %> + <% if @link_type == 'oqs' %> + window.location.href = '/oqs'; + <% elsif @link_type == 'pending' %> + window.location.href = '/origami/quick_service/pending_order/'+booking_id; + <% else %> + <% if !@dining_type.nil? %> + <% if @dining_type == 'Table' %> + window.location.href = '/origami/table/'+<%=@link_type%>; + <% else %> + window.location.href = '/origami/room/'+<%=@link_type%>; + <% end %> + <% else %> window.location.href = '/origami/table/'+<%=@link_type%>; - <% else %> - window.location.href = '/origami/room/'+<%=@link_type%>; - <% end %> - <% else %> - window.location.href = '/origami/table/'+<%=@link_type%>; - <% end %> + <% end %> + <% end %> + <% else %> + window.location.href = '/oqs'; <% end %> - <% else %> - window.location.href = '/oqs'; - <% end %> + }else{ + swal("Alert!", result.message, "warning"); + } } }); }); diff --git a/app/views/origami/moveroom/move_dining.html.erb b/app/views/origami/moveroom/move_dining.html.erb index 240d3b20..543e33d0 100755 --- a/app/views/origami/moveroom/move_dining.html.erb +++ b/app/views/origami/moveroom/move_dining.html.erb @@ -1,215 +1,376 @@
-
- -
+
+ +
- - + +
+
+ + +
+
+ <% @tables.each do |table| %> + <% if table.status == 'occupied' %> + <% if table.get_booking.nil? %> + <% if table.get_checkout_booking.nil? %> +
+ <% else %> +
+ <% end %> +
+ <%= table.name %> +
+
+ <% else %> + <% if table.get_checkout_booking.nil? %> +
+ <% else %> +
+ <% end %> +
+ <%= table.name %> +
+
+ <% end %> + <% else %> +
+
+ <%= table.name %> +
+
+ <% end %> + <% end %> +
+
- -
+ +
<% @rooms.each do |room| %> <% if room.status == 'occupied' %> - <% if room.get_booking.nil? %> -
+ <% if room.get_booking.nil? %> +
<% else %> -
- <% end %> -
- <%= room.name %> -
-
- <% else %> -
-
+
+ <% end %> +
<%= room.name %> -
-
- <% end %> - <% end %> -
-
- -
-
- -
- - - -
-
-
-
MOVE --> ' <%= @dining.name %>' to
- -
-
-
-
-

Receipt No: - <% if @status_sale == 'sale' %> - <%= @obj_sale.receipt_no rescue '' %> - <% end %> -

-
-
-

Date: <%= @date.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%>

-
-
-
-
-

Customer :

-
- -
-
-
- - - - - - - - - - <% - sub_total = 0 - if @status_sale == "sale" - @obj_sale.sale_items.each do |sale_item| - sub_total = sub_total + sale_item.price - %> - - <% unless sale_item.price <= 0 %> - - - - - - <% - end - end - end - - if @status_order == 'order' - unless @order_items.nil? - @order_items.each do |order_item | - sub_total = sub_total + order_item.price - - unless order_item.price <= 0 %> - - - - - - <% - end - end - end - end - %> - -
ItemsQTYPrice
<%= sale_item.product_name %><%= sale_item.qty %><%= sale_item.price %>
<%= order_item.item_name %><%= order_item.qty %><%= order_item.qty*order_item.price %>
-
-
-
-
-
MOVE TABLE
-
-
-
-
+
+
+ <% else %> +
+
+ <%= room.name %> +
+
+ <% end %> + <% end %> +
+
+
+
+ +
+ - -
- - + +
+
+
+
MOVE --> ' <%= @dining.name %> ' to
+ + <% if @status_order == 'order' && @status_sale != 'sale' %> + <% if !@obj_order.nil? %> +
+ <% else %> +
+ <% end %> + <% if !@booking.nil? %> + ORDER DETAILS | Table <%= @dining.name rescue "" %> + <% if @booking.checkout_by.nil? && !@booking.reserved_by.nil? %> + <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> - <%= @booking.checkout_at.utc.getlocal.strftime("%I:%M %p") %> + <% else %> + Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> + <% end %> + <% end %> +
+ <% elsif @status_sale == 'sale' %> +
INVOICE DETAILS | Table <%= @dining.name rescue "" %> + <% if !@booking.reserved_by.nil? && %> + <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> - <%= @booking.checkout_at.utc.getlocal.strftime("%I:%M %p") %> + <% else %> + Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> + <% end %> +
+ <% else %> + ORDER DETAILS | Table <%= @dining.name rescue "" %> + <% end %> +
+
+
+
+ <% if (!@sale_array.empty?) && (!@date.nil?) %> +
+   Receipt No: + <% if @status_sale == 'sale' %> + <%= @sale_array[0].receipt_no rescue '' %> + <% end %> + +
+
+
+ Date: <%= @date.utc.getlocal.strftime("%d/%m/%Y-%I:%M %p") rescue '-' %> +
+
+ <% elsif !@date.nil? %> +
+   Order No: + <% if @status_order == 'order' %> + <%= @obj_order.order_id rescue '' %> + <% end %> + +
+
+
+ Date: <%= @date.utc.getlocal.strftime("%d/%m/%Y") rescue '-' %> +
+
+ <% end %> +
+
+
+
+ <% if @status_sale == 'sale' && !@sale_array.empty? %> + +   Customer : <%= @sale_array[0].customer.name rescue '' %> + <% elsif @status_order == 'order' && !@customer.nil? + %> + +   Customer : <%= @customer.name rescue "" %> + <% end %> + +
+
+
+
+ + + + + + + + + + + <% + count = 0 + sub_total = 0 + if @status_sale == "sale" + @sale_array[0].sale_items.each do |sale_item| + count += 1 + sub_total = sub_total + sale_item.price + %> + + <% unless sale_item.price <= 0 %> + + + + + + + <% + end + end + end + + if @status_order == 'order' && @status_sale != 'sale' + unless @order_items.nil? || @order_items.empty? + count = 0 + @order_items.each do |order_item | + count += 1 + sub_total = sub_total + (order_item.price * order_item.qty) + + #unless order_item.price <= 0 %> + + + + + + + <% + #end + end + end + end + %> + +
#ItemsQTYPrice
<%= count %><%= sale_item.product_name %><%= sale_item.qty %><%= sale_item.price %>
<%= count %><%= order_item.item_name %><%= order_item.qty %><%= order_item.qty*order_item.price %>
+
+
+<% +if @status_sale == 'sale' + unless @order_items.nil? + %> + Pending New Order + + <% + @order_items.each do |order_item | + %> + + + + + + + + <% + end + %> +
<%= order_item.item_name %><%= order_item.qty %><%= order_item.qty*order_item.price %>
+ + <% + else + @sale_array.each do |sale| + if @sale_array.size > 1 + unless sale.receipt_no == @sale_array[0].receipt_no + %> + Pending Payment + + + + + +
Receipt No - <%= sale.receipt_no %>
+ <% + end + end + end + end +end +%> +
+
+
MOVE ROOM
+
+
+ + +
+ + + + +
+
+
diff --git a/app/views/origami/movetable/move_dining.html.erb b/app/views/origami/movetable/move_dining.html.erb index 76f704e8..64102211 100755 --- a/app/views/origami/movetable/move_dining.html.erb +++ b/app/views/origami/movetable/move_dining.html.erb @@ -22,27 +22,27 @@
<% @tables.each do |table| %> <% if table.status == 'occupied' %> - <% if table.get_booking.nil? %> - <% if table.get_checkout_booking.nil? %> -
- <% else %> -
- <% end %> -
- <%= table.name %> -
-
- <% else %> - <% if table.get_checkout_booking.nil? %> -
- <% else %> -
- <% end %> -
- <%= table.name %> + <% if table.get_booking.nil? %> + <% if table.get_checkout_booking.nil? %> +
+ <% else %> +
+ <% end %> +
+ <%= table.name %> +
-
- <% end %> + <% else %> + <% if table.get_checkout_booking.nil? %> +
+ <% else %> +
+ <% end %> +
+ <%= table.name %> +
+
+ <% end %> <% else %>
@@ -54,119 +54,120 @@
+
<% @rooms.each do |room| %> <% if room.status == 'occupied' %> - <% if room.get_booking.nil? %> -
+ <% if room.get_booking.nil? %> +
<% else %> -
- <% end %> -
- <%= room.name %> -
+
+ <% end %> +
+ <%= room.name %>
- <% else %> -
-
- <%= room.name %>
+ <% else %> +
+
+ <%= room.name %> +
+
+ <% end %> + <% end %>
- <% end %> - <% end %> +
+ +
- - +
-
- -
- + - -
-
-
-
MOVE --> ' <%= @dining.name %> ' to
- - <% if @status_order == 'order' && @status_sale != 'sale' %> - <% if !@obj_order.nil? %> -
- <% else %> -
- <% end %> - <% if !@booking.nil? %> - ORDER DETAILS | Table <%= @dining.name rescue "" %> - <% if @booking.checkout_by.nil? && !@booking.reserved_by.nil? %> - <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> - <%= @booking.checkout_at.utc.getlocal.strftime("%I:%M %p") %> - <% else %> - Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> - <% end %> - <% end %> -
- <% elsif @status_sale == 'sale' %> -
INVOICE DETAILS | Table <%= @dining.name rescue "" %> - <% if !@booking.reserved_by.nil? && %> - <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> - <%= @booking.checkout_at.utc.getlocal.strftime("%I:%M %p") %> - <% else %> - Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> - <% end %> -
- <% else %> - ORDER DETAILS | Table <%= @dining.name rescue "" %> - <% end %> -
-
-
-
- <% if (!@sale_array.empty?) && (!@date.nil?) %> -
-   Receipt No: - <% if @status_sale == 'sale' %> + +
+
+
+
MOVE --> ' <%= @dining.name %> ' to
+ + <% if @status_order == 'order' && @status_sale != 'sale' %> + <% if !@obj_order.nil? %> +
+ <% else %> +
+ <% end %> + <% if !@booking.nil? %> + ORDER DETAILS | Table <%= @dining.name rescue "" %> + <% if @booking.checkout_by.nil? && !@booking.reserved_by.nil? %> + <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> - <%= @booking.checkout_at.utc.getlocal.strftime("%I:%M %p") %> + <% else %> + Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> + <% end %> + <% end %> +
+ <% elsif @status_sale == 'sale' %> +
INVOICE DETAILS | Table <%= @dining.name rescue "" %> + <% if !@booking.reserved_by.nil? && %> + <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> - <%= @booking.checkout_at.utc.getlocal.strftime("%I:%M %p") %> + <% else %> + Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> + <% end %> +
+ <% else %> + ORDER DETAILS | Table <%= @dining.name rescue "" %> + <% end %> +
+
+
+
+ <% if (!@sale_array.empty?) && (!@date.nil?) %> +
+   Receipt No: + <% if @status_sale == 'sale' %> <%= @sale_array[0].receipt_no rescue '' %> - <% end %> - -
-
-
- Date: <%= @date.utc.getlocal.strftime("%d/%m/%Y-%I:%M %p") rescue '-' %> -
-
- <% elsif !@date.nil? %> -
-   Order No: - <% if @status_order == 'order' %> - <%= @obj_order.order_id rescue '' %> + <% end %> + +
+
+
+ Date: <%= @date.utc.getlocal.strftime("%d/%m/%Y-%I:%M %p") rescue '-' %> +
+
+ <% elsif !@date.nil? %> +
+   Order No: + <% if @status_order == 'order' %> + <%= @obj_order.order_id rescue '' %> - <% end %> - -
+ <% end %> + +
Date: <%= @date.utc.getlocal.strftime("%d/%m/%Y") rescue '-' %>
- <% end %> + <% end %> +
-
-
-
- - <% if @status_sale == 'sale' && !@sale_array.empty? %> - -   Customer : <%= @sale_array[0].customer.name rescue '' %> - <% elsif @status_order == 'order' && !@customer.nil? - %> - -   Customer : <%= @customer.name rescue "" %> - <% end %> +
+
+ + <% if @status_sale == 'sale' && !@sale_array.empty? %> + +   Customer : <%= @sale_array[0].customer.name rescue '' %> + <% elsif @status_order == 'order' && !@customer.nil? + %> + +   Customer : <%= @customer.name rescue "" %> + <% end %> +
-
-
+
@@ -243,7 +244,7 @@ if @status_sale == 'sale' end %>
- + <% else @sale_array.each do |sale| @@ -289,30 +290,22 @@ end showHideNavbar(webview); $(".tables").on('click', function(){ - $('.tables').removeClass('selected-item'); - $(this).addClass('selected-item'); - var dining_name = $(this).attr("data-name"); - var dining_id = $(this).attr("data-id"); - var change_from = "<%= @dining.id %>"; - if (dining_id == change_from) { - /*$.alert({ - title: 'Alert!', - content: 'Please Select Another Table', - type: 'red', - typeAnimated: true, - btnClass: 'btn-danger', - });*/ - swal({ - title: "Alert!!", - text: 'Please Select Another Table !', - type: 'warning', - }); - }else{ - $('#moved').text(" ' " + dining_name + " ' ") - $('#change_table_value').val(dining_id); - } - - }) + $('.tables').removeClass('selected-item'); + $(this).addClass('selected-item'); + var dining_name = $(this).attr("data-name"); + var dining_id = $(this).attr("data-id"); + var change_from = "<%= @dining.id %>"; + if ((dining_id == change_from) || (dining_name==undefined)) { + swal({ + title: "Alert!!", + text: 'Please select another table !', + type: 'warning', + }); + }else{ + $('#moved').text(" ' " + dining_name + " ' ") + $('#change_table_value').val(dining_id); + } + }); $(".rooms").on('click', function(){ $('.rooms').removeClass('selected-item'); @@ -323,14 +316,14 @@ end if (dining_id == change_from) { swal({ title: "Alert!!", - text: 'Please Select Another Table !', + text: 'Please select another room !', type: 'warning', }); }else{ $('#moved').text(dining_name) $('#change_table_value').val(dining_id); } - }) + }); $('#move_table').on('click',function(){ change_to = $('#change_table_value').val(); @@ -362,7 +355,32 @@ end } }); } - }) + }); + + $('#add_invoice').on('click', function () { + var dining_id = "<%= @dining.id %>"; + var sale_id = $("#sale_id").val(); + var ajax_url = "/origami/sale/append_order"; + $.ajax({ + type: "POST", + url: ajax_url, + data: 'dining_id=' + dining_id + "&sale_id=" + sale_id, + success: function (result) { + swal({ + title: "Information!", + text: "Invoice updated", + html: true, + closeOnConfirm: false, + closeOnCancel: false, + allowOutsideClick: false + }, function () { + $("#first_bill").removeAttr('disabled'); + $("#pay").removeAttr('disabled'); + window.location.reload(); + }); + } + }); + }); }); $('#back').on('click',function(){ window.location.href = '/origami/table/'+ "<%= @dining.id %>"; diff --git a/app/views/origami/rooms/show.html.erb b/app/views/origami/rooms/show.html.erb index fb3d9a75..359df149 100755 --- a/app/views/origami/rooms/show.html.erb +++ b/app/views/origami/rooms/show.html.erb @@ -30,7 +30,7 @@ <% @complete.each do |sale| %>
- <%= sale.receipt_no %><%= sale.sale_status %> + <%= sale.receipt_no %><%= sale.sale_status %>
<% end %> @@ -135,7 +135,7 @@
<% @orders.each do |order| %> -
+
text-white" data-id="<%= order.order_id %>">
<% order_status = "" diff --git a/app/views/origami/sales/show.html.erb b/app/views/origami/sales/show.html.erb index 98dce056..94cbce39 100755 --- a/app/views/origami/sales/show.html.erb +++ b/app/views/origami/sales/show.html.erb @@ -90,9 +90,24 @@
<% @orders.each do |order| %> -
+
text-white" data-id="<%= order.order_id %>">
- <%= order.order_id %> + <% + order_status = "" + sale_order = SaleOrder.find_by_order_id(order) + if sale_order + unless sale_order.sale_id.nil? + sale = Sale.find(sale_order.sale_id) + order_status = sale.sale_status + if order_status == 'new' + order_status = order.status + end + end + else + order_status = order.status + end + %> + <%= order.order_id %> <% if !order_status.empty? %>| <%= order_status %> <% end %>
<% end %> @@ -198,14 +213,13 @@
- <% if @sale.sale_status != 'void' %> - <% if @sale.sale_status != "waste" || @sale.sale_status != "spoile"%> - <% if current_login_employee.role == "cashier" %> - Void - <% else %> - - <% end %> - <% end %> + + <% if @sale.sale_status != 'void' && @sale.sale_status != 'waste' && @sale.sale_status != 'spoile' %> + <% if current_login_employee.role == "cashier" %> + Void + <% else %> + + <% end %> <% end %>
diff --git a/app/views/reports/receipt_no/index.html.erb b/app/views/reports/receipt_no/index.html.erb index 567b056b..9581d5df 100755 --- a/app/views/reports/receipt_no/index.html.erb +++ b/app/views/reports/receipt_no/index.html.erb @@ -59,20 +59,16 @@ <% if @print_settings.precision.to_i > 0 - precision = @print_settings.precision - else - precision = 0 - end - #check delimiter - if @print_settings.delimiter - delimiter = "," - else - delimiter = "" - end - - puts precision - puts "predelidm" - puts delimiter %> + precision = @print_settings.precision + else + precision = 0 + end + #check delimiter + if @print_settings.delimiter + delimiter = "," + else + delimiter = "" + end %> <% grand_total = 0 %> <% old_grand_total = 0 %> @@ -116,12 +112,18 @@   <%= number_with_precision(total_sum, precision: precision.to_i ,delimiter: delimiter) rescue '-' %> <%= number_with_precision(discount_amt, precision: precision.to_i ,delimiter: delimiter) rescue '-' %> - <% @sale_taxes.each do |tax| %> - <%= number_with_precision(tax.st_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-' %> + <% if !@sale_taxes.empty? + @sale_taxes.each do |tax| %> + <%= number_with_precision(tax.st_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-' %> + <% end %> + <% else %> + <% @tax_profiles.each do |tax| %> + 0 + <% end %> <% end %> <%= number_with_precision(grand_total.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %> <%= rounding_adj.to_f rescue '-' %> - <%= number_with_precision(grand_total.to_f.round + rounding_adj, precision: precision.to_i ,delimiter: delimiter) %> + <%= number_with_precision(grand_total.to_f.round + rounding_adj, precision: precision.to_i ,delimiter: delimiter) rescue '0' %>