update rome check all fun

This commit is contained in:
Aung Myo
2017-08-03 11:22:23 +06:30
parent 3bbf60b3ef
commit 39a314bc9a
3 changed files with 112 additions and 56 deletions

View File

@@ -36,4 +36,19 @@ class Origami::MoveroomController < BaseOrigamiController
end end
end end
def moving
change_to = params[:change_to] #new
change_from = params[:change_from] #original
bookings = Booking.where('dining_facility_id=?',change_from)
booking_array = Array.new
bookings.each do | booking |
if booking.sale_id.nil? && booking.booking_status != 'moved'
booking_array.push(booking)
end
end
@get_type = Booking.update_dining_facility(booking_array,change_to,change_from)
end
end end

View File

@@ -1,36 +1,77 @@
class Origami::RoomsController < BaseOrigamiController class Origami::RoomsController < BaseOrigamiController
def index
@tables = Table.all.active.order('status desc')
@rooms = Room.all.active.order('status desc')
@complete = Sale.where("sale_status != 'new'")
@orders = Order.all.order('date desc')
# @shift = ShiftSale.current_open_shift(current_user.id)
end
def show def show
@tables = Table.all.active.order('status desc') @tables = Table.all.active.order('status desc')
@rooms = Room.all.active.order('status desc') @rooms = Room.all.active.order('status desc')
@complete = Sale.where("sale_status != 'new'") @complete = Sale.where("sale_status != 'new'")
@orders = Order.all.order('date desc') @orders = Order.all.order('date desc')
@room = DiningFacility.find(params[:room_id]) @room = DiningFacility.find(params[:room_id])
@sale_array = Array.new
@room.bookings.each do |booking|
if booking.sale_id.nil?
@order_items = Array.new
@status = ""
@sale_array = Array.new
@room.bookings.active.each do |booking|
if booking.sale_id.nil? && booking.booking_status != 'moved'
@order_items = Array.new
booking.booking_orders.each do |booking_order| booking.booking_orders.each do |booking_order|
order = Order.find(booking_order.order_id) order = Order.find(booking_order.order_id)
@obj = order if (order.status == "new")
@customer = order.customer @obj = order
order.order_items.each do |item| @customer = order.customer
@order_items.push(item) @date = order.created_at
order.order_items.each do |item|
@order_items.push(item)
end
end end
end end
@status = 'order' @status = 'order'
else else
sale = Sale.find(booking.sale_id) sale = Sale.find(booking.sale_id)
if sale.sale_status != "completed" if sale.sale_status != "completed" && sale.sale_status != 'void'
@sale_array.push(sale) @sale_array.push(sale)
if @status == 'order'
@status = 'sale'
end
@date = sale.created_at
@status = 'sale' @status = 'sale'
@obj = sale @obj = sale
@customer = sale.customer @customer = sale.customer
end end
end end
end end
# @room.bookings.each do |booking|
# 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
# @customer = order.customer
# order.order_items.each do |item|
# @order_items.push(item)
# end
# end
# @status = 'order'
# else
# sale = Sale.find(booking.sale_id)
# if sale.sale_status != "completed"
# @sale_array.push(sale)
# @status = 'sale'
# @obj = sale
# @customer = sale.customer
# end
# end
# end
end end

View File

@@ -207,7 +207,7 @@
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td> <td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
</tr> </tr>
<tr> <tr>
<%if @obj != nil && @status_sale == 'sale' && @obj.discount_type == 'member_discount'%> <%if @obj != nil && @status == 'sale' && @obj.discount_type == 'member_discount'%>
<td class="charges-name"><strong>Member Discount:</strong></td> <td class="charges-name"><strong>Member Discount:</strong></td>
<%else%> <%else%>
<td class="charges-name"><strong>Discount:</strong></td> <td class="charges-name"><strong>Discount:</strong></td>
@@ -232,52 +232,52 @@
</table> </table>
</div> </div>
<br> <br>
<% <%
if @status == 'sale' if @status == 'sale'
unless @order_items.nil? unless @order_items.nil?
%> %>
Pending New Order Pending New Order
<table class="table table-striped"> <table class="table table-striped">
<% <%
count = 0 count = 0
@order_items.each do |order_item | @order_items.each do |order_item |
count += 1 count += 1
%>
<tr>
<td><%= count %>
<td class='item-name'><%= order_item.item_name %></td>
<td class='item-attr'><%= order_item.qty %></td>
<td class='item-attr'><%= order_item.qty*order_item.price %></td>
</tr>
<%
end
%> %>
</table>
<button class='btn btn-primary' id='add_invoice'> Add to existing invoice </button>
<% end %>
<% if @sale_array.size > 1 %>
<br><br>
Pending Payment
<% end %>
<% @sale_array.each do |sale|
if @sale_array.size > 1
unless sale.receipt_no == @sale_array[0].receipt_no
%>
<table class="table table-striped"> <tr>
<tr> <td><%= count %>
<td>Receipt No - <%= sale.receipt_no %></td> <td class='item-name'><%= order_item.item_name %></td>
<td><button class='btn btn-sm btn-primary invoicedetails' id="<%= sale.sale_id %>">Show Detail </button></td> <td class='item-attr'><%= order_item.qty %></td>
</tr> <td class='item-attr'><%= order_item.qty*order_item.price %></td>
</table> </tr>
<%
end <%
end end
end %>
end </table>
%> <button class='btn btn-primary' id='add_invoice'> Add to existing invoice </button>
<% end %>
<% if @sale_array.size > 1 %>
<br><br>
Pending Payment
<% end %>
<% @sale_array.each do |sale|
if @sale_array.size > 1
unless sale.receipt_no == @sale_array[0].receipt_no
%>
<table class="table table-striped">
<tr>
<td>Receipt No - <%= sale.receipt_no %></td>
<td><button class='btn btn-sm btn-primary invoicedetails' id="<%= sale.sale_id %>">Show Detail </button></td>
</tr>
</table>
<%
end
end
end
end
%>
</div> </div>
</div> </div>