From bcd44db9a2cdd97f44ee9adbc5d81505ce061037 Mon Sep 17 00:00:00 2001 From: Zin Lin Phyo Date: Tue, 27 Jun 2017 11:35:36 +0630 Subject: [PATCH] multiple invoice void --- .idea/workspace.xml | 615 ++++++++++++++---- .../origami/table_invoices_controller.rb | 2 +- app/controllers/origami/void_controller.rb | 8 + app/views/origami/home/index.html.erb | 1 + app/views/origami/home/show.html.erb | 33 +- app/views/origami/orders/show.html.erb | 2 +- app/views/origami/payments/show.html.erb | 22 +- app/views/origami/rooms/show.html.erb | 2 +- app/views/origami/sales/show.html.erb | 6 +- .../origami/table_invoices/show.html.erb | 19 +- dump.rdb | Bin 18261 -> 17895 bytes 11 files changed, 568 insertions(+), 142 deletions(-) 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 acef6aa79d6c19cf0bb0d215a80225ad58500e81..989b20db9eb66d7ef6d034695caac9e1fa5f72fb 100644 GIT binary patch delta 1616 zcmZvcU1(cn7{~MGq_hibnoer$T+*|#>RfDmzdz`<_C)9K16=j0)2+o?)X65T?!t>g zTs9pj;&|~sv;{9j=yrM`ZphjwBZ}Y$f>Y-@Ce#bDt4;)k>HD6OoaCan59d73|M@-t z|NGrLVD&BVF1#zbIx_lC$B9=apBp$fd2IP$HWRxY`!@r0UovxcESH!VU0Xf-I_+dc z35g0)A*}eh<;U#@cP6m7l=f5ct`0Dzb4ePi3gwiaTx7 zldn#{maBT#iX(anmGzCipPQ}_F;*a4U?KI6)ZxLE*jz$!NmS)#Vr=5&6UT?EF;+^) zUR(hWl>81}z?cX^X0{-zB$H5zu*9JBze?T$&XwW;)Ba&y8XETZb-w_dYsDvndAs@L zbV@cRGR~Ni`eOFT5SWisDcth-dVS)j&54U-i@@7m&=&B!Z>f{+Q6~@)`ZXKWAc)R%hf5%guxTj>=2h=|JvDgRcY2Qk z=XzcFjcs2&Qr+=906+N)WCS!iQV1zy zM&{^H>|6ptq-5nb7@KhO!(Y3zUROwdX_LXsA(9+7(Hqsari8LrwUkfkTU#%uH${|% z+YfL+c@WGy+>EMh1R3yx`;mhviWb0>7K}3xGp&En3*@w3*jel9j2bJ*&Gpvh(|Zz( zQ;I78S;_Ygf73V}EG=8k9213_ifvbpsrk9;t<-(^XlJd(7f2C=knzRgeV69jj4>5% z)hrrTTx_?-K$L`%xe*V;3MEx9yxd9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