update pending ordre

This commit is contained in:
Aung Myo
2018-07-12 18:36:35 +06:30
parent eef4af4cc6
commit d254ff744d
3 changed files with 261 additions and 218 deletions

View File

@@ -82,7 +82,15 @@ $(document).ready(function() {
touchScrollStep : 45 touchScrollStep : 45
}); });
$('#pending-order-slimscroll').slimScroll({
height: height-$('#pending-order-slimscroll').attr('data-height'),
size: '5px',
color: 'rgba(0,0,0,0.5)',
alwaysVisible: false,
borderRadius: '0',
railBorderRadius: '0',
touchScrollStep : 50
});
// $('.delete').click(function(){ // $('.delete').click(function(){
// var method = $(this).attr('data-method'); // var method = $(this).attr('data-method');
// var url = $(this).attr('data-ref'); // var url = $(this).attr('data-ref');

View File

@@ -520,3 +520,8 @@ nav.pagination .page a:hover,
filter: alpha(opacity=100); /* ie */ filter: alpha(opacity=100); /* ie */
-moz-opacity: 1; /* mozilla */ -moz-opacity: 1; /* mozilla */
} }
.existing_invoice{
background-color:#009688;
color:#fff;
}

View File

@@ -16,10 +16,10 @@
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#rooms" role="tab"><%= t :rooms %></a> <a class="nav-link" data-toggle="tab" href="#rooms" role="tab"><%= t :rooms %></a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#orders" role="tab"><%= t :orders %></a> <a class="nav-link" data-toggle="tab" href="#orders" role="tab"><%= t :orders %></a>
</li> </li>
</ul> </ul>
<!-- Nav tabs - End --> <!-- Nav tabs - End -->
<div id="custom-slimscroll"> <div id="custom-slimscroll">
<div class="tab-content m-t-10"> <div class="tab-content m-t-10">
@@ -48,38 +48,28 @@
<% else %> <% else %>
<div class="card tables orange text-white table_<%= table.id %>" data-id="<%= table.id %>"> <div class="card tables orange text-white table_<%= table.id %>" data-id="<%= table.id %>">
<% end %> <% end %>
<div class="card-block"> <div class="card-block">
<%= table.name %> <%= table.name %>
<!-- <% if !@order_items_count.nil? %> <span class="float-right font-12 new_text_<%= table.id %>"> billed</span>
<% if @order_items_count.key?(table.id) %> <div style="font-size:12px;"></div>
(Orders : <%= @order_items_count[table.id] %>) </div>
<% end %>
<% end %> -->
<span class="float-right font-12 new_text_<%= table.id %>"> billed</span>
<div style="font-size:12px;"></div>
</div> </div>
</div>
<% else %> <% else %>
<% if table.get_checkout_booking.nil? %> <% if table.get_checkout_booking.nil? %>
<div class="card tables blue text-white table_<%= table.id %>" data-id="<%= table.id %>"> <div class="card tables blue text-white table_<%= table.id %>" data-id="<%= table.id %>">
<% else %> <% else %>
<div class="card tables orange text-white table_<%= table.id %>" data-id="<%= table.id %>"> <div class="card tables orange text-white table_<%= table.id %>" data-id="<%= table.id %>">
<% end %> <% end %>
<div class="card-block"> <div class="card-block">
<%= table.name %> <%= table.name %>
<!-- <% if !@order_items_count.nil? %> <span class="float-right font-12 new_text_<%= table.id %>"> new</span>
<% if @order_items_count.key?(table.id) %> </div>
(Orders : <%= @order_items_count[table.id] %>)
<% end %>
<% end %> -->
<span class="float-right font-12 new_text_<%= table.id %>"> new</span>
</div> </div>
</div>
<% end %> <% end %>
<% else %> <% else %>
<div class="card tables green text-white table_<%= table.id %>" data-id="<%= table.id %>"> <div class="card tables green text-white table_<%= table.id %>" data-id="<%= table.id %>">
<div class="card-block"> <div class="card-block">
<%= table.name %> <%= table.name %>
<span class="float-right font-12 new_text_<%= table.id %> hide"> new</span> <span class="float-right font-12 new_text_<%= table.id %> hide"> new</span>
</div> </div>
</div> </div>
@@ -95,33 +85,23 @@
<% if room.status == 'occupied' %> <% if room.status == 'occupied' %>
<% if room.get_booking.nil? %> <% if room.get_booking.nil? %>
<% if room.get_checkout_booking.nil? %> <% if room.get_checkout_booking.nil? %>
<div class="card rooms red text-white table_<%= room.id %>" data-id="<%= room.id %>"> <div class="card rooms red text-white table_<%= room.id %>" data-id="<%= room.id %>">
<% else %> <% else %>
<div class="card rooms orange text-white table_<%= room.id %>" data-id="<%= room.id %>"> <div class="card rooms orange text-white table_<%= room.id %>" data-id="<%= room.id %>">
<% end %> <% end %>
<div class="card-block"> <div class="card-block">
<%= room.name %> <%= room.name %>
<!-- <% if !@order_items_count.nil? %> <span class="float-right font-12 new_text_<%= room.id %>"> billed</span>
<% if @order_items_count.key?(room.id) %> </div>
(Orders : <%= @order_items_count[room.id] %>)
<% end %>
<% end %> -->
<span class="float-right font-12 new_text_<%= room.id %>"> billed</span>
</div> </div>
</div>
<% else %> <% else %>
<% if room.get_checkout_booking.nil? %> <% if room.get_checkout_booking.nil? %>
<div class="card rooms blue text-white table_<%= room.id %>" data-id="<%= room.id %>"> <div class="card rooms blue text-white table_<%= room.id %>" data-id="<%= room.id %>">
<% else %> <% else %>
<div class="card rooms orange text-white table_<%= room.id %>" data-id="<%= room.id %>"> <div class="card rooms orange text-white table_<%= room.id %>" data-id="<%= room.id %>">
<% end %> <% end %>
<div class="card-block"> <div class="card-block">
<%= room.name %> <%= room.name %>
<!-- <% if !@order_items_count.nil? %>
<% if @order_items_count.key?(room.id) %>
(Orders : <%= @order_items_count[room.id] %>)
<% end %>
<% end %> -->
<span class="float-right font-12 new_text_<%= room.id %>"> new</span> <span class="float-right font-12 new_text_<%= room.id %>"> new</span>
</div> </div>
</div> </div>
@@ -144,22 +124,22 @@
<% @orders.each do |order| %> <% @orders.each do |order| %>
<div class="card orders <%=(order.status=="new") ? 'blue' : 'red'%> text-white" data-id="<%= order.order_id %>"> <div class="card orders <%=(order.status=="new") ? 'blue' : 'red'%> text-white" data-id="<%= order.order_id %>">
<div class="card-block"> <div class="card-block">
<% <% order_status = "" %>
order_status = "" <% sale_order = order.sale_orders.first %>
sale_order = order.sale_orders.first <% if sale_order %>
if sale_order <% unless sale_order.sale_id.nil? %>
unless sale_order.sale_id.nil? <% sale = Sale.find(sale_order.sale_id) %>
sale = Sale.find(sale_order.sale_id) <% order_status = sale.sale_status %>
order_status = sale.sale_status <% if order_status == 'new' %>
if order_status == 'new' <% order_status = order.status %>
order_status = order.status <% end %>
end <% end %>
end <% else %>
else <% order_status = order.status %>
order_status = order.status <% end %>
end <%= order.order_id %>
%> <% if !order_status.empty? %>| <%= order_status %>
<%= order.order_id %> <% if !order_status.empty? %>| <%= order_status %> <% end %> <% end %>
</div> </div>
</div> </div>
<% end %> <% end %>
@@ -174,7 +154,12 @@
<!-- Column Two --> <!-- Column Two -->
<div class="col-lg-5 col-md-5 col-sm-5"> <div class="col-lg-5 col-md-5 col-sm-5">
<div class="card"> <div class="card">
<div class="card-header"> <% existing_class = "" %>
<% if @status_sale == 'sale' && (!@order_items.nil?) %>
<% existing_class = "existing_invoice"%>
<% tooltip = ' data-toggle=modal title=Add_To_Existing data-target=#invoiceModal'%>
<%end%>
<div class="card-header <%= existing_class %>" <%= tooltip %>>
<% if @status_order == 'order' && @status_sale != 'sale' %> <% if @status_order == 'order' && @status_sale != 'sale' %>
<% if !@obj_order.nil? %> <% if !@obj_order.nil? %>
<div id="save_order_id" data-order="<%= @obj_order.order_id %>"> <div id="save_order_id" data-order="<%= @obj_order.order_id %>">
@@ -222,7 +207,6 @@
&nbsp; Order No: <span id="order_no"> &nbsp; Order No: <span id="order_no">
<% if @status_order == 'order' %> <% if @status_order == 'order' %>
<%= @obj_order.order_id rescue '' %> <%= @obj_order.order_id rescue '' %>
<% end %> <% end %>
</span> </span>
<br> <br>
@@ -234,109 +218,84 @@
<% end %> <% end %>
</div> </div>
<div class="row p-l-5 p-r-5"> <div class="row p-l-5 p-r-5">
<div class="col-lg-6 col-md-6 col-sm-6"> <div class="col-lg-6 col-md-6 col-sm-6">
<% if @status_sale == 'sale' %>
<% if @status_sale == 'sale' %> <p class="hidden customer-id"><%= @sale_array[0].customer_id rescue '' %></p>
<p class="hidden customer-id"><%= @sale_array[0].customer_id rescue '' %></p> &nbsp; Customer : <%= @sale_array[0].customer.name rescue '' %>
&nbsp; Customer : <%= @sale_array[0].customer.name rescue '' %> <% elsif @status_order == 'order'
<% elsif @status_order == 'order' %>
%> <p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p>
<p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p> &nbsp; Customer : <%= @customer.name rescue "" %>
&nbsp; Customer : <%= @customer.name rescue "" %> <% end %>
<% end %> </div>
</div>
</div> </div>
</div> </div>
<div id="order-detail-slimscroll" data-height="<%= @status_sale=="sale" ? 200 : 160%>"> <div id="order-detail-slimscroll" data-height="<%= @status_sale=="sale" ? 200 : 160%>">
<div class="card-text" > <div class="card-text" >
<table class="table table-striped" id="order-items-table"> <table class="table table-striped" id="order-items-table">
<thead> <thead>
<tr> <tr>
<th>#</th>
<th>#</th> <th class="item-name">Items</th>
<th class="item-name">Items</th> <th class="item-attr">QTY</th>
<th class="item-attr">QTY <th class="item-attr">Price</th>
</th> </tr>
<th class="item-attr">Price
</th>
</tr>
</thead> </thead>
<tbody> <tbody>
<% <% count = 0
count = 0
sub_total = 0 sub_total = 0
if @status_sale == "sale" if @status_sale == "sale"
@sale_array[0].sale_items.each do |sale_item| @sale_array[0].sale_items.each do |sale_item|
sub_total = sub_total + sale_item.price%>
sub_total = sub_total + sale_item.price
%>
<input type="hidden" id="sale_id" value="<%= @sale_array[0].sale_id %>"> <input type="hidden" id="sale_id" value="<%= @sale_array[0].sale_id %>">
<% <%count += 1 %>
# Can't check for discount
# unless sale_item.price == 0
count += 1
%>
<tr> <tr>
<td><%= count %></td> <td><%= count %></td>
<td class='item-name'><%= sale_item.product_name %></td> <td class='item-name'><%= sale_item.product_name %></td>
<td class='item-attr'><%= sale_item.qty %></td> <td class='item-attr'><%= sale_item.qty %></td>
<td class='item-attr'><%= sale_item.price %></td> <td class='item-attr'><%= sale_item.price %></td>
</tr> </tr>
<%end %>
<% end %>
<% if @status_order == 'order' && @status_sale != 'sale'
unless @order_items.nil? || @order_items.empty?
count = 0
@order_items.each do |order_item|
set_item_prices = 0
count += 1
sub_total = sub_total + (order_item.price * order_item.qty)
# unless order_item.price == 0 %>
<tr class="<%= @edit_order_origami==true ? 'edit_order' : '' %>" data-id='<%= order_item.order_items_id %>'>
<td><%= count %></td>
<td class='item-name'><%= order_item.item_name %>
<% if !order_item.options.nil? && !order_item.options.empty? && order_item.options != "undefined" %>
<% JSON.parse(order_item.options).each do |option| %>
<br><span class="font-13"><%= option %></span>
<% end %>
<% end %>
<% <% if !order_item.set_menu_items.nil? && order_item.set_menu_items != '[]'
end JSON.parse(order_item.set_menu_items).each do |item_instance|
end set_item_prices += (item_instance["quantity"].to_f * item_instance["price"].to_f).to_f %>
<br>
if @status_order == 'order' && @status_sale != 'sale' <span class="font-13">
puts <%= item_instance["item_instance_name"] %>
unless @order_items.nil? || @order_items.empty? <% if !item_instance["options"].nil? && !item_instance["options"].empty? %>
count = 0 <% (item_instance["options"]).each do |set_item_option| %>
@order_items.each do |order_item| <br><span class="font-13"> <%= set_item_option %></span>
set_item_prices = 0
count += 1
sub_total = sub_total + (order_item.price * order_item.qty)
# unless order_item.price == 0 %>
<tr class="<%= @edit_order_origami==true ? 'edit_order' : '' %>" data-id='<%= order_item.order_items_id %>'>
<td><%= count %></td>
<td class='item-name'>
<%= order_item.item_name %>
<% if !order_item.options.nil? && !order_item.options.empty? && order_item.options != "undefined" %>
<% JSON.parse(order_item.options).each do |option| %>
<br><span class="font-13">
<%= option %>
</span>
<% end %> <% end %>
<% end %> <% end %>
</span>
<% if !order_item.set_menu_items.nil? && order_item.set_menu_items != '[]' <% end
JSON.parse(order_item.set_menu_items).each do |item_instance| sub_total += set_item_prices
set_item_prices += (item_instance["quantity"].to_f * item_instance["price"].to_f).to_f %> end %>
<br><span class="font-13"> </td>
<%= item_instance["item_instance_name"] %> <td class='item-attr'><%= order_item.qty %></td>
<% if !item_instance["options"].nil? && !item_instance["options"].empty? %> <td class='item-attr'><%= (order_item.qty*order_item.price).to_f + set_item_prices %></td>
<% (item_instance["options"]).each do |set_item_option| %> </tr>
<br><span class="font-13"> <% end %>
<%= set_item_option %> <% end %>
</span> <% end %>
<% end %>
<% end %>
</span>
<% end
sub_total += set_item_prices
end %>
</td>
<td class='item-attr'><%= order_item.qty %></td>
<td class='item-attr'><%= (order_item.qty*order_item.price).to_f + set_item_prices %></td>
</tr>
<%
# end
end
end
end
%>
</tbody> </tbody>
</table> </table>
</div> </div>
@@ -348,64 +307,60 @@
<td class="item-attr"><strong id="sub-total"><%= sub_total %></strong></td> <td class="item-attr"><strong id="sub-total"><%= sub_total %></strong></td>
</tr> </tr>
<tr> <tr>
<%if @obj_sale != nil && @obj_sale.discount_type == 'member_discount'%> <%if @obj_sale != nil && @obj_sale.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>
<%end%> <%end%>
<td class="item-attr"><strong id="order-discount">(<%= @obj_sale.total_discount rescue 0%>)</strong></td> <td class="item-attr"><strong id="order-discount">(<%= @obj_sale.total_discount rescue 0%>)</strong></td>
</tr> </tr>
<% if @status_sale == "sale" %> <% if @status_sale == "sale" %>
<tr>
<td class="charges-name"><strong>
<% if !@sale_taxes.empty? %>
Tax:
(<% @i = 0
@sale_taxes.each do |ct| %>
<%=ct.tax_name%>
<% if @sale_taxes.count != @i+1%>
+ <% @i =+1 %>
<%end%>
<%end %>)
<% else %>
No Tax
<% end %></strong><br>
<%if !@webview %>
<button class="btn btn-link waves-effect bg-info change_tax">Change Tax</button>
<% end %>
</td>
<td class="item-attr"><strong id="order-Tax"><%= @obj_sale.total_tax rescue 0%></strong></td>
</tr>
<tr> <tr>
<td class="charges-name"><strong>Rounding Adj:</strong></td> <td class="charges-name"><strong>
<td class="item-attr"><strong id="order-round-adj"><%= @obj_sale.rounding_adjustment rescue 0%></strong></td> <% if !@sale_taxes.empty? %>
</tr> Tax:
<tr> (<% @i = 0
<td class="charges-name"><strong>Grand Total:</strong></td> @sale_taxes.each do |ct| %>
<td class="item-attr"><strong id="order-grand-total"><%= @obj_sale.grand_total rescue 0%></strong></td> <%=ct.tax_name%>
</tr> <% if @sale_taxes.count != @i+1%>
<% end %> + <% @i =+1 %>
<%end%>
<%end %>)
<% else %>
No Tax
<% end %></strong><br>
<%if !@webview %>
<button class="btn btn-link waves-effect bg-info change_tax">Change Tax</button>
<% end %>
</td>
<td class="item-attr"><strong id="order-Tax"><%= @obj_sale.total_tax rescue 0%></strong></td>
</tr>
<tr>
<td class="charges-name"><strong>Rounding Adj:</strong></td>
<td class="item-attr"><strong id="order-round-adj"><%= @obj_sale.rounding_adjustment rescue 0%></strong></td>
</tr>
<tr>
<td class="charges-name"><strong>Grand Total:</strong></td>
<td class="item-attr"><strong id="order-grand-total"><%= @obj_sale.grand_total rescue 0%></strong></td>
</tr>
<% end %>
<tr class="rebate_amount"></tr> <tr class="rebate_amount"></tr>
</table> </table>
</div> </div>
<% <% if @status_sale == 'sale'
if @status_sale == 'sale' unless @order_items.nil? || @order_items.empty?%>
unless @order_items.nil? || @order_items.empty? <!-- Pending New Order
%> <table class="table table-striped">
Pending New Order <% count = 0
<table class="table table-striped"> @order_items.each do |order_item|
<% set_item_prices = 0
count = 0 count += 1 %>
@order_items.each do |order_item| <tr class="<%= @edit_order_origami==true ? 'edit_order' : '' %>" data-id='<%= order_item.order_items_id %>'>
set_item_prices = 0 <td><%= count %>
count += 1 <td class='item-name'>
%> <%= order_item.item_name %>
<tr class="<%= @edit_order_origami==true ? 'edit_order' : '' %>" data-id='<%= order_item.order_items_id %>'>
<td><%= count %>
<td class='item-name'>
<%= order_item.item_name %>
<% if !order_item.options.nil? && !order_item.options.empty? && order_item.options != "undefined" %> <% if !order_item.options.nil? && !order_item.options.empty? && order_item.options != "undefined" %>
<% JSON.parse(order_item.options).each do |option| %> <% JSON.parse(order_item.options).each do |option| %>
<br><span class="font-13"> <br><span class="font-13">
@@ -438,9 +393,9 @@
<% <%
end end
%> %>
</table> </table> -->
<button class='btn btn-primary btn-block waves-effect' id='add_invoice'> Add to existing invoice</button> <!-- <button class='btn btn-primary btn-block waves-effect' id='add_invoice'> Add to existing invoice</button> -->
<% end %> <% end %>
<% if @sale_array.size > 1 %> <% if @sale_array.size > 1 %>
<br><br> <br><br>
@@ -449,24 +404,21 @@
<% @sale_array.each do |sale| <% @sale_array.each do |sale|
if @sale_array.size > 1 if @sale_array.size > 1
unless sale.receipt_no == @sale_array[0].receipt_no unless sale.receipt_no == @sale_array[0].receipt_no
%> %>
<table class="table table-striped">
<table class="table table-striped"> <tr>
<tr> <td>Receipt No - <%= sale.receipt_no %></td>
<td>Receipt No - <%= sale.receipt_no %></td> <td>
<td> <button class='btn btn-sm btn-primary invoicedetails' id="<%= sale.sale_id %>">Show
<button class='btn btn-sm btn-primary invoicedetails' id="<%= sale.sale_id %>">Show
Detail Detail
</button> </button>
</td> </td>
</tr> </tr>
</table> </table>
<% <%end%>
end <% end%>
end <% end%>
end <%end %>
end
%>
</div> </div>
</div> </div>
</div> </div>
@@ -642,6 +594,84 @@
</div> </div>
</div> </div>
<% if @status_sale == 'sale' && (!@order_items.nil?) %>
<div class="modal fade" id="invoiceModal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="invoiceModalLabel">Pending New Order</h4>
</div>
<div class="modal-body">
<div class="card">
<div id="pending-order-slimscroll" data-height="160">
<table class="table table-striped">
<thead>
<tr>
<th>#</th>
<th class="item-name">Items</th>
<th class="item-attr">QTY</th>
<th class="item-attr">Price</th>
</tr>
</thead>
<tbody>
<% count = 0
@order_items.each do |order_item|
set_item_prices = 0
count += 1 %>
<tr class="<%= @edit_order_origami==true ? 'edit_order' : '' %>" data-id='<%= order_item.order_items_id %>'>
<td><%= count %></td>
<td class='item-name'>
<%= order_item.item_name %>
<% if !order_item.options.nil? && !order_item.options.empty? && order_item.options != "undefined" %>
<% JSON.parse(order_item.options).each do |option| %>
<br><span class="font-13">
<%= option %>
</span>
<% end %>
<% end %>
<% if !order_item.set_menu_items.nil?
JSON.parse(order_item.set_menu_items).each do |item_instance|
set_item_prices += (item_instance["quantity"].to_f * item_instance["price"].to_f).to_f
%>
<br><span class="font-13">
<%= item_instance["item_instance_name"] %>
<% if !item_instance["options"].nil? && item_instance["options"] != "undefined" %>
<% (item_instance["options"]).each do |set_item_option| %>
<br><span class="font-13">
<%= set_item_option %>
</span>
<% end %>
<% end %>
</span>
<% end
sub_total += set_item_prices
end %>
</td>
<td class='item-attr'><%= order_item.qty %></td>
<td class='item-attr'><%= (order_item.qty*order_item.price).to_f + set_item_prices %></td>
</tr>
<%end %>
</tbody>
</table>
</div>
</div>
</div>
<div class="modal-footer ">
<div class="row p-r-20">
<div class="col-md-9">
<button class='btn btn-link bg-blue waves-effect' data-dismiss="modal" id='add_invoice'> Add to existing invoice</button>
</div>
<div class="col-md-3">
<button type="button" class="btn btn-link bg-blue waves-effect" data-dismiss="modal">CLOSE</button>
</div>
</div>
</div>
</div>
</div>
</div>
<%end%>
<!-- change tax modal --> <!-- change tax modal -->
<div class="modal fade" id="change_taxModal" tabindex="-1" role="dialog"> <div class="modal fade" id="change_taxModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-md" role="document"> <div class="modal-dialog modal-md" role="document">