diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 4d3242d5..b5dfb1c3 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,16 +2,17 @@ - - - - - - - - - + + + + + + + + + + @@ -27,21 +28,73 @@ - - + + - - + + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -50,33 +103,8 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -85,8 +113,18 @@ - - + + + + + + + + + + + + @@ -97,6 +135,8 @@ origami + table_invoice + sale_id @@ -105,11 +145,17 @@ @@ -168,6 +214,264 @@ - @@ -672,38 +998,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -712,22 +1006,6 @@ - - - - - - - - - - - - - - - - @@ -760,16 +1038,27 @@ - + - - - - - - - - + + + + + + + + + + + + + + + + + + + @@ -781,34 +1070,124 @@ - + - - + + - + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/controllers/origami/table_invoices_controller.rb b/app/controllers/origami/table_invoices_controller.rb index 32e0ef7f..4571ba87 100644 --- a/app/controllers/origami/table_invoices_controller.rb +++ b/app/controllers/origami/table_invoices_controller.rb @@ -25,7 +25,7 @@ class Origami::TableInvoicesController < BaseOrigamiController else sale = Sale.find(booking.sale_id) - if sale.sale_status != "completed" + if sale.sale_status != "completed" && sale.sale_status != 'void' @sale_array.push(sale) end end diff --git a/app/controllers/origami/void_controller.rb b/app/controllers/origami/void_controller.rb index bea37a21..3515b010 100644 --- a/app/controllers/origami/void_controller.rb +++ b/app/controllers/origami/void_controller.rb @@ -9,6 +9,14 @@ class Origami::VoidController < BaseOrigamiController sale.sale_status = 'void' sale.save + bookings = sale.bookings + bookings.each do |booking| + orders = booking.orders + orders.each do |order| + # order.status = 'void' + end + end + table_avaliable = true table = sale.bookings[0].dining_facility table.bookings.each do |booking| diff --git a/app/views/origami/home/index.html.erb b/app/views/origami/home/index.html.erb index 5888bb3e..cd451e68 100644 --- a/app/views/origami/home/index.html.erb +++ b/app/views/origami/home/index.html.erb @@ -27,6 +27,7 @@
<%= sale.receipt_no %> + <%= sale.sale_status %>
<% end %> diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index 2e852b7c..84f606f8 100644 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -27,6 +27,7 @@
<%= sale.receipt_no %> + <%= sale.sale_status %>
<% end %> @@ -287,7 +288,7 @@ - + <% else %> @@ -474,23 +475,23 @@ $('#edit').on('click',function(){ window.location.href = '/origami/table/'+ dining_id + "/sale/"+ sale_id + "/edit"; }) - $('#void').on('click',function () { - var sure = confirm("Are you sure want to Void"); - if (sure == true) { - var sale_id = $('#sale_id').val(); - var ajax_url = "/origami/sale/" + sale_id + '/void'; - $.ajax({ - type: 'POST', - url: ajax_url, - success: function () { - window.location.href = '/origami/'; - } - }) - } else { +$('#void').on('click',function () { + var sure = confirm("Are you sure want to Void"); + if (sure == true) { + var sale_id = $('#sale_id').val(); + var ajax_url = "/origami/sale/" + sale_id + '/void'; + $.ajax({ + type: 'POST', + url: ajax_url, + success: function () { + window.location.href = '/origami/'; + } + }) + } else { - } + } - }) +}) diff --git a/app/views/origami/orders/show.html.erb b/app/views/origami/orders/show.html.erb index d2c065a1..b386a86d 100644 --- a/app/views/origami/orders/show.html.erb +++ b/app/views/origami/orders/show.html.erb @@ -26,7 +26,7 @@ <% @complete.each do |sale| %>
- <%= sale.receipt_no %> + <%= sale.receipt_no %><%= sale.sale_status %>
<% end %> diff --git a/app/views/origami/payments/show.html.erb b/app/views/origami/payments/show.html.erb index cef27145..4d9089b5 100644 --- a/app/views/origami/payments/show.html.erb +++ b/app/views/origami/payments/show.html.erb @@ -11,7 +11,7 @@ Table No <% if @sale_data%>- <%=@sale_data.receipt_no%><% end %> - Sale Id <% if @sale_data %><%=@sale_data.sale_id %><% end %> + Sale Id <% if @sale_data %><%=@sale_data.sale_id %><% end %> Customer : <%= @sale_data.customer.name%> @@ -244,7 +244,7 @@ - + @@ -354,6 +354,23 @@ $( document ).ready(function() { } }); +$('#void').on('click',function () { + var sure = confirm("Are you sure want to Void"); + if (sure == true) { + var sale_id = $('#sale_id').text(); + var ajax_url = "/origami/sale/" + sale_id + '/void'; + $.ajax({ + type: 'POST', + url: ajax_url, + success: function () { + window.location.href = '/origami/'; + } + }) + } else { + + } +}); + }); function update_balance(){ @@ -369,4 +386,5 @@ function update_balance(){ var result = amount_due - total; $('#balance').text(result.toFixed(2)); } + diff --git a/app/views/origami/rooms/show.html.erb b/app/views/origami/rooms/show.html.erb index 584410d6..77b35a40 100644 --- a/app/views/origami/rooms/show.html.erb +++ b/app/views/origami/rooms/show.html.erb @@ -26,7 +26,7 @@ <% @complete.each do |sale| %>
- <%= sale.receipt_no %> + <%= sale.receipt_no %><%= sale.sale_status %>
<% end %> diff --git a/app/views/origami/sales/show.html.erb b/app/views/origami/sales/show.html.erb index cd716052..8e660261 100644 --- a/app/views/origami/sales/show.html.erb +++ b/app/views/origami/sales/show.html.erb @@ -26,7 +26,7 @@ <% @complete.each do |sale| %>
- <%= sale.receipt_no %> + <%= sale.receipt_no %><%= sale.sale_status %>
<% end %> @@ -185,7 +185,9 @@
- + <% if @sale.sale_status != 'void' %> + + <% end %>
diff --git a/app/views/origami/table_invoices/show.html.erb b/app/views/origami/table_invoices/show.html.erb index ee66f9a3..ade1f021 100644 --- a/app/views/origami/table_invoices/show.html.erb +++ b/app/views/origami/table_invoices/show.html.erb @@ -128,6 +128,7 @@
+
diff --git a/dump.rdb b/dump.rdb index acef6aa7..989b20db 100644 Binary files a/dump.rdb and b/dump.rdb differ