'
@@ -151,9 +153,22 @@ $(document).on('turbolinks:load', function() {
url: '/oqs/' + orderNo,
data: { 'status' : order_status },
success: function(res){
- for (i = 0; i < res.length; i++) {
- var data = JSON.stringify(res[i]);
+ // console.log(res);
+ for (i = 0; i < res["items"].length; i++) {
+ var data = JSON.stringify(res["items"][i]);
var parse_data = JSON.parse(data);
+ var assigned_order_items = [];
+ var assigned_order_item_id = '';
+ if(res["assigned_order_items"]!= undefined && res["assigned_order_items"]!=''){
+ assigned_order_items = JSON.parse(JSON.stringify(res["assigned_order_items"]));
+ $.each(assigned_order_items,function(key,value){
+ if(value[parse_data.order_items_id] != undefined){
+ assigned_order_item_id = value[parse_data.order_items_id];
+ }
+ });
+ }
+ // console.log(assigned_order_item_id);
+
var set_menu_items = parse_data.set_menu_items;
var set_instance_items = "";
if(set_menu_items!=null){
@@ -165,10 +180,18 @@ $(document).on('turbolinks:load', function() {
}
if (oqs_id > 0){
- var order_item_row = "
" +
- "| " + parse_data.item_name + set_instance_items + " | " +
- "" + parse_data.qty + " | " +
- "
";
+ if(assigned_order_item_id != ''){
+ var order_item_row = "
" +
+ "| " + parse_data.item_name + set_instance_items + " | " +
+ "" + parse_data.qty + " | " +
+ "
";
+ }else{
+ var order_item_row = "
" +
+ "| " + parse_data.item_name + set_instance_items + " | " +
+ "" + parse_data.qty + " | " +
+ "
";
+ }
+
}else{
var order_item_row = "
" +
"| " + parse_data.item_name + set_instance_items + " | " +
@@ -191,7 +214,7 @@ $(document).on('turbolinks:load', function() {
$(document).on('click', '.order-item-edit', function(event){
var _self = $(this); // To know in ajax return
var assigned_item_id=$(this).attr('id').substr(5);
- window.location.href = '/oqs/'+ assigned_item_id + "/edit"
+ window.location.href = '/oqs/'+ assigned_item_id + "/edit/oqs";
});
// complete for queue item
diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb
index 1c006be1..97c413c0 100755
--- a/app/controllers/home_controller.rb
+++ b/app/controllers/home_controller.rb
@@ -46,9 +46,12 @@ class HomeController < ApplicationController
elsif @employee.role == "manager"
session[:session_token] = @employee.token_session
redirect_to dashboard_path
- elsif @employee.role == "supervisor" || @employee.role == "waiter"
+ elsif @employee.role == "supervisor"
session[:session_token] = @employee.token_session
redirect_to origami_root_path
+ elsif @employee.role == "waiter"
+ session[:session_token] = @employee.token_session
+ redirect_to origami_dashboard_path
elsif @employee.role == "account"
session[:session_token] = @employee.token_session
redirect_to reports_dailysale_index_path
@@ -160,7 +163,7 @@ class HomeController < ApplicationController
elsif employee.role == "manager"
redirect_to dashboard_path
elsif employee.role == "waiter"
- redirect_to oqs_root_path
+ redirect_to origami_dashboard_path
elsif employee.role == "crm"
redirect_to crm_root_path
elsif @employee.role == "supervisor"
diff --git a/app/controllers/oqs/edit_controller.rb b/app/controllers/oqs/edit_controller.rb
index f8bef2de..52ebdd2c 100755
--- a/app/controllers/oqs/edit_controller.rb
+++ b/app/controllers/oqs/edit_controller.rb
@@ -1,6 +1,12 @@
class Oqs::EditController < BaseOqsController
def index
assigned_item_id = params[:id]
+ @link_type = params[:type]
+ @dining_type = nil
+ if params[:type] != 'oqs'
+ dining = DiningFacility.find_by_id(params[:type])
+ @dining_type = dining.type
+ end
assigned_item = AssignedOrderItem.find(assigned_item_id)
@order_item = OrderItem.where("order_id='#{ assigned_item.order_id }' AND item_instance_code='#{ assigned_item.instance_code }'");
end
diff --git a/app/controllers/oqs/home_controller.rb b/app/controllers/oqs/home_controller.rb
index 371425ca..ad430e49 100755
--- a/app/controllers/oqs/home_controller.rb
+++ b/app/controllers/oqs/home_controller.rb
@@ -60,6 +60,7 @@ class Oqs::HomeController < BaseOqsController
# Get Order items
def get_order_items
items = []
+ assigned_items = []
order_no = params[:order_no]
status = params[:status]
# dining = DiningFacility.find_by_name(table_name);
@@ -90,6 +91,11 @@ class Oqs::HomeController < BaseOqsController
if !items.empty?
items.each do |item|
+ assigned_order_items = AssignedOrderItem.find_by_item_code_and_instance_code_and_order_id(item.item_code,item.item_instance_code,item.order_id)
+ if !assigned_order_items.nil?
+ assigned_items.push({item.order_items_id => assigned_order_items.assigned_order_item_id})
+ end
+
if !item.set_menu_items.nil?
instance_item_sets = JSON.parse(item.set_menu_items)
arr_instance_item_sets = Array.new
@@ -101,7 +107,7 @@ class Oqs::HomeController < BaseOqsController
end
end
end
- render :json => items.to_json
+ render :json => {'items' => items, 'assigned_order_items' => assigned_items }
end
def get_items_by_oqs
diff --git a/app/controllers/origami/dashboard_controller.rb b/app/controllers/origami/dashboard_controller.rb
index e47a8e48..a3d08132 100644
--- a/app/controllers/origami/dashboard_controller.rb
+++ b/app/controllers/origami/dashboard_controller.rb
@@ -55,6 +55,7 @@ class Origami::DashboardController < BaseOrigamiController
# get printer info
@print_settings = PrintSetting.get_precision_delimiter()
+ @current_user = current_user
end
helper_method :shop_detail
diff --git a/app/controllers/origami/home_controller.rb b/app/controllers/origami/home_controller.rb
index 3a7501e6..eedbfdfc 100755
--- a/app/controllers/origami/home_controller.rb
+++ b/app/controllers/origami/home_controller.rb
@@ -62,6 +62,7 @@ class Origami::HomeController < BaseOrigamiController
@dining.bookings.active.each do |booking|
if booking.sale_id.nil? && booking.booking_status != 'moved'
@order_items = Array.new
+ @assigned_order_items = Array.new
if booking.booking_orders.empty?
@booking = booking
else
@@ -84,6 +85,10 @@ class Origami::HomeController < BaseOrigamiController
item.set_menu_items = arr_instance_item_sets
end
@order_items.push(item)
+ assigned_order_items = AssignedOrderItem.find_by_item_code_and_instance_code_and_order_id(item.item_code,item.item_instance_code,item.order_id)
+ if !assigned_order_items.nil?
+ @assigned_order_items.push({item.order_items_id => assigned_order_items.assigned_order_item_id})
+ end
end
accounts = @customer.tax_profiles
puts accounts.to_json
diff --git a/app/controllers/origami/split_bill_controller.rb b/app/controllers/origami/split_bill_controller.rb
index 987f68e7..59dd3a71 100644
--- a/app/controllers/origami/split_bill_controller.rb
+++ b/app/controllers/origami/split_bill_controller.rb
@@ -8,6 +8,7 @@ class Origami::SplitBillController < BaseOrigamiController
@orders = Array.new
@order_items = Array.new
@sale_data = Array.new
+ @current_user = current_user
table_bookings = Booking.where("dining_facility_id = #{dining_id} and sale_id IS NOT NULL")
if !table_bookings.nil?
diff --git a/app/controllers/origami/table_invoices_controller.rb b/app/controllers/origami/table_invoices_controller.rb
index f2dd132a..09535f4a 100755
--- a/app/controllers/origami/table_invoices_controller.rb
+++ b/app/controllers/origami/table_invoices_controller.rb
@@ -65,6 +65,8 @@ class Origami::TableInvoicesController < BaseOrigamiController
if !lookup_spit_bill[0].nil?
@split_bill = lookup_spit_bill[0][1]
end
+ # get printer info
+ @print_settings = PrintSetting.get_precision_delimiter()
end
#Shop Name in Navbor
diff --git a/app/models/ability.rb b/app/models/ability.rb
index 7afb6bc4..33372ac9 100755
--- a/app/models/ability.rb
+++ b/app/models/ability.rb
@@ -191,6 +191,9 @@ class Ability
elsif user.role == "waiter"
can :index, :home
can :show, :home
+ #ability for split_bill
+ can :index, :split_bill
+ can :create, :split_bill
end
end
end
diff --git a/app/pdf/receipt_bill_a5_pdf.rb b/app/pdf/receipt_bill_a5_pdf.rb
index c4666963..b3302485 100644
--- a/app/pdf/receipt_bill_a5_pdf.rb
+++ b/app/pdf/receipt_bill_a5_pdf.rb
@@ -487,17 +487,17 @@ class ReceiptBillA5Pdf < Prawn::Document
move_down 5
y_position = cursor
bounding_box([0,y_position], :width =>self.label_width+50) do
- text "Individual amount for #{sale_data.equal_persons} persons", :size => self.item_font_size+1,:align => :left
+ text "Split Bill for #{sale_data.equal_persons} persons", :size => self.item_font_size+1,:align => :left
end
bounding_box([0,y_position], :width =>self.label_width) do
move_down 15
- text "Total Amount", :size => self.item_font_size,:align => :left
+ text "Amount Due (per person)", :size => self.item_font_size,:align => :left
end
bounding_box([self.label_width,y_position], :width =>self.item_description_width) do
move_down 15
- text "#{number_with_precision(per_person, :precision => precision.to_i, :delimiter => delimiter)} per person", :size => self.item_font_size,:align => :right
+ text "#{number_with_precision(per_person, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
end
end
diff --git a/app/pdf/receipt_bill_pdf.rb b/app/pdf/receipt_bill_pdf.rb
index aef26a9d..0ae57fea 100755
--- a/app/pdf/receipt_bill_pdf.rb
+++ b/app/pdf/receipt_bill_pdf.rb
@@ -488,17 +488,17 @@ class ReceiptBillPdf < Prawn::Document
move_down 5
y_position = cursor
bounding_box([0,y_position], :width =>self.label_width+50) do
- text "Individual amount for #{sale_data.equal_persons} persons", :size => self.item_font_size+1,:align => :left
+ text "Split Bill for #{sale_data.equal_persons} persons", :size => self.item_font_size+1,:align => :left
end
bounding_box([0,y_position], :width =>self.label_width) do
move_down 15
- text "Total Amount", :size => self.item_font_size,:align => :left
+ text "Amount Due (per person)", :size => self.item_font_size,:align => :left
end
bounding_box([self.label_width,y_position], :width =>self.item_description_width) do
move_down 15
- text "#{number_with_precision(per_person, :precision => precision.to_i, :delimiter => delimiter)} per person", :size => self.item_font_size,:align => :right
+ text "#{number_with_precision(per_person, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
end
end
diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb
index ec0a3c68..5f1fe42d 100755
--- a/app/views/layouts/_header.html.erb
+++ b/app/views/layouts/_header.html.erb
@@ -18,7 +18,7 @@
<% else %>
-
+
<%end%>
SX Restaurant
diff --git a/app/views/oqs/edit/index.html.erb b/app/views/oqs/edit/index.html.erb
index 24599bd1..775b214d 100755
--- a/app/views/oqs/edit/index.html.erb
+++ b/app/views/oqs/edit/index.html.erb
@@ -118,13 +118,45 @@ $(document).ready(function(){
data: params,
success: function(result){
// alert("Updated!");
- window.location.href = '/oqs';
+ <% if !@link_type.nil? %>
+ <% if @link_type == 'oqs' %>
+ window.location.href = '/oqs';
+ <% 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%>;
+ <% end %>
+ <% end %>
+ <% else %>
+ window.location.href = '/oqs';
+ <% end %>
}
});
});
$('#back').on('click', function () {
+ <% if !@link_type.nil? %>
+ <% if @link_type == 'oqs' %>
+ window.location.href = '/oqs';
+ <% 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%>;
+ <% end %>
+ <% end %>
+ <% else %>
window.location.href = '/oqs';
+ <% end %>
})
// number key pad
diff --git a/app/views/origami/dashboard/index.html.erb b/app/views/origami/dashboard/index.html.erb
index 8f432e1e..98e253cc 100644
--- a/app/views/origami/dashboard/index.html.erb
+++ b/app/views/origami/dashboard/index.html.erb
@@ -14,55 +14,7 @@
delimiter = ""
end
%>
-
-
-
-
-
- help
-
-
-
<%= t :sale_count %>
-
-
-
-
-
-
-
- attach_money
-
-
-
<%= t :total_sale %>
-
-
-
-
-
-
-
- person_add
-
-
-
<%= t :total_credit %>
-
-
-
-
-
-
-
- credit_card
-
-
-
<%= t :total_card %>
-
-
-
-
-
-
+ <% if !@current_user.nil? && @current_user.role != 'waiter' %>
@@ -230,6 +183,7 @@
+ <% end %>
diff --git a/app/views/origami/payments/show.html.erb b/app/views/origami/payments/show.html.erb
index fa4167b2..2a78ee91 100755
--- a/app/views/origami/payments/show.html.erb
+++ b/app/views/origami/payments/show.html.erb
@@ -125,7 +125,13 @@
<% if !@individual_total[0].nil? %>
|
- Individual amount for <%= @individual_total[0]['total_customer'] %> persons
+ Split Bill for <%= @individual_total[0]['total_customer'] %> persons
+ |
+ |
+
+
+ |
+ Amount Due (per person)
|
<%= number_with_precision(@individual_total[0]['per_person_amount'], precision: precision.to_i )%> |
@@ -445,7 +451,7 @@ console.log("fffffffffffff")
swal ( "Oops" , "Please select an table!" , "warning" );
}
}else{
- swal("Opps","You are not authorized for Discount","warning")
+ swal("Oops","You are not authorized for Discount","warning")
}
return false;
});
@@ -461,7 +467,7 @@ console.log("fffffffffffff")
}
}else{
- swal("Opps","You are not authorized for void","warning")
+ swal("Oops","You are not authorized for void","warning")
}
});
@@ -548,23 +554,23 @@ console.log("fffffffffffff")
$('#pay').click(function() {
sub_total = $('#sub-total').text();
if (payment_type == 'MPU' && $('.mpu').text() == 0 && sub_total != 0.0) {
- swal("Opps","Please Pay with MPU Payment","warning");
+ swal("Oops","Please Pay with MPU Payment","warning");
}else if(payment_type == "Redeem" && $('#ppamount').text()==0 && sub_total != 0.0){
- swal("Opps","Please Pay with Redeem Payment","warning");
+ swal("Oops","Please Pay with Redeem Payment","warning");
}else if(payment_type == "VISA" && $('#visacount').text()==0 && sub_total != 0.0){
- swal("Opps","Please Pay with Visa Payment","warning");
+ swal("Oops","Please Pay with Visa Payment","warning");
}else if(payment_type == "JCB" && $('#jcbcount').text()==0 && sub_total != 0.0){
- swal("Opps","Please Pay with jcb Payment","warning");
+ swal("Oops","Please Pay with jcb Payment","warning");
}
else if(payment_type == "Master" && $('#mastercount').text()==0 && sub_total != 0.0){
- swal("Opps","Please Pay with Master Payment","warning");
+ swal("Oops","Please Pay with Master Payment","warning");
}
else if(payment_type == "UNIONPAY" && $('#unionpaycount').text()==0 && sub_total != 0.0){
- swal("Opps","Please Pay with UNIONPAY Payment","warning");
+ swal("Oops","Please Pay with UNIONPAY Payment","warning");
}
else if(payment_type == "Credit" && $('#credit').text()==0 && sub_total != 0.0){
- swal("Opps","Please Pay with Credit Payment","warning");
+ swal("Oops","Please Pay with Credit Payment","warning");
}else{
$( "#loading_wrapper").show();
@@ -664,7 +670,7 @@ console.log("fffffffffffff")
})
});
}else{
- swal("Opps","You are not authorized for void","warning")
+ swal("Oops","You are not authorized for void","warning")
}
});
@@ -722,7 +728,7 @@ console.log("fffffffffffff")
}
});
}else{
- swal("Opps","You are not authorized for foc","warning")
+ swal("Oops","You are not authorized for foc","warning")
}
});
diff --git a/app/views/origami/rooms/show.html.erb b/app/views/origami/rooms/show.html.erb
index 74c81b77..1235f522 100755
--- a/app/views/origami/rooms/show.html.erb
+++ b/app/views/origami/rooms/show.html.erb
@@ -420,6 +420,7 @@
<% if @status_sale == 'sale' %>
+ <% if current_login_employee.role != "waiter" %>
@@ -427,6 +428,13 @@
+ <% end %>
+ <% if !@split_bill.nil? %>
+ <% if @split_bill == '1' %>
+
+ <% end %>
+ <% end %>
+ <% if current_login_employee.role != "waiter" %>
<% if ENV["SERVER_MODE"] == "cloud" %>
@@ -437,14 +445,11 @@
<%end%>
<%end%>
- <% if !@split_bill.nil? %>
- <% if @split_bill == '1' %>
-
- <% end %>
- <% end %>
+ <% end %>
<% end %>
+ <% if current_login_employee.role != "waiter" %>
">
<%= @membership.discount%>
<%= @obj_sale.customer.membership_id rescue 0%>
@@ -475,7 +480,7 @@
-
+ <% end %>
<% end %>
diff --git a/app/views/origami/sale_edit/edit.html.erb b/app/views/origami/sale_edit/edit.html.erb
index 3f65a8ad..b971ddbd 100755
--- a/app/views/origami/sale_edit/edit.html.erb
+++ b/app/views/origami/sale_edit/edit.html.erb
@@ -1,7 +1,7 @@
<%
# end
@@ -93,7 +108,7 @@
<%= count %> |
<%= order_item.item_name %> |
<%= order_item.qty %> |
-
<%= order_item.qty*order_item.price %> |
+
<%= number_with_precision(order_item.qty*order_item.price, precision: precision.to_i ) %> |
<%
end
@@ -109,7 +124,7 @@
| Sub Total: |
- <%= sub_total %> |
+ <%= number_with_precision(sub_total, precision: precision.to_i ) %> |
<%if @sale.discount_type == 'member_discount'%>
@@ -117,19 +132,19 @@
<%else%>
| Discount: |
<%end%>
- (<%= @sale.total_discount rescue 0%>) |
+ (<%= number_with_precision(@sale.total_discount, precision: precision.to_i ) rescue 0%>) |
| Tax: |
- <%= @sale.total_tax rescue 0%> |
+ <%= number_with_precision(@sale.total_tax, precision: precision.to_i ) rescue 0%> |
| Rounding Adj: |
- <%= @sale.rounding_adjustment rescue 0%> |
+ <%= number_with_precision(@sale.rounding_adjustment, precision: precision.to_i ) rescue 0%> |
| Grand Total: |
- <%= @sale.grand_total rescue 0%> |
+ <%= number_with_precision(@sale.grand_total, precision: precision.to_i ) rescue 0%> |
@@ -142,7 +157,8 @@